summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhackademix2018-08-01 19:00:33 +0200
committerhackademix2018-08-01 19:07:37 +0200
commit99e8c8b09f7270d335985fb84fa237323dfe2242 (patch)
tree167d565bf060d5bf70b0c8f3199fb716c3dd8d6b
parentce541c4a53679934e349b2bc85b2b18843a4146d (diff)
downloadnoscript-99e8c8b09f7270d335985fb84fa237323dfe2242.tar.gz
noscript-99e8c8b09f7270d335985fb84fa237323dfe2242.tar.xz
noscript-99e8c8b09f7270d335985fb84fa237323dfe2242.zip
Skip non-content windows when deferring startup page loading.
-rw-r--r--src/bg/deferWebTraffic.js8
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"],