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

Unified Diff: lib/whitelisting.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 | « lib/filterComposer.js ('k') | popupBlocker.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
);
« no previous file with comments | « lib/filterComposer.js ('k') | popupBlocker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld