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: Address PS2 comment Created Aug. 27, 2018, 5:06 p.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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 /** 113 /**
114 * Creates a filter of correct type from its text representation - does the 114 * Creates a filter of correct type from its text representation - does the
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)
124 return filter;
125
123 let match = text.includes("#") ? Filter.contentRegExp.exec(text) : null; 126 let match = text.includes("#") ? Filter.contentRegExp.exec(text) : null;
124 if (match) 127 if (match)
125 filter = ContentFilter.fromText(text, match[1], match[2], match[3]); 128 filter = ContentFilter.fromText(text, match[1], match[2], match[3]);
126 else if (text[0] == "!") 129 else if (text[0] == "!")
127 filter = new CommentFilter(text); 130 filter = new CommentFilter(text);
128 else 131 else
129 filter = RegExpFilter.fromText(text); 132 filter = RegExpFilter.fromText(text);
130 133
131 Filter.knownFilters.set(filter.text, filter); 134 Filter.knownFilters.set(filter.text, filter);
132 return filter; 135 return filter;
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 1177
1175 /** 1178 /**
1176 * Script that should be executed 1179 * Script that should be executed
1177 * @type {string} 1180 * @type {string}
1178 */ 1181 */
1179 get script() 1182 get script()
1180 { 1183 {
1181 return this.body; 1184 return this.body;
1182 } 1185 }
1183 }); 1186 });
LEFTRIGHT

Powered by Google App Engine
This is Rietveld