From fafe651d235b471adefac9262d04bd39324f66c0 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 7227aac12a7762..1813b86962f4cd 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -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 { diff --git a/test/wpt/status/url.json b/test/wpt/status/url.json index 67dbfb3528b5d6..0b4beb54549495 100644 --- a/test/wpt/status/url.json +++ b/test/wpt/status/url.json @@ -17,8 +17,5 @@ }, "javascript-urls.window.js": { "skip": "requires document.body reference" - }, - "url-origin.any.js": { - "skip": "implementation not up to date" } }