From eb1428c8bb753cafe797e77fb9dae5433f81343e Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Thu, 27 Dec 2018 10:17:08 -0500 Subject: [PATCH] Fix regression in the collapsing of blocked resources Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/356 --- src/js/contentscript.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/js/contentscript.js b/src/js/contentscript.js index 02c04487a..4facff119 100644 --- a/src/js/contentscript.js +++ b/src/js/contentscript.js @@ -774,8 +774,6 @@ vAPI.domFilterer = new vAPI.DOMFilterer(); vAPI.domCollapser = (function() { const messaging = vAPI.messaging; - const toProcess = []; - const toFilter = []; const toCollapse = new Map(); const src1stProps = { embed: 'src', @@ -798,6 +796,8 @@ vAPI.domCollapser = (function() { cachedBlockedSet, cachedBlockedSetHash, cachedBlockedSetTimer, + toProcess = [], + toFilter = [], netSelectorCacheCount = 0; const cachedBlockedSetClear = function() { @@ -888,8 +888,8 @@ vAPI.domCollapser = (function() { hash: cachedBlockedSetHash }; messaging.send('contentscript', msg, onProcessed); - toProcess.length = 0; - toFilter.length = 0; + toProcess = []; + toFilter = []; resquestIdGenerator += 1; }; @@ -949,10 +949,7 @@ vAPI.domCollapser = (function() { return; } if ( src.startsWith('http') === false ) { return; } - toFilter[toFilter.length] = { - type: 'sub_frame', - url: iframe.src - }; + toFilter.push({ type: 'sub_frame', url: iframe.src }); add(iframe); };