LEFT | RIGHT |
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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 * @param {?SpecialSubscription} [subscription] The subscription that the | 246 * @param {?SpecialSubscription} [subscription] The subscription that the |
247 * filter should be added to. | 247 * filter should be added to. |
248 * @param {number} [position] The position within the subscription at which | 248 * @param {number} [position] The position within the subscription at which |
249 * the filter should be added. If not specified, the filter is added at the | 249 * the filter should be added. If not specified, the filter is added at the |
250 * end of the subscription. | 250 * end of the subscription. |
251 */ | 251 */ |
252 addFilter(filter, subscription, position) | 252 addFilter(filter, subscription, position) |
253 { | 253 { |
254 if (!subscription) | 254 if (!subscription) |
255 { | 255 { |
256 for (let currentSubscription of filter.subscriptions()) | 256 for (let currentSubscription of this.subscriptionsForFilter(filter)) |
257 { | 257 { |
258 if (currentSubscription instanceof SpecialSubscription && | 258 if (currentSubscription instanceof SpecialSubscription && |
259 !currentSubscription.disabled) | 259 !currentSubscription.disabled) |
260 { | 260 { |
261 return; // No need to add | 261 return; // No need to add |
262 } | 262 } |
263 } | 263 } |
264 subscription = this.getGroupForFilter(filter); | 264 subscription = this.getGroupForFilter(filter); |
265 } | 265 } |
266 if (!subscription) | 266 if (!subscription) |
(...skipping 18 matching lines...) Expand all Loading... |
285 * @param {?SpecialSubscription} [subscription] The subscription that the | 285 * @param {?SpecialSubscription} [subscription] The subscription that the |
286 * filter should be removed from. If not specified, the filter will be | 286 * filter should be removed from. If not specified, the filter will be |
287 * removed from all subscriptions. | 287 * removed from all subscriptions. |
288 * @param {number} [position] The position within the subscription at which | 288 * @param {number} [position] The position within the subscription at which |
289 * the filter should be removed. If not specified, all instances of the | 289 * the filter should be removed. If not specified, all instances of the |
290 * filter will be removed. | 290 * filter will be removed. |
291 */ | 291 */ |
292 removeFilter(filter, subscription, position) | 292 removeFilter(filter, subscription, position) |
293 { | 293 { |
294 let subscriptions = ( | 294 let subscriptions = ( |
295 subscription ? [subscription] : filter.subscriptions() | 295 subscription ? [subscription] : this.subscriptionsForFilter(filter) |
296 ); | 296 ); |
297 for (let currentSubscription of subscriptions) | 297 for (let currentSubscription of subscriptions) |
298 { | 298 { |
299 if (currentSubscription instanceof SpecialSubscription) | 299 if (currentSubscription instanceof SpecialSubscription) |
300 { | 300 { |
301 let positions = []; | 301 let positions = []; |
302 if (typeof position == "undefined") | 302 if (typeof position == "undefined") |
303 { | 303 { |
304 let index = -1; | 304 let index = -1; |
305 do | 305 do |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 } | 739 } |
740 | 740 |
741 /** | 741 /** |
742 * Clears any in-memory caches held by subscriptions in the storage. | 742 * Clears any in-memory caches held by subscriptions in the storage. |
743 */ | 743 */ |
744 function clearSubscriptionCaches() | 744 function clearSubscriptionCaches() |
745 { | 745 { |
746 for (let subscription of filterStorage.subscriptions()) | 746 for (let subscription of filterStorage.subscriptions()) |
747 subscription.clearCaches(); | 747 subscription.clearCaches(); |
748 } | 748 } |
LEFT | RIGHT |