From f59c9636f4bca0642780a10494cf729a365c8ad2 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Sat, 3 Jun 2023 12:52:23 -0400 Subject: [PATCH] url: conform to origin getter spec changes PR-URL: https://github.com/nodejs/node/pull/48319 Reviewed-By: Luigi Pinca Reviewed-By: Yagiz Nizipli Reviewed-By: Benjamin Gruenbaum --- lib/internal/url.js | 4 +++- test/wpt/status/url.json | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/internal/url.js b/lib/internal/url.js index beadc12cbaa913..c6b48ce94c7576 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -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 { diff --git a/test/wpt/status/url.json b/test/wpt/status/url.json index f139ef7b03c27e..712ad96680a323 100644 --- a/test/wpt/status/url.json +++ b/test/wpt/status/url.json @@ -15,8 +15,5 @@ }, "javascript-urls.window.js": { "skip": "requires document.body reference" - }, - "url-origin.any.js": { - "skip": "implementation not up to date" } }