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: Created Aug. 11, 2018, 2:52 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 }, 184 },
185 185
186 /** 186 /**
187 * Replaces the list of filters in a subscription by a new list 187 * Replaces the list of filters in a subscription by a new list
188 * @param {Subscription} subscription filter subscription to be updated 188 * @param {Subscription} subscription filter subscription to be updated
189 * @param {Filter[]} filters new filter list 189 * @param {Filter[]} filters new filter list
190 */ 190 */
191 updateSubscriptionFilters(subscription, filters) 191 updateSubscriptionFilters(subscription, filters)
192 { 192 {
193 removeSubscriptionFilters(subscription); 193 removeSubscriptionFilters(subscription);
194 subscription.oldFilters = subscription.filters; 194 let oldFilters = subscription.filters;
195 subscription.filters = filters; 195 subscription.filters = filters;
196 addSubscriptionFilters(subscription); 196 addSubscriptionFilters(subscription);
197 FilterNotifier.triggerListeners("subscription.updated", subscription); 197 FilterNotifier.triggerListeners("subscription.updated", subscription,
198 delete subscription.oldFilters; 198 oldFilters);
199 }, 199 },
200 200
201 /** 201 /**
202 * Adds a user-defined filter to the list 202 * Adds a user-defined filter to the list
203 * @param {Filter} filter 203 * @param {Filter} filter
204 * @param {SpecialSubscription} [subscription] 204 * @param {SpecialSubscription} [subscription]
205 * particular group that the filter should be added to 205 * particular group that the filter should be added to
206 * @param {number} [position] 206 * @param {number} [position]
207 * position within the subscription at which the filter should be added 207 * position within the subscription at which the filter should be added
208 */ 208 */
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 else if (this.wantObj === false && val) 773 else if (this.wantObj === false && val)
774 this.curObj.push(val.replace(/\\\[/g, "[")); 774 this.curObj.push(val.replace(/\\\[/g, "["));
775 } 775 }
776 finally 776 finally
777 { 777 {
778 Filter.knownFilters = origKnownFilters; 778 Filter.knownFilters = origKnownFilters;
779 Subscription.knownSubscriptions = origKnownSubscriptions; 779 Subscription.knownSubscriptions = origKnownSubscriptions;
780 } 780 }
781 } 781 }
782 }; 782 };
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