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

Delta Between Two Patch Sets: lib/filterStorage.js

Issue 29800557: Issue 6559 - Use Map object for known subscriptions (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Created June 6, 2018, 10:50 a.m.
Right Patch Set: Move check for known subscription into removeSubscription Created June 6, 2018, 11 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
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 FilterNotifier.triggerListeners("subscription.added", subscription); 134 FilterNotifier.triggerListeners("subscription.added", subscription);
135 }, 135 },
136 136
137 /** 137 /**
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 if (!FilterStorage.knownSubscriptions.has(subscription.url))
Manish Jethani 2018/06/06 11:04:42 IMO it makes more sense to do the check here rathe
144 return;
145
143 for (let i = 0; i < FilterStorage.subscriptions.length; i++) 146 for (let i = 0; i < FilterStorage.subscriptions.length; i++)
144 { 147 {
145 if (FilterStorage.subscriptions[i].url == subscription.url) 148 if (FilterStorage.subscriptions[i].url == subscription.url)
146 { 149 {
147 removeSubscriptionFilters(subscription); 150 removeSubscriptionFilters(subscription);
148 151
149 FilterStorage.subscriptions.splice(i--, 1); 152 FilterStorage.subscriptions.splice(i--, 1);
150 FilterStorage.knownSubscriptions.delete(subscription.url); 153 FilterStorage.knownSubscriptions.delete(subscription.url);
151 FilterNotifier.triggerListeners("subscription.removed", subscription); 154 FilterNotifier.triggerListeners("subscription.removed", subscription);
152 return; 155 return;
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 else if (this.wantObj === false && val) 776 else if (this.wantObj === false && val)
774 this.curObj.push(val.replace(/\\\[/g, "[")); 777 this.curObj.push(val.replace(/\\\[/g, "["));
775 } 778 }
776 finally 779 finally
777 { 780 {
778 Filter.knownFilters = origKnownFilters; 781 Filter.knownFilters = origKnownFilters;
779 Subscription.knownSubscriptions = origKnownSubscriptions; 782 Subscription.knownSubscriptions = origKnownSubscriptions;
780 } 783 }
781 } 784 }
782 }; 785 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld