diff --git a/test/fixtures/wpt/README.md b/test/fixtures/wpt/README.md
index 563148c0dbe4e0..c4d323f7777c43 100644
--- a/test/fixtures/wpt/README.md
+++ b/test/fixtures/wpt/README.md
@@ -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/bc9dcbbf1a/streams
-- url: https://github.com/web-platform-tests/wpt/tree/d86fcc9e87/url
+- url: https://github.com/web-platform-tests/wpt/tree/9504a83e01/url
- urlpattern: https://github.com/web-platform-tests/wpt/tree/6ceca69d26/urlpattern
- 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
diff --git a/test/fixtures/wpt/url/IdnaTestV2-removed.window.js b/test/fixtures/wpt/url/IdnaTestV2-removed.window.js
new file mode 100644
index 00000000000000..0f70f84816acd7
--- /dev/null
+++ b/test/fixtures/wpt/url/IdnaTestV2-removed.window.js
@@ -0,0 +1,21 @@
+promise_test(() => fetch("resources/IdnaTestV2-removed.json").then(res => res.json()).then(runTests), "Loading data…");
+
+function runTests(idnaTests) {
+ for (const idnaTest of idnaTests) {
+ if (typeof idnaTest === "string") {
+ continue // skip comments
+ }
+
+ test(() => {
+ if (idnaTest.output === null) {
+ assert_throws_js(TypeError, () => new URL(`https://${idnaTest.input}/x`));
+ } else {
+ const url = new URL(`https://${idnaTest.input}/x`);
+ assert_equals(url.host, idnaTest.output);
+ assert_equals(url.hostname, idnaTest.output);
+ assert_equals(url.pathname, "/x");
+ assert_equals(url.href, `https://${idnaTest.output}/x`);
+ }
+ }, `ToASCII("${idnaTest.input}")${idnaTest.comment ? " " + idnaTest.comment : ""}`);
+ }
+}
diff --git a/test/fixtures/wpt/url/resources/IdnaTestV2-removed.json b/test/fixtures/wpt/url/resources/IdnaTestV2-removed.json
new file mode 100644
index 00000000000000..523dac3bfa1fec
--- /dev/null
+++ b/test/fixtures/wpt/url/resources/IdnaTestV2-removed.json
@@ -0,0 +1,104 @@
+[
+ "This is generated with the help from ../tools/IdnaTestV2-compare.py.",
+ "These tests are from an older IdnaTestV2 and thus the comment line may no longer be accurate.",
+ {
+ "comment": "P1; V6; V3 (ignored)",
+ "input": "-\udb40\ude56\ua867\uff0e\udb40\ude82\ud8dc\udd83\ud83c\udd09",
+ "output": null
+ },
+ {
+ "comment": "P1; V5; V6",
+ "input": "\ud83c\udd04\uff0e\u1cdc\u2488\u00df",
+ "output": null
+ },
+ {
+ "comment": "P1; V5; V6",
+ "input": "\ud83c\udd04\uff0e\u1cdc\u2488SS",
+ "output": null
+ },
+ {
+ "comment": "P1; V5; V6",
+ "input": "\ud83c\udd04\uff0e\u1cdc\u2488ss",
+ "output": null
+ },
+ {
+ "comment": "P1; V5; V6",
+ "input": "\ud83c\udd04\uff0e\u1cdc\u2488Ss",
+ "output": null
+ },
+ {
+ "comment": "C2; P1; V6",
+ "input": "\u0756\u3002\u3164\u200d\u03c2",
+ "output": null
+ },
+ {
+ "comment": "C2; P1; V6",
+ "input": "\u0756\u3002\u1160\u200d\u03c2",
+ "output": null
+ },
+ {
+ "comment": "C2; P1; V6",
+ "input": "\u0756\u3002\u1160\u200d\u03a3",
+ "output": null
+ },
+ {
+ "comment": "C2; P1; V6",
+ "input": "\u0756\u3002\u1160\u200d\u03c3",
+ "output": null
+ },
+ {
+ "comment": "C2; P1; V6",
+ "input": "\u0756\u3002\u3164\u200d\u03a3",
+ "output": null
+ },
+ {
+ "comment": "C2; P1; V6",
+ "input": "\u0756\u3002\u3164\u200d\u03c3",
+ "output": null
+ },
+ {
+ "comment": "P1; V6",
+ "input": "\ud83c\udd07\u4f10\ufe12.\ud831\ude5a\ua8c4",
+ "output": null
+ },
+ {
+ "comment": "P1; V5; V6",
+ "input": "\ud802\ude3f.\ud83c\udd06\u2014",
+ "output": null
+ },
+ {
+ "comment": "C2; P1; V5; V6",
+ "input": "\u1c32\ud83c\udd08\u2f9b\u05a6\uff0e\u200d\uda7e\udd64\u07fd",
+ "output": null
+ },
+ {
+ "comment": "C2; P1; V5; V6",
+ "input": "\ud83e\udc9f\ud83c\udd08\u200d\ua84e\uff61\u0f84",
+ "output": null
+ },
+ {
+ "comment": "P1; V6",
+ "input": "\udaa5\udeaa\uff61\ud83c\udd02",
+ "output": null
+ },
+ {
+ "comment": "C2; P1; V6",
+ "input": "\u186f\u2689\u59f6\ud83c\udd09\uff0e\u06f7\u200d\ud83c\udfaa\u200d",
+ "output": null
+ },
+ {
+ "comment": "C1; P1; V5; V6",
+ "input": "\ua67d\u200c\ud87e\uddf5\ud83c\udd06\uff61\u200c\ud804\udc42\u1b01",
+ "output": null
+ },
+ {
+ "comment": "C1; P1; V5; V6",
+ "input": "\ua67d\u200c\u9723\ud83c\udd06\uff61\u200c\ud804\udc42\u1b01",
+ "output": null
+ },
+ {
+ "comment": "C1; P1; V5; V6; V3 (ignored)",
+ "input": "-\u1897\u200c\ud83c\udd04.\ud805\udf22",
+ "output": null
+ }
+]
diff --git a/test/fixtures/wpt/url/resources/setters_tests.json b/test/fixtures/wpt/url/resources/setters_tests.json
index c47797c4d61c75..e7072cd6afdb30 100644
--- a/test/fixtures/wpt/url/resources/setters_tests.json
+++ b/test/fixtures/wpt/url/resources/setters_tests.json
@@ -1177,6 +1177,24 @@
"host": "test.invalid",
"hostname": "test.invalid"
}
+ },
+ {
+ "href": "https://test.invalid/",
+ "new_value": "test/@aaa",
+ "expected": {
+ "href": "https://test/",
+ "host": "test",
+ "hostname": "test"
+ }
+ },
+ {
+ "href": "https://test.invalid/",
+ "new_value": "test/:aaa",
+ "expected": {
+ "href": "https://test/",
+ "host": "test",
+ "hostname": "test"
+ }
}
],
"hostname": [
@@ -1624,6 +1642,24 @@
"host": "test.invalid",
"hostname": "test.invalid"
}
+ },
+ {
+ "href": "https://test.invalid/",
+ "new_value": "test/@aaa",
+ "expected": {
+ "href": "https://test/",
+ "host": "test",
+ "hostname": "test"
+ }
+ },
+ {
+ "href": "https://test.invalid/",
+ "new_value": "test/:aaa",
+ "expected": {
+ "href": "https://test/",
+ "host": "test",
+ "hostname": "test"
+ }
}
],
"port": [
@@ -2241,12 +2277,12 @@
}
},
{
- "comment": "Drop trailing spaces from trailing opaque paths",
+ "comment": "Trailing spaces and opaque paths",
"href": "data:space ?query",
"new_value": "",
"expected": {
- "href": "data:space",
- "pathname": "space",
+ "href": "data:space%20",
+ "pathname": "space%20",
"search": ""
}
},
@@ -2254,17 +2290,17 @@
"href": "sc:space ?query",
"new_value": "",
"expected": {
- "href": "sc:space",
- "pathname": "space",
+ "href": "sc:space%20",
+ "pathname": "space%20",
"search": ""
}
},
{
- "comment": "Do not drop trailing spaces from non-trailing opaque paths",
+ "comment": "Trailing spaces and opaque paths",
"href": "data:space ?query#fragment",
"new_value": "",
"expected": {
- "href": "data:space #fragment",
+ "href": "data:space %20#fragment",
"search": ""
}
},
@@ -2272,7 +2308,7 @@
"href": "sc:space ?query#fragment",
"new_value": "",
"expected": {
- "href": "sc:space #fragment",
+ "href": "sc:space %20#fragment",
"search": ""
}
},
@@ -2429,12 +2465,12 @@
}
},
{
- "comment": "Drop trailing spaces from trailing opaque paths",
+ "comment": "Trailing spaces and opaque paths",
"href": "data:space #fragment",
"new_value": "",
"expected": {
- "href": "data:space",
- "pathname": "space",
+ "href": "data:space %20",
+ "pathname": "space %20",
"hash": ""
}
},
@@ -2442,17 +2478,17 @@
"href": "sc:space #fragment",
"new_value": "",
"expected": {
- "href": "sc:space",
- "pathname": "space",
+ "href": "sc:space %20",
+ "pathname": "space %20",
"hash": ""
}
},
{
- "comment": "Do not drop trailing spaces from non-trailing opaque paths",
+ "comment": "Trailing spaces and opaque paths",
"href": "data:space ?query#fragment",
"new_value": "",
"expected": {
- "href": "data:space ?query",
+ "href": "data:space %20?query",
"hash": ""
}
},
@@ -2460,7 +2496,7 @@
"href": "sc:space ?query#fragment",
"new_value": "",
"expected": {
- "href": "sc:space ?query",
+ "href": "sc:space %20?query",
"hash": ""
}
},
diff --git a/test/fixtures/wpt/url/resources/toascii.json b/test/fixtures/wpt/url/resources/toascii.json
index 02291962ebce4f..588ef150f9ce6a 100644
--- a/test/fixtures/wpt/url/resources/toascii.json
+++ b/test/fixtures/wpt/url/resources/toascii.json
@@ -1,6 +1,9 @@
[
"This contains assorted IDNA tests that IdnaTestV2 might not cover.",
"Feel free to deduplicate with a clear commit message.",
+ "",
+ "If the test only applies to the URL Standard's 'domain to ASCII', ",
+ "and not to TR46's ToASCII, then tag it with `urlStandardOnly`",
{
"comment": "Label with hyphens in 3rd and 4th position",
"input": "aa--",
@@ -239,11 +242,13 @@
},
{
"input": "www.lookout.net\u2A7480",
- "output": null
+ "output": null,
+ "urlStandardOnly": true
},
{
"input": "www\u00A0.lookout.net",
- "output": null
+ "output": null,
+ "urlStandardOnly": true
},
{
"input": "\u1680lookout.net",
@@ -251,7 +256,8 @@
},
{
"input": "\u001flookout.net",
- "output": null
+ "output": null,
+ "urlStandardOnly": true
},
{
"input": "look\u06DDout.net",
diff --git a/test/fixtures/wpt/url/resources/urltestdata.json b/test/fixtures/wpt/url/resources/urltestdata.json
index 214ed0852aa312..d1a06f6319d1bc 100644
--- a/test/fixtures/wpt/url/resources/urltestdata.json
+++ b/test/fixtures/wpt/url/resources/urltestdata.json
@@ -3778,6 +3778,126 @@
"search": "",
"hash": ""
},
+ {
+ "input": "non-special:opaque ",
+ "base": null,
+ "href": "non-special:opaque",
+ "origin": "null",
+ "protocol": "non-special:",
+ "username": "",
+ "password": "",
+ "host": "",
+ "hostname": "",
+ "port": "",
+ "pathname": "opaque",
+ "search": "",
+ "hash": ""
+ },
+ {
+ "input": "non-special:opaque ?hi",
+ "base": null,
+ "href": "non-special:opaque %20?hi",
+ "origin": "null",
+ "protocol": "non-special:",
+ "username": "",
+ "password": "",
+ "host": "",
+ "hostname": "",
+ "port": "",
+ "pathname": "opaque %20",
+ "search": "?hi",
+ "hash": ""
+ },
+ {
+ "input": "non-special:opaque #hi",
+ "base": null,
+ "href": "non-special:opaque %20#hi",
+ "origin": "null",
+ "protocol": "non-special:",
+ "username": "",
+ "password": "",
+ "host": "",
+ "hostname": "",
+ "port": "",
+ "pathname": "opaque %20",
+ "search": "",
+ "hash": "#hi"
+ },
+ {
+ "input": "non-special:opaque x?hi",
+ "base": null,
+ "href": "non-special:opaque x?hi",
+ "origin": "null",
+ "protocol": "non-special:",
+ "username": "",
+ "password": "",
+ "host": "",
+ "hostname": "",
+ "port": "",
+ "pathname": "opaque x",
+ "search": "?hi",
+ "hash": ""
+ },
+ {
+ "input": "non-special:opaque x#hi",
+ "base": null,
+ "href": "non-special:opaque x#hi",
+ "origin": "null",
+ "protocol": "non-special:",
+ "username": "",
+ "password": "",
+ "host": "",
+ "hostname": "",
+ "port": "",
+ "pathname": "opaque x",
+ "search": "",
+ "hash": "#hi"
+ },
+ {
+ "input": "non-special:opaque \t\t \t#hi",
+ "base": null,
+ "href": "non-special:opaque %20#hi",
+ "origin": "null",
+ "protocol": "non-special:",
+ "username": "",
+ "password": "",
+ "host": "",
+ "hostname": "",
+ "port": "",
+ "pathname": "opaque %20",
+ "search": "",
+ "hash": "#hi"
+ },
+ {
+ "input": "non-special:opaque \t\t #hi",
+ "base": null,
+ "href": "non-special:opaque %20#hi",
+ "origin": "null",
+ "protocol": "non-special:",
+ "username": "",
+ "password": "",
+ "host": "",
+ "hostname": "",
+ "port": "",
+ "pathname": "opaque %20",
+ "search": "",
+ "hash": "#hi"
+ },
+ {
+ "input": "non-special:opaque\t\t \r #hi",
+ "base": null,
+ "href": "non-special:opaque %20#hi",
+ "origin": "null",
+ "protocol": "non-special:",
+ "username": "",
+ "password": "",
+ "host": "",
+ "hostname": "",
+ "port": "",
+ "pathname": "opaque %20",
+ "search": "",
+ "hash": "#hi"
+ },
"Ideographic full stop (full-width period for Chinese, etc.) should be treated as a dot. U+3002 is mapped to U+002E (dot)",
{
"input": "http://www.foo。bar.com",
diff --git a/test/fixtures/wpt/url/url-setters-a-area.window.js b/test/fixtures/wpt/url/url-setters-a-area.window.js
index 6a5e762cd42fe8..0012595cc469ee 100644
--- a/test/fixtures/wpt/url/url-setters-a-area.window.js
+++ b/test/fixtures/wpt/url/url-setters-a-area.window.js
@@ -8,36 +8,37 @@
promise_test(() => fetch("resources/setters_tests.json").then(res => res.json()).then(runURLSettersTests), "Loading data…");
-function runURLSettersTests(all_test_cases) {
- for (var attribute_to_be_set in all_test_cases) {
- if (attribute_to_be_set == "comment") {
+function runURLSettersTests(allTestCases) {
+ for (const [propertyToBeSet, testCases] of Object.entries(allTestCases)) {
+ if (propertyToBeSet === "comment") {
continue;
}
- var test_cases = all_test_cases[attribute_to_be_set];
- for(var i = 0, l = test_cases.length; i < l; i++) {
- var test_case = test_cases[i];
- var name = "Setting <" + test_case.href + ">." + attribute_to_be_set +
- " = '" + test_case.new_value + "'";
- if ("comment" in test_case) {
- name += " " + test_case.comment;
- }
- const key = test_case.href.split(":")[0];
- subsetTestByKey(key, test, function() {
- var url = document.createElement("a");
- url.href = test_case.href;
- url[attribute_to_be_set] = test_case.new_value;
- for (var attribute in test_case.expected) {
- assert_equals(url[attribute], test_case.expected[attribute])
+
+ for (const testCase of testCases) {
+ const name = `Setting <${testCase.href}>.${propertyToBeSet} = '${testCase.new_value}'${
+ testCase.comment ? ` ${testCase.comment}` : ''
+ }`;
+
+ const key = testCase.href.split(":")[0];
+ subsetTestByKey(key, test, () => {
+ const url = document.createElement("a");
+ url.href = testCase.href;
+ url[propertyToBeSet] = testCase.new_value;
+
+ for (const [property, expectedValue] of Object.entries(testCase.expected)) {
+ assert_equals(url[property], expectedValue);
}
- }, ": " + name)
- subsetTestByKey(key, test, function() {
- var url = document.createElement("area");
- url.href = test_case.href;
- url[attribute_to_be_set] = test_case.new_value;
- for (var attribute in test_case.expected) {
- assert_equals(url[attribute], test_case.expected[attribute])
+ }, `: ${name}`);
+
+ subsetTestByKey(key, test, () => {
+ const url = document.createElement("area");
+ url.href = testCase.href;
+ url[propertyToBeSet] = testCase.new_value;
+
+ for (const [property, expectedValue] of Object.entries(testCase.expected)) {
+ assert_equals(url[property], expectedValue);
}
- }, ": " + name)
+ }, `: ${name}`);
}
}
}
diff --git a/test/fixtures/wpt/url/url-setters.any.js b/test/fixtures/wpt/url/url-setters.any.js
index fe88175ac63446..66b3d9b4f9d047 100644
--- a/test/fixtures/wpt/url/url-setters.any.js
+++ b/test/fixtures/wpt/url/url-setters.any.js
@@ -8,27 +8,26 @@
promise_test(() => fetch("resources/setters_tests.json").then(res => res.json()).then(runURLSettersTests), "Loading data…");
-function runURLSettersTests(all_test_cases) {
- for (var attribute_to_be_set in all_test_cases) {
- if (attribute_to_be_set == "comment") {
+function runURLSettersTests(allTestCases) {
+ for (const [propertyToBeSet, testCases] of Object.entries(allTestCases)) {
+ if (propertyToBeSet === "comment") {
continue;
}
- var test_cases = all_test_cases[attribute_to_be_set];
- for(var i = 0, l = test_cases.length; i < l; i++) {
- var test_case = test_cases[i];
- var name = "Setting <" + test_case.href + ">." + attribute_to_be_set +
- " = '" + test_case.new_value + "'";
- if ("comment" in test_case) {
- name += " " + test_case.comment;
- }
+
+ for (const test_case of testCases) {
+ const name = `Setting <${test_case.href}>.${propertyToBeSet} = '${test_case.new_value}'${
+ test_case.comment ? ` ${test_case.comment}` : ''
+ }`;
+
const key = test_case.href.split(":")[0];
- subsetTestByKey(key, test, function() {
- var url = new URL(test_case.href);
- url[attribute_to_be_set] = test_case.new_value;
- for (var attribute in test_case.expected) {
- assert_equals(url[attribute], test_case.expected[attribute])
+ subsetTestByKey(key, test, () => {
+ const url = new URL(test_case.href);
+ url[propertyToBeSet] = test_case.new_value;
+
+ for (const [property, expectedValue] of Object.entries(test_case.expected)) {
+ assert_equals(url[property], expectedValue);
}
- }, "URL: " + name)
+ }, `URL: ${name}`);
}
}
}
diff --git a/test/fixtures/wpt/url/url-statics-canparse.any.js b/test/fixtures/wpt/url/url-statics-canparse.any.js
index 74f3da31f0d175..9b352029d8569b 100644
--- a/test/fixtures/wpt/url/url-statics-canparse.any.js
+++ b/test/fixtures/wpt/url/url-statics-canparse.any.js
@@ -15,6 +15,11 @@
"base": "aaa:b",
"expected": false
},
+ {
+ "url": undefined,
+ "base": "https://test:test/",
+ "expected": false
+ },
{
"url": "aaa:/b",
"base": undefined,
diff --git a/test/fixtures/wpt/url/urlsearchparams-delete.any.js b/test/fixtures/wpt/url/urlsearchparams-delete.any.js
index c597142c51d5bf..09a5dccb648733 100644
--- a/test/fixtures/wpt/url/urlsearchparams-delete.any.js
+++ b/test/fixtures/wpt/url/urlsearchparams-delete.any.js
@@ -50,17 +50,17 @@ test(() => {
url.searchParams.delete('test');
assert_false(url.searchParams.has('test'));
assert_equals(url.search, '');
- assert_equals(url.pathname, 'space');
- assert_equals(url.href, 'data:space');
-}, 'Changing the query of a URL with an opaque path can impact the path');
+ assert_equals(url.pathname, 'space %20');
+ assert_equals(url.href, 'data:space %20');
+}, 'Changing the query of a URL with an opaque path with trailing spaces');
test(() => {
const url = new URL('data:space ?test#test');
url.searchParams.delete('test');
assert_equals(url.search, '');
- assert_equals(url.pathname, 'space ');
- assert_equals(url.href, 'data:space #test');
-}, 'Changing the query of a URL with an opaque path can impact the path if the URL has no fragment');
+ assert_equals(url.pathname, 'space %20');
+ assert_equals(url.href, 'data:space %20#test');
+}, 'Changing the query of a URL with an opaque path with trailing spaces and a fragment');
test(() => {
const params = new URLSearchParams();
diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json
index 5eeb76397f83ba..d001b577f5f336 100644
--- a/test/fixtures/wpt/versions.json
+++ b/test/fixtures/wpt/versions.json
@@ -72,7 +72,7 @@
"path": "streams"
},
"url": {
- "commit": "d86fcc9e8764155485975a2a9bbfc5ec4aa9e75b",
+ "commit": "9504a83e014b6b26d6c09eaee89c6b83cb7410c2",
"path": "url"
},
"urlpattern": {