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

Unified Diff: lib/filterClasses.js

Issue 5672992042385408: Issue 2503 - Inconsistent behavior: $document flag implied for exception rules with protocol includ… (Closed)
Patch Set: Created May 18, 2015, 5:51 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterClasses.js
===================================================================
--- a/lib/filterClasses.js
+++ b/lib/filterClasses.js
@@ -699,25 +699,16 @@ RegExpFilter.fromText = function(text)
collapse = false;
else if (option == "SITEKEY" && typeof value != "undefined")
sitekeys = value;
else
return new InvalidFilter(origText, "Unknown option " + option.toLowerCase());
}
}
- if (!blocking && (contentType == null || (contentType & RegExpFilter.typeMap.DOCUMENT)) &&
- (!options || options.indexOf("DOCUMENT") < 0) && !/^\|?[\w\-]+:/.test(text))
- {
- // Exception filters shouldn't apply to pages by default unless they start with a protocol name
- if (contentType == null)
- contentType = RegExpFilter.prototype.contentType;
- contentType &= ~RegExpFilter.typeMap.DOCUMENT;
- }
-
try
{
if (blocking)
return new BlockingFilter(origText, text, contentType, matchCase, domains, thirdParty, sitekeys, collapse);
else
return new WhitelistFilter(origText, text, contentType, matchCase, domains, thirdParty, sitekeys);
}
catch (e)
@@ -747,17 +738,17 @@ RegExpFilter.typeMap = {
BACKGROUND: 4, // Backwards compat, same as IMAGE
POPUP: 0x10000000,
ELEMHIDE: 0x40000000
};
// ELEMHIDE, POPUP option shouldn't be there by default
Sebastian Noack 2015/05/18 18:02:57 Mind updating the comment as well?
Wladimir Palant 2015/05/18 18:06:29 Done.
-RegExpFilter.prototype.contentType &= ~(RegExpFilter.typeMap.ELEMHIDE | RegExpFilter.typeMap.POPUP);
+RegExpFilter.prototype.contentType &= ~(RegExpFilter.typeMap.DOCUMENT | RegExpFilter.typeMap.ELEMHIDE | RegExpFilter.typeMap.POPUP);
/**
* Class for blocking filters
* @param {String} text see Filter()
* @param {String} regexpSource see RegExpFilter()
* @param {Number} contentType see RegExpFilter()
* @param {Boolean} matchCase see RegExpFilter()
* @param {String} domains see RegExpFilter()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld