Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b3b7dbc

Browse filesBrowse files
meixgdanielleadams
authored andcommitted
test: update web-platform tests for url
PR-URL: #46860 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com>
1 parent 50789a5 commit b3b7dbc
Copy full SHA for b3b7dbc

File tree

Expand file treeCollapse file tree

6 files changed

+121
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

6 files changed

+121
-6
lines changed
Open diff view settings
Collapse file

‎test/fixtures/wpt/README.md‎

Copy file name to clipboardExpand all lines: test/fixtures/wpt/README.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Last update:
2727
- performance-timeline: https://github.com/web-platform-tests/wpt/tree/17ebc3aea0/performance-timeline
2828
- resources: https://github.com/web-platform-tests/wpt/tree/fbf1e7d247/resources
2929
- streams: https://github.com/web-platform-tests/wpt/tree/9e5ef42bd3/streams
30-
- url: https://github.com/web-platform-tests/wpt/tree/f1ade799d0/url
30+
- url: https://github.com/web-platform-tests/wpt/tree/1eaeb0e178/url
3131
- user-timing: https://github.com/web-platform-tests/wpt/tree/df24fb604e/user-timing
3232
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/d8dbe6990b/wasm/jsapi
3333
- wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi
Collapse file

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

Copy file name to clipboardExpand all lines: test/fixtures/wpt/url/failure.html
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
<script src=/resources/testharness.js></script>
66
<script src=/resources/testharnessreport.js></script>
77
<div id=log></div>
8-
<iframe></iframe>
98
<script>
109
promise_test(() => fetch("resources/urltestdata.json").then(res => res.json()).then(runTests), "Loading data…")
1110

@@ -41,9 +40,11 @@
4140
assert_throws_js(TypeError, () => self.navigator.sendBeacon(test.input))
4241
}, "sendBeacon(): " + name)
4342

44-
self.test(() => {
45-
assert_throws_js(self[0].TypeError, () => self[0].location = test.input)
46-
}, "Location's href: " + name)
43+
self.test(t => {
44+
const frame = document.body.appendChild(document.createElement("iframe"));
45+
t.add_cleanup(() => frame.remove());
46+
assert_throws_dom("SyntaxError", frame.contentWindow.DOMException, () => frame.contentWindow.location = test.input);
47+
}, "Location's href: " + name);
4748

4849
self.test(() => {
4950
assert_throws_dom("SyntaxError", () => self.open(test.input).close())
Collapse file

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

Copy file name to clipboardExpand all lines: test/fixtures/wpt/url/resources/setters_tests.json
+45Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,6 +1592,17 @@
15921592
"port": "8080"
15931593
}
15941594
},
1595+
{
1596+
"comment": "Setting port to a string that doesn't parse as a number",
1597+
"href": "http://example.net:8080/path",
1598+
"new_value": "randomstring",
1599+
"expected": {
1600+
"href": "http://example.net:8080/path",
1601+
"host": "example.net:8080",
1602+
"hostname": "example.net",
1603+
"port": "8080"
1604+
}
1605+
},
15951606
{
15961607
"comment": "Port numbers are 16 bit integers, overflowing is an error",
15971608
"href": "non-special://example.net:8080/path",
@@ -1650,6 +1661,30 @@
16501661
"href": "javascript://x:12/",
16511662
"port": "12"
16521663
}
1664+
},
1665+
{
1666+
"comment": "Leading u0009 on special scheme",
1667+
"href": "https://domain.com:443",
1668+
"new_value": "\u00098080",
1669+
"expected": {
1670+
"port": "8080"
1671+
}
1672+
},
1673+
{
1674+
"comment": "Leading u0009 on non-special scheme",
1675+
"href": "wpt++://domain.com:443",
1676+
"new_value": "\u00098080",
1677+
"expected": {
1678+
"port": "8080"
1679+
}
1680+
},
1681+
{
1682+
"comment": "Should use all ascii prefixed characters as port",
1683+
"href": "https://www.google.com:4343",
1684+
"new_value": "4wpt",
1685+
"expected": {
1686+
"port": "4"
1687+
}
16531688
}
16541689
],
16551690
"pathname": [
@@ -2205,5 +2240,15 @@
22052240
"hash": ""
22062241
}
22072242
}
2243+
],
2244+
"href": [
2245+
{
2246+
"href": "file:///var/log/system.log",
2247+
"new_value": "http://0300.168.0xF0",
2248+
"expected": {
2249+
"href": "http://192.168.0.240/",
2250+
"protocol": "http:"
2251+
}
2252+
}
22082253
]
22092254
}
Collapse file

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

Copy file name to clipboardExpand all lines: test/fixtures/wpt/url/resources/urltestdata.json
+35Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,11 @@
964964
"search": "",
965965
"hash": ""
966966
},
967+
{
968+
"input": "http://[::127.0.0.1.]",
969+
"base": "http://example.org/foo/bar",
970+
"failure": true
971+
},
967972
{
968973
"input": "http://[0:0:0:0:0:0:13.1.68.3]",
969974
"base": "http://example.org/foo/bar",
@@ -3959,11 +3964,21 @@
39593964
"base": "http://other.com/",
39603965
"failure": true
39613966
},
3967+
{
3968+
"input": "http://[::.1.2]",
3969+
"base": "http://other.com/",
3970+
"failure": true
3971+
},
39623972
{
39633973
"input": "http://[::1.]",
39643974
"base": "http://other.com/",
39653975
"failure": true
39663976
},
3977+
{
3978+
"input": "http://[::.1]",
3979+
"base": "http://other.com/",
3980+
"failure": true
3981+
},
39673982
{
39683983
"input": "http://[::%31]",
39693984
"base": "http://other.com/",
@@ -8857,5 +8872,25 @@
88578872
"protocol": "non-special:",
88588873
"search": "",
88598874
"username": ""
8875+
},
8876+
{
8877+
"input": "",
8878+
"base": "about:blank",
8879+
"failure": true
8880+
},
8881+
{
8882+
"input": "https://example.com/\"quoted\"",
8883+
"base": "about:blank",
8884+
"hash": "",
8885+
"host": "example.com",
8886+
"hostname": "example.com",
8887+
"href": "https://example.com/%22quoted%22",
8888+
"origin": "https://example.com",
8889+
"password": "",
8890+
"pathname": "/%22quoted%22",
8891+
"port": "",
8892+
"protocol": "https:",
8893+
"search": "",
8894+
"username": ""
88608895
}
88618896
]
Collapse file
+34Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
test(() => {
2+
const params = new URLSearchParams("a=1&b=2&a=3");
3+
assert_equals(params.size, 3);
4+
5+
params.delete("a");
6+
assert_equals(params.size, 1);
7+
}, "URLSearchParams's size and deletion");
8+
9+
test(() => {
10+
const params = new URLSearchParams("a=1&b=2&a=3");
11+
assert_equals(params.size, 3);
12+
13+
params.append("b", "4");
14+
assert_equals(params.size, 4);
15+
}, "URLSearchParams's size and addition");
16+
17+
test(() => {
18+
const url = new URL("http://localhost/query?a=1&b=2&a=3");
19+
assert_equals(url.searchParams.size, 3);
20+
21+
url.searchParams.delete("a");
22+
assert_equals(url.searchParams.size, 1);
23+
24+
url.searchParams.append("b", 4);
25+
assert_equals(url.searchParams.size, 2);
26+
}, "URLSearchParams's size when obtained from a URL");
27+
28+
test(() => {
29+
const url = new URL("http://localhost/query?a=1&b=2&a=3");
30+
assert_equals(url.searchParams.size, 3);
31+
32+
url.search = "?";
33+
assert_equals(url.searchParams.size, 0);
34+
}, "URLSearchParams's size when obtained from a URL and using .search");
Collapse file

‎test/fixtures/wpt/versions.json‎

Copy file name to clipboardExpand all lines: test/fixtures/wpt/versions.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"path": "streams"
6969
},
7070
"url": {
71-
"commit": "f1ade799d04b72b0ff75c13e988744c2cd873741",
71+
"commit": "1eaeb0e178b14078bd730ffecd62cb7569315523",
7272
"path": "url"
7373
},
7474
"user-timing": {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.