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

Unified Diff: lib/filterListener.js

Issue 29852555: Issue 6559 - Convert subscriptions property of Filter to a set (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Aug. 10, 2018, 2:12 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/filterClasses.js ('k') | lib/filterStorage.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterListener.js
===================================================================
--- a/lib/filterListener.js
+++ b/lib/filterListener.js
@@ -137,20 +137,18 @@
*/
function addFilter(filter)
{
if (!(filter instanceof ActiveFilter) || filter.disabled)
return;
let hasEnabled = false;
let allowSnippets = false;
- for (let i = 0; i < filter.subscriptions.length; i++)
+ for (let subscription of filter.subscriptions)
{
- let subscription = filter.subscriptions[i];
-
if (!subscription.disabled)
{
hasEnabled = true;
// Allow snippets to be executed only by the circumvention lists or the
// user's own filters.
if (subscription.type == "circumvention" ||
subscription instanceof SpecialSubscription)
@@ -184,19 +182,19 @@
function removeFilter(filter)
{
if (!(filter instanceof ActiveFilter))
return;
if (!filter.disabled)
{
let hasEnabled = false;
- for (let i = 0; i < filter.subscriptions.length; i++)
+ for (let subscription of filter.subscriptions)
{
- if (!filter.subscriptions[i].disabled)
+ if (!subscription.disabled)
{
hasEnabled = true;
break;
}
}
if (hasEnabled)
return;
}
« no previous file with comments | « lib/filterClasses.js ('k') | lib/filterStorage.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld