summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-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;
}