More graceful handling of chrome: origins.
This commit is contained in:
parent
1a90574124
commit
081ffddda6
|
@ -84,11 +84,11 @@ var {Permissions, Policy, Sites} = (() => {
|
||||||
static origin(site) {
|
static origin(site) {
|
||||||
if (!site) return "";
|
if (!site) return "";
|
||||||
try {
|
try {
|
||||||
let objUrl = site.href ? site : new URL(site);
|
let objUrl = (typeof site === "object" && "origin" in site) ? site : site.startsWith("chrome:") ? {origin: "chrome:" } : new URL(site);
|
||||||
let origin = objUrl.origin;
|
let {origin} = objUrl;
|
||||||
return origin === "null" ? Sites.cleanUrl(objUrl) || site : origin;
|
return origin === "null" ? Sites.cleanUrl(objUrl) || site : origin;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
error(e);
|
||||||
};
|
};
|
||||||
return site.origin || site;
|
return site.origin || site;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue