[Firefox] Fix regression causing file:// policy not to be correctly enforced sometimes.

This commit is contained in:
hackademix 2022-02-12 22:19:45 +01:00
parent 11d7cfc4c8
commit 9b0553f760
3 changed files with 10 additions and 8 deletions

View File

@ -668,9 +668,6 @@ var RequestGuard = (() => {
ns.domPolicy = domPolicy;
if (ns.setup) {
if (ns.syncSetup) ns.syncSetup(domPolicy);
else if (!ns.pendingSyncFetchPolicy) {
ns.setup(domPolicy);
}
} ;
} else {
window.ns = {domPolicy}

View File

@ -72,6 +72,13 @@
}
}
if (this.syncFetchPolicy) {
// extra hops to ensure that scripts don't run when CSP has not been set through HTTP headers
this.syncFetchPolicy();
} else {
this.pendingSyncFetchPolicy = true;
}
if (!sync) {
queueMicrotask(() => this.fetchPolicy(true));
return;
@ -86,10 +93,8 @@
debug("Fetching policy for actual URL %s (was %s)", url, document.URL);
}
if (this.syncFetchPolicy) {
// extra hops to ensure that scripts don't run when CSP has not been set through HTTP headers
this.syncFetchPolicy();
} else {
if (!this.syncFetchPolicy) {
let msg = {id: "fetchChildPolicy", url, contextUrl: url};
let asyncFetch = (async () => {

View File

@ -65,7 +65,7 @@
}
let syncFetch = callback => {
browser.runtime.sendSyncMessage(
{id: "fetchPolicy", url, contextUrl: url},
{id: "fetchChildPolicy", url, contextUrl: url},
callback);
};
debug("Initial readyState and body", document.readyState, document.body);