From 8b44147f55a7e8660d60aeb4154c6696b4e4dd05 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Sun, 28 Apr 2024 14:01:21 -0400 Subject: [PATCH] test: update web platform tests (#637) --- tests/wpt/setters_tests.json | 44 +++++++++++++++++++++++++++ tests/wpt/urltestdata.json | 58 ++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) diff --git a/tests/wpt/setters_tests.json b/tests/wpt/setters_tests.json index 82adf4cdc..3850606d6 100644 --- a/tests/wpt/setters_tests.json +++ b/tests/wpt/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/tests/wpt/urltestdata.json b/tests/wpt/urltestdata.json index 69767a20d..b9a199daa 100644 --- a/tests/wpt/urltestdata.json +++ b/tests/wpt/urltestdata.json @@ -734,6 +734,36 @@ "search": "", "hash": "" }, + { + "input": "http://a:b@c\\", + "base": null, + "href": "http://a:b@c/", + "origin": "http://c", + "protocol": "http:", + "username": "a", + "password": "b", + "host": "c", + "hostname": "c", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "ws://a@b\\c", + "base": null, + "href": "ws://a@b/c", + "origin": "ws://b", + "protocol": "ws:", + "username": "a", + "password": "", + "host": "b", + "hostname": "b", + "port": "", + "pathname": "/c", + "search": "", + "hash": "" + }, { "input": "foo:/", "base": "http://example.org/foo/bar", @@ -3560,6 +3590,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", {