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

Side by Side Diff: background.js

Issue 29321504: Issue 2738 - Pass bit masks to matching functions (Closed)
Patch Set: Created July 9, 2015, 2:50 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 | lib/filterComposer.js » ('j') | lib/filterComposer.js » ('J')
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 with(require("filterClasses")) 18 with(require("filterClasses"))
19 { 19 {
20 this.Filter = Filter; 20 this.Filter = Filter;
21 this.BlockingFilter = BlockingFilter; 21 this.BlockingFilter = BlockingFilter;
22 this.WhitelistFilter = WhitelistFilter; 22 this.WhitelistFilter = WhitelistFilter;
23 this.RegExpFilter = RegExpFilter;
23 } 24 }
24 with(require("subscriptionClasses")) 25 with(require("subscriptionClasses"))
25 { 26 {
26 this.Subscription = Subscription; 27 this.Subscription = Subscription;
27 this.DownloadableSubscription = DownloadableSubscription; 28 this.DownloadableSubscription = DownloadableSubscription;
28 this.SpecialSubscription = SpecialSubscription; 29 this.SpecialSubscription = SpecialSubscription;
29 } 30 }
30 with(require("whitelisting")) 31 with(require("whitelisting"))
31 { 32 {
32 this.isPageWhitelisted = isPageWhitelisted; 33 this.isPageWhitelisted = isPageWhitelisted;
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 break; 334 break;
334 } 335 }
335 336
336 var documentHost = extractHostFromFrame(sender.frame); 337 var documentHost = extractHostFromFrame(sender.frame);
337 var blocked = false; 338 var blocked = false;
338 339
339 for (var i = 0; i < msg.urls.length; i++) 340 for (var i = 0; i < msg.urls.length; i++)
340 { 341 {
341 var url = new URL(msg.urls[i], msg.baseURL); 342 var url = new URL(msg.urls[i], msg.baseURL);
342 var filter = defaultMatcher.matchesAny( 343 var filter = defaultMatcher.matchesAny(
343 stringifyURL(url), msg.mediatype, 344 stringifyURL(url), RegExpFilter.toTypeMask(msg.mediatype),
Sebastian Noack 2015/07/09 15:28:52 This operation can be done outside of the loop.
kzar 2015/07/12 14:28:00 Done.
344 documentHost, isThirdParty(url, documentHost) 345 documentHost, isThirdParty(url, documentHost)
345 ); 346 );
346 347
347 if (filter instanceof BlockingFilter) 348 if (filter instanceof BlockingFilter)
348 { 349 {
349 if (filter.collapse != null) 350 if (filter.collapse != null)
350 { 351 {
351 sendResponse(filter.collapse); 352 sendResponse(filter.collapse);
352 return; 353 return;
353 } 354 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 break; 423 break;
423 } 424 }
424 }); 425 });
425 426
426 // update icon when page changes location 427 // update icon when page changes location
427 ext.pages.onLoading.addListener(function(page) 428 ext.pages.onLoading.addListener(function(page)
428 { 429 {
429 page.sendMessage({type: "clickhide-deactivate"}); 430 page.sendMessage({type: "clickhide-deactivate"});
430 refreshIconAndContextMenu(page); 431 refreshIconAndContextMenu(page);
431 }); 432 });
OLDNEW
« no previous file with comments | « no previous file | lib/filterComposer.js » ('j') | lib/filterComposer.js » ('J')

Powered by Google App Engine
This is Rietveld