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

Side by Side Diff: lib/filterStorage.js

Issue 29853570: Issue 6908 - Pass updated subscription's old filters as an event argument (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Rebase Created Aug. 29, 2018, 6:03 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 | « lib/filterListener.js ('k') | no next file » | 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 }, 190 },
191 191
192 /** 192 /**
193 * Replaces the list of filters in a subscription by a new list 193 * Replaces the list of filters in a subscription by a new list
194 * @param {Subscription} subscription filter subscription to be updated 194 * @param {Subscription} subscription filter subscription to be updated
195 * @param {Filter[]} filters new filter list 195 * @param {Filter[]} filters new filter list
196 */ 196 */
197 updateSubscriptionFilters(subscription, filters) 197 updateSubscriptionFilters(subscription, filters)
198 { 198 {
199 removeSubscriptionFilters(subscription); 199 removeSubscriptionFilters(subscription);
200 subscription.oldFilters = subscription.filters; 200 let oldFilters = subscription.filters;
201 subscription.filters = filters; 201 subscription.filters = filters;
202 addSubscriptionFilters(subscription); 202 addSubscriptionFilters(subscription);
203 filterNotifier.emit("subscription.updated", subscription); 203 filterNotifier.emit("subscription.updated", subscription, oldFilters);
204 delete subscription.oldFilters;
205 }, 204 },
206 205
207 /** 206 /**
208 * Adds a user-defined filter to the list 207 * Adds a user-defined filter to the list
209 * @param {Filter} filter 208 * @param {Filter} filter
210 * @param {SpecialSubscription} [subscription] 209 * @param {SpecialSubscription} [subscription]
211 * particular group that the filter should be added to 210 * particular group that the filter should be added to
212 * @param {number} [position] 211 * @param {number} [position]
213 * position within the subscription at which the filter should be added 212 * position within the subscription at which the filter should be added
214 */ 213 */
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 * @param {Subscription} subscription filter subscription to be removed 671 * @param {Subscription} subscription filter subscription to be removed
673 */ 672 */
674 function removeSubscriptionFilters(subscription) 673 function removeSubscriptionFilters(subscription)
675 { 674 {
676 if (!FilterStorage.knownSubscriptions.has(subscription.url)) 675 if (!FilterStorage.knownSubscriptions.has(subscription.url))
677 return; 676 return;
678 677
679 for (let filter of subscription.filters) 678 for (let filter of subscription.filters)
680 filter.subscriptions.delete(subscription); 679 filter.subscriptions.delete(subscription);
681 } 680 }
OLDNEW
« no previous file with comments | « lib/filterListener.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld