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

Unified Diff: lib/filterClasses.js

Issue 5840485868371968: Issue 616 - Add $generichide + $genericblock filter options and enforce them. (Closed)
Patch Set: Fixed interaction with sitekey and generichide logic Created Aug. 25, 2015, 5:40 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
« lib/contentPolicy.js ('K') | « lib/contentPolicy.js ('k') | no next file » | 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 1932a6895b6b4d15897d2a104d416be74e2bd80a..bfee06f62020a707b57869a2e22184544311ffc0 100644
--- a/lib/filterClasses.js
+++ b/lib/filterClasses.js
@@ -478,6 +478,16 @@ ActiveFilter.prototype =
},
/**
+ * Checks whether this filter is generic or specific
+ * @return {Boolean} true if filter is generic, otherwise false
+ */
+ isGeneric: function() /**Boolean*/
Thomas Greiner 2015/08/28 10:28:24 Detail: Documentation is great but please avoid du
kzar 2015/09/03 12:37:02 I'm not sure where the duplication is here, but I'
Thomas Greiner 2015/09/21 16:53:36 The duplication I meant is that you specify the re
kzar 2015/09/22 13:16:47 I see, Done.
+ {
+ return (!(this.sitekeys && this.sitekeys.length) &&
+ (!this.domains || this.domains[""]));
+ },
+
+ /**
* See Filter.serialize()
*/
serialize: function(buffer)
@@ -754,11 +764,18 @@ RegExpFilter.typeMap = {
BACKGROUND: 4, // Backwards compat, same as IMAGE
POPUP: 0x10000000,
- ELEMHIDE: 0x40000000
+ GENERICBLOCK: 0x20000000,
+ ELEMHIDE: 0x40000000,
+ GENERICHIDE: 0x80000000
};
-// DOCUMENT, ELEMHIDE, POPUP options shouldn't be there by default
-RegExpFilter.prototype.contentType &= ~(RegExpFilter.typeMap.DOCUMENT | RegExpFilter.typeMap.ELEMHIDE | RegExpFilter.typeMap.POPUP);
+// DOCUMENT, ELEMHIDE, POPUP, GENERICHIDE and GENERICBLOCK options shouldn't
+// be there by default
+RegExpFilter.prototype.contentType &= ~(RegExpFilter.typeMap.DOCUMENT |
+ RegExpFilter.typeMap.ELEMHIDE |
+ RegExpFilter.typeMap.POPUP |
+ RegExpFilter.typeMap.GENERICHIDE |
+ RegExpFilter.typeMap.GENERICBLOCK);
/**
* Class for blocking filters
« lib/contentPolicy.js ('K') | « lib/contentPolicy.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld