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

Side by Side Diff: background.js

Issue 29674584: Issue 5549 - Implement missing error handlings for custom filter lists (Closed)
Patch Set: enabled testing via ?filterError=true Created Jan. 25, 2018, 12:56 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
« no previous file with comments | « no previous file | desktop-options.html » ('j') | desktop-options.html » ('J')
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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 modules.filterValidation = 334 modules.filterValidation =
335 { 335 {
336 parseFilter(text) 336 parseFilter(text)
337 { 337 {
338 if (params.filterError) 338 if (params.filterError)
339 return {error: "Invalid filter"}; 339 return {error: "Invalid filter"};
340 return {filter: modules.filterClasses.Filter.fromText(text)}; 340 return {filter: modules.filterClasses.Filter.fromText(text)};
341 }, 341 },
342 parseFilters(text) 342 parseFilters(text)
343 { 343 {
344 if (params.filterError) 344 if (params.filterError)
saroyanm 2018/01/29 11:44:48 Suggestion: copy pasting with the slight modificat
a.giammarchi 2018/01/29 17:36:32 not sure I understand this one. What do you mean?
saroyanm 2018/01/30 12:03:44 We will try to use part of filterValidation in ord
345 return {errors: ["Invalid filter"]}; 345 return {errors: [{reason: "Invalid filter", lineno: 1}]};
346 return { 346 return {
347 filters: text.split("\n") 347 filters: text.split("\n")
348 .filter((filter) => !!filter) 348 .filter((filter) => !!filter)
349 .map(modules.filterClasses.Filter.fromText), 349 .map(modules.filterClasses.Filter.fromText),
350 errors: [] 350 errors: []
351 }; 351 };
352 } 352 }
353 }; 353 };
354 354
355 modules.synchronizer = { 355 modules.synchronizer = {
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 }, 612 },
613 filter: { 613 filter: {
614 text: "||example.com/some-annoying-popup$popup", 614 text: "||example.com/some-annoying-popup$popup",
615 whitelisted: false, 615 whitelisted: false,
616 userDefined: true, 616 userDefined: true,
617 subscription: null 617 subscription: null
618 } 618 }
619 }); 619 });
620 }); 620 });
621 }()); 621 }());
OLDNEW
« no previous file with comments | « no previous file | desktop-options.html » ('j') | desktop-options.html » ('J')

Powered by Google App Engine
This is Rietveld