From 24f738337be6f6328ffb9464dcd07fcbeab5e9ab Mon Sep 17 00:00:00 2001 From: hackademix Date: Mon, 12 Nov 2018 02:18:58 +0100 Subject: Fixed issue #35 "tabId is not defined" on startup. --- src/bg/deferWebTraffic.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/bg') 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: [""] }, ["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(); })(); -} +} -- cgit v1.2.3