 Issue 29674584:
  Issue 5549 - Implement missing error handlings for custom filter lists  (Closed)
    
  
    Issue 29674584:
  Issue 5549 - Implement missing error handlings for custom filter lists  (Closed) 
  | Left: | ||
| Right: | 
| OLD | NEW | 
|---|---|
| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 262 return subscription.filters.map(convertFilter); | 262 return subscription.filters.map(convertFilter); | 
| 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 errors.push(error.toString()); | 272 { | 
| 273 // passing along all the info available through the error object | |
| 274 // in case we'll ever need these extra info in the future | |
| 275 errors.push({ | |
| 
saroyanm
2018/01/29 11:44:48
Detail: Why not just pass "error" Object ?
errors.
 
a.giammarchi
2018/01/29 17:36:32
I've missed this: because it comes from a class un
 
saroyanm
2018/01/30 12:03:44
@Thomas, can you please let me know what is the re
 
Thomas Greiner
2018/01/30 13:08:59
We can only pass plain objects using the messaging
 | |
| 276 lineno: error.lineno, | |
| 277 reason: error.reason, | |
| 278 type: error.type | |
| 279 }); | |
| 280 } | |
| 273 } | 281 } | 
| 274 | 282 | 
| 275 if (errors.length > 0) | 283 if (errors.length > 0) | 
| 276 return errors; | 284 return errors; | 
| 277 | 285 | 
| 278 let seenFilter = Object.create(null); | 286 let seenFilter = Object.create(null); | 
| 279 for (let filter of result.filters) | 287 for (let filter of result.filters) | 
| 280 { | 288 { | 
| 281 FilterStorage.addFilter(filter); | 289 FilterStorage.addFilter(filter); | 
| 282 seenFilter[filter.text] = null; | 290 seenFilter[filter.text] = null; | 
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 456 if (message.url) | 464 if (message.url) | 
| 457 subscriptions = [Subscription.fromURL(message.url)]; | 465 subscriptions = [Subscription.fromURL(message.url)]; | 
| 458 | 466 | 
| 459 for (let subscription of subscriptions) | 467 for (let subscription of subscriptions) | 
| 460 { | 468 { | 
| 461 if (subscription instanceof DownloadableSubscription) | 469 if (subscription instanceof DownloadableSubscription) | 
| 462 Synchronizer.execute(subscription, true); | 470 Synchronizer.execute(subscription, true); | 
| 463 } | 471 } | 
| 464 }); | 472 }); | 
| 465 })(this); | 473 })(this); | 
| OLD | NEW |