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

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

Issue 29321478: Issue 2738 - Make RegExpFilter.matches() take a bit mask instead of content type string (Closed)
Patch Set: Changed API as discussed and addressed feedback Created July 12, 2015, 1:55 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 | « chrome/content/ui/composer.js ('k') | chrome/content/ui/sidebar.js » ('j') | 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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 if (filter instanceof BlockingFilter && filter.disabled) 920 if (filter instanceof BlockingFilter && filter.disabled)
921 disabledMatcher.add(filter); 921 disabledMatcher.add(filter);
922 } 922 }
923 923
924 let seenFilters = Object.create(null); 924 let seenFilters = Object.create(null);
925 for (let request of requestsDataSource.origRequests) 925 for (let request of requestsDataSource.origRequests)
926 { 926 {
927 if (request.filter) 927 if (request.filter)
928 continue; 928 continue;
929 929
930 let filter = disabledMatcher.matchesAny(request.location, request.typeDe scr, request.docDomain, request.thirdParty); 930 let filter = disabledMatcher.matchesAny(request.location, RegExpFilter.t ypeMap[request.typeDescr], request.docDomain, request.thirdParty);
931 if (filter && !(filter.text in seenFilters)) 931 if (filter && !(filter.text in seenFilters))
932 { 932 {
933 this.disabledFilters.push(filter); 933 this.disabledFilters.push(filter);
934 seenFilters[filter.text] = true; 934 seenFilters[filter.text] = true;
935 } 935 }
936 } 936 }
937 937
938 // Find disabled subscriptions with filters matching any of the requests 938 // Find disabled subscriptions with filters matching any of the requests
939 let seenSubscriptions = Object.create(null); 939 let seenSubscriptions = Object.create(null);
940 for (let subscription of FilterStorage.subscriptions) 940 for (let subscription of FilterStorage.subscriptions)
941 { 941 {
942 if (!subscription.disabled) 942 if (!subscription.disabled)
943 continue; 943 continue;
944 944
945 disabledMatcher.clear(); 945 disabledMatcher.clear();
946 for (let filter of subscription.filters) 946 for (let filter of subscription.filters)
947 if (filter instanceof BlockingFilter) 947 if (filter instanceof BlockingFilter)
948 disabledMatcher.add(filter); 948 disabledMatcher.add(filter);
949 949
950 for (let request of requestsDataSource.origRequests) 950 for (let request of requestsDataSource.origRequests)
951 { 951 {
952 if (request.filter) 952 if (request.filter)
953 continue; 953 continue;
954 954
955 let filter = disabledMatcher.matchesAny(request.location, request.type Descr, request.docDomain, request.thirdParty); 955 let filter = disabledMatcher.matchesAny(request.location, RegExpFilter .typeMap[request.typeDescr], request.docDomain, request.thirdParty);
956 if (filter && !(subscription.url in seenSubscriptions)) 956 if (filter && !(subscription.url in seenSubscriptions))
957 { 957 {
958 this.disabledSubscriptions.push(subscription); 958 this.disabledSubscriptions.push(subscription);
959 seenSubscriptions[subscription.text] = true; 959 seenSubscriptions[subscription.text] = true;
960 break; 960 break;
961 } 961 }
962 } 962 }
963 } 963 }
964 964
965 this.numSubscriptions = FilterStorage.subscriptions.filter(this.subscripti onFilter).length; 965 this.numSubscriptions = FilterStorage.subscriptions.filter(this.subscripti onFilter).length;
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 1574
1575 function censorURL(url) 1575 function censorURL(url)
1576 { 1576 {
1577 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*"); 1577 return url.replace(/([?;&\/#][^?;&\/#]+?=)[^?;&\/#]+/g, "$1*");
1578 } 1578 }
1579 1579
1580 function encodeHTML(str) 1580 function encodeHTML(str)
1581 { 1581 {
1582 return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"). replace(/"/g, "&quot;"); 1582 return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"). replace(/"/g, "&quot;");
1583 } 1583 }
OLDNEW
« no previous file with comments | « chrome/content/ui/composer.js ('k') | chrome/content/ui/sidebar.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld