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

Unified Diff: lib/filterListener.js

Issue 29790570: Noissue - Avoid redundant iterations in subscriptions loop (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created May 25, 2018, 7:03 a.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 | « no previous file | no next file » | 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
@@ -136,17 +136,20 @@
{
if (!(filter instanceof ActiveFilter) || filter.disabled)
return;
let hasEnabled = false;
for (let i = 0; i < filter.subscriptions.length; i++)
{
if (!filter.subscriptions[i].disabled)
+ {
hasEnabled = true;
+ break;
+ }
}
if (!hasEnabled)
return;
if (filter instanceof RegExpFilter)
defaultMatcher.add(filter);
else if (filter instanceof ElemHideBase)
{
@@ -168,17 +171,20 @@
return;
if (!filter.disabled)
{
let hasEnabled = false;
for (let i = 0; i < filter.subscriptions.length; i++)
{
if (!filter.subscriptions[i].disabled)
+ {
hasEnabled = true;
+ break;
+ }
}
if (hasEnabled)
return;
}
if (filter instanceof RegExpFilter)
defaultMatcher.remove(filter);
else if (filter instanceof ElemHideBase)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld