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

Side by Side Diff: lib/filterStorage.js

Issue 29860589: Issue 6829 - Free filters when subscriptions are empty (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Address PS1 comment Created Aug. 30, 2018, 5:10 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.js » ('j') | test/filterStorage.js » ('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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 * Removes a filter subscription from the list 138 * Removes a filter subscription from the list
139 * @param {Subscription} subscription filter subscription to be removed 139 * @param {Subscription} subscription filter subscription to be removed
140 */ 140 */
141 removeSubscription(subscription) 141 removeSubscription(subscription)
142 { 142 {
143 for (let i = 0; i < FilterStorage.subscriptions.length; i++) 143 for (let i = 0; i < FilterStorage.subscriptions.length; i++)
144 { 144 {
145 if (FilterStorage.subscriptions[i].url == subscription.url) 145 if (FilterStorage.subscriptions[i].url == subscription.url)
146 { 146 {
147 removeSubscriptionFilters(subscription); 147 removeSubscriptionFilters(subscription);
148 for (let filter of subscription.filters)
149 {
150 if (filter.subscriptions.size == 0)
151 Filter.knownFilters.delete(filter.text);
152 }
148 153
149 FilterStorage.subscriptions.splice(i--, 1); 154 FilterStorage.subscriptions.splice(i--, 1);
150 FilterStorage.knownSubscriptions.delete(subscription.url); 155 FilterStorage.knownSubscriptions.delete(subscription.url);
151 FilterNotifier.triggerListeners("subscription.removed", subscription); 156 FilterNotifier.triggerListeners("subscription.removed", subscription);
152 return; 157 return;
153 } 158 }
154 } 159 }
155 }, 160 },
156 161
157 /** 162 /**
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 else if (this.wantObj === false && val) 778 else if (this.wantObj === false && val)
774 this.curObj.push(val.replace(/\\\[/g, "[")); 779 this.curObj.push(val.replace(/\\\[/g, "["));
775 } 780 }
776 finally 781 finally
777 { 782 {
778 Filter.knownFilters = origKnownFilters; 783 Filter.knownFilters = origKnownFilters;
779 Subscription.knownSubscriptions = origKnownSubscriptions; 784 Subscription.knownSubscriptions = origKnownSubscriptions;
780 } 785 }
781 } 786 }
782 }; 787 };
OLDNEW
« no previous file with comments | « no previous file | test/filterStorage.js » ('j') | test/filterStorage.js » ('J')

Powered by Google App Engine
This is Rietveld