diff options
author | hackademix | 2018-07-12 22:58:52 +0200 |
---|---|---|
committer | hackademix | 2018-07-12 22:58:52 +0200 |
commit | 25719ddc5e4caf28e8443c09fdba6008d5628f9d (patch) | |
tree | 1f6e2efc02fc3bf56650fabdeba86dd4253f554c /src/bg/RequestUtil.js | |
parent | 7e3decc8f41cbe76284f4b4d1494ebab42325217 (diff) | |
download | noscript-25719ddc5e4caf28e8443c09fdba6008d5628f9d.tar.gz noscript-25719ddc5e4caf28e8443c09fdba6008d5628f9d.tar.xz noscript-25719ddc5e4caf28e8443c09fdba6008d5628f9d.zip |
Fixed cleaning up reloadingTabs in StreamFilter.onstart() was still breaking some feeds sometimes.
Diffstat (limited to 'src/bg/RequestUtil.js')
-rw-r--r-- | src/bg/RequestUtil.js | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/bg/RequestUtil.js b/src/bg/RequestUtil.js index e151f5b..557293d 100644 --- a/src/bg/RequestUtil.js +++ b/src/bg/RequestUtil.js @@ -8,11 +8,15 @@ let pendingRequests = new Map(); - let reloadingTabs = new Set(); + let reloadingTabs = new Map(); let tabKey = (tabId, url) => `${tabId}:${url}`; let cleanup = r => { pendingRequests.delete(r.requestId); + let key = tabKey(r.tabId, r.url); + if (reloadingTabs.get(key) === false) { + reloadingTabs.delete(key); + } }; let filter = { urls: ["<all_urls>"], @@ -66,14 +70,8 @@ if (frameId === 0) { let key = tabKey(tabId, url); debug("Checking whether %s is a reloading tab...", key); - if (reloadingTabs.has(key)) { - debug("Skipping dynamic script injection for reloading feed tab", key); - let filter = browser.webRequest.filterResponseData(requestId); - filter.onstart = e => { - reloadingTabs.delete(key); - filter.write(NULL); - filter.disconnect(); - } + if (reloadingTabs.get(key)) { + reloadingTabs.set(key, false); // doom it for removal in cleanup return; } } @@ -97,7 +95,7 @@ if (mustCheckFeed && !scriptsRan) { mustReload = true; debug(`Marking as "must reload"`, tabId, url); - reloadingTabs.add(tabKey(tabId, url)); + reloadingTabs.set(tabKey(tabId, url), true); } if (buffer && buffer.length) { debug("Flushing %s buffer chunks", buffer.length); |