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

Side by Side Diff: lib/filterStorage.js

Issue 29854572: Issue 6857 - Do not serialize empty special subscriptions (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Use temporary Set object in unit test Created Oct. 3, 2018, 3: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 | test/filterStorage_readwrite.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-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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 440
441 /** 441 /**
442 * Generator serializing filter data and yielding it line by line. 442 * Generator serializing filter data and yielding it line by line.
443 */ 443 */
444 *exportData() 444 *exportData()
445 { 445 {
446 // Do not persist external subscriptions 446 // Do not persist external subscriptions
447 let subscriptions = []; 447 let subscriptions = [];
448 for (let subscription of this.subscriptions()) 448 for (let subscription of this.subscriptions())
449 { 449 {
450 if (!(subscription instanceof ExternalSubscription)) 450 if (!(subscription instanceof ExternalSubscription) &&
451 !(subscription instanceof SpecialSubscription &&
452 subscription.filters.length == 0))
453 {
451 subscriptions.push(subscription); 454 subscriptions.push(subscription);
455 }
452 } 456 }
453 457
454 yield "# Adblock Plus preferences"; 458 yield "# Adblock Plus preferences";
455 yield "version=" + formatVersion; 459 yield "version=" + formatVersion;
456 460
457 let saved = new Set(); 461 let saved = new Set();
458 let buf = []; 462 let buf = [];
459 463
460 // Save subscriptions 464 // Save subscriptions
461 for (let subscription of subscriptions) 465 for (let subscription of subscriptions)
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 * @param {Subscription} subscription filter subscription to be removed 654 * @param {Subscription} subscription filter subscription to be removed
651 */ 655 */
652 function removeSubscriptionFilters(subscription) 656 function removeSubscriptionFilters(subscription)
653 { 657 {
654 if (!FilterStorage.knownSubscriptions.has(subscription.url)) 658 if (!FilterStorage.knownSubscriptions.has(subscription.url))
655 return; 659 return;
656 660
657 for (let filter of subscription.filters) 661 for (let filter of subscription.filters)
658 filter.removeSubscription(subscription); 662 filter.removeSubscription(subscription);
659 } 663 }
OLDNEW
« no previous file with comments | « no previous file | test/filterStorage_readwrite.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld