[UI] Fix punycode inconsistencies.

This commit is contained in:
hackademix 2021-02-12 19:37:46 +01:00
parent 9eb58f75e5
commit aeb303d669
1 changed files with 7 additions and 7 deletions

View File

@ -795,7 +795,7 @@ var UI = (() => {
} }
} }
let hostname = Sites.toExternal(url.hostname); let {hostname} = url;
let overrideDefault = site && url.protocol && site !== url.protocol ? let overrideDefault = site && url.protocol && site !== url.protocol ?
policy.get(url.protocol, contextMatch) : null; policy.get(url.protocol, contextMatch) : null;
if (overrideDefault && !overrideDefault.siteMatch) overrideDefault = null; if (overrideDefault && !overrideDefault.siteMatch) overrideDefault = null;
@ -819,22 +819,22 @@ var UI = (() => {
row.siteMatch = siteMatch; row.siteMatch = siteMatch;
row.contextMatch = contextMatch; row.contextMatch = contextMatch;
row.perms = perms; row.perms = perms;
row.domain = domain || siteMatch;
if (domain) { // "normal" URL if (domain) { // "normal" URL
let justDomain = hostname === domain; let justDomain = hostname === domain;
let domainEntry = secure || domain === site; let domainEntry = secure || domain === site;
row._label = domainEntry ? "." + domain : site; let unicodeDomain = row.domain = punycode.toUnicode(domain);
row._label = domainEntry ? `.${unicodeDomain}` : Sites.toExternal(site);
row.querySelector(".protocol").textContent = `${url.protocol}//`; row.querySelector(".protocol").textContent = `${url.protocol}//`;
row.querySelector(".sub").textContent = justDomain ? row.querySelector(".sub").textContent = justDomain ?
(keyStyle === "full" || keyStyle == "unsafe" (keyStyle === "full" || keyStyle == "unsafe"
? "" : "…") ? "" : "…")
: hostname.substring(0, hostname.length - domain.length); : punycode.toUnicode(hostname.substring(0, hostname.length - domain.length));
row.querySelector(".domain").textContent = domain; row.querySelector(".domain").textContent = unicodeDomain;
row.querySelector(".path").textContent = siteMatch.length > url.origin.length ? url.pathname : ""; row.querySelector(".path").textContent = siteMatch.length > url.origin.length ? url.pathname : "";
} else { } else {
row._label = siteMatch; urlContainer.querySelector(".full-address").textContent =
urlContainer.querySelector(".full-address").textContent = siteMatch; row._label = row.domain = siteMatch;
} }
let httpsOnly = row.querySelector("input.https-only"); let httpsOnly = row.querySelector("input.https-only");
httpsOnly.checked = keyStyle === "full" || keyStyle === "secure"; httpsOnly.checked = keyStyle === "full" || keyStyle === "secure";