From 1c1bd7ce527cd13c4b17de9edd35cbe89ea27b80 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Tue, 18 Jun 2024 12:02:16 -0400 Subject: [PATCH] test: update `url` web-platform tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/53472 Reviewed-By: Michaël Zasso Reviewed-By: Filip Skokan Reviewed-By: Chemi Atlow Reviewed-By: Moshe Atlow Reviewed-By: Tobias Nießen --- test/fixtures/wpt/README.md | 2 +- test/fixtures/wpt/url/WEB_FEATURES.yml | 4 + test/fixtures/wpt/url/a-element.html | 10 ++ .../wpt/url/resources/setters_tests.json | 44 +++++++++ .../wpt/url/resources/urltestdata.json | 98 +++++++++++++++++++ test/fixtures/wpt/versions.json | 4 +- 6 files changed, 159 insertions(+), 3 deletions(-) create mode 100644 test/fixtures/wpt/url/WEB_FEATURES.yml diff --git a/test/fixtures/wpt/README.md b/test/fixtures/wpt/README.md index 9c4e4cf5ad9747..3f65907043f984 100644 --- a/test/fixtures/wpt/README.md +++ b/test/fixtures/wpt/README.md @@ -27,7 +27,7 @@ Last update: - resource-timing: https://github.com/web-platform-tests/wpt/tree/22d38586d0/resource-timing - resources: https://github.com/web-platform-tests/wpt/tree/1e140d63ec/resources - streams: https://github.com/web-platform-tests/wpt/tree/9b03282a99/streams -- url: https://github.com/web-platform-tests/wpt/tree/0f550ab9f5/url +- url: https://github.com/web-platform-tests/wpt/tree/7f369fef2b/url - user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing - wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi - wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi diff --git a/test/fixtures/wpt/url/WEB_FEATURES.yml b/test/fixtures/wpt/url/WEB_FEATURES.yml new file mode 100644 index 00000000000000..4711efc1faf9a9 --- /dev/null +++ b/test/fixtures/wpt/url/WEB_FEATURES.yml @@ -0,0 +1,4 @@ +features: +- name: url-canparse + files: + - url-statics-canparse.* diff --git a/test/fixtures/wpt/url/a-element.html b/test/fixtures/wpt/url/a-element.html index 3429e07ec3f3f7..3428fa00574c4d 100644 --- a/test/fixtures/wpt/url/a-element.html +++ b/test/fixtures/wpt/url/a-element.html @@ -11,3 +11,13 @@
+ + + Link with embedded \n is parsed correctly + + diff --git a/test/fixtures/wpt/url/resources/setters_tests.json b/test/fixtures/wpt/url/resources/setters_tests.json index 82adf4cdce270b..3850606d660bbb 100644 --- a/test/fixtures/wpt/url/resources/setters_tests.json +++ b/test/fixtures/wpt/url/resources/setters_tests.json @@ -825,6 +825,17 @@ "port": "" } }, + { + "comment": "Stuff after a ? delimiter is ignored, trailing 'port'", + "href": "http://example.net/path", + "new_value": "example.com?stuff:8080", + "expected": { + "href": "http://example.com/path", + "host": "example.com", + "hostname": "example.com", + "port": "" + } + }, { "comment": "Stuff after a ? delimiter is ignored", "href": "http://example.net/path", @@ -924,6 +935,39 @@ "port": "8080" } }, + { + "comment": "Anything other than ASCII digit stops the port parser in a setter but is not an error", + "href": "http://example.net:8080", + "new_value": "example.com:invalid", + "expected": { + "href": "http://example.com:8080/", + "host": "example.com:8080", + "hostname": "example.com", + "port": "8080" + } + }, + { + "comment": "Anything other than ASCII digit stops the port parser in a setter but is not an error", + "href": "http://example.net:8080/test", + "new_value": "[::1]:invalid", + "expected": { + "href": "http://[::1]:8080/test", + "host": "[::1]:8080", + "hostname": "[::1]", + "port": "8080" + } + }, + { + "comment": "IPv6 without port", + "href": "http://example.net:8080/test", + "new_value": "[::1]", + "expected": { + "href": "http://[::1]:8080/test", + "host": "[::1]:8080", + "hostname": "[::1]", + "port": "8080" + } + }, { "comment": "Port numbers are 16 bit integers", "href": "http://example.net/path", diff --git a/test/fixtures/wpt/url/resources/urltestdata.json b/test/fixtures/wpt/url/resources/urltestdata.json index 287a84b467a48b..7c2a0f68c77a26 100644 --- a/test/fixtures/wpt/url/resources/urltestdata.json +++ b/test/fixtures/wpt/url/resources/urltestdata.json @@ -1751,6 +1751,76 @@ "search": "", "hash": "" }, + { + "input": "file:///w|m", + "base": null, + "href": "file:///w|m", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/w|m", + "search": "", + "hash": "" + }, + { + "input": "file:///w||m", + "base": null, + "href": "file:///w||m", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/w||m", + "search": "", + "hash": "" + }, + { + "input": "file:///w|/m", + "base": null, + "href": "file:///w:/m", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/w:/m", + "search": "", + "hash": "" + }, + { + "input": "file:C|/m/", + "base": null, + "href": "file:///C:/m/", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/C:/m/", + "search": "", + "hash": "" + }, + { + "input": "file:C||/m/", + "base": null, + "href": "file:///C||/m/", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/C||/m/", + "search": "", + "hash": "" + }, "# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/path.js", { "input": "http://example.com/././foo", @@ -3560,6 +3630,34 @@ "search": "", "hash": "" }, + { + "input": "file:.", + "base": null, + "href": "file:///", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "file:.", + "base": "http://www.example.com/test", + "href": "file:///", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, "# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/host.html", "Basic canonicalization, uppercase should be converted to lowercase", { diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json index c31d76cc47fb25..602b4c63e83205 100644 --- a/test/fixtures/wpt/versions.json +++ b/test/fixtures/wpt/versions.json @@ -68,7 +68,7 @@ "path": "streams" }, "url": { - "commit": "c2d7e70b52cbd9a5b938aa32f37078d7a71e0b21", + "commit": "7f369fef2b6f740a0738510331274bf2cbf7b509", "path": "url" }, "user-timing": { @@ -95,4 +95,4 @@ "commit": "e97fac4791931fb7455ba3fad759d362c7108b09", "path": "webmessaging/broadcastchannel" } -} +} \ No newline at end of file