Skip to content

Commit 551c9d6

Browse files
rmisevannevk
authored andcommitted
Test non-special URLs are idempotent
See whatwg/url#415 and whatwg/url#505 for context.
1 parent aa022e7 commit 551c9d6

File tree

2 files changed

+239
-0
lines changed

2 files changed

+239
-0
lines changed

url/resources/setters_tests.json

+55
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,27 @@
13241324
"hostname": "test",
13251325
"port": "12"
13261326
}
1327+
},
1328+
{
1329+
"comment": "Drop /. from path",
1330+
"href": "non-spec:/.//p",
1331+
"new_value": "h",
1332+
"expected": {
1333+
"href": "non-spec://h//p",
1334+
"host": "h",
1335+
"hostname": "h",
1336+
"pathname": "//p"
1337+
}
1338+
},
1339+
{
1340+
"href": "non-spec:/.//p",
1341+
"new_value": "",
1342+
"expected": {
1343+
"href": "non-spec:////p",
1344+
"host": "",
1345+
"hostname": "",
1346+
"pathname": "//p"
1347+
}
13271348
}
13281349
],
13291350
"port": [
@@ -1672,6 +1693,40 @@
16721693
"href": "file:///",
16731694
"pathname": "/"
16741695
}
1696+
},
1697+
{
1698+
"comment": "Serialize /. in path",
1699+
"href": "non-spec:/",
1700+
"new_value": "/.//p",
1701+
"expected": {
1702+
"href": "non-spec:/.//p",
1703+
"pathname": "//p"
1704+
}
1705+
},
1706+
{
1707+
"href": "non-spec:/",
1708+
"new_value": "/..//p",
1709+
"expected": {
1710+
"href": "non-spec:/.//p",
1711+
"pathname": "//p"
1712+
}
1713+
},
1714+
{
1715+
"href": "non-spec:/",
1716+
"new_value": "//p",
1717+
"expected": {
1718+
"href": "non-spec:/.//p",
1719+
"pathname": "//p"
1720+
}
1721+
},
1722+
{
1723+
"comment": "Drop /. from path",
1724+
"href": "non-spec:/.//",
1725+
"new_value": "p",
1726+
"expected": {
1727+
"href": "non-spec:/p",
1728+
"pathname": "/p"
1729+
}
16751730
}
16761731
],
16771732
"search": [

url/resources/urltestdata.json

+184
Original file line numberDiff line numberDiff line change
@@ -6445,6 +6445,190 @@
64456445
"search": "",
64466446
"hash": ""
64476447
},
6448+
"Serialize /. in path",
6449+
{
6450+
"input": "non-spec:/.//",
6451+
"base": "about:blank",
6452+
"href": "non-spec:/.//",
6453+
"protocol": "non-spec:",
6454+
"username": "",
6455+
"password": "",
6456+
"host": "",
6457+
"hostname": "",
6458+
"port": "",
6459+
"pathname": "//",
6460+
"search": "",
6461+
"hash": ""
6462+
},
6463+
{
6464+
"input": "non-spec:/..//",
6465+
"base": "about:blank",
6466+
"href": "non-spec:/.//",
6467+
"protocol": "non-spec:",
6468+
"username": "",
6469+
"password": "",
6470+
"host": "",
6471+
"hostname": "",
6472+
"port": "",
6473+
"pathname": "//",
6474+
"search": "",
6475+
"hash": ""
6476+
},
6477+
{
6478+
"input": "non-spec:/a/..//",
6479+
"base": "about:blank",
6480+
"href": "non-spec:/.//",
6481+
"protocol": "non-spec:",
6482+
"username": "",
6483+
"password": "",
6484+
"host": "",
6485+
"hostname": "",
6486+
"port": "",
6487+
"pathname": "//",
6488+
"search": "",
6489+
"hash": ""
6490+
},
6491+
{
6492+
"input": "non-spec:/.//path",
6493+
"base": "about:blank",
6494+
"href": "non-spec:/.//path",
6495+
"protocol": "non-spec:",
6496+
"username": "",
6497+
"password": "",
6498+
"host": "",
6499+
"hostname": "",
6500+
"port": "",
6501+
"pathname": "//path",
6502+
"search": "",
6503+
"hash": ""
6504+
},
6505+
{
6506+
"input": "non-spec:/..//path",
6507+
"base": "about:blank",
6508+
"href": "non-spec:/.//path",
6509+
"protocol": "non-spec:",
6510+
"username": "",
6511+
"password": "",
6512+
"host": "",
6513+
"hostname": "",
6514+
"port": "",
6515+
"pathname": "//path",
6516+
"search": "",
6517+
"hash": ""
6518+
},
6519+
{
6520+
"input": "non-spec:/a/..//path",
6521+
"base": "about:blank",
6522+
"href": "non-spec:/.//path",
6523+
"protocol": "non-spec:",
6524+
"username": "",
6525+
"password": "",
6526+
"host": "",
6527+
"hostname": "",
6528+
"port": "",
6529+
"pathname": "//path",
6530+
"search": "",
6531+
"hash": ""
6532+
},
6533+
{
6534+
"input": "/.//path",
6535+
"base": "non-spec:/p",
6536+
"href": "non-spec:/.//path",
6537+
"protocol": "non-spec:",
6538+
"username": "",
6539+
"password": "",
6540+
"host": "",
6541+
"hostname": "",
6542+
"port": "",
6543+
"pathname": "//path",
6544+
"search": "",
6545+
"hash": ""
6546+
},
6547+
{
6548+
"input": "/..//path",
6549+
"base": "non-spec:/p",
6550+
"href": "non-spec:/.//path",
6551+
"protocol": "non-spec:",
6552+
"username": "",
6553+
"password": "",
6554+
"host": "",
6555+
"hostname": "",
6556+
"port": "",
6557+
"pathname": "//path",
6558+
"search": "",
6559+
"hash": ""
6560+
},
6561+
{
6562+
"input": "..//path",
6563+
"base": "non-spec:/p",
6564+
"href": "non-spec:/.//path",
6565+
"protocol": "non-spec:",
6566+
"username": "",
6567+
"password": "",
6568+
"host": "",
6569+
"hostname": "",
6570+
"port": "",
6571+
"pathname": "//path",
6572+
"search": "",
6573+
"hash": ""
6574+
},
6575+
{
6576+
"input": "a/..//path",
6577+
"base": "non-spec:/p",
6578+
"href": "non-spec:/.//path",
6579+
"protocol": "non-spec:",
6580+
"username": "",
6581+
"password": "",
6582+
"host": "",
6583+
"hostname": "",
6584+
"port": "",
6585+
"pathname": "//path",
6586+
"search": "",
6587+
"hash": ""
6588+
},
6589+
{
6590+
"input": "",
6591+
"base": "non-spec:/..//p",
6592+
"href": "non-spec:/.//p",
6593+
"protocol": "non-spec:",
6594+
"username": "",
6595+
"password": "",
6596+
"host": "",
6597+
"hostname": "",
6598+
"port": "",
6599+
"pathname": "//p",
6600+
"search": "",
6601+
"hash": ""
6602+
},
6603+
{
6604+
"input": "path",
6605+
"base": "non-spec:/..//p",
6606+
"href": "non-spec:/.//path",
6607+
"protocol": "non-spec:",
6608+
"username": "",
6609+
"password": "",
6610+
"host": "",
6611+
"hostname": "",
6612+
"port": "",
6613+
"pathname": "//path",
6614+
"search": "",
6615+
"hash": ""
6616+
},
6617+
"Do not serialize /. in path",
6618+
{
6619+
"input": "../path",
6620+
"base": "non-spec:/.//p",
6621+
"href": "non-spec:/path",
6622+
"protocol": "non-spec:",
6623+
"username": "",
6624+
"password": "",
6625+
"host": "",
6626+
"hostname": "",
6627+
"port": "",
6628+
"pathname": "/path",
6629+
"search": "",
6630+
"hash": ""
6631+
},
64486632
"# percent encoded hosts in non-special-URLs",
64496633
{
64506634
"input": "non-special://%E2%80%A0/",

0 commit comments

Comments
 (0)