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

Unified Diff: lib/filterClasses.js

Issue 29801609: Issue 6733 - Allow empty values in filter options (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Rebase and simplify Created June 25, 2018, 1:08 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 | 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
@@ -92,17 +92,17 @@
* Regular expression that RegExp filters specified as RegExps should match
* @type {RegExp}
*/
Filter.regexpRegExp = /^(@@)?\/.*\/(?:\$~?[\w-]+(?:=[^,\s]+)?(?:,~?[\w-]+(?:=[^,\s]+)?)*)?$/;
/**
* Regular expression that options on a RegExp filter should match
* @type {RegExp}
*/
-Filter.optionsRegExp = /\$(~?[\w-]+(?:=[^,]+)?(?:,~?[\w-]+(?:=[^,]+)?)*)$/;
+Filter.optionsRegExp = /\$(~?[\w-]+(?:=[^,]*)?(?:,~?[\w-]+(?:=[^,]*)?)*)$/;
/**
* Regular expression that matches an invalid Content Security Policy
* @type {RegExp}
*/
Filter.invalidCSPRegExp = /(;|^) ?(base-uri|referrer|report-to|report-uri|upgrade-insecure-requests)\b/i;
/**
* Creates a filter of correct type from its text representation - does the
@@ -796,17 +796,17 @@
collapse = !inverse;
break;
case "sitekey":
if (!value)
return new InvalidFilter(origText, "filter_unknown_option");
sitekeys = value.toUpperCase();
break;
case "rewrite":
- if (!value)
+ if (value == null)
Manish Jethani 2018/06/25 13:13:44 Blank value is allowed for $rewrite here while sti
kzar 2018/07/12 10:36:13 So by checking for `value == null` instead of `!va
Manish Jethani 2018/07/12 10:52:55 Yes, we're allowing $rewrite= but not $rewrite, be
kzar 2018/07/12 11:04:20 Ah right I see, we anticipate the confusion about
Manish Jethani 2018/07/12 11:11:12 Yup.
return new InvalidFilter(origText, "filter_unknown_option");
rewrite = value;
break;
default:
return new InvalidFilter(origText, "filter_unknown_option");
}
}
}
« no previous file with comments | « no previous file | test/filterClasses.js » ('j') | test/filterClasses.js » ('J')

Powered by Google App Engine
This is Rietveld