From 4f08302084476cee636b869e94c12d57db41d963 Mon Sep 17 00:00:00 2001 From: hackademix Date: Sun, 3 Nov 2019 13:31:04 +0100 Subject: Fetch policies asynchronously for about: and javascript: URLs. --- src/content/staticNS.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/content/staticNS.js b/src/content/staticNS.js index 59f2b39..82ef302 100644 --- a/src/content/staticNS.js +++ b/src/content/staticNS.js @@ -40,13 +40,14 @@ , document.documentElement.outerHTML, // DEV_ONLY document.domain, document.baseURI, window.isSecureContext // DEV_ONLY ); - if (/^(javascript|about):/.test(url)) { - url = document.readyState === "loading" - ? document.baseURI - : `${window.isSecureContext ? "https" : "http"}://${document.domain}`; - debug("Fetching policy for actual URL %s (was %s)", url, document.URL); - } + if (!/^(?:file|ftp|https?):/i.test(url)) { + if (/^(javascript|about):/.test(url)) { + url = document.readyState === "loading" + ? document.baseURI + : `${window.isSecureContext ? "https" : "http"}://${document.domain}`; + debug("Fetching policy for actual URL %s (was %s)", url, document.URL); + } (async () => { let policy; try { -- cgit v1.2.3