Skip to content

Commit

Permalink
url: conform to origin getter spec changes
Browse files Browse the repository at this point in the history
PR-URL: nodejs#48319
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
  • Loading branch information
anonrig authored and nodejs-github-bot committed Jun 7, 2023
1 parent e6e0110 commit f2670a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,9 @@ class URL {
if (path.length > 0) {
try {
const out = new URL(path);
if (out.#context.scheme_type !== 1) {
// Only return origin of scheme is `http` or `https`
// Otherwise return a new opaque origin (null).
if (out.#context.scheme_type === 0 || out.#context.scheme_type === 2) {
return `${out.protocol}//${out.host}`;
}
} catch {
Expand Down
3 changes: 0 additions & 3 deletions test/wpt/status/url.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,5 @@
},
"javascript-urls.window.js": {
"skip": "requires document.body reference"
},
"url-origin.any.js": {
"skip": "implementation not up to date"
}
}

0 comments on commit f2670a6

Please sign in to comment.