Index: lib/matcher.js |
diff --git a/lib/matcher.js b/lib/matcher.js |
index 8494b6e4cf18660799aea2bc16441c271f5f220e..3aedf9ba310f6f21dfcd3910a948c15e6a5d1802 100644 |
--- a/lib/matcher.js |
+++ b/lib/matcher.js |
@@ -165,13 +165,13 @@ Matcher.prototype = { |
/** |
* Checks whether the entries for a particular keyword match a URL |
*/ |
- _checkEntryMatch: function(keyword, location, contentType, docDomain, thirdParty, sitekey) |
+ _checkEntryMatch: function(keyword, location, typeMask, docDomain, thirdParty, sitekey) |
{ |
let list = this.filterByKeyword[keyword]; |
for (let i = 0; i < list.length; i++) |
{ |
let filter = list[i]; |
- if (filter.matches(location, contentType, docDomain, thirdParty, sitekey)) |
+ if (filter.matches(location, typeMask, docDomain, thirdParty, sitekey)) |
return filter; |
} |
return null; |
@@ -180,13 +180,13 @@ Matcher.prototype = { |
/** |
* Tests whether the URL matches any of the known filters |
* @param {String} location URL to be tested |
- * @param {String} contentType content type identifier of the URL |
+ * @param {String} typeMask bitmask of content / request types to match |
* @param {String} docDomain domain name of the document that loads the URL |
* @param {Boolean} thirdParty should be true if the URL is a third-party request |
* @param {String} sitekey public key provided by the document |
* @return {RegExpFilter} matching filter or null |
*/ |
- matchesAny: function(location, contentType, docDomain, thirdParty, sitekey) |
+ matchesAny: function(location, typeMask, docDomain, thirdParty, sitekey) |
{ |
let candidates = location.toLowerCase().match(/[a-z0-9%]{3,}/g); |
if (candidates === null) |
@@ -197,7 +197,7 @@ Matcher.prototype = { |
let substr = candidates[i]; |
if (substr in this.filterByKeyword) |
{ |
- let result = this._checkEntryMatch(substr, location, contentType, docDomain, thirdParty, sitekey); |
+ let result = this._checkEntryMatch(substr, location, typeMask, docDomain, thirdParty, sitekey); |
if (result) |
return result; |
} |
@@ -347,7 +347,7 @@ CombinedMatcher.prototype = |
* simultaneously. For parameters see Matcher.matchesAny(). |
* @see Matcher#matchesAny |
*/ |
- matchesAnyInternal: function(location, contentType, docDomain, thirdParty, sitekey) |
+ matchesAnyInternal: function(location, typeMask, docDomain, thirdParty, sitekey) |
{ |
let candidates = location.toLowerCase().match(/[a-z0-9%]{3,}/g); |
if (candidates === null) |
@@ -360,12 +360,12 @@ CombinedMatcher.prototype = |
let substr = candidates[i]; |
if (substr in this.whitelist.filterByKeyword) |
{ |
- let result = this.whitelist._checkEntryMatch(substr, location, contentType, docDomain, thirdParty, sitekey); |
+ let result = this.whitelist._checkEntryMatch(substr, location, typeMask, docDomain, thirdParty, sitekey); |
if (result) |
return result; |
} |
if (substr in this.blacklist.filterByKeyword && blacklistHit === null) |
- blacklistHit = this.blacklist._checkEntryMatch(substr, location, contentType, docDomain, thirdParty, sitekey); |
+ blacklistHit = this.blacklist._checkEntryMatch(substr, location, typeMask, docDomain, thirdParty, sitekey); |
} |
return blacklistHit; |
}, |
@@ -373,13 +373,13 @@ CombinedMatcher.prototype = |
/** |
* @see Matcher#matchesAny |
*/ |
- matchesAny: function(location, contentType, docDomain, thirdParty, sitekey) |
+ matchesAny: function(location, typeMask, docDomain, thirdParty, sitekey) |
{ |
- let key = location + " " + contentType + " " + docDomain + " " + thirdParty + " " + sitekey; |
+ let key = location + " " + typeMask + " " + docDomain + " " + thirdParty + " " + sitekey; |
if (key in this.resultCache) |
return this.resultCache[key]; |
- let result = this.matchesAnyInternal(location, contentType, docDomain, thirdParty, sitekey); |
+ let result = this.matchesAnyInternal(location, typeMask, docDomain, thirdParty, sitekey); |
if (this.cacheEntries >= CombinedMatcher.maxCacheEntries) |
{ |