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

Unified Diff: lib/filterClasses.js

Issue 29863644: Issue 6870 - Remove support for legacy :-abp-properties() syntax (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Patch Set: Add check for legacy syntax and return of InvalidFilter Created Aug. 25, 2018, 5:29 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 | « no previous file | test/filterClasses.js » ('j') | test/filterClasses.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterClasses.js
===================================================================
--- a/lib/filterClasses.js
+++ b/lib/filterClasses.js
@@ -117,34 +117,22 @@
* @param {string} text as in Filter()
* @return {Filter}
*/
Filter.fromText = function(text)
{
let filter = Filter.knownFilters.get(text);
if (filter)
return filter;
+ if (/\[-abp-properties=(["'])([^"']+)\1\]/i.test(text))
Manish Jethani 2018/08/25 07:31:10 This would be nice to do, but we simply cannot aff
Jon Sonesen 2018/08/27 21:32:21 Done.
+ return new InvalidFilter(text, "filter_unknown_option");
let match = text.includes("#") ? Filter.contentRegExp.exec(text) : null;
if (match)
- {
- let propsMatch;
- if (!match[2] && match[3].includes("[-") &&
- (propsMatch = /\[-abp-properties=(["'])([^"']+)\1\]/.exec(match[3])))
- {
- // This is legacy CSS properties syntax, convert to current syntax
- let prefix = match[3].substr(0, propsMatch.index);
- let expression = propsMatch[2];
- let suffix = match[3].substr(propsMatch.index + propsMatch[0].length);
- return Filter.fromText(`${match[1]}#?#` +
- `${prefix}:-abp-properties(${expression})${suffix}`);
- }
-
filter = ContentFilter.fromText(text, match[1], match[2], match[3]);
- }
else if (text[0] == "!")
filter = new CommentFilter(text);
else
filter = RegExpFilter.fromText(text);
Filter.knownFilters.set(filter.text, filter);
return filter;
};
« no previous file with comments | « no previous file | test/filterClasses.js » ('j') | test/filterClasses.js » ('J')

Powered by Google App Engine
This is Rietveld