summaryrefslogtreecommitdiff
path: root/cli/js/web
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js/web')
-rw-r--r--cli/js/web/url.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/cli/js/web/url.ts b/cli/js/web/url.ts
index 1ae24ff87..cdbba36d9 100644
--- a/cli/js/web/url.ts
+++ b/cli/js/web/url.ts
@@ -370,7 +370,7 @@ export class URLImpl implements URL {
throw new TypeError("Invalid URL.");
}
- const { port } = (urlParts.protocol ? urlParts : baseParts) as URLParts;
+ const { port } = !urlParts.protocol && baseParts ? baseParts : urlParts;
if (this.#validatePort(port) === undefined) {
throw new TypeError("Invalid URL.");
}
@@ -389,7 +389,7 @@ export class URLImpl implements URL {
hash: urlParts.hash,
});
} else {
- throw new TypeError("URL requires a base URL.");
+ throw new TypeError("Invalid URL.");
}
this.#updateSearchParams();