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

Side by Side Diff: lib/filterValidation.js

Issue 29680696: [$csp4 adblockpluschrome] Issue 5241 - Add support for Content Security Policy filters (Closed)
Patch Set: Created Jan. 26, 2018, 6:05 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
« lib/csp.js ('K') | « lib/csp.js ('k') | no next file » | no next file with comments »
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 let parseFilter = 122 let parseFilter =
123 /** 123 /**
124 * Parses and validates a filter given by the user. 124 * Parses and validates a filter given by the user.
125 * 125 *
126 * @param {string} text 126 * @param {string} text
127 * @return {ParsedFilter} 127 * @return {ParsedFilter}
128 */ 128 */
129 exports.parseFilter = text => 129 exports.parseFilter = text =>
130 { 130 {
131 let filter = null; 131 let filter = null;
132 text = Filter.normalize(text); 132 text = Filter.stripJunk(text);
133 133
134 if (text) 134 if (text)
135 { 135 {
136 if (text[0] == "[") 136 if (text[0] == "[")
137 return {error: new FilterParsingError("unexpected-filter-list-header")}; 137 return {error: new FilterParsingError("unexpected-filter-list-header")};
138 138
139 filter = Filter.fromText(text); 139 filter = Filter.fromText(text);
140 140
141 if (filter instanceof InvalidFilter) 141 if (filter instanceof InvalidFilter)
142 { 142 {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 184
185 if (error) 185 if (error)
186 { 186 {
187 error.lineno = i + 1; 187 error.lineno = i + 1;
188 errors.push(error); 188 errors.push(error);
189 } 189 }
190 } 190 }
191 191
192 return {filters, errors}; 192 return {filters, errors};
193 }; 193 };
OLDNEW
« lib/csp.js ('K') | « lib/csp.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld