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 <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
  • Loading branch information
anonrig authored and Ceres6 committed Aug 14, 2023
1 parent 0bdbf9d commit 882b9dd
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 882b9dd

Please sign in to comment.