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

Side by Side Diff: messageResponder.js

Issue 29338614: Issue 3830 - Add option indicating whether to remove existing filters on raw import (Closed)
Patch Set: Created March 18, 2016, 1:08 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 | options.js » ('j') | no next file with comments »
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-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
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 return; 259 return;
260 260
261 var seenFilter = Object.create(null); 261 var seenFilter = Object.create(null);
262 for (var i = 0; i < result.filters.length; i++) 262 for (var i = 0; i < result.filters.length; i++)
263 { 263 {
264 var filter = result.filters[i]; 264 var filter = result.filters[i];
265 FilterStorage.addFilter(filter); 265 FilterStorage.addFilter(filter);
266 seenFilter[filter.text] = null; 266 seenFilter[filter.text] = null;
267 } 267 }
268 268
269 if (!message.removeExisting)
270 return;
271
269 for (var i = 0; i < FilterStorage.subscriptions.length; i++) 272 for (var i = 0; i < FilterStorage.subscriptions.length; i++)
270 { 273 {
271 var subscription = FilterStorage.subscriptions[i]; 274 var subscription = FilterStorage.subscriptions[i];
272 if (!(subscription instanceof SpecialSubscription)) 275 if (!(subscription instanceof SpecialSubscription))
273 continue; 276 continue;
274 277
275 for (var j = subscription.filters.length - 1; j >= 0; j--) 278 for (var j = subscription.filters.length - 1; j >= 0; j--)
276 { 279 {
277 var filter = subscription.filters[j]; 280 var filter = subscription.filters[j];
278 if (/^@@\|\|([^\/:]+)\^\$document$/.test(filter.text)) 281 if (/^@@\|\|([^\/:]+)\^\$document$/.test(filter.text))
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 if (subscription instanceof DownloadableSubscription) 397 if (subscription instanceof DownloadableSubscription)
395 Synchronizer.execute(subscription, true); 398 Synchronizer.execute(subscription, true);
396 } 399 }
397 break; 400 break;
398 case "subscriptions.isDownloading": 401 case "subscriptions.isDownloading":
399 callback(Synchronizer.isExecuting(message.url)); 402 callback(Synchronizer.isExecuting(message.url));
400 break; 403 break;
401 } 404 }
402 }); 405 });
403 })(this); 406 })(this);
OLDNEW
« no previous file with comments | « no previous file | options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld