Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: chrome/content/ui/sendReport.js

Issue 5410618009976832: issue #690 - don't consider special subscriptions when complaining about high subscription count (Closed)
Patch Set: Created July 26, 2014, 7:39 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 } 872 }
873 873
874 let issuesDataSource = 874 let issuesDataSource =
875 { 875 {
876 contentWnd: null, 876 contentWnd: null,
877 isEnabled: Prefs.enabled, 877 isEnabled: Prefs.enabled,
878 whitelistFilter: null, 878 whitelistFilter: null,
879 disabledFilters: [], 879 disabledFilters: [],
880 disabledSubscriptions: [], 880 disabledSubscriptions: [],
881 ownFilters: [], 881 ownFilters: [],
882 numSubscriptions: 0, 882 numGeneralSubscriptions: 0,
Wladimir Palant 2014/07/28 09:17:18 I see no point renaming this property, your new na
saroyanm 2014/07/28 09:49:20 Done.
883 numAppliedFilters: Infinity, 883 numAppliedFilters: Infinity,
884 884
885 subscriptionFilter: function(s) 885 subscriptionFilter: function(s)
886 { 886 {
887 if (s instanceof DownloadableSubscription) 887 if (s instanceof DownloadableSubscription)
888 return subscriptionsDataSource.subscriptionFilter(s); 888 return subscriptionsDataSource.subscriptionFilter(s);
889 else 889 else
890 return false; 890 return false;
891 }, 891 },
892 892
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 942
943 let filter = disabledMatcher.matchesAny(request.location, request.type Descr, request.docDomain, request.thirdParty); 943 let filter = disabledMatcher.matchesAny(request.location, request.type Descr, request.docDomain, request.thirdParty);
944 if (filter && !(subscription.url in seenSubscriptions)) 944 if (filter && !(subscription.url in seenSubscriptions))
945 { 945 {
946 this.disabledSubscriptions.push(subscription); 946 this.disabledSubscriptions.push(subscription);
947 seenSubscriptions[subscription.text] = true; 947 seenSubscriptions[subscription.text] = true;
948 break; 948 break;
949 } 949 }
950 } 950 }
951 } 951 }
952
953 for each (let {url} in FilterStorage.subscriptions.filter(this.subscriptio nFilter))
saroyanm 2014/07/26 19:52:07 Not sure if we need separate generalSubscriptionFi
Wladimir Palant 2014/07/28 09:17:18 Please simply extend subscriptionFilter - this fun
saroyanm 2014/07/28 09:49:20 Seams like the issuesDataSource.subscriptionFilter
954 if (url != Prefs.subscriptions_exceptionsurl && url != Prefs.subscriptio ns_antiadblockurl)
955 this.numGeneralSubscriptions++;
952 956
953 this.numSubscriptions = FilterStorage.subscriptions.filter(this.subscripti onFilter).length;
954 this.numAppliedFilters = 0; 957 this.numAppliedFilters = 0;
955 for each (let filter in filtersDataSource.origFilters) 958 for each (let filter in filtersDataSource.origFilters)
956 { 959 {
957 if (filter instanceof WhitelistFilter) 960 if (filter instanceof WhitelistFilter)
958 continue; 961 continue;
959 962
960 this.numAppliedFilters++; 963 this.numAppliedFilters++;
961 if (filter.subscriptions.some(function(subscription) subscription instan ceof SpecialSubscription)) 964 if (filter.subscriptions.some(function(subscription) subscription instan ceof SpecialSubscription))
962 this.ownFilters.push(filter); 965 this.ownFilters.push(filter);
963 } 966 }
964 } 967 }
965 968
966 callback(); 969 callback();
967 }, 970 },
968 971
969 updateIssues: function(type) 972 updateIssues: function(type)
970 { 973 {
971 if (type == "other") 974 if (type == "other")
972 { 975 {
973 E("typeSelectorPage").next = "typeWarning"; 976 E("typeSelectorPage").next = "typeWarning";
974 return; 977 return;
975 } 978 }
976 979
977 E("issuesWhitelistBox").hidden = !this.whitelistFilter; 980 E("issuesWhitelistBox").hidden = !this.whitelistFilter;
978 E("issuesDisabledBox").hidden = this.isEnabled; 981 E("issuesDisabledBox").hidden = this.isEnabled;
979 E("issuesNoFiltersBox").hidden = (type != "false positive" || this.numApplie dFilters > 0); 982 E("issuesNoFiltersBox").hidden = (type != "false positive" || this.numApplie dFilters > 0);
980 E("issuesNoSubscriptionsBox").hidden = (type != "false negative" || this.num AppliedFilters > 0 || this.numSubscriptions > 0); 983 E("issuesNoSubscriptionsBox").hidden = (type != "false negative" || this.num AppliedFilters > 0 || this.numGeneralSubscriptions > 0);
981 E("issuesSubscriptionCountBox").hidden = (this.numSubscriptions < 5); 984 E("issuesSubscriptionCountBox").hidden = (this.numGeneralSubscriptions < 5);
982 985
983 let ownFiltersBox = E("issuesOwnFilters"); 986 let ownFiltersBox = E("issuesOwnFilters");
984 if (this.ownFilters.length && !ownFiltersBox.firstChild) 987 if (this.ownFilters.length && !ownFiltersBox.firstChild)
985 { 988 {
986 let template = E("issuesOwnFiltersTemplate"); 989 let template = E("issuesOwnFiltersTemplate");
987 for each (let filter in this.ownFilters) 990 for each (let filter in this.ownFilters)
988 { 991 {
989 let element = template.cloneNode(true); 992 let element = template.cloneNode(true);
990 element.removeAttribute("id"); 993 element.removeAttribute("id");
991 element.removeAttribute("hidden"); 994 element.removeAttribute("hidden");
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 1565
1563 function censorURL(url) 1566 function censorURL(url)
1564 { 1567 {
1565 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*"); 1568 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*");
1566 } 1569 }
1567 1570
1568 function encodeHTML(str) 1571 function encodeHTML(str)
1569 { 1572 {
1570 return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"). replace(/"/g, "&quot;"); 1573 return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"). replace(/"/g, "&quot;");
1571 } 1574 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld