Skip to content

Commit

Permalink
test: update url web-platform tests
Browse files Browse the repository at this point in the history
PR-URL: #53472
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
  • Loading branch information
anonrig authored and targos committed Jun 20, 2024
1 parent a502638 commit d2c169a
Show file tree
Hide file tree
Showing 6 changed files with 158 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/fixtures/wpt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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
Expand Down
4 changes: 4 additions & 0 deletions test/fixtures/wpt/url/WEB_FEATURES.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
features:
- name: url-canparse
files:
- url-statics-canparse.*
10 changes: 10 additions & 0 deletions test/fixtures/wpt/url/a-element.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,13 @@
<div id=log></div>
<script src=resources/a-element.js></script>
<!-- Other dependencies: resources/urltestdata.json -->


<a id="multline-entity" download="multline-entity.txt" href="data:text/plain;charset=utf-8,first%20line&#10;second%20line"> Link with embedded \n is parsed correctly </a>

<script type="text/javascript">
test(function() {
const link = document.getElementById("multline-entity");
assert_equals(link.href, "data:text/plain;charset=utf-8,first%20linesecond%20line");
}, "Test that embedded 0x0A is stripped");
</script>
44 changes: 44 additions & 0 deletions test/fixtures/wpt/url/resources/setters_tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
98 changes: 98 additions & 0 deletions test/fixtures/wpt/url/resources/urltestdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -1781,6 +1781,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",
Expand Down Expand Up @@ -3590,6 +3660,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",
{
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"path": "streams"
},
"url": {
"commit": "0f550ab9f5a07ed293926a306e914866164b346b",
"commit": "7f369fef2b6f740a0738510331274bf2cbf7b509",
"path": "url"
},
"user-timing": {
Expand Down

0 comments on commit d2c169a

Please sign in to comment.