Fetch policies asynchronously for about: and javascript: URLs.

This commit is contained in:
hackademix 2019-11-03 13:31:04 +01:00
parent 049485e495
commit 4f08302084
1 changed files with 7 additions and 6 deletions

View File

@ -40,13 +40,14 @@
, document.documentElement.outerHTML, // DEV_ONLY
document.domain, document.baseURI, window.isSecureContext // DEV_ONLY
);
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);
}
if (!/^(?:file|ftp|https?):/i.test(url)) {
(async () => {
let policy;
try {