Skip non-content windows when deferring startup page loading.
This commit is contained in:
parent
ce541c4a53
commit
99e8c8b09f
|
@ -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"],
|
||||
|
|
Loading…
Reference in New Issue