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

Delta Between Two Patch Sets: messageResponder.js

Issue 29674584: Issue 5549 - Implement missing error handlings for custom filter lists (Closed)
Left Patch Set: enabled testing via ?filterError=true Created Jan. 25, 2018, 12:56 p.m.
Right Patch Set: changed custom-filters-edit-area to custom-filters-control as suggested Created Feb. 5, 2018, 9:05 a.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 | « locale/en_US/desktop-options.json ('k') | skin/desktop-options.css » ('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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
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({
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 } 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
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);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld