LEFT | RIGHT |
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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 /** @module filterValidation */ | 18 /** @module filterValidation */ |
19 | 19 |
20 let {Filter, InvalidFilter, ElemHideBase} = require("filterClasses"); | 20 "use strict"; |
21 let {Utils} = require("utils"); | 21 |
| 22 const {Filter, InvalidFilter, ElemHideBase} = require("filterClasses"); |
| 23 const {Utils} = require("utils"); |
22 | 24 |
23 /** | 25 /** |
24 * An error returned by | 26 * An error returned by |
25 * {@link module:filterValidation.parseFilter parseFilter()} or | 27 * {@link module:filterValidation.parseFilter parseFilter()} or |
26 * {@link module:filterValidation.parseFilters parseFilters()} | 28 * {@link module:filterValidation.parseFilters parseFilters()} |
27 * indicating that a given filter cannot be parsed, | 29 * indicating that a given filter cannot be parsed, |
28 * contains an invalid CSS selector or is a filter list header. | 30 * contains an invalid CSS selector or is a filter list header. |
29 * | 31 * |
30 * @constructor | 32 * @constructor |
31 */ | 33 */ |
(...skipping 24 matching lines...) Expand all Loading... |
56 * | 58 * |
57 * @type {?number} | 59 * @type {?number} |
58 */ | 60 */ |
59 lineno: null, | 61 lineno: null, |
60 | 62 |
61 /** | 63 /** |
62 * Returns a detailed translated error message. | 64 * Returns a detailed translated error message. |
63 * | 65 * |
64 * @return {string} | 66 * @return {string} |
65 */ | 67 */ |
66 toString: function() | 68 toString() |
67 { | 69 { |
68 let message; | 70 let message; |
69 if (this.reason) | 71 if (this.reason) |
70 message = Utils.getString(this.reason); | 72 message = Utils.getString(this.reason); |
71 else | 73 else |
72 message = ext.i18n.getMessage( | 74 message = ext.i18n.getMessage( |
73 this.type.replace(/-/g, "_"), | 75 this.type.replace(/-/g, "_"), |
74 "selector" in this ? "'" + this.selector + "'" : null | 76 "selector" in this ? "'" + this.selector + "'" : null |
75 ); | 77 ); |
76 | 78 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 166 |
165 if (error) | 167 if (error) |
166 { | 168 { |
167 error.lineno = i + 1; | 169 error.lineno = i + 1; |
168 errors.push(error); | 170 errors.push(error); |
169 } | 171 } |
170 } | 172 } |
171 | 173 |
172 return {filters: filters, errors: errors}; | 174 return {filters: filters, errors: errors}; |
173 }; | 175 }; |
LEFT | RIGHT |