summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhackademix2019-07-21 02:21:49 +0200
committerhackademix2019-07-23 18:11:14 +0200
commit081ffddda6ee3419dc6c706458ad3f006f4f1a97 (patch)
tree6812e9a18897499b4b9e2b0ee7f9331136fe3ed2 /src
parent1a90574124e099cfe8a56806e7fd4e79eb2b1f81 (diff)
downloadnoscript-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.js6
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;
}