Skip to content

Commit 182be26

Browse files
nodejs-github-botmarco-ippolito
authored andcommittedMar 6, 2025
test: update WPT for url to 67880a4eb83ca9aa732eec4b35a1971ff5bf37ff
PR-URL: #55999 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Jason Zhang <xzha4350@gmail.com>
1 parent 8af1b53 commit 182be26

17 files changed

+359
-34
lines changed
 

‎test/fixtures/wpt/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Last update:
2727
- resource-timing: https://github.com/web-platform-tests/wpt/tree/22d38586d0/resource-timing
2828
- resources: https://github.com/web-platform-tests/wpt/tree/1e140d63ec/resources
2929
- streams: https://github.com/web-platform-tests/wpt/tree/2bd26e124c/streams
30-
- url: https://github.com/web-platform-tests/wpt/tree/6a39784534/url
30+
- url: https://github.com/web-platform-tests/wpt/tree/67880a4eb8/url
3131
- user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing
3232
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi
3333
- wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi

‎test/fixtures/wpt/url/META.yml

-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ suggested_reviewers:
33
- mikewest
44
- domenic
55
- annevk
6-
- GPHemsley
76
- TimothyGu

‎test/fixtures/wpt/url/README.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
## urltestdata.json
1+
## urltestdata.json / urltestdata-javascript-only.json
22

3-
`resources/urltestdata.json` contains URL parsing tests suitable for any URL parser implementation.
3+
[`resources/urltestdata.json`](resources/urltestdata.json) contains URL parsing tests suitable for any URL parser implementation.
4+
[`resources/urltestdata-javascript-only.json`](resources/urltestdata-javascript-only.json) contains URL parsing tests specifically meant
5+
for JavaScript's `URL()` class as well as other languages accepting non-scalar-value strings.
46

5-
It's used as a source of tests by `a-element.html`, `failure.html`, `url-constructor.any.js`, and
6-
other test files in this directory.
7+
These files are used as a source of tests by `a-element.html`, `failure.html`, `url-constructor.any.js`,
8+
and other test files in this directory.
79

8-
The format of `resources/urltestdata.json` is a JSON array of comments as strings and test cases as
10+
Both files share the same format. They consist of a JSON array of comments as strings and test cases as
911
objects. The keys for each test case are:
1012

1113
* `input`: a string to be parsed as URL.

‎test/fixtures/wpt/url/a-element-origin-xhtml.xhtml

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@
1212
<script src="resources/a-element-origin.js"></script>
1313
</body>
1414
</html>
15-
<!-- Other dependencies: resources/urltestdata.json -->
15+
<!--
16+
Other dependencies:
17+
* resources/urltestdata.json,
18+
* resources/urltestdata-javascript-only.json,
19+
-->

‎test/fixtures/wpt/url/a-element-origin.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@
55
<base id=base>
66
<div id=log></div>
77
<script src=resources/a-element-origin.js></script>
8-
<!-- Other dependencies: resources/urltestdata.json -->
8+
<!--
9+
Other dependencies:
10+
* resources/urltestdata.json,
11+
* resources/urltestdata-javascript-only.json,
12+
-->

‎test/fixtures/wpt/url/a-element-xhtml.xhtml

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@
1717
<script src="resources/a-element.js"></script>
1818
</body>
1919
</html>
20-
<!-- Other dependencies: resources/urltestdata.json -->
20+
<!--
21+
Other dependencies:
22+
* resources/urltestdata.json,
23+
* resources/urltestdata-javascript-only.json,
24+
-->

‎test/fixtures/wpt/url/a-element.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
<base id=base>
1111
<div id=log></div>
1212
<script src=resources/a-element.js></script>
13-
<!-- Other dependencies: resources/urltestdata.json -->
13+
<!--
14+
Other dependencies:
15+
* resources/urltestdata.json,
16+
* resources/urltestdata-javascript-only.json,
17+
-->
1418

1519

1620
<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>

‎test/fixtures/wpt/url/failure.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
<script src=/resources/testharnessreport.js></script>
77
<div id=log></div>
88
<script>
9-
promise_test(() => fetch("resources/urltestdata.json").then(res => res.json()).then(runTests), "Loading data…")
9+
promise_test(() => Promise.all([
10+
fetch("resources/urltestdata.json").then(res => res.json()),
11+
fetch("resources/urltestdata-javascript-only.json").then(res => res.json()),
12+
]).then((tests) => tests.flat()).then(runTests), "Loading data…");
1013

