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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/filterClasses.js » ('j') | test/filterClasses.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 Filter.elemhideRegExp = /^([^/*|@"!]*?)#([@?])?#(.+)$/; 90 Filter.elemhideRegExp = /^([^/*|@"!]*?)#([@?])?#(.+)$/;
91 /** 91 /**
92 * Regular expression that RegExp filters specified as RegExps should match 92 * Regular expression that RegExp filters specified as RegExps should match
93 * @type {RegExp} 93 * @type {RegExp}
94 */ 94 */
95 Filter.regexpRegExp = /^(@@)?\/.*\/(?:\$~?[\w-]+(?:=[^,\s]+)?(?:,~?[\w-]+(?:=[^, \s]+)?)*)?$/; 95 Filter.regexpRegExp = /^(@@)?\/.*\/(?:\$~?[\w-]+(?:=[^,\s]+)?(?:,~?[\w-]+(?:=[^, \s]+)?)*)?$/;
96 /** 96 /**
97 * Regular expression that options on a RegExp filter should match 97 * Regular expression that options on a RegExp filter should match
98 * @type {RegExp} 98 * @type {RegExp}
99 */ 99 */
100 Filter.optionsRegExp = /\$(~?[\w-]+(?:=[^,]+)?(?:,~?[\w-]+(?:=[^,]+)?)*)$/; 100 Filter.optionsRegExp = /\$(~?[\w-]+(?:=[^,]*)?(?:,~?[\w-]+(?:=[^,]*)?)*)$/;
101 /** 101 /**
102 * Regular expression that matches an invalid Content Security Policy 102 * Regular expression that matches an invalid Content Security Policy
103 * @type {RegExp} 103 * @type {RegExp}
104 */ 104 */
105 Filter.invalidCSPRegExp = /(;|^) ?(base-uri|referrer|report-to|report-uri|upgrad e-insecure-requests)\b/i; 105 Filter.invalidCSPRegExp = /(;|^) ?(base-uri|referrer|report-to|report-uri|upgrad e-insecure-requests)\b/i;
106 106
107 /** 107 /**
108 * Creates a filter of correct type from its text representation - does the 108 * Creates a filter of correct type from its text representation - does the
109 * basic parsing and calls the right constructor then. 109 * basic parsing and calls the right constructor then.
110 * 110 *
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 break; 794 break;
795 case "collapse": 795 case "collapse":
796 collapse = !inverse; 796 collapse = !inverse;
797 break; 797 break;
798 case "sitekey": 798 case "sitekey":
799 if (!value) 799 if (!value)
800 return new InvalidFilter(origText, "filter_unknown_option"); 800 return new InvalidFilter(origText, "filter_unknown_option");
801 sitekeys = value.toUpperCase(); 801 sitekeys = value.toUpperCase();
802 break; 802 break;
803 case "rewrite": 803 case "rewrite":
804 if (!value) 804 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.
805 return new InvalidFilter(origText, "filter_unknown_option"); 805 return new InvalidFilter(origText, "filter_unknown_option");
806 rewrite = value; 806 rewrite = value;
807 break; 807 break;
808 default: 808 default:
809 return new InvalidFilter(origText, "filter_unknown_option"); 809 return new InvalidFilter(origText, "filter_unknown_option");
810 } 810 }
811 } 811 }
812 } 812 }
813 } 813 }
814 814
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 */ 1100 */
1101 function ElemHideEmulationFilter(text, domains, selector) 1101 function ElemHideEmulationFilter(text, domains, selector)
1102 { 1102 {
1103 ElemHideBase.call(this, text, domains, selector); 1103 ElemHideBase.call(this, text, domains, selector);
1104 } 1104 }
1105 exports.ElemHideEmulationFilter = ElemHideEmulationFilter; 1105 exports.ElemHideEmulationFilter = ElemHideEmulationFilter;
1106 1106
1107 ElemHideEmulationFilter.prototype = extend(ElemHideBase, { 1107 ElemHideEmulationFilter.prototype = extend(ElemHideBase, {
1108 type: "elemhideemulation" 1108 type: "elemhideemulation"
1109 }); 1109 });
OLDNEW
« no previous file with comments | « no previous file | test/filterClasses.js » ('j') | test/filterClasses.js » ('J')

Powered by Google App Engine
This is Rietveld