diff options
author | hackademix | 2019-07-21 02:21:49 +0200 |
---|---|---|
committer | hackademix | 2019-07-23 18:11:14 +0200 |
commit | 081ffddda6ee3419dc6c706458ad3f006f4f1a97 (patch) | |
tree | 6812e9a18897499b4b9e2b0ee7f9331136fe3ed2 /src | |
parent | 1a90574124e099cfe8a56806e7fd4e79eb2b1f81 (diff) | |
download | noscript-081ffddda6ee3419dc6c706458ad3f006f4f1a97.tar.gz noscript-081ffddda6ee3419dc6c706458ad3f006f4f1a97.tar.xz noscript-081ffddda6ee3419dc6c706458ad3f006f4f1a97.zip |
More graceful handling of chrome: origins.
Diffstat (limited to 'src')
-rw-r--r-- | src/common/Policy.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/common/Policy.js b/src/common/Policy.js index c61596d..3f7e0c7 100644 --- a/src/common/Policy.js +++ b/src/common/Policy.js @@ -84,11 +84,11 @@ var {Permissions, Policy, Sites} = (() => { static origin(site) { if (!site) return ""; try { - let objUrl = site.href ? site : new URL(site); - let origin = objUrl.origin; + let objUrl = (typeof site === "object" && "origin" in site) ? site : site.startsWith("chrome:") ? {origin: "chrome:" } : new URL(site); + let {origin} = objUrl; return origin === "null" ? Sites.cleanUrl(objUrl) || site : origin; } catch (e) { - console.error(e); + error(e); }; return site.origin || site; } |