| 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-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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 }); | 263 }); |
| 264 | 264 |
| 265 port.on("filters.importRaw", (message, sender) => | 265 port.on("filters.importRaw", (message, sender) => |
| 266 { | 266 { |
| 267 let result = require("filterValidation").parseFilters(message.text); | 267 let result = require("filterValidation").parseFilters(message.text); |
| 268 let errors = []; | 268 let errors = []; |
| 269 for (let error of result.errors) | 269 for (let error of result.errors) |
| 270 { | 270 { |
| 271 if (error.type != "unexpected-filter-list-header") | 271 if (error.type != "unexpected-filter-list-header") |
| 272 { | 272 { |
| 273 // passing along all the info available through the error object | 273 errors.push(convertObject(["lineno", "reason"], error)); |
| 274 // in case we'll ever need these extra info in the future | |
| 275 errors.push({ | |
| 276 lineno: error.lineno, | |
| 277 reason: error.reason, | |
| 278 type: error.type | |
| 279 }); | |
| 280 } | 274 } |
| 281 } | 275 } |
| 282 | 276 |
| 283 if (errors.length > 0) | 277 if (errors.length > 0) |
| 284 return errors; | 278 return errors; |
| 285 | 279 |
| 286 let seenFilter = Object.create(null); | 280 let seenFilter = Object.create(null); |
| 287 for (let filter of result.filters) | 281 for (let filter of result.filters) |
| 288 { | 282 { |
| 289 FilterStorage.addFilter(filter); | 283 FilterStorage.addFilter(filter); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 if (message.url) | 458 if (message.url) |
| 465 subscriptions = [Subscription.fromURL(message.url)]; | 459 subscriptions = [Subscription.fromURL(message.url)]; |
| 466 | 460 |
| 467 for (let subscription of subscriptions) | 461 for (let subscription of subscriptions) |
| 468 { | 462 { |
| 469 if (subscription instanceof DownloadableSubscription) | 463 if (subscription instanceof DownloadableSubscription) |
| 470 Synchronizer.execute(subscription, true); | 464 Synchronizer.execute(subscription, true); |
| 471 } | 465 } |
| 472 }); | 466 }); |
| 473 })(this); | 467 })(this); |
| LEFT | RIGHT |