From f875281961b6263f308c6c28bedc87bbac77b1ce Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Sun, 11 Oct 2026 00:33:45 +0000 Subject: [PATCH 1/3] test: update WPT for url to b1a3daad99 --- .../wpt/url/resources/IdnaTestV2.json | 60 ++++++++++++------- .../wpt/url/url-setters-stripping.any.js | 21 +++++++ test/fixtures/wpt/versions.json | 2 +- 3 files changed, 60 insertions(+), 23 deletions(-) diff --git a/test/fixtures/wpt/url/resources/IdnaTestV2.json b/test/fixtures/wpt/url/resources/IdnaTestV2.json index ed4d433ebeeb..be363124a6ad 100644 --- a/test/fixtures/wpt/url/resources/IdnaTestV2.json +++ b/test/fixtures/wpt/url/resources/IdnaTestV2.json @@ -7048,22 +7048,33 @@ "output": "j" }, { - "comment": "C1; V7", + "comment": "C1", "input": "\u10ad\ud8be\udccd\ua868\u05ae\u3002\u10be\u200c\u200c", "output": null }, { - "comment": "C1; V7", + "comment": "C1", "input": "\u2d0d\ud8be\udccd\ua868\u05ae\u3002\u2d1e\u200c\u200c", "output": null }, { - "comment": "V7", "input": "xn--5cb172r175fug38a.xn--mlj", "output": "xn--5cb172r175fug38a.xn--mlj" }, { - "comment": "C1; V7", + "input": "\u2d0d\ud8be\udccd\ua868\u05ae.\u2d1e", + "output": "xn--5cb172r175fug38a.xn--mlj" + }, + { + "input": "\u10ad\ud8be\udccd\ua868\u05ae.\u10be", + "output": "xn--5cb172r175fug38a.xn--mlj" + }, + { + "input": "\u10ad\ud8be\udccd\ua868\u05ae.\u2d1e", + "output": "xn--5cb172r175fug38a.xn--mlj" + }, + { + "comment": "C1", "input": "xn--5cb172r175fug38a.xn--0uga051h", "output": "xn--5cb172r175fug38a.xn--0uga051h" }, @@ -8238,67 +8249,67 @@ "output": "xn--ep37b.xn----hec165lho83b" }, { - "comment": "C2; V6; V7", + "comment": "C2; V6", "input": "\ud8bc\udc2b\uff0e\u1baa\u03c2\u10a6\u200d", "output": null }, { - "comment": "C2; V6; V7", + "comment": "C2; V6", "input": "\ud8bc\udc2b.\u1baa\u03c2\u10a6\u200d", "output": null }, { - "comment": "C2; V6; V7", + "comment": "C2; V6", "input": "\ud8bc\udc2b.\u1baa\u03c2\u2d06\u200d", "output": null }, { - "comment": "C2; V6; V7", + "comment": "C2; V6", "input": "\ud8bc\udc2b.\u1baa\u03a3\u10a6\u200d", "output": null }, { - "comment": "C2; V6; V7", + "comment": "C2; V6", "input": "\ud8bc\udc2b.\u1baa\u03c3\u2d06\u200d", "output": null }, { - "comment": "C2; V6; V7", + "comment": "C2; V6", "input": "\ud8bc\udc2b.\u1baa\u03a3\u2d06\u200d", "output": null }, { - "comment": "V6; V7", + "comment": "V6", "input": "xn--nu4s.xn--4xa153j7im", "output": "xn--nu4s.xn--4xa153j7im" }, { - "comment": "C2; V6; V7", + "comment": "C2; V6", "input": "xn--nu4s.xn--4xa153jk8cs1q", "output": "xn--nu4s.xn--4xa153jk8cs1q" }, { - "comment": "C2; V6; V7", + "comment": "C2; V6", "input": "xn--nu4s.xn--3xa353jk8cs1q", "output": "xn--nu4s.xn--3xa353jk8cs1q" }, { - "comment": "C2; V6; V7", + "comment": "C2; V6", "input": "\ud8bc\udc2b\uff0e\u1baa\u03c2\u2d06\u200d", "output": null }, { - "comment": "C2; V6; V7", + "comment": "C2; V6", "input": "\ud8bc\udc2b\uff0e\u1baa\u03a3\u10a6\u200d", "output": null }, { - "comment": "C2; V6; V7", + "comment": "C2; V6", "input": "\ud8bc\udc2b\uff0e\u1baa\u03c3\u2d06\u200d", "output": null }, { - "comment": "C2; V6; V7", + "comment": "C2; V6", "input": "\ud8bc\udc2b\uff0e\u1baa\u03a3\u2d06\u200d", "output": null }, @@ -11936,20 +11947,25 @@ "output": null }, { - "comment": "V7", "input": "\ud8ba\udcac\u3002\u0729\u3002\ucbd95", - "output": null + "output": "xn--t92s.xn--znb.xn--5-y88f" }, { - "comment": "V7", "input": "\ud8ba\udcac\u3002\u0729\u3002\u110d\u1173\u11ac5", - "output": null + "output": "xn--t92s.xn--znb.xn--5-y88f" }, { - "comment": "V7", "input": "xn--t92s.xn--znb.xn--5-y88f", "output": "xn--t92s.xn--znb.xn--5-y88f" }, + { + "input": "\ud8ba\udcac.\u0729.\ucbd95", + "output": "xn--t92s.xn--znb.xn--5-y88f" + }, + { + "input": "\ud8ba\udcac.\u0729.\u110d\u1173\u11ac5", + "output": "xn--t92s.xn--znb.xn--5-y88f" + }, { "comment": "C2; V6", "input": "\u17ca.\u200d\ud835\udfee\ud804\udc3f", diff --git a/test/fixtures/wpt/url/url-setters-stripping.any.js b/test/fixtures/wpt/url/url-setters-stripping.any.js index ac90cc17e0bf..ff91aea87252 100644 --- a/test/fixtures/wpt/url/url-setters-stripping.any.js +++ b/test/fixtures/wpt/url/url-setters-stripping.any.js @@ -121,5 +121,26 @@ for(const scheme of ["https", "wpt++"]) { }, `Setting ${property} with ${type} ${cpReference} (${scheme}:)`); } } + + // searchParams has to reflect the resulting query, also when it was obtained before setting + // search + for (const [type, input] of [ + ["leading", String.fromCodePoint(i) + "test"], + ["middle", "te" + String.fromCodePoint(i) + "st"], + ["trailing", "test" + String.fromCodePoint(i)] + ]) { + for (const searchParamsFirst of [false, true]) { + test(() => { + const expected = stripped ? "test" : input; + const url = urlRecord(scheme); + if (searchParamsFirst) { + url.searchParams; + } + url.search = input; + assert_array_equals([...url.searchParams.keys()], [expected], "keys"); + assert_array_equals([...url.searchParams.values()], [""], "values"); + }, `Setting search with ${type} ${cpReference} updates ${searchParamsFirst ? "previously obtained " : ""}searchParams (${scheme}:)`); + } + } } } diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json index 33c38735174e..088d8c8d5174 100644 --- a/test/fixtures/wpt/versions.json +++ b/test/fixtures/wpt/versions.json @@ -76,7 +76,7 @@ "path": "streams" }, "url": { - "commit": "c48d58747e1f211527fb695fd60548a997fae617", + "commit": "b1a3daad996272add733ff1c420bf48049a5b698", "path": "url" }, "urlpattern": { From eeed9c92e1e38387a20eab73031551477f8692aa Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Sun, 8 Nov 2026 00:19:25 +0000 Subject: [PATCH 2/3] test: update WPT for url to 8c17bfeb3e --- .../wpt/url/resources/urltestdata.json | 37 +++++++++++++++++++ test/fixtures/wpt/versions.json | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/test/fixtures/wpt/url/resources/urltestdata.json b/test/fixtures/wpt/url/resources/urltestdata.json index 22900fb0ecce..c98300ec7815 100644 --- a/test/fixtures/wpt/url/resources/urltestdata.json +++ b/test/fixtures/wpt/url/resources/urltestdata.json @@ -3823,6 +3823,43 @@ "search": "", "hash": "" }, + "Leading and trailing U+007F DELETE are not trimmed", + { + "input": "\u007Fhttp://example.com/", + "base": null, + "failure": true, + "relativeTo": "non-opaque-path-base" + }, + { + "input": "\u007Fjavascript:alert(1)", + "base": "http://example.org/foo/bar", + "href": "http://example.org/foo/%7Fjavascript:alert(1)", + "origin": "http://example.org", + "protocol": "http:", + "username": "", + "password": "", + "host": "example.org", + "hostname": "example.org", + "port": "", + "pathname": "/foo/%7Fjavascript:alert(1)", + "search": "", + "hash": "" + }, + { + "input": "http://example.com/\u007F", + "base": null, + "href": "http://example.com/%7F", + "origin": "http://example.com", + "protocol": "http:", + "username": "", + "password": "", + "host": "example.com", + "hostname": "example.com", + "port": "", + "pathname": "/%7F", + "search": "", + "hash": "" + }, { "input": "non-special:opaque ", "base": null, diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json index 088d8c8d5174..ac61a9f37124 100644 --- a/test/fixtures/wpt/versions.json +++ b/test/fixtures/wpt/versions.json @@ -76,7 +76,7 @@ "path": "streams" }, "url": { - "commit": "b1a3daad996272add733ff1c420bf48049a5b698", + "commit": "8c17bfeb3e66a2986be16b0e004f85ace68db647", "path": "url" }, "urlpattern": { From 6e158ec97fb1d10ee56217042fdc54dabd282309 Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Sun, 15 Nov 2026 00:18:47 +0000 Subject: [PATCH 3/3] test: update WPT for url to dca32277cb --- test/fixtures/wpt/url/failure.html | 9 ++- .../wpt/url/resources/setters_tests.json | 58 ++++++++++++++ .../urltestdata-javascript-only.json | 15 ++++ .../wpt/url/resources/urltestdata.json | 76 +++++++++++++++++++ .../url/url-setters-lone-surrogates.any.js | 44 +++++++++++ .../url/urlsearchparams-constructor.any.js | 35 +++++++++ test/fixtures/wpt/versions.json | 2 +- 7 files changed, 237 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/wpt/url/url-setters-lone-surrogates.any.js diff --git a/test/fixtures/wpt/url/failure.html b/test/fixtures/wpt/url/failure.html index d95b1d52d672..71efb0f27d91 100644 --- a/test/fixtures/wpt/url/failure.html +++ b/test/fixtures/wpt/url/failure.html @@ -29,8 +29,15 @@ }, "URL's constructor's base argument: " + name) self.test(() => { - const url = new URL("about:blank") + const original = "http://user:pass@example.com:8080/path?query#fragment" + const url = new URL(original) assert_throws_js(TypeError, () => url.href = test.input) + const expected = new URL(original) + for (const property of ["href", "origin", "protocol", "username", "password", "host", "hostname", "port", "pathname", "search", "hash"]) { + assert_equals(url[property], expected[property], property) + } + url.hash = "changed" + assert_equals(url.href, "http://user:pass@example.com:8080/path?query#changed") }, "URL's href: " + name) // The following use cases resolve the URL input relative to the current diff --git a/test/fixtures/wpt/url/resources/setters_tests.json b/test/fixtures/wpt/url/resources/setters_tests.json index 221e77a951bb..94d2dcd78d4a 100644 --- a/test/fixtures/wpt/url/resources/setters_tests.json +++ b/test/fixtures/wpt/url/resources/setters_tests.json @@ -677,6 +677,16 @@ "port": "8080" } }, + { + "href": "http://example.net:8080", + "new_value": "example.com:0", + "expected": { + "href": "http://example.com:0/", + "host": "example.com:0", + "hostname": "example.com", + "port": "0" + } + }, { "comment": "Port number is unchanged if not specified", "href": "http://example.net:8080", @@ -697,6 +707,16 @@ "host": "example.net" } }, + { + "href": "http://example.net:8080/path", + "new_value": ":example.com:15", + "expected": { + "href": "http://example.net:8080/path", + "host": "example.net:8080", + "hostname": "example.net", + "port": "8080" + } + }, { "comment": "The empty host is OK for non-special schemes", "href": "view-source+http://example.net/foo", @@ -1066,6 +1086,16 @@ "port": "" } }, + { + "href": "file:///x", + "new_value": "example.net", + "expected": { + "href": "file://example.net/x", + "host": "example.net", + "hostname": "example.net", + "port": "" + } + }, { "href": "sc://test@test/", "new_value": "", @@ -1519,6 +1549,16 @@ "port": "" } }, + { + "href": "file:///x", + "new_value": "example.net", + "expected": { + "href": "file://example.net/x", + "host": "example.net", + "hostname": "example.net", + "port": "" + } + }, { "href": "sc://test@test/", "new_value": "", @@ -1693,6 +1733,16 @@ "port": "" } }, + { + "href": "http://example.net:8080", + "new_value": "0", + "expected": { + "href": "http://example.net:0/", + "host": "example.net:0", + "hostname": "example.net", + "port": "0" + } + }, { "comment": "Default port number is removed", "href": "http://example.net:8080", @@ -2034,6 +2084,14 @@ "pathname": "/home" } }, + { + "href": "https://example.net/home#nav", + "new_value": "", + "expected": { + "href": "https://example.net/#nav", + "pathname": "/" + } + }, { "comment": "\\ is a segment delimiter for 'special' URLs", "href": "http://example.net/home?lang=fr#nav", diff --git a/test/fixtures/wpt/url/resources/urltestdata-javascript-only.json b/test/fixtures/wpt/url/resources/urltestdata-javascript-only.json index a3793c1f472f..01b37526b99e 100644 --- a/test/fixtures/wpt/url/resources/urltestdata-javascript-only.json +++ b/test/fixtures/wpt/url/resources/urltestdata-javascript-only.json @@ -14,5 +14,20 @@ "pathname": "/%EF%BF%BD%F0%90%9F%BE%EF%BF%BD%EF%B7%90%EF%B7%8F%EF%B7%AF%EF%B7%B0%EF%BF%BE%EF%BF%BF", "search": "?%EF%BF%BD%F0%90%9F%BE%EF%BF%BD%EF%B7%90%EF%B7%8F%EF%B7%AF%EF%B7%B0%EF%BF%BE%EF%BF%BF", "hash": "" + }, + { + "input": "b/c", + "base": "http://example.com/\uD801/b", + "href": "http://example.com/%EF%BF%BD/b/c", + "origin": "http://example.com", + "protocol": "http:", + "username": "", + "password": "", + "host": "example.com", + "hostname": "example.com", + "port": "", + "pathname": "/%EF%BF%BD/b/c", + "search": "", + "hash": "" } ] diff --git a/test/fixtures/wpt/url/resources/urltestdata.json b/test/fixtures/wpt/url/resources/urltestdata.json index c98300ec7815..950569a80247 100644 --- a/test/fixtures/wpt/url/resources/urltestdata.json +++ b/test/fixtures/wpt/url/resources/urltestdata.json @@ -10721,5 +10721,81 @@ "pathname": "blank", "search": "", "hash": "#%00%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9" + }, + "# Relative resolution against empty-path and path-only non-special base URLs with query/fragment", + { + "input": "p", + "base": "git://host?q#r", + "href": "git://host/p", + "origin": "null", + "protocol": "git:", + "username": "", + "password": "", + "host": "host", + "hostname": "host", + "port": "", + "pathname": "/p", + "search": "", + "hash": "" + }, + { + "input": "?q2", + "base": "git://host?q#r", + "href": "git://host?q2", + "origin": "null", + "protocol": "git:", + "username": "", + "password": "", + "host": "host", + "hostname": "host", + "port": "", + "pathname": "", + "search": "?q2", + "hash": "" + }, + { + "input": "#h", + "base": "git://host?q#r", + "href": "git://host?q#h", + "origin": "null", + "protocol": "git:", + "username": "", + "password": "", + "host": "host", + "hostname": "host", + "port": "", + "pathname": "", + "search": "?q", + "hash": "#h" + }, + { + "input": "?q2", + "base": "git:/.//a?q#r", + "href": "git:/.//a?q2", + "origin": "null", + "protocol": "git:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "//a", + "search": "?q2", + "hash": "" + }, + { + "input": "#h", + "base": "git:/.//a?q#r", + "href": "git:/.//a?q#h", + "origin": "null", + "protocol": "git:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "//a", + "search": "?q", + "hash": "#h" } ] diff --git a/test/fixtures/wpt/url/url-setters-lone-surrogates.any.js b/test/fixtures/wpt/url/url-setters-lone-surrogates.any.js new file mode 100644 index 000000000000..1a81723d9466 --- /dev/null +++ b/test/fixtures/wpt/url/url-setters-lone-surrogates.any.js @@ -0,0 +1,44 @@ +// Not in setters_tests.json since lone surrogates are not portable JSON. + +[{ + property: 'pathname', + newValue: '\uDC01\uD802a', + expected: { + href: 'http://example.net/%EF%BF%BD%EF%BF%BDa', + pathname: '/%EF%BF%BD%EF%BF%BDa' + } +}, + { + property: 'search', + newValue: '\uDC01\uD802a', + expected: { + href: 'http://example.net/?%EF%BF%BD%EF%BF%BDa', + search: '?%EF%BF%BD%EF%BF%BDa' + } + }, + { + property: 'hash', + newValue: '\uDC01\uD802a', + expected: { + href: 'http://example.net/#%EF%BF%BD%EF%BF%BDa', + hash: '#%EF%BF%BD%EF%BF%BDa' + } + }, + { + property: 'host', + newValue: 'exa\uDC01\uD802mple.com', + expected: {href: 'http://example.net/', host: 'example.net'} + }, + { + property: 'hostname', + newValue: 'exa\uDC01\uD802mple.com', + expected: {href: 'http://example.net/', hostname: 'example.net'} + }].forEach(({property, newValue, expected}) => { + test(() => { + const url = new URL('http://example.net/'); + url[property] = newValue; + for (const [key, value] of Object.entries(expected)) { + assert_equals(url[key], value, key); + } + }, `Setting ${property} to a value with lone surrogates`); +}); diff --git a/test/fixtures/wpt/url/urlsearchparams-constructor.any.js b/test/fixtures/wpt/url/urlsearchparams-constructor.any.js index d482911350ba..ecd341a431e4 100644 --- a/test/fixtures/wpt/url/urlsearchparams-constructor.any.js +++ b/test/fixtures/wpt/url/urlsearchparams-constructor.any.js @@ -19,6 +19,15 @@ test(function () { assert_equals(params.toString(), "a=b") }, 'URLSearchParams constructor, remove leading "?"') +test(function() { + var params = new URLSearchParams('??a=b') + assert_equals(params.toString(), '%3Fa=b') + params = new URLSearchParams('?') + assert_equals(params.toString(), '') + params = new URLSearchParams('??') + assert_equals(params.toString(), '%3F=') +}, 'URLSearchParams constructor, remove only one leading "?"') + test(() => { var params = new URLSearchParams(DOMException); assert_equals(params.toString(), "INDEX_SIZE_ERR=1&DOMSTRING_SIZE_ERR=2&HIERARCHY_REQUEST_ERR=3&WRONG_DOCUMENT_ERR=4&INVALID_CHARACTER_ERR=5&NO_DATA_ALLOWED_ERR=6&NO_MODIFICATION_ALLOWED_ERR=7&NOT_FOUND_ERR=8&NOT_SUPPORTED_ERR=9&INUSE_ATTRIBUTE_ERR=10&INVALID_STATE_ERR=11&SYNTAX_ERR=12&INVALID_MODIFICATION_ERR=13&NAMESPACE_ERR=14&INVALID_ACCESS_ERR=15&VALIDATION_ERR=16&TYPE_MISMATCH_ERR=17&SECURITY_ERR=18&NETWORK_ERR=19&ABORT_ERR=20&URL_MISMATCH_ERR=21"A_EXCEEDED_ERR=22&TIMEOUT_ERR=23&INVALID_NODE_TYPE_ERR=24&DATA_CLONE_ERR=25") @@ -130,6 +139,20 @@ test(function() { assert_equals(newParams.get('query'), testValue); }, 'Parse encoded +'); +test(function() { + var params = new URLSearchParams('a=b%2Bc'); + assert_equals(params.get('a'), 'b+c'); + params = new URLSearchParams('a%2Bb=c'); + assert_equals(params.get('a+b'), 'c'); +}, 'Parse %2B'); + +test(function() { + var params = new URLSearchParams('='); + assert_true(params.has('')); + assert_equals(params.get(''), ''); + assert_equals(params.toString(), '='); +}, 'Parse ='); + test(function() { var params = new URLSearchParams('a=b c'); assert_equals(params.get('a'), 'b c'); @@ -196,6 +219,18 @@ test(function() { assert_throws_js(TypeError, function() { new URLSearchParams([[1,2,3]]); }); }, "Constructor with sequence of sequences of strings"); +test(function() { + var params = new URLSearchParams([[1, 2], ['a', 'b']]); + assert_equals(params.toString(), '1=2&a=b'); +}, 'Constructor with sequence of sequences of non-strings'); + +test(function() { + var params = new URLSearchParams({1: 2, 'a': 'b'}); + assert_equals(params.toString(), '1=2&a=b'); + params = new URLSearchParams({false: true, 0: 'foo'}); + assert_equals(params.toString(), '0=foo&false=true'); +}, 'Constructor with record of non-strings, in property order'); + [ { "input": {"+": "%C2"}, "output": [["+", "%C2"]], "name": "object with +" }, { "input": {c: "x", a: "?"}, "output": [["c", "x"], ["a", "?"]], "name": "object with two keys" }, diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json index ac61a9f37124..72a345fe0ada 100644 --- a/test/fixtures/wpt/versions.json +++ b/test/fixtures/wpt/versions.json @@ -76,7 +76,7 @@ "path": "streams" }, "url": { - "commit": "8c17bfeb3e66a2986be16b0e004f85ace68db647", + "commit": "dca32277cbf3d40b3ec20bba999a987b0ea51ed7", "path": "url" }, "urlpattern": {