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) |
); |