Skip to content

Commit 3f91606

Browse files
committed
url: update wpt tests to pull in tests for URL idempotency (see #601)
1 parent 0587063 commit 3f91606

File tree

2 files changed

+312
-6
lines changed

2 files changed

+312
-6
lines changed

url/tests/setters_tests.json

+80-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"comment": [
3-
"AS OF https://github.com/jsdom/whatwg-url/commit/35f04dfd3048cf6362f4398745bb13375c5020c2",
43
"## Tests for setters of https://url.spec.whatwg.org/#urlutils-members",
4+
"AS OF https://github.com/web-platform-tests/wpt/commit/551c9d604fb8b97d3f8c65793bb047d15baddbc2",
55
"",
66
"This file contains a JSON object.",
77
"Other than 'comment', each key is an attribute of the `URL` interface",
@@ -120,11 +120,11 @@
120120
}
121121
},
122122
{
123-
"href": "gopher://example.net:1234",
123+
"href": "https://example.net:1234",
124124
"new_value": "file",
125125
"expected": {
126-
"href": "gopher://example.net:1234",
127-
"protocol": "gopher:"
126+
"href": "https://example.net:1234/",
127+
"protocol": "https:"
128128
}
129129
},
130130
{
@@ -146,7 +146,7 @@
146146
},
147147
{
148148
"href": "file:///test",
149-
"new_value": "gopher",
149+
"new_value": "https",
150150
"expected": {
151151
"href": "file:///test",
152152
"protocol": "file:"
@@ -962,6 +962,16 @@
962962
"port": ""
963963
}
964964
},
965+
{
966+
"href": "file://hi/x",
967+
"new_value": "",
968+
"expected": {
969+
"href": "file:///x",
970+
"host": "",
971+
"hostname": "",
972+
"port": ""
973+
}
974+
},
965975
{
966976
"href": "sc://test@test/",
967977
"new_value": "",
@@ -1286,6 +1296,16 @@
12861296
"port": ""
12871297
}
12881298
},
1299+
{
1300+
"href": "file://hi/x",
1301+
"new_value": "",
1302+
"expected": {
1303+
"href": "file:///x",
1304+
"host": "",
1305+
"hostname": "",
1306+
"port": ""
1307+
}
1308+
},
12891309
{
12901310
"href": "sc://test@test/",
12911311
"new_value": "",
@@ -1305,6 +1325,27 @@
13051325
"hostname": "test",
13061326
"port": "12"
13071327
}
1328+
},
1329+
{
1330+
"comment": "Drop /. from path",
1331+
"href": "non-spec:/.//p",
1332+
"new_value": "h",
1333+
"expected": {
1334+
"href": "non-spec://h//p",
1335+
"host": "h",
1336+
"hostname": "h",
1337+
"pathname": "//p"
1338+
}
1339+
},
1340+
{
1341+
"href": "non-spec:/.//p",
1342+
"new_value": "",
1343+
"expected": {
1344+
"href": "non-spec:////p",
1345+
"host": "",
1346+
"hostname": "",
1347+
"pathname": "//p"
1348+
}
13081349
}
13091350
],
13101351
"port": [
@@ -1653,6 +1694,40 @@
16531694
"href": "file:///",
16541695
"pathname": "/"
16551696
}
1697+
},
1698+
{
1699+
"comment": "Serialize /. in path",
1700+
"href": "non-spec:/",
1701+
"new_value": "/.//p",
1702+
"expected": {
1703+
"href": "non-spec:/.//p",
1704+
"pathname": "//p"
1705+
}
1706+
},
1707+
{
1708+
"href": "non-spec:/",
1709+
"new_value": "/..//p",
1710+
"expected": {
1711+
"href": "non-spec:/.//p",
1712+
"pathname": "//p"
1713+
}
1714+
},
1715+
{
1716+
"href": "non-spec:/",
1717+
"new_value": "//p",
1718+
"expected": {
1719+
"href": "non-spec:/.//p",
1720+
"pathname": "//p"
1721+
}
1722+
},
1723+
{
1724+
"comment": "Drop /. from path",
1725+
"href": "non-spec:/.//",
1726+
"new_value": "p",
1727+
"expected": {
1728+
"href": "non-spec:/p",
1729+
"pathname": "/p"
1730+
}
16561731
}
16571732
],
16581733
"search": [

url/tests/urltestdata.json

+232-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[
2+
23
"# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/segments.js",
3-
"# AS OF https://github.com/jsdom/whatwg-url/commit/35f04dfd3048cf6362f4398745bb13375c5020c2",
4+
"# AS OF https://github.com/web-platform-tests/wpt/commit/551c9d604fb8b97d3f8c65793bb047d15baddbc2",
45
{
56
"input": "http://example\t.\norg",
67
"base": "http://example.org/foo/bar",
@@ -6446,6 +6447,190 @@
64466447
"search": "",
64476448
"hash": ""
64486449
},
6450+
"Serialize /. in path",
6451+
{
6452+
"input": "non-spec:/.//",
6453+
"base": "about:blank",
6454+
"href": "non-spec:/.//",
6455+
"protocol": "non-spec:",
6456+
"username": "",
6457+
"password": "",
6458+
"host": "",
6459+
"hostname": "",
6460+
"port": "",
6461+
"pathname": "//",
6462+
"search": "",
6463+
"hash": ""
6464+
},
6465+
{
6466+
"input": "non-spec:/..//",
6467+
"base": "about:blank",
6468+
"href": "non-spec:/.//",
6469+
"protocol": "non-spec:",
6470+
"username": "",
6471+
"password": "",
6472+
"host": "",
6473+
"hostname": "",
6474+
"port": "",
6475+
"pathname": "//",
6476+
"search": "",
6477+
"hash": ""
6478+
},
6479+
{
6480+
"input": "non-spec:/a/..//",
6481+
"base": "about:blank",
6482+
"href": "non-spec:/.//",
6483+
"protocol": "non-spec:",
6484+
"username": "",
6485+
"password": "",
6486+
"host": "",
6487+
"hostname": "",
6488+
"port": "",
6489+
"pathname": "//",
6490+
"search": "",
6491+
"hash": ""
6492+
},
6493+
{
6494+
"input": "non-spec:/.//path",
6495+
"base": "about:blank",
6496+
"href": "non-spec:/.//path",
6497+
"protocol": "non-spec:",
6498+
"username": "",
6499+
"password": "",
6500+
"host": "",
6501+
"hostname": "",
6502+
"port": "",
6503+
"pathname": "//path",
6504+
"search": "",
6505+
"hash": ""
6506+
},
6507+
{
6508+
"input": "non-spec:/..//path",
6509+
"base": "about:blank",
6510+
"href": "non-spec:/.//path",
6511+
"protocol": "non-spec:",
6512+
"username": "",
6513+
"password": "",
6514+
"host": "",
6515+
"hostname": "",
6516+
"port": "",
6517+
"pathname": "//path",
6518+
"search": "",
6519+
"hash": ""
6520+
},
6521+
{
6522+
"input": "non-spec:/a/..//path",
6523+
"base": "about:blank",
6524+
"href": "non-spec:/.//path",
6525+
"protocol": "non-spec:",
6526+
"username": "",
6527+
"password": "",
6528+
"host": "",
6529+
"hostname": "",
6530+
"port": "",
6531+
"pathname": "//path",
6532+
"search": "",
6533+
"hash": ""
6534+
},
6535+
{
6536+
"input": "/.//path",
6537+
"base": "non-spec:/p",
6538+
"href": "non-spec:/.//path",
6539+
"protocol": "non-spec:",
6540+
"username": "",
6541+
"password": "",
6542+
"host": "",
6543+
"hostname": "",
6544+
"port": "",
6545+
"pathname": "//path",
6546+
"search": "",
6547+
"hash": ""
6548+
},
6549+
{
6550+
"input": "/..//path",
6551+
"base": "non-spec:/p",
6552+
"href": "non-spec:/.//path",
6553+
"protocol": "non-spec:",
6554+
"username": "",
6555+
"password": "",
6556+
"host": "",
6557+
"hostname": "",
6558+
"port": "",
6559+
"pathname": "//path",
6560+
"search": "",
6561+
"hash": ""
6562+
},
6563+
{
6564+
"input": "..//path",
6565+
"base": "non-spec:/p",
6566+
"href": "non-spec:/.//path",
6567+
"protocol": "non-spec:",
6568+
"username": "",
6569+
"password": "",
6570+
"host": "",
6571+
"hostname": "",
6572+
"port": "",
6573+
"pathname": "//path",
6574+
"search": "",
6575+
"hash": ""
6576+
},
6577+
{
6578+
"input": "a/..//path",
6579+
"base": "non-spec:/p",
6580+
"href": "non-spec:/.//path",
6581+
"protocol": "non-spec:",
6582+
"username": "",
6583+
"password": "",
6584+
"host": "",
6585+
"hostname": "",
6586+
"port": "",
6587+
"pathname": "//path",
6588+
"search": "",
6589+
"hash": ""
6590+
},
6591+
{
6592+
"input": "",
6593+
"base": "non-spec:/..//p",
6594+
"href": "non-spec:/.//p",
6595+
"protocol": "non-spec:",
6596+
"username": "",
6597+
"password": "",
6598+
"host": "",
6599+
"hostname": "",
6600+
"port": "",
6601+
"pathname": "//p",
6602+
"search": "",
6603+
"hash": ""
6604+
},
6605+
{
6606+
"input": "path",
6607+
"base": "non-spec:/..//p",
6608+
"href": "non-spec:/.//path",
6609+
"protocol": "non-spec:",
6610+
"username": "",
6611+
"password": "",
6612+
"host": "",
6613+
"hostname": "",
6614+
"port": "",
6615+
"pathname": "//path",
6616+
"search": "",
6617+
"hash": ""
6618+
},
6619+
"Do not serialize /. in path",
6620+
{
6621+
"input": "../path",
6622+
"base": "non-spec:/.//p",
6623+
"href": "non-spec:/path",
6624+
"protocol": "non-spec:",
6625+
"username": "",
6626+
"password": "",
6627+
"host": "",
6628+
"hostname": "",
6629+
"port": "",
6630+
"pathname": "/path",
6631+
"search": "",
6632+
"hash": ""
6633+
},
64496634
"# percent encoded hosts in non-special-URLs",
64506635
{
64516636
"input": "non-special://%E2%80%A0/",
@@ -6987,5 +7172,51 @@
69877172
"pathname": "/",
69887173
"search": "",
69897174
"hash": "#link"
7175+
},
7176+
"UTF-8 percent-encode of C0 control percent-encode set and supersets",
7177+
{
7178+
"input": "non-special:cannot-be-a-base-url-\u0000\u0001\u001F\u001E\u007E\u007F\u0080",
7179+
"base": "about:blank",
7180+
"hash": "",
7181+
"host": "",
7182+
"hostname": "",
7183+
"href": "non-special:cannot-be-a-base-url-%00%01%1F%1E~%7F%C2%80",
7184+
"origin": "null",
7185+
"password": "",
7186+
"pathname": "cannot-be-a-base-url-%00%01%1F%1E~%7F%C2%80",
7187+
"port": "",
7188+
"protocol": "non-special:",
7189+
"search": "",
7190+
"username": ""
7191+
},
7192+
{
7193+
"input": "https://www.example.com/path{\u007Fpath.html?query'\u007F=query#fragment<\u007Ffragment",
7194+
"base": "about:blank",
7195+
"hash": "#fragment%3C%7Ffragment",
7196+
"host": "www.example.com",
7197+
"hostname": "www.example.com",
7198+
"href": "https://www.example.com/path%7B%7Fpath.html?query%27%7F=query#fragment%3C%7Ffragment",
7199+
"origin": "https://www.example.com",
7200+
"password": "",
7201+
"pathname": "/path%7B%7Fpath.html",
7202+
"port": "",
7203+
"protocol": "https:",
7204+
"search": "?query%27%7F=query",
7205+
"username": ""
7206+
},
7207+
{
7208+
"input": "https://user:pass[\u007F@foo/bar",
7209+
"base": "http://example.org",
7210+
"hash": "",
7211+
"host": "foo",
7212+
"hostname": "foo",
7213+
"href": "https://user:pass%5B%7F@foo/bar",
7214+
"origin": "https://foo",
7215+
"password": "pass%5B%7F",
7216+
"pathname": "/bar",
7217+
"port": "",
7218+
"protocol": "https:",
7219+
"search": "",
7220+
"username": "user"
69907221
}
69917222
]

0 commit comments

Comments
 (0)