Index: lib/whitelisting.js |
diff --git a/lib/whitelisting.js b/lib/whitelisting.js |
index 129e775847c2229e272be68113210d439ef32fb4..e98e75b7e564b3d3504ef4890099dfe454ac1be8 100644 |
--- a/lib/whitelisting.js |
+++ b/lib/whitelisting.js |
@@ -18,6 +18,7 @@ |
/** @module whitelisting */ |
let {defaultMatcher} = require("matcher"); |
+let {RegExpFilter} = require("filterClasses"); |
let {stringifyURL, getDecodedHostname, extractHostFromFrame, isThirdParty} = require("url"); |
let pagesWithKey = new ext.PageMap(); |
@@ -33,7 +34,7 @@ exports.isPageWhitelisted = function(page) |
let url = page.url; |
return defaultMatcher.whitelist.matchesAny( |
- stringifyURL(url), "DOCUMENT", |
+ stringifyURL(url), RegExpFilter.typeMap.DOCUMENT, |
getDecodedHostname(url), false, null |
); |
}; |
@@ -43,11 +44,10 @@ exports.isPageWhitelisted = function(page) |
* |
* @param {Page} page |
* @param {Frame} frame |
- * @param {string} [type=DOCUMENT] The request type to check whether |
- * the frame is whitelisted for. |
+ * @param {number} [typeMask=RegExpFilter.typeMap.DOCUMENT] Bit mask of request / content types to match |
* @return {Boolean} |
*/ |
-exports.isFrameWhitelisted = function(page, frame, type) |
+exports.isFrameWhitelisted = function(page, frame, typeMask) |
{ |
while (frame) |
{ |
@@ -56,7 +56,7 @@ exports.isFrameWhitelisted = function(page, frame, type) |
let documentHost = extractHostFromFrame(parent) || getDecodedHostname(url); |
let filter = defaultMatcher.whitelist.matchesAny( |
- stringifyURL(url), type || "DOCUMENT", |
+ stringifyURL(url), typeMask || RegExpFilter.typeMap.DOCUMENT, |
documentHost, isThirdParty(url, documentHost), |
getKey(page, frame) |
); |