Loading browser/components/onionservices/OnionAliasStore.sys.mjs +7 −8 Original line number Diff line number Diff line Loading @@ -175,17 +175,15 @@ class Channel { ); return; } let toHostname; try { const toUrl = new URL(rule.rule[0].to); toHostname = toUrl.hostname; } catch (err) { const toHostname = URL.parse(rule.rule[0].to)?.hostname; if (!toHostname) { log.error( "Cannot detect the hostname from the to rule", rule.rule[0].to, err "Unable to parse the URL and the hostname from the to rule", rule.rule[0].to ); return; } let fromRe; try { fromRe = new RegExp(rule.rule[0].from); Loading Loading @@ -318,6 +316,7 @@ class _OnionAliasStore { throw Error("Name cannot be empty"); } // This will throw if the URL is invalid. new URL(chanData.pathPrefix); const scope = new RegExp(chanData.scope); const ch = new Channel( Loading browser/components/onionservices/TorRequestWatch.sys.mjs +8 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,14 @@ class RequestObserver { } isCrossOrigin(url1, url2) { return new URL(url1).origin !== new URL(url2).origin; const origin1 = URL.parse(url1)?.origin; const origin2 = URL.parse(url2)?.origin; if (!origin1 || !origin2) { return true; } return origin1 !== origin2; } shouldBlindCrossOrigin(uri) { try { Loading browser/components/rulesets/content/aboutRulesets.js +2 −2 Original line number Diff line number Diff line Loading @@ -210,8 +210,8 @@ class EditState { const pathPrefix = elements.pathPrefixInput.value.trim(); try { const url = new URL(pathPrefix); if (url.protocol !== "http:" && url.protocol !== "https:") { const url = URL.parse(pathPrefix); if (url?.protocol !== "http:" && url?.protocol !== "https:") { elements.pathPrefixInput.setCustomValidity( await document.l10n.formatValue("rulesets-details-path-input-invalid") ); Loading Loading
browser/components/onionservices/OnionAliasStore.sys.mjs +7 −8 Original line number Diff line number Diff line Loading @@ -175,17 +175,15 @@ class Channel { ); return; } let toHostname; try { const toUrl = new URL(rule.rule[0].to); toHostname = toUrl.hostname; } catch (err) { const toHostname = URL.parse(rule.rule[0].to)?.hostname; if (!toHostname) { log.error( "Cannot detect the hostname from the to rule", rule.rule[0].to, err "Unable to parse the URL and the hostname from the to rule", rule.rule[0].to ); return; } let fromRe; try { fromRe = new RegExp(rule.rule[0].from); Loading Loading @@ -318,6 +316,7 @@ class _OnionAliasStore { throw Error("Name cannot be empty"); } // This will throw if the URL is invalid. new URL(chanData.pathPrefix); const scope = new RegExp(chanData.scope); const ch = new Channel( Loading
browser/components/onionservices/TorRequestWatch.sys.mjs +8 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,14 @@ class RequestObserver { } isCrossOrigin(url1, url2) { return new URL(url1).origin !== new URL(url2).origin; const origin1 = URL.parse(url1)?.origin; const origin2 = URL.parse(url2)?.origin; if (!origin1 || !origin2) { return true; } return origin1 !== origin2; } shouldBlindCrossOrigin(uri) { try { Loading
browser/components/rulesets/content/aboutRulesets.js +2 −2 Original line number Diff line number Diff line Loading @@ -210,8 +210,8 @@ class EditState { const pathPrefix = elements.pathPrefixInput.value.trim(); try { const url = new URL(pathPrefix); if (url.protocol !== "http:" && url.protocol !== "https:") { const url = URL.parse(pathPrefix); if (url?.protocol !== "http:" && url?.protocol !== "https:") { elements.pathPrefixInput.setCustomValidity( await document.l10n.formatValue("rulesets-details-path-input-invalid") ); Loading