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

Delta Between Two Patch Sets: lib/notification.js

Issue 29321478: Issue 2738 - Make RegExpFilter.matches() take a bit mask instead of content type string (Closed)
Left Patch Set: Created July 9, 2015, 1:45 p.m.
Right 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « lib/matcher.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 continue; 215 continue;
216 } 216 }
217 217
218 if (typeof url === "string" || notification.urlFilters instanceof Array) 218 if (typeof url === "string" || notification.urlFilters instanceof Array)
219 { 219 {
220 if (typeof url === "string" && notification.urlFilters instanceof Array) 220 if (typeof url === "string" && notification.urlFilters instanceof Array)
221 { 221 {
222 let matcher = new Matcher(); 222 let matcher = new Matcher();
223 for (let urlFilter of notification.urlFilters) 223 for (let urlFilter of notification.urlFilters)
224 matcher.add(Filter.fromText(urlFilter)); 224 matcher.add(Filter.fromText(urlFilter));
225 if (!matcher.matchesAny(url, RegExpFilter.toTypeMask("DOCUMENT"), url) ) 225 if (!matcher.matchesAny(url, RegExpFilter.typeMap.DOCUMENT, url))
226 continue; 226 continue;
227 } 227 }
228 else 228 else
229 continue; 229 continue;
230 } 230 }
231 231
232 if (notification.targets instanceof Array) 232 if (notification.targets instanceof Array)
233 { 233 {
234 let match = false; 234 let match = false;
235 for (let target of notification.targets) 235 for (let target of notification.targets)
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 Prefs.notifications_showui = true; 384 Prefs.notifications_showui = true;
385 } 385 }
386 else if (index != -1 && forceValue !== true) 386 else if (index != -1 && forceValue !== true)
387 categories.splice(index, 1); 387 categories.splice(index, 1);
388 388
389 // HACK: JSON values aren't saved unless they are assigned a different objec t. 389 // HACK: JSON values aren't saved unless they are assigned a different objec t.
390 Prefs.notifications_ignoredcategories = JSON.parse(JSON.stringify(categories )); 390 Prefs.notifications_ignoredcategories = JSON.parse(JSON.stringify(categories ));
391 } 391 }
392 }; 392 };
393 Notification.init(); 393 Notification.init();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld