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

Unified Diff: lib/filterClasses.js

Issue 29356018: Issue 4450 - Prevent ElemHide filters with empty domains (Closed)
Patch Set: Addressed feedback Created Oct. 6, 2016, 8:50 a.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/elemHide.js ('k') | test/elemHide.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 ebfe551604cf296e582fbd6e7cdeca87bbe66237..899b0c69ad3749603cb86363f1fd2428d1fc96f8 100644
--- a/lib/filterClasses.js
+++ b/lib/filterClasses.js
@@ -924,6 +924,12 @@ ElemHideBase.fromText = function(text, domain, isException, tagName, attrRules,
return new InvalidFilter(text, "filter_elemhide_nocriteria");
}
+ // We don't allow ElemHide filters which have any empty domains.
+ // Note: The ElemHide.prototype.domainSeparator is duplicated here, if that
+ // changes this must be changed too.
+ if (domain && /(^|,)~?(,|$)/.test(domain))
+ return new InvalidFilter(text, "filter_invalid_domain");
+
if (isException)
return new ElemHideException(text, domain, selector);
« no previous file with comments | « lib/elemHide.js ('k') | test/elemHide.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld