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

Delta Between Two Patch Sets: lib/filterClasses.js

Issue 29863644: Issue 6870 - Remove support for legacy :-abp-properties() syntax (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore
Left Patch Set: Add check for legacy syntax and return of InvalidFilter Created Aug. 25, 2018, 5:29 a.m.
Right Patch Set: Put filter return back Created Aug. 27, 2018, 9:48 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | test/filterClasses.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 * basic parsing and calls the right constructor then. 115 * basic parsing and calls the right constructor then.
116 * 116 *
117 * @param {string} text as in Filter() 117 * @param {string} text as in Filter()
118 * @return {Filter} 118 * @return {Filter}
119 */ 119 */
120 Filter.fromText = function(text) 120 Filter.fromText = function(text)
121 { 121 {
122 let filter = Filter.knownFilters.get(text); 122 let filter = Filter.knownFilters.get(text);
123 if (filter) 123 if (filter)
124 return filter; 124 return filter;
125 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.
126 return new InvalidFilter(text, "filter_unknown_option");
127 125
128 let match = text.includes("#") ? Filter.contentRegExp.exec(text) : null; 126 let match = text.includes("#") ? Filter.contentRegExp.exec(text) : null;
129 if (match) 127 if (match)
130 filter = ContentFilter.fromText(text, match[1], match[2], match[3]); 128 filter = ContentFilter.fromText(text, match[1], match[2], match[3]);
131 else if (text[0] == "!") 129 else if (text[0] == "!")
132 filter = new CommentFilter(text); 130 filter = new CommentFilter(text);
133 else 131 else
134 filter = RegExpFilter.fromText(text); 132 filter = RegExpFilter.fromText(text);
135 133
136 Filter.knownFilters.set(filter.text, filter); 134 Filter.knownFilters.set(filter.text, filter);
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 if (inverse) 774 if (inverse)
777 { 775 {
778 if (contentType == null) 776 if (contentType == null)
779 ({contentType} = RegExpFilter.prototype); 777 ({contentType} = RegExpFilter.prototype);
780 contentType &= ~type; 778 contentType &= ~type;
781 } 779 }
782 else 780 else
783 { 781 {
784 contentType |= type; 782 contentType |= type;
785 783
786 if (type == RegExpFilter.typeMap.CSP && value) 784 if (type == RegExpFilter.typeMap.CSP)
785 {
786 if (!value)
787 return new InvalidFilter(origText, "filter_invalid_csp");
787 csp = value; 788 csp = value;
789 }
788 } 790 }
789 } 791 }
790 else 792 else
791 { 793 {
792 switch (option.toLowerCase()) 794 switch (option.toLowerCase())
793 { 795 {
794 case "match-case": 796 case "match-case":
795 matchCase = !inverse; 797 matchCase = !inverse;
796 break; 798 break;
797 case "domain": 799 case "domain":
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 1177
1176 /** 1178 /**
1177 * Script that should be executed 1179 * Script that should be executed
1178 * @type {string} 1180 * @type {string}
1179 */ 1181 */
1180 get script() 1182 get script()
1181 { 1183 {
1182 return this.body; 1184 return this.body;
1183 } 1185 }
1184 }); 1186 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld