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

Unified Diff: lib/filterClasses.js

Issue 29321478: Issue 2738 - Make RegExpFilter.matches() take a bit mask instead of content type string (Closed)
Patch Set: Changed API as discussed and addressed feedback Created July 12, 2015, 1:55 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/contentPolicy.js ('k') | lib/matcher.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterClasses.js
diff --git a/lib/filterClasses.js b/lib/filterClasses.js
index 6bc6f29fdbf938c2d3b9a811bff24f9d85020ae0..1932a6895b6b4d15897d2a104d416be74e2bd80a 100644
--- a/lib/filterClasses.js
+++ b/lib/filterClasses.js
@@ -625,15 +625,15 @@ RegExpFilter.prototype =
/**
* Tests whether the URL matches this filter
* @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 {Boolean} true in case of a match
*/
- matches: function(location, contentType, docDomain, thirdParty, sitekey)
+ matches: function(location, typeMask, docDomain, thirdParty, sitekey)
{
- if ((RegExpFilter.typeMap[contentType] & this.contentType) != 0 &&
+ if (this.contentType & typeMask &&
(this.thirdParty == null || this.thirdParty == thirdParty) &&
this.isActiveOnDomain(docDomain, sitekey) && this.regexp.test(location))
{
« no previous file with comments | « lib/contentPolicy.js ('k') | lib/matcher.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld