Work around for unpredictable content script execution order.

This commit is contained in:
hackademix 2020-09-12 19:27:09 +02:00
parent 8169a7f561
commit bfe1ddc6da
2 changed files with 13 additions and 2 deletions

View File

@ -41,8 +41,14 @@
//, document.domain, document.baseURI, window.isSecureContext // DEV_ONLY
);
if (this.syncFetchPolicy) { // ftp: or file: - no CSP headers yet
this.syncFetchPolicy();
if (/^(ftp|file):/.test(url)) { // ftp: or file: - no CSP headers yet
if (this.syncFetchPolicy) {
this.syncFetchPolicy();
} else { // additional content scripts not loaded yet
log("Waiting for syncFetchPolicy to load...");
this.pendingFetchPolicy = true;
return;
}
} else {
// CSP headers have been already provided by webRequest, we are not in a hurry...
if (/^(javascript|about):/.test(url)) {

View File

@ -143,4 +143,9 @@
error("Background page not ready yet, retrying to fetch policy...")
}
}
};
if (this.ns.pendingSyncFetchPolicy) {
this.ns.pendingSyncFetchPolicy = false;
this.ns.syncFetchPolicy();
}