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: #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 ruyadorno committed Aug 31, 2023
1 parent cb92c4b commit f59c963
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
Expand Up @@ -731,7 +731,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
Expand Up @@ -15,8 +15,5 @@
},
"javascript-urls.window.js": {
"skip": "requires document.body reference"
},
"url-origin.any.js": {
"skip": "implementation not up to date"
}
}

0 comments on commit f59c963

Please sign in to comment.