| Index: lib/matcher.js |
| diff --git a/lib/matcher.js b/lib/matcher.js |
| index 8494b6e4cf18660799aea2bc16441c271f5f220e..fde5a8887f5ad2a3f65dddc665342714c823ce7e 100644 |
| --- a/lib/matcher.js |
| +++ b/lib/matcher.js |
| @@ -184,14 +184,18 @@ Matcher.prototype = { |
| * @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 |
| + * @param {Boolean} specificOnly should be true if generic matches should be ignored |
| * @return {RegExpFilter} matching filter or null |
| */ |
| - matchesAny: function(location, contentType, docDomain, thirdParty, sitekey) |
| + matchesAny: function(location, contentType, docDomain, thirdParty, sitekey, specificOnly) |
| { |
| let candidates = location.toLowerCase().match(/[a-z0-9%]{3,}/g); |
| if (candidates === null) |
| candidates = []; |
| - candidates.push(""); |
| + |
| + if (!specificOnly) |
| + candidates.push(""); |
| + |
| for (let i = 0, l = candidates.length; i < l; i++) |
| { |
| let substr = candidates[i]; |
| @@ -347,12 +351,14 @@ CombinedMatcher.prototype = |
| * simultaneously. For parameters see Matcher.matchesAny(). |
| * @see Matcher#matchesAny |
| */ |
| - matchesAnyInternal: function(location, contentType, docDomain, thirdParty, sitekey) |
| + matchesAnyInternal: function(location, contentType, docDomain, thirdParty, sitekey, specificOnly) |
| { |
| let candidates = location.toLowerCase().match(/[a-z0-9%]{3,}/g); |
| if (candidates === null) |
| candidates = []; |
| - candidates.push(""); |
| + |
| + if (!specificOnly) |
| + candidates.push(""); |
| let blacklistHit = null; |
| for (let i = 0, l = candidates.length; i < l; i++) |
| @@ -373,13 +379,13 @@ CombinedMatcher.prototype = |
| /** |
| * @see Matcher#matchesAny |
| */ |
| - matchesAny: function(location, contentType, docDomain, thirdParty, sitekey) |
| + matchesAny: function(location, contentType, docDomain, thirdParty, sitekey, specificOnly) |
| { |
| - let key = location + " " + contentType + " " + docDomain + " " + thirdParty + " " + sitekey; |
| + let key = location + " " + contentType + " " + docDomain + " " + thirdParty + " " + sitekey + " " + specificOnly; |
| if (key in this.resultCache) |
| return this.resultCache[key]; |
| - let result = this.matchesAnyInternal(location, contentType, docDomain, thirdParty, sitekey); |
| + let result = this.matchesAnyInternal(location, contentType, docDomain, thirdParty, sitekey, specificOnly); |
| if (this.cacheEntries >= CombinedMatcher.maxCacheEntries) |
| { |