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 adblockplus dependency Created July 14, 2015, 2:45 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 | dependencies » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: background.js
diff --git a/background.js b/background.js
index cf1e2ea081f70101fdb8f2a21298466478c99124..cb75d32e61ed093b382d7d62604595c0379a3dc5 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,12 +328,13 @@ 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;
}
+ var typeMask = RegExpFilter.typeMap[msg.mediatype];
var documentHost = extractHostFromFrame(sender.frame);
var blocked = false;
@@ -340,7 +342,7 @@ ext.onMessage.addListener(function (msg, sender, sendResponse)
{
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 | dependencies » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld