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

Unified Diff: background.js

Issue 29321504: Issue 2738 - Pass bit masks to matching functions (Closed)
Patch Set: Updated to match adblockplus changes and addressed feedback Created July 12, 2015, 2:25 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/filterComposer.js » ('j') | lib/filterComposer.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: background.js
diff --git a/background.js b/background.js
index cf1e2ea081f70101fdb8f2a21298466478c99124..35566c62c937ee2d2717c8691988214f4196e408 100644
--- a/background.js
+++ b/background.js
@@ -20,6 +20,7 @@ with(require("filterClasses"))
this.Filter = Filter;
this.BlockingFilter = BlockingFilter;
this.WhitelistFilter = WhitelistFilter;
+ this.RegExpFilter = RegExpFilter;
}
with(require("subscriptionClasses"))
{
@@ -300,8 +301,8 @@ ext.onMessage.addListener(function (msg, sender, sendResponse)
case "get-selectors":
var selectors = [];
- if (!isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT") &&
- !isFrameWhitelisted(sender.page, sender.frame, "ELEMHIDE"))
+ if (!isFrameWhitelisted(sender.page, sender.frame,
+ RegExpFilter.typeMap.DOCUMENT | RegExpFilter.typeMap.ELEMHIDE))
{
var noStyleRules = false;
var host = extractHostFromFrame(sender.frame);
@@ -327,7 +328,7 @@ ext.onMessage.addListener(function (msg, sender, sendResponse)
sendResponse(selectors);
break;
case "should-collapse":
- if (isFrameWhitelisted(sender.page, sender.frame, "DOCUMENT"))
+ if (isFrameWhitelisted(sender.page, sender.frame, RegExpFilter.typeMap.DOCUMENT))
{
sendResponse(false);
break;
@@ -335,12 +336,13 @@ ext.onMessage.addListener(function (msg, sender, sendResponse)
var documentHost = extractHostFromFrame(sender.frame);
var blocked = false;
+ var typeMask = RegExpFilter.typeMap[msg.mediatype];
Sebastian Noack 2015/07/13 16:41:50 Nit: I'd put it above the declaration of documentH
kzar 2015/07/14 09:22:23 Done.
for (var i = 0; i < msg.urls.length; i++)
{
var url = new URL(msg.urls[i], msg.baseURL);
var filter = defaultMatcher.matchesAny(
- stringifyURL(url), msg.mediatype,
+ stringifyURL(url), typeMask,
documentHost, isThirdParty(url, documentHost)
);
« no previous file with comments | « no previous file | lib/filterComposer.js » ('j') | lib/filterComposer.js » ('J')

Powered by Google App Engine
This is Rietveld