Skip to content

Commit

Permalink
test: update WPT for url to 67880a4eb83ca9aa732eec4b35a1971ff5bf37ff
Browse files Browse the repository at this point in the history
PR-URL: #55999
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Jason Zhang <[email protected]>
  • Loading branch information
nodejs-github-bot authored Nov 28, 2024
1 parent ba912ee commit d09458f
Show file tree
Hide file tree
Showing 17 changed files with 359 additions and 34 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/2bd26e124c/streams
- url: https://github.com/web-platform-tests/wpt/tree/6a39784534/url
- url: https://github.com/web-platform-tests/wpt/tree/67880a4eb8/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
1 change: 0 additions & 1 deletion test/fixtures/wpt/url/META.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ suggested_reviewers:
- mikewest
- domenic
- annevk
- GPHemsley
- TimothyGu
12 changes: 7 additions & 5 deletions test/fixtures/wpt/url/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
## urltestdata.json
## urltestdata.json / urltestdata-javascript-only.json

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

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

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

* `input`: a string to be parsed as URL.
Expand Down
6 changes: 5 additions & 1 deletion test/fixtures/wpt/url/a-element-origin-xhtml.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@
<script src="resources/a-element-origin.js"></script>
</body>
</html>
<!-- Other dependencies: resources/urltestdata.json -->
<!--
Other dependencies:
* resources/urltestdata.json,
* resources/urltestdata-javascript-only.json,
-->
6 changes: 5 additions & 1 deletion test/fixtures/wpt/url/a-element-origin.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@
<base id=base>
<div id=log></div>
<script src=resources/a-element-origin.js></script>
<!-- Other dependencies: resources/urltestdata.json -->
<!--
Other dependencies:
* resources/urltestdata.json,
* resources/urltestdata-javascript-only.json,
-->
6 changes: 5 additions & 1 deletion test/fixtures/wpt/url/a-element-xhtml.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@
<script src="resources/a-element.js"></script>
</body>
</html>
<!-- Other dependencies: resources/urltestdata.json -->
<!--
Other dependencies:
* resources/urltestdata.json,
* resources/urltestdata-javascript-only.json,
-->
6 changes: 5 additions & 1 deletion test/fixtures/wpt/url/a-element.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
<base id=base>
<div id=log></div>
<script src=resources/a-element.js></script>
<!-- Other dependencies: resources/urltestdata.json -->
<!--
Other dependencies:
* resources/urltestdata.json,
* resources/urltestdata-javascript-only.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>
Expand Down
5 changes: 4 additions & 1 deletion test/fixtures/wpt/url/failure.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
promise_test(() => fetch("resources/urltestdata.json").then(res => res.json()).then(runTests), "Loading data…")
promise_test(() => Promise.all([
fetch("resources/urltestdata.json").then(res => res.json()),
fetch("resources/urltestdata-javascript-only.json").then(res => res.json()),
]).then((tests) => tests.flat()).then(runTests), "Loading data…");

function runTests(testData) {
for (const test of testData) {
Expand Down
2 changes: 0 additions & 2 deletions test/fixtures/wpt/url/idlharness-shadowrealm.window.js

This file was deleted.

1 change: 1 addition & 0 deletions test/fixtures/wpt/url/idlharness.any.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// META: global=window,dedicatedworker,shadowrealm-in-window

idl_test(
['url'],
Expand Down
5 changes: 4 additions & 1 deletion test/fixtures/wpt/url/resources/a-element-origin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
promise_test(() => fetch("resources/urltestdata.json").then(res => res.json()).then(runURLTests), "Loading data…");
promise_test(() => Promise.all([
fetch("resources/urltestdata.json").then(res => res.json()),
fetch("resources/urltestdata-javascript-only.json").then(res => res.json()),
]).then((tests) => tests.flat()).then(runURLTests), "Loading data…");

function setBase(base) {
document.getElementById("base").href = base
Expand Down
5 changes: 4 additions & 1 deletion test/fixtures/wpt/url/resources/a-element.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
promise_test(() => fetch("resources/urltestdata.json").then(res => res.json()).then(runURLTests), "Loading data…");
promise_test(() => Promise.all([
fetch("resources/urltestdata.json").then(res => res.json()),
fetch("resources/urltestdata-javascript-only.json").then(res => res.json()),
]).then((tests) => tests.flat()).then(runURLTests), "Loading data…");

function setBase(base) {
document.getElementById("base").href = base;
Expand Down
18 changes: 18 additions & 0 deletions test/fixtures/wpt/url/resources/urltestdata-javascript-only.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
"See ../README.md for a description of the format.",
{
"input": "http://example.com/\uD800\uD801\uDFFE\uDFFF\uFDD0\uFDCF\uFDEF\uFDF0\uFFFE\uFFFF?\uD800\uD801\uDFFE\uDFFF\uFDD0\uFDCF\uFDEF\uFDF0\uFFFE\uFFFF",
"base": null,
"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",
"origin": "http://example.com",
"protocol": "http:",
"username": "",
"password": "",
"host": "example.com",
"hostname": "example.com",
"port": "",
"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": ""
}
]
Loading

0 comments on commit d09458f

Please sign in to comment.