Mitigate race conditions on startup.

This commit is contained in:
hackademix 2024-10-03 14:11:02 +02:00
parent 2947793037
commit 33d2ce0c1d
No known key found for this signature in database
GPG Key ID: 231A83AFDA9C2434
3 changed files with 4 additions and 3 deletions

View File

@ -46,6 +46,7 @@ function deferWebTraffic(promiseToWaitFor, next) {
async function waitFor(request) { async function waitFor(request) {
let {type, documentUrl, url, tabId, frameId} = request; let {type, documentUrl, url, tabId, frameId} = request;
debug("deferWebTraffic probing",request);
if (tabId === browser.tabs.TAB_ID_NONE) return; if (tabId === browser.tabs.TAB_ID_NONE) return;
if (!seenTabs.has(tabId)) { if (!seenTabs.has(tabId)) {
if (type === "main_frame") { if (type === "main_frame") {

View File

@ -204,8 +204,7 @@
async fetchChildPolicy({url, contextUrl}, sender) { async fetchChildPolicy({url, contextUrl}, sender) {
await ns.initializing; await ns.initializing;
return (messageHandler.fetchChildPolicy = return ns.computeChildPolicy(...arguments);
ns.computeChildPolicy)(...arguments);
}, },
async openStandalonePopup(tab) { async openStandalonePopup(tab) {
@ -416,6 +415,7 @@
}, },
async collectSeen(tabId) { async collectSeen(tabId) {
await this.initializing;
try { try {
let seen = Array.from(await Messages.send("collect", {uuid: ns.local.uuid}, {tabId, frameId: 0})); let seen = Array.from(await Messages.send("collect", {uuid: ns.local.uuid}, {tabId, frameId: 0}));
debug("Collected seen", seen); // DEV_ONLY debug("Collected seen", seen); // DEV_ONLY

@ -1 +1 @@
Subproject commit 593c414c9ae7ede326109d5af10e6ff21c4a1138 Subproject commit 1a94f457568d2708e5e61c6322bfa4f1e50a20ec