diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bg/deferWebTraffic.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bg/deferWebTraffic.js b/src/bg/deferWebTraffic.js index 6efef97..fced870 100644 --- a/src/bg/deferWebTraffic.js +++ b/src/bg/deferWebTraffic.js @@ -2,7 +2,7 @@ function deferWebTraffic(promiseToWaitFor, next) { debug("deferWebTraffic on %o", promiseToWaitFor); let seenTabs = new Set(); function checkNavigation(nav) { - if (nav.url.startsWith("http")) { + if (nav.tabId !== browser.tabs.TAB_ID_NONE && nav.url.startsWith("http")) { let seen = seenTabs.has(nav.tabId); debug(`%s navigation %o`, seen ? "seen" : "unseen", nav); if (!seen) { @@ -14,7 +14,6 @@ function deferWebTraffic(promiseToWaitFor, next) { function reloadTab(tabId) { seenTabs.add(tabId); try { - // browser.tabs.update(tabId, {url: documentUrl}); browser.tabs.executeScript(tabId, { runAt: "document_start", code: "window.location.reload(false)" @@ -27,6 +26,7 @@ function deferWebTraffic(promiseToWaitFor, next) { async function waitFor(request) { let {type, documentUrl, url, tabId, frameId} = request; + if (tabId === browser.tabs.TAB_ID_NONE) return; if (!seenTabs.has(tabId)) { if (type === "main_frame") { seenTabs.add(tabId); @@ -47,9 +47,9 @@ function deferWebTraffic(promiseToWaitFor, next) { } function spyTabs(request) { - debug("Spying request %o", request); - + debug("Spying request %o", request); } + browser.webRequest.onHeadersReceived.addListener(spyTabs, { urls: ["<all_urls>"], types: ["main_frame"], |