1114
function runTests(testData) {
1215
for (const test of testData) {

‎test/fixtures/wpt/url/idlharness-shadowrealm.window.js

-2
This file was deleted.

‎test/fixtures/wpt/url/idlharness.any.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// META: script=/resources/WebIDLParser.js
22
// META: script=/resources/idlharness.js
3+
// META: global=window,dedicatedworker,shadowrealm-in-window
34

45
idl_test(
56
['url'],

‎test/fixtures/wpt/url/resources/a-element-origin.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
promise_test(() => fetch("resources/urltestdata.json").then(res => res.json()).then(runURLTests), "Loading data…");
1+
promise_test(() => Promise.all([
2+
fetch("resources/urltestdata.json").then(res => res.json()),
3+
fetch("resources/urltestdata-javascript-only.json").then(res => res.json()),
4+
]).then((tests) => tests.flat()).then(runURLTests), "Loading data…");
25

36
function setBase(base) {
47
document.getElementById("base").href = base

‎test/fixtures/wpt/url/resources/a-element.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
promise_test(() => fetch("resources/urltestdata.json").then(res => res.json()).then(runURLTests), "Loading data…");
1+
promise_test(() => Promise.all([
2+
fetch("resources/urltestdata.json").then(res => res.json()),
3+
fetch("resources/urltestdata-javascript-only.json").then(res => res.json()),
4+
]).then((tests) => tests.flat()).then(runURLTests), "Loading data…");
25

36
function setBase(base) {
47
document.getElementById("base").href = base;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[
2+
"See ../README.md for a description of the format.",
3+
{
4+
"input": "http://example.com/\uD800\uD801\uDFFE\uDFFF\uFDD0\uFDCF\uFDEF\uFDF0\uFFFE\uFFFF?\uD800\uD801\uDFFE\uDFFF\uFDD0\uFDCF\uFDEF\uFDF0\uFFFE\uFFFF",
5+
"base": null,
6+
"href": "http://example.com/%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?%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",
7+
"origin": "http://example.com",
8+
"protocol": "http:",
9+
"username": "",
10+
"password": "",
11+
"host": "example.com",
12+
"hostname": "example.com",
13+
"port": "",
14+
"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",
15+
"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",
16+
"hash": ""
17+
}
18+
]

‎test/fixtures/wpt/url/resources/urltestdata.json

+291-15
Original file line numberDiff line numberDiff line change
@@ -4849,21 +4849,6 @@
48494849
"search": "",
48504850
"hash": ""
48514851
},
4852-
{
4853-
"input": "http://example.com/\uD800\uD801\uDFFE\uDFFF\uFDD0\uFDCF\uFDEF\uFDF0\uFFFE\uFFFF?\uD800\uD801\uDFFE\uDFFF\uFDD0\uFDCF\uFDEF\uFDF0\uFFFE\uFFFF",
4854-
"base": null,
4855-
"href": "http://example.com/%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?%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",
4856-
"origin": "http://example.com",
4857-
"protocol": "http:",
4858-
"username": "",
4859-
"password": "",
4860-
"host": "example.com",
4861-
"hostname": "example.com",
4862-
"port": "",
4863-
"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",
4864-
"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",
4865-
"hash": ""
4866-
},
48674852
"Forbidden host code points",
48684853
{
48694854
"input": "sc://a\u0000b/",
@@ -9658,6 +9643,201 @@
96589643
"search": "",
96599644
"hash": ""
96609645
},
9646+
{
9647+
"input": "android://x:0/a",
9648+
"base": null,
9649+
"href": "android://x:0/a",
9650+
"origin": "null",
9651+
"protocol": "android:",
9652+
"username": "",
9653+
"password": "",
9654+
"host": "x:0",
9655+
"hostname": "x",
9656+
"port": "0",
9657+
"pathname": "/a",
9658+
"search": "",
9659+
"hash": ""
9660+
},
9661+
{
9662+
"input": "drivefs://x:0/a",
9663+
"base": null,
9664+
"href": "drivefs://x:0/a",
9665+
"origin": "null",
9666+
"protocol": "drivefs:",
9667+
"username": "",
9668+
"password": "",
9669+
"host": "x:0",
9670+
"hostname": "x",
9671+
"port": "0",
9672+
"pathname": "/a",
9673+
"search": "",
9674+
"hash": ""
9675+
},
9676+
{
9677+
"input": "chromeos-steam://x:0/a",
9678+
"base": null,
9679+
"href": "chromeos-steam://x:0/a",
9680+
"origin": "null",
9681+
"protocol": "chromeos-steam:",
9682+
"username": "",
9683+
"password": "",
9684+
"host": "x:0",
9685+
"hostname": "x",
9686+
"port": "0",
9687+
"pathname": "/a",
9688+
"search": "",
9689+
"hash": ""
9690+
},
9691+
{
9692+
"input": "steam://x:0/a",
9693+
"base": null,
9694+
"href": "steam://x:0/a",
9695+
"origin": "null",
9696+
"protocol": "steam:",
9697+
"username": "",
9698+
"password": "",
9699+
"host": "x:0",
9700+
"hostname": "x",
9701+
"port": "0",
9702+
"pathname": "/a",
9703+
"search": "",
9704+
"hash": ""
9705+
},
9706+
{
9707+
"input": "materialized-view://x:0/a",
9708+
"base": null,
9709+
"href": "materialized-view://x:0/a",
9710+
"origin": "null",
9711+
"protocol": "materialized-view:",
9712+
"username": "",
9713+
"password": "",
9714+
"host": "x:0",
9715+
"hostname": "x",
9716+
"port": "0",
9717+
"pathname": "/a",
9718+
"search": "",
9719+
"hash": ""
9720+
},
9721+
{
9722+
"input": "android-app://x:0",
9723+
"base": null,
9724+
"href": "android-app://x:0",
9725+
"origin": "null",
9726+
"protocol": "android-app:",
9727+
"username": "",
9728+
"password": "",
9729+
"host": "x:0",
9730+
"hostname": "x",
9731+
"port": "0",
9732+
"pathname": "",
9733+
"search": "",
9734+
"hash": ""
9735+
},
9736+
{
9737+
"input": "chrome-distiller://x:0",
9738+
"base": null,
9739+
"href": "chrome-distiller://x:0",
9740+
"origin": "null",
9741+
"protocol": "chrome-distiller:",
9742+
"username": "",
9743+
"password": "",
9744+
"host": "x:0",
9745+
"hostname": "x",
9746+
"port": "0",
9747+
"pathname": "",
9748+
"search": "",
9749+
"hash": ""
9750+
},
9751+
{
9752+
"input": "chrome-extension://x:0",
9753+
"base": null,
9754+
"href": "chrome-extension://x:0",
9755+
"origin": "null",
9756+
"protocol": "chrome-extension:",
9757+
"username": "",
9758+
"password": "",
9759+
"host": "x:0",
9760+
"hostname": "x",
9761+
"port": "0",
9762+
"pathname": "",
9763+
"search": "",
9764+
"hash": ""
9765+
},
9766+
{
9767+
"input": "chrome-native://x:0",
9768+
"base": null,
9769+
"href": "chrome-native://x:0",
9770+
"origin": "null",
9771+
"protocol": "chrome-native:",
9772+
"username": "",
9773+
"password": "",
9774+
"host": "x:0",
9775+
"hostname": "x",
9776+
"port": "0",
9777+
"pathname": "",
9778+
"search": "",
9779+
"hash": ""
9780+
},
9781+
{
9782+
"input": "chrome-resource://x:0",
9783+
"base": null,
9784+
"href": "chrome-resource://x:0",
9785+
"origin": "null",
9786+
"protocol": "chrome-resource:",
9787+
"username": "",
9788+
"password": "",
9789+
"host": "x:0",
9790+
"hostname": "x",
9791+
"port": "0",
9792+
"pathname": "",
9793+
"search": "",
9794+
"hash": ""
9795+
},
9796+
{
9797+
"input": "chrome-search://x:0",
9798+
"base": null,
9799+
"href": "chrome-search://x:0",
9800+
"origin": "null",
9801+
"protocol": "chrome-search:",
9802+
"username": "",
9803+
"password": "",
9804+
"host": "x:0",
9805+
"hostname": "x",
9806+
"port": "0",
9807+
"pathname": "",
9808+
"search": "",
9809+
"hash": ""
9810+
},
9811+
{
9812+
"input": "fuchsia-dir://x:0",
9813+
"base": null,
9814+
"href": "fuchsia-dir://x:0",
9815+
"origin": "null",
9816+
"protocol": "fuchsia-dir:",
9817+
"username": "",
9818+
"password": "",
9819+
"host": "x:0",
9820+
"hostname": "x",
9821+
"port": "0",
9822+
"pathname": "",
9823+
"search": "",
9824+
"hash": ""
9825+
},
9826+
{
9827+
"input": "isolated-app://x:0",
9828+
"base": null,
9829+
"href": "isolated-app://x:0",
9830+
"origin": "null",
9831+
"protocol": "isolated-app:",
9832+
"username": "",
9833+
"password": "",
9834+
"host": "x:0",
9835+
"hostname": "x",
9836+
"port": "0",
9837+
"pathname": "",
9838+
"search": "",
9839+
"hash": ""
9840+
},
96619841
"Scheme relative path starting with multiple slashes",
96629842
{
96639843
"input": "///test",
@@ -9812,5 +9992,101 @@
98129992
"pathname": "/",
98139993
"search": "",
98149994
"hash": ""
9995+
},
9996+
"# Non-special URL and backslashes",
9997+
{
9998+
"input": "non-special:\\\\opaque",
9999+
"base": null,
10000+
"href": "non-special:\\\\opaque",
10001+
"origin": "null",
10002+
"protocol": "non-special:",
10003+
"username": "",
10004+
"password": "",
10005+
"host": "",
10006+
"hostname": "",
10007+
"port": "",
10008+
"pathname": "\\\\opaque",
10009+
"search": "",
10010+
"hash": ""
10011+
},
10012+
{
10013+
"input": "non-special:\\\\opaque/path",
10014+
"base": null,
10015+
"href": "non-special:\\\\opaque/path",
10016+
"origin": "null",
10017+
"protocol": "non-special:",
10018+
"username": "",
10019+
"password": "",
10020+
"host": "",
10021+
"hostname": "",
10022+
"port": "",
10023+
"pathname": "\\\\opaque/path",
10024+
"search": "",
10025+
"hash": ""
10026+
},
10027+
{
10028+
"input": "non-special:\\\\opaque\\path",
10029+
"base": null,
10030+
"href": "non-special:\\\\opaque\\path",
10031+
"origin": "null",
10032+
"protocol": "non-special:",
10033+
"username": "",
10034+
"password": "",
10035+
"host": "",
10036+
"hostname": "",
10037+
"port": "",
10038+
"pathname": "\\\\opaque\\path",
10039+
"search": "",
10040+
"hash": ""
10041+
},
10042+
{
10043+
"input": "non-special:\\/opaque",
10044+
"base": null,
10045+
"href": "non-special:\\/opaque",
10046+
"origin": "null",
10047+
"protocol": "non-special:",
10048+
"username": "",
10049+
"password": "",
10050+
"host": "",
10051+
"hostname": "",
10052+
"port": "",
10053+
"pathname": "\\/opaque",
10054+
"search": "",
10055+
"hash": ""
10056+
},
10057+
{
10058+
"input": "non-special:/\\path",
10059+
"base": null,
10060+
"href": "non-special:/\\path",
10061+
"origin": "null",
10062+
"protocol": "non-special:",
10063+
"username": "",
10064+
"password": "",
10065+
"host": "",
10066+
"hostname": "",
10067+
"port": "",
10068+
"pathname": "/\\path",
10069+
"search": "",
10070+
"hash": ""
10071+
},
10072+
{
10073+
"input": "non-special://host\\a",
10074+
"base": null,
10075+
"failure": true
10076+
},
10077+
{
10078+
"input": "non-special://host/a\\b",
10079+
"base": null,
10080+
"href": "non-special://host/a\\b",
10081+
"origin": "null",
10082+
"protocol": "non-special:",
10083+
"username": "",
10084+
"password": "",
10085+
"host": "host",
10086+
"hostname": "host",
10087+
"port": "",
10088+
"pathname": "/a\\b",
10089+
"search": "",
10090+
"hash": ""
981510091
}
981610092
]

‎test/fixtures/wpt/url/url-constructor.any.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,7 @@ function runURLTests(urlTests) {
5050
}
5151
}
5252

53-
promise_test(() => fetch("resources/urltestdata.json").then(res => res.json()).then(runURLTests), "Loading data…");
53+
promise_test(() => Promise.all([
54+
fetch("resources/urltestdata.json").then(res => res.json()),
55+
fetch("resources/urltestdata-javascript-only.json").then(res => res.json()),
56+
]).then((tests) => tests.flat()).then(runURLTests), "Loading data…");

‎test/fixtures/wpt/url/url-origin.any.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
promise_test(() => fetch("resources/urltestdata.json").then(res => res.json()).then(runURLTests), "Loading data…");
1+
promise_test(() => Promise.all([
2+
fetch("resources/urltestdata.json").then(res => res.json()),
3+
fetch("resources/urltestdata-javascript-only.json").then(res => res.json()),
4+
]).then((tests) => tests.flat()).then(runURLTests), "Loading data…");
25

36
function runURLTests(urlTests) {
47
for (const expected of urlTests) {

‎test/fixtures/wpt/versions.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"path": "streams"
6969
},
7070
"url": {
71-
"commit": "6a39784534e118acc102cf5252c542378831401d",
71+
"commit": "67880a4eb83ca9aa732eec4b35a1971ff5bf37ff",
7272
"path": "url"
7373
},
7474
"user-timing": {

0 commit comments

Comments
 (0)
Please sign in to comment.