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

Side by Side Diff: lib/filterListener.js

Issue 29800557: Issue 6559 - Use Map object for known subscriptions (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
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:
View unified diff | Download patch
« no previous file with comments | « no previous file | lib/filterStorage.js » ('j') | lib/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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 FilterListener.setDirty(1); 234 FilterListener.setDirty(1);
235 235
236 if (!subscription.disabled) 236 if (!subscription.disabled)
237 subscription.filters.forEach(removeFilter); 237 subscription.filters.forEach(removeFilter);
238 } 238 }
239 239
240 function onSubscriptionDisabled(subscription, newValue) 240 function onSubscriptionDisabled(subscription, newValue)
241 { 241 {
242 FilterListener.setDirty(1); 242 FilterListener.setDirty(1);
243 243
244 if (subscription.url in FilterStorage.knownSubscriptions) 244 if (FilterStorage.knownSubscriptions.has(subscription.url))
245 { 245 {
246 if (newValue == false) 246 if (newValue == false)
247 addFilters(subscription.filters); 247 addFilters(subscription.filters);
248 else 248 else
249 subscription.filters.forEach(removeFilter); 249 subscription.filters.forEach(removeFilter);
250 } 250 }
251 } 251 }
252 252
253 function onSubscriptionUpdated(subscription) 253 function onSubscriptionUpdated(subscription)
254 { 254 {
255 FilterListener.setDirty(1); 255 FilterListener.setDirty(1);
256 256
257 if (subscription.url in FilterStorage.knownSubscriptions && 257 if (!subscription.disabled &&
Manish Jethani 2018/06/06 11:04:42 Better to check if the subscription is disabled fi
kzar 2018/06/07 13:52:26 Acknowledged.
258 !subscription.disabled) 258 FilterStorage.knownSubscriptions.has(subscription.url))
259 { 259 {
260 subscription.oldFilters.forEach(removeFilter); 260 subscription.oldFilters.forEach(removeFilter);
261 addFilters(subscription.filters); 261 addFilters(subscription.filters);
262 } 262 }
263 } 263 }
264 264
265 function onFilterHitCount(filter, newValue) 265 function onFilterHitCount(filter, newValue)
266 { 266 {
267 if (newValue == 0) 267 if (newValue == 0)
268 FilterListener.setDirty(0); 268 FilterListener.setDirty(0);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 { 317 {
318 if (!subscription.disabled) 318 if (!subscription.disabled)
319 addFilters(subscription.filters); 319 addFilters(subscription.filters);
320 } 320 }
321 } 321 }
322 322
323 function onSave() 323 function onSave()
324 { 324 {
325 isDirty = 0; 325 isDirty = 0;
326 } 326 }
OLDNEW
« no previous file with comments | « no previous file | lib/filterStorage.js » ('j') | lib/filterStorage.js » ('J')

Powered by Google App Engine
This is Rietveld