From 54c24a5405b0aaea159c1875a05bc01c44f3f90b Mon Sep 17 00:00:00 2001 From: hackademix Date: Thu, 31 Oct 2019 00:14:26 +0100 Subject: On Chrome limit SyncMessage usage to non-HTTP urls. --- src/content/staticNS.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/content/staticNS.js b/src/content/staticNS.js index 5fc7ac4..447d619 100644 --- a/src/content/staticNS.js +++ b/src/content/staticNS.js @@ -34,11 +34,18 @@ }, fetchPolicy() { + let url = document.URL; + if (!UA.isMozilla && url.startsWith("http")) { + (async () => { + this.setup(await Messages.send("fetchPolicy", {url, contextUrl: url})); + })(); + return; + } debug(`Fetching policy from document %s, readyState %s, content %s`, - document.URL, document.readyState, document.documentElement.outerHTML); + url, document.readyState, document.documentElement.outerHTML); let originalState = document.readyState; let blockedScripts = []; - let url = document.URL; + addEventListener("beforescriptexecute", e => { // safety net for syncrhonous load on Firefox if (!this.canScript) { -- cgit v1.2.3