summaryrefslogtreecommitdiff
path: root/src/bg/deferWebTraffic.js
diff options
context:
space:
mode:
authorhackademix2018-11-12 02:18:58 +0100
committerhackademix2018-11-12 02:18:58 +0100
commit24f738337be6f6328ffb9464dcd07fcbeab5e9ab (patch)
tree6ee34e5f974f2b4c74cfb31a265aa896c7f125b1 /src/bg/deferWebTraffic.js
parent6860ee2a403ad118327dfda6b2307bdb95b37e2c (diff)
downloadnoscript-24f738337be6f6328ffb9464dcd07fcbeab5e9ab.tar.gz
noscript-24f738337be6f6328ffb9464dcd07fcbeab5e9ab.tar.xz
noscript-24f738337be6f6328ffb9464dcd07fcbeab5e9ab.zip
Fixed issue #35 "tabId is not defined" on startup.
Diffstat (limited to 'src/bg/deferWebTraffic.js')
-rw-r--r--src/bg/deferWebTraffic.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/bg/deferWebTraffic.js b/src/bg/deferWebTraffic.js
index 3f27dd5..a384e29 100644
--- a/src/bg/deferWebTraffic.js
+++ b/src/bg/deferWebTraffic.js
@@ -6,7 +6,7 @@ function deferWebTraffic(promiseToWaitFor, next) {
let seen = seenTabs.has(nav.tabId);
debug(`%s navigation %o`, seen ? "seen" : "unseen", nav);
if (!seen) {
- reloadTab(tabId);
+ reloadTab(nav.tabId);
}
}
}
@@ -23,7 +23,7 @@ function deferWebTraffic(promiseToWaitFor, next) {
error(e, "Can't reload tab", tabId);
}
}
-
+
async function waitFor(request) {
let {type, documentUrl, url, tabId, frameId} = request;
if (tabId === browser.tabs.TAB_ID_NONE) return;
@@ -45,9 +45,9 @@ function deferWebTraffic(promiseToWaitFor, next) {
}
debug("Green light to %s %s from %s", type, url, documentUrl);
}
-
+
function spyTabs(request) {
- debug("Spying request %o", request);
+ debug("Spying request %o", request);
}
browser.webRequest.onHeadersReceived.addListener(spyTabs, {
@@ -57,7 +57,7 @@ function deferWebTraffic(promiseToWaitFor, next) {
browser.webRequest.onBeforeRequest.addListener(waitFor, {
urls: ["<all_urls>"]
}, ["blocking"]);
-
+
(async () => {
await promiseToWaitFor;
browser.webNavigation.onCommitted.removeListener(checkNavigation);
@@ -65,4 +65,4 @@ function deferWebTraffic(promiseToWaitFor, next) {
browser.webRequest.onHeadersReceived.removeListener(spyTabs);
if (next) next();
})();
-}
+}