3 "AS OF https://github.com/jsdom/whatwg-url/commit/35f04dfd3048cf6362f4398745bb13375c5020c2",
4 "## Tests for setters of https://url.spec.whatwg.org/#urlutils-members",
6 "This file contains a JSON object.",
7 "Other than 'comment', each key is an attribute of the `URL` interface",
8 "defined in WHATWG’s URL Standard.",
9 "The values are arrays of test case objects for that attribute.",
11 "To run a test case for the attribute `attr`:",
13 "* Create a new `URL` object with the value for the 'href' key",
14 " the constructor single parameter. (Without a base URL.)",
15 " This must not throw.",
16 "* Set the attribute `attr` to (invoke its setter with)",
17 " with the value of for 'new_value' key.",
18 "* The value for the 'expected' key is another object.",
19 " For each `key` / `value` pair of that object,",
20 " get the attribute `key` (invoke its getter).",
21 " The returned string must be equal to `value`.",
23 "Note: the 'href' setter is already covered by urltestdata.json."
27 "comment": "The empty string is not a valid scheme. Setter leaves the URL unchanged.",
28 "href": "a://example.net",
31 "href": "a://example.net",
36 "href": "a://example.net",
39 "href": "b://example.net",
44 "href": "javascript:alert(1)",
45 "new_value": "defuse",
47 "href": "defuse:alert(1)",
52 "comment": "Upper-case ASCII is lower-cased",
53 "href": "a://example.net",
56 "href": "b://example.net",
61 "comment": "Non-ASCII is rejected",
62 "href": "a://example.net",
65 "href": "a://example.net",
70 "comment": "No leading digit",
71 "href": "a://example.net",
74 "href": "a://example.net",
79 "comment": "No leading punctuation",
80 "href": "a://example.net",
83 "href": "a://example.net",
88 "href": "a://example.net",
89 "new_value": "bC0+-.",
91 "href": "bc0+-.://example.net",
96 "comment": "Only some punctuation is acceptable",
97 "href": "a://example.net",
100 "href": "a://example.net",
105 "comment": "Non-ASCII is rejected",
106 "href": "a://example.net",
109 "href": "a://example.net",
114 "comment": "Can’t switch from URL containing username/password/port to file",
115 "href": "http://test@example.net",
118 "href": "http://test@example.net/",
123 "href": "gopher://example.net:1234",
126 "href": "gopher://example.net:1234",
127 "protocol": "gopher:"
131 "href": "wss://x:x@example.net:1234",
134 "href": "wss://x:x@example.net:1234/",
139 "comment": "Can’t switch from file URL with no host",
140 "href": "file://localhost/",
148 "href": "file:///test",
149 "new_value": "gopher",
151 "href": "file:///test",
164 "comment": "Can’t switch from special scheme to non-special",
165 "href": "http://example.net",
168 "href": "http://example.net/",
173 "href": "file://hi/path",
176 "href": "file://hi/path",
181 "href": "https://example.net",
184 "href": "https://example.net/",
189 "href": "ftp://example.net",
192 "href": "ftp://example.net/",
197 "comment": "Cannot-be-a-base URL doesn’t have a host, but URL in a special scheme must.",
198 "href": "mailto:me@example.net",
201 "href": "mailto:me@example.net",
202 "protocol": "mailto:"
206 "comment": "Can’t switch from non-special scheme to special",
207 "href": "ssh://me@example.net",
210 "href": "ssh://me@example.net",
215 "href": "ssh://me@example.net",
216 "new_value": "https",
218 "href": "ssh://me@example.net",
223 "href": "ssh://me@example.net",
226 "href": "ssh://me@example.net",
231 "href": "ssh://example.net",
234 "href": "ssh://example.net",
239 "href": "nonsense:///test",
240 "new_value": "https",
242 "href": "nonsense:///test",
243 "protocol": "nonsense:"
247 "comment": "Stuff after the first ':' is ignored",
248 "href": "http://example.net",
249 "new_value": "https:foo : bar",
251 "href": "https://example.net/",
256 "comment": "Stuff after the first ':' is ignored",
257 "href": "data:text/html,<p>Test",
258 "new_value": "view-source+data:foo : bar",
260 "href": "view-source+data:text/html,<p>Test",
261 "protocol": "view-source+data:"
265 "comment": "Port is set to null if it is the default for new scheme.",
266 "href": "http://foo.com:443/",
267 "new_value": "https",
269 "href": "https://foo.com/",
270 "protocol": "https:",
277 "comment": "No host means no username",
278 "href": "file:///home/you/index.html",
281 "href": "file:///home/you/index.html",
286 "comment": "No host means no username",
287 "href": "unix:/run/foo.socket",
290 "href": "unix:/run/foo.socket",
295 "comment": "Cannot-be-a-base means no username",
296 "href": "mailto:you@example.net",
299 "href": "mailto:you@example.net",
304 "href": "javascript:alert(1)",
305 "new_value": "wario",
307 "href": "javascript:alert(1)",
312 "href": "http://example.net",
315 "href": "http://me@example.net/",
320 "href": "http://:secret@example.net",
323 "href": "http://me:secret@example.net/",
328 "href": "http://me@example.net",
331 "href": "http://example.net/",
336 "href": "http://me:secret@example.net",
339 "href": "http://:secret@example.net/",
344 "comment": "UTF-8 percent encoding with the userinfo encode set.",
345 "href": "http://example.net",
346 "new_value": "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
348 "href": "http://%00%01%09%0A%0D%1F%20!%22%23$%&'()*+,-.%2F09%3A%3B%3C%3D%3E%3F%40AZ%5B%5C%5D%5E_%60az%7B%7C%7D~%7F%C2%80%C2%81%C3%89%C3%A9@example.net/",
349 "username": "%00%01%09%0A%0D%1F%20!%22%23$%&'()*+,-.%2F09%3A%3B%3C%3D%3E%3F%40AZ%5B%5C%5D%5E_%60az%7B%7C%7D~%7F%C2%80%C2%81%C3%89%C3%A9"
353 "comment": "Bytes already percent-encoded are left as-is.",
354 "href": "http://example.net",
355 "new_value": "%c3%89té",
357 "href": "http://%c3%89t%C3%A9@example.net/",
358 "username": "%c3%89t%C3%A9"
370 "href": "javascript://x/",
371 "new_value": "wario",
373 "href": "javascript://wario@x/",
378 "href": "file://test/",
381 "href": "file://test/",
388 "comment": "No host means no password",
389 "href": "file:///home/me/index.html",
390 "new_value": "secret",
392 "href": "file:///home/me/index.html",
397 "comment": "No host means no password",
398 "href": "unix:/run/foo.socket",
399 "new_value": "secret",
401 "href": "unix:/run/foo.socket",
406 "comment": "Cannot-be-a-base means no password",
407 "href": "mailto:me@example.net",
408 "new_value": "secret",
410 "href": "mailto:me@example.net",
415 "href": "http://example.net",
416 "new_value": "secret",
418 "href": "http://:secret@example.net/",
423 "href": "http://me@example.net",
424 "new_value": "secret",
426 "href": "http://me:secret@example.net/",
431 "href": "http://:secret@example.net",
434 "href": "http://example.net/",
439 "href": "http://me:secret@example.net",
442 "href": "http://me@example.net/",
447 "comment": "UTF-8 percent encoding with the userinfo encode set.",
448 "href": "http://example.net",
449 "new_value": "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
451 "href": "http://:%00%01%09%0A%0D%1F%20!%22%23$%&'()*+,-.%2F09%3A%3B%3C%3D%3E%3F%40AZ%5B%5C%5D%5E_%60az%7B%7C%7D~%7F%C2%80%C2%81%C3%89%C3%A9@example.net/",
452 "password": "%00%01%09%0A%0D%1F%20!%22%23$%&'()*+,-.%2F09%3A%3B%3C%3D%3E%3F%40AZ%5B%5C%5D%5E_%60az%7B%7C%7D~%7F%C2%80%C2%81%C3%89%C3%A9"
456 "comment": "Bytes already percent-encoded are left as-is.",
457 "href": "http://example.net",
458 "new_value": "%c3%89té",
460 "href": "http://:%c3%89t%C3%A9@example.net/",
461 "password": "%c3%89t%C3%A9"
473 "href": "javascript://x/",
474 "new_value": "bowser",
476 "href": "javascript://:bowser@x/",
481 "href": "file://test/",
484 "href": "file://test/",
491 "comment": "Non-special scheme",
493 "new_value": "\u0000",
502 "new_value": "\u0009",
511 "new_value": "\u000A",
520 "new_value": "\u000D",
576 "href": "sc://%C3%9F/",
582 "comment": "IDNA Nontransitional_Processing",
583 "href": "https://x/",
586 "href": "https://xn--zca/",
588 "hostname": "xn--zca"
592 "comment": "Cannot-be-a-base means no host",
593 "href": "mailto:me@example.net",
594 "new_value": "example.com",
596 "href": "mailto:me@example.net",
601 "comment": "Cannot-be-a-base means no host",
602 "href": "data:text/plain,Stuff",
603 "new_value": "example.net",
605 "href": "data:text/plain,Stuff",
610 "href": "http://example.net",
611 "new_value": "example.com:8080",
613 "href": "http://example.com:8080/",
614 "host": "example.com:8080",
615 "hostname": "example.com",
620 "comment": "Port number is unchanged if not specified in the new value",
621 "href": "http://example.net:8080",
622 "new_value": "example.com",
624 "href": "http://example.com:8080/",
625 "host": "example.com:8080",
626 "hostname": "example.com",
631 "comment": "Port number is unchanged if not specified",
632 "href": "http://example.net:8080",
633 "new_value": "example.com:",
635 "href": "http://example.com:8080/",
636 "host": "example.com:8080",
637 "hostname": "example.com",
642 "comment": "The empty host is not valid for special schemes",
643 "href": "http://example.net",
646 "href": "http://example.net/",
647 "host": "example.net"
651 "comment": "The empty host is OK for non-special schemes",
652 "href": "view-source+http://example.net/foo",
655 "href": "view-source+http:///foo",
660 "comment": "Path-only URLs can gain a host",
662 "new_value": "example.net",
664 "href": "a://example.net/foo",
665 "host": "example.net"
669 "comment": "IPv4 address syntax is normalized",
670 "href": "http://example.net",
671 "new_value": "0x7F000001:8080",
673 "href": "http://127.0.0.1:8080/",
674 "host": "127.0.0.1:8080",
675 "hostname": "127.0.0.1",
680 "comment": "IPv6 address syntax is normalized",
681 "href": "http://example.net",
682 "new_value": "[::0:01]:2",
684 "href": "http://[::1]:2/",
691 "comment": "IPv6 literal address with port, crbug.com/1012416",
692 "href": "http://example.net",
693 "new_value": "[2001:db8::2]:4002",
695 "href": "http://[2001:db8::2]:4002/",
696 "host": "[2001:db8::2]:4002",
697 "hostname": "[2001:db8::2]",
702 "comment": "Default port number is removed",
703 "href": "http://example.net",
704 "new_value": "example.com:80",
706 "href": "http://example.com/",
707 "host": "example.com",
708 "hostname": "example.com",
713 "comment": "Default port number is removed",
714 "href": "https://example.net",
715 "new_value": "example.com:443",
717 "href": "https://example.com/",
718 "host": "example.com",
719 "hostname": "example.com",
724 "comment": "Default port number is only removed for the relevant scheme",
725 "href": "https://example.net",
726 "new_value": "example.com:80",
728 "href": "https://example.com:80/",
729 "host": "example.com:80",
730 "hostname": "example.com",
735 "comment": "Port number is removed if new port is scheme default and existing URL has a non-default port",
736 "href": "http://example.net:8080",
737 "new_value": "example.com:80",
739 "href": "http://example.com/",
740 "host": "example.com",
741 "hostname": "example.com",
746 "comment": "Stuff after a / delimiter is ignored",
747 "href": "http://example.net/path",
748 "new_value": "example.com/stuff",
750 "href": "http://example.com/path",
751 "host": "example.com",
752 "hostname": "example.com",
757 "comment": "Stuff after a / delimiter is ignored",
758 "href": "http://example.net/path",
759 "new_value": "example.com:8080/stuff",
761 "href": "http://example.com:8080/path",
762 "host": "example.com:8080",
763 "hostname": "example.com",
768 "comment": "Stuff after a ? delimiter is ignored",
769 "href": "http://example.net/path",
770 "new_value": "example.com?stuff",
772 "href": "http://example.com/path",
773 "host": "example.com",
774 "hostname": "example.com",
779 "comment": "Stuff after a ? delimiter is ignored",
780 "href": "http://example.net/path",
781 "new_value": "example.com:8080?stuff",
783 "href": "http://example.com:8080/path",
784 "host": "example.com:8080",
785 "hostname": "example.com",
790 "comment": "Stuff after a # delimiter is ignored",
791 "href": "http://example.net/path",
792 "new_value": "example.com#stuff",
794 "href": "http://example.com/path",
795 "host": "example.com",
796 "hostname": "example.com",
801 "comment": "Stuff after a # delimiter is ignored",
802 "href": "http://example.net/path",
803 "new_value": "example.com:8080#stuff",
805 "href": "http://example.com:8080/path",
806 "host": "example.com:8080",
807 "hostname": "example.com",
812 "comment": "Stuff after a \\ delimiter is ignored for special schemes",
813 "href": "http://example.net/path",
814 "new_value": "example.com\\stuff",
816 "href": "http://example.com/path",
817 "host": "example.com",
818 "hostname": "example.com",
823 "comment": "Stuff after a \\ delimiter is ignored for special schemes",
824 "href": "http://example.net/path",
825 "new_value": "example.com:8080\\stuff",
827 "href": "http://example.com:8080/path",
828 "host": "example.com:8080",
829 "hostname": "example.com",
834 "comment": "\\ is not a delimiter for non-special schemes, but still forbidden in hosts",
835 "href": "view-source+http://example.net/path",
836 "new_value": "example.com\\stuff",
838 "href": "view-source+http://example.net/path",
839 "host": "example.net",
840 "hostname": "example.net",
845 "comment": "Anything other than ASCII digit stops the port parser in a setter but is not an error",
846 "href": "view-source+http://example.net/path",
847 "new_value": "example.com:8080stuff2",
849 "href": "view-source+http://example.com:8080/path",
850 "host": "example.com:8080",
851 "hostname": "example.com",
856 "comment": "Anything other than ASCII digit stops the port parser in a setter but is not an error",
857 "href": "http://example.net/path",
858 "new_value": "example.com:8080stuff2",
860 "href": "http://example.com:8080/path",
861 "host": "example.com:8080",
862 "hostname": "example.com",
867 "comment": "Anything other than ASCII digit stops the port parser in a setter but is not an error",
868 "href": "http://example.net/path",
869 "new_value": "example.com:8080+2",
871 "href": "http://example.com:8080/path",
872 "host": "example.com:8080",
873 "hostname": "example.com",
878 "comment": "Port numbers are 16 bit integers",
879 "href": "http://example.net/path",
880 "new_value": "example.com:65535",
882 "href": "http://example.com:65535/path",
883 "host": "example.com:65535",
884 "hostname": "example.com",
889 "comment": "Port numbers are 16 bit integers, overflowing is an error. Hostname is still set, though.",
890 "href": "http://example.net/path",
891 "new_value": "example.com:65536",
893 "href": "http://example.com/path",
894 "host": "example.com",
895 "hostname": "example.com",
900 "comment": "Broken IPv6",
901 "href": "http://example.net/",
902 "new_value": "[google.com]",
904 "href": "http://example.net/",
905 "host": "example.net",
906 "hostname": "example.net"
910 "href": "http://example.net/",
911 "new_value": "[::1.2.3.4x]",
913 "href": "http://example.net/",
914 "host": "example.net",
915 "hostname": "example.net"
919 "href": "http://example.net/",
920 "new_value": "[::1.2.3.]",
922 "href": "http://example.net/",
923 "host": "example.net",
924 "hostname": "example.net"
928 "href": "http://example.net/",
929 "new_value": "[::1.2.]",
931 "href": "http://example.net/",
932 "host": "example.net",
933 "hostname": "example.net"
937 "href": "http://example.net/",
938 "new_value": "[::1.]",
940 "href": "http://example.net/",
941 "host": "example.net",
942 "hostname": "example.net"
947 "new_value": "x:123",
957 "new_value": "loc%41lhost",
966 "href": "sc://test@test/",
969 "href": "sc://test@test/",
976 "href": "sc://test:12/",
979 "href": "sc://test:12/",
988 "comment": "Non-special scheme",
990 "new_value": "\u0000",
999 "new_value": "\u0009",
1008 "new_value": "\u000A",
1017 "new_value": "\u000D",
1070 "comment": "Cannot-be-a-base means no host",
1071 "href": "mailto:me@example.net",
1072 "new_value": "example.com",
1074 "href": "mailto:me@example.net",
1079 "comment": "Cannot-be-a-base means no host",
1080 "href": "data:text/plain,Stuff",
1081 "new_value": "example.net",
1083 "href": "data:text/plain,Stuff",
1088 "href": "http://example.net:8080",
1089 "new_value": "example.com",
1091 "href": "http://example.com:8080/",
1092 "host": "example.com:8080",
1093 "hostname": "example.com",
1098 "comment": "The empty host is not valid for special schemes",
1099 "href": "http://example.net",
1102 "href": "http://example.net/",
1103 "host": "example.net"
1107 "comment": "The empty host is OK for non-special schemes",
1108 "href": "view-source+http://example.net/foo",
1111 "href": "view-source+http:///foo",
1116 "comment": "Path-only URLs can gain a host",
1118 "new_value": "example.net",
1120 "href": "a://example.net/foo",
1121 "host": "example.net"
1125 "comment": "IPv4 address syntax is normalized",
1126 "href": "http://example.net:8080",
1127 "new_value": "0x7F000001",
1129 "href": "http://127.0.0.1:8080/",
1130 "host": "127.0.0.1:8080",
1131 "hostname": "127.0.0.1",
1136 "comment": "IPv6 address syntax is normalized",
1137 "href": "http://example.net",
1138 "new_value": "[::0:01]",
1140 "href": "http://[::1]/",
1142 "hostname": "[::1]",
1147 "comment": "Stuff after a : delimiter is ignored",
1148 "href": "http://example.net/path",
1149 "new_value": "example.com:8080",
1151 "href": "http://example.com/path",
1152 "host": "example.com",
1153 "hostname": "example.com",
1158 "comment": "Stuff after a : delimiter is ignored",
1159 "href": "http://example.net:8080/path",
1160 "new_value": "example.com:",
1162 "href": "http://example.com:8080/path",
1163 "host": "example.com:8080",
1164 "hostname": "example.com",
1169 "comment": "Stuff after a / delimiter is ignored",
1170 "href": "http://example.net/path",
1171 "new_value": "example.com/stuff",
1173 "href": "http://example.com/path",
1174 "host": "example.com",
1175 "hostname": "example.com",
1180 "comment": "Stuff after a ? delimiter is ignored",
1181 "href": "http://example.net/path",
1182 "new_value": "example.com?stuff",
1184 "href": "http://example.com/path",
1185 "host": "example.com",
1186 "hostname": "example.com",
1191 "comment": "Stuff after a # delimiter is ignored",
1192 "href": "http://example.net/path",
1193 "new_value": "example.com#stuff",
1195 "href": "http://example.com/path",
1196 "host": "example.com",
1197 "hostname": "example.com",
1202 "comment": "Stuff after a \\ delimiter is ignored for special schemes",
1203 "href": "http://example.net/path",
1204 "new_value": "example.com\\stuff",
1206 "href": "http://example.com/path",
1207 "host": "example.com",
1208 "hostname": "example.com",
1213 "comment": "\\ is not a delimiter for non-special schemes, but still forbidden in hosts",
1214 "href": "view-source+http://example.net/path",
1215 "new_value": "example.com\\stuff",
1217 "href": "view-source+http://example.net/path",
1218 "host": "example.net",
1219 "hostname": "example.net",
1224 "comment": "Broken IPv6",
1225 "href": "http://example.net/",
1226 "new_value": "[google.com]",
1228 "href": "http://example.net/",
1229 "host": "example.net",
1230 "hostname": "example.net"
1234 "href": "http://example.net/",
1235 "new_value": "[::1.2.3.4x]",
1237 "href": "http://example.net/",
1238 "host": "example.net",
1239 "hostname": "example.net"
1243 "href": "http://example.net/",
1244 "new_value": "[::1.2.3.]",
1246 "href": "http://example.net/",
1247 "host": "example.net",
1248 "hostname": "example.net"
1252 "href": "http://example.net/",
1253 "new_value": "[::1.2.]",
1255 "href": "http://example.net/",
1256 "host": "example.net",
1257 "hostname": "example.net"
1261 "href": "http://example.net/",
1262 "new_value": "[::1.]",
1264 "href": "http://example.net/",
1265 "host": "example.net",
1266 "hostname": "example.net"
1270 "href": "file://y/",
1271 "new_value": "x:123",
1273 "href": "file://y/",
1280 "href": "file://y/",
1281 "new_value": "loc%41lhost",
1290 "href": "sc://test@test/",
1293 "href": "sc://test@test/",
1300 "href": "sc://test:12/",
1303 "href": "sc://test:12/",
1312 "href": "http://example.net",
1313 "new_value": "8080",
1315 "href": "http://example.net:8080/",
1316 "host": "example.net:8080",
1317 "hostname": "example.net",
1322 "comment": "Port number is removed if empty is the new value",
1323 "href": "http://example.net:8080",
1326 "href": "http://example.net/",
1327 "host": "example.net",
1328 "hostname": "example.net",
1333 "comment": "Default port number is removed",
1334 "href": "http://example.net:8080",
1337 "href": "http://example.net/",
1338 "host": "example.net",
1339 "hostname": "example.net",
1344 "comment": "Default port number is removed",
1345 "href": "https://example.net:4433",
1348 "href": "https://example.net/",
1349 "host": "example.net",
1350 "hostname": "example.net",
1355 "comment": "Default port number is only removed for the relevant scheme",
1356 "href": "https://example.net",
1359 "href": "https://example.net:80/",
1360 "host": "example.net:80",
1361 "hostname": "example.net",
1366 "comment": "Stuff after a / delimiter is ignored",
1367 "href": "http://example.net/path",
1368 "new_value": "8080/stuff",
1370 "href": "http://example.net:8080/path",
1371 "host": "example.net:8080",
1372 "hostname": "example.net",
1377 "comment": "Stuff after a ? delimiter is ignored",
1378 "href": "http://example.net/path",
1379 "new_value": "8080?stuff",
1381 "href": "http://example.net:8080/path",
1382 "host": "example.net:8080",
1383 "hostname": "example.net",
1388 "comment": "Stuff after a # delimiter is ignored",
1389 "href": "http://example.net/path",
1390 "new_value": "8080#stuff",
1392 "href": "http://example.net:8080/path",
1393 "host": "example.net:8080",
1394 "hostname": "example.net",
1399 "comment": "Stuff after a \\ delimiter is ignored for special schemes",
1400 "href": "http://example.net/path",
1401 "new_value": "8080\\stuff",
1403 "href": "http://example.net:8080/path",
1404 "host": "example.net:8080",
1405 "hostname": "example.net",
1410 "comment": "Anything other than ASCII digit stops the port parser in a setter but is not an error",
1411 "href": "view-source+http://example.net/path",
1412 "new_value": "8080stuff2",
1414 "href": "view-source+http://example.net:8080/path",
1415 "host": "example.net:8080",
1416 "hostname": "example.net",
1421 "comment": "Anything other than ASCII digit stops the port parser in a setter but is not an error",
1422 "href": "http://example.net/path",
1423 "new_value": "8080stuff2",
1425 "href": "http://example.net:8080/path",
1426 "host": "example.net:8080",
1427 "hostname": "example.net",
1432 "comment": "Anything other than ASCII digit stops the port parser in a setter but is not an error",
1433 "href": "http://example.net/path",
1434 "new_value": "8080+2",
1436 "href": "http://example.net:8080/path",
1437 "host": "example.net:8080",
1438 "hostname": "example.net",
1443 "comment": "Port numbers are 16 bit integers",
1444 "href": "http://example.net/path",
1445 "new_value": "65535",
1447 "href": "http://example.net:65535/path",
1448 "host": "example.net:65535",
1449 "hostname": "example.net",
1454 "comment": "Port numbers are 16 bit integers, overflowing is an error",
1455 "href": "http://example.net:8080/path",
1456 "new_value": "65536",
1458 "href": "http://example.net:8080/path",
1459 "host": "example.net:8080",
1460 "hostname": "example.net",
1465 "comment": "Port numbers are 16 bit integers, overflowing is an error",
1466 "href": "non-special://example.net:8080/path",
1467 "new_value": "65536",
1469 "href": "non-special://example.net:8080/path",
1470 "host": "example.net:8080",
1471 "hostname": "example.net",
1476 "href": "file://test/",
1479 "href": "file://test/",
1484 "href": "file://localhost/",
1492 "href": "non-base:value",
1495 "href": "non-base:value",
1511 "href": "sc://x:12/",
1516 "href": "javascript://x/",
1519 "href": "javascript://x:12/",
1526 "comment": "Cannot-be-a-base don’t have a path",
1527 "href": "mailto:me@example.net",
1528 "new_value": "/foo",
1530 "href": "mailto:me@example.net",
1531 "pathname": "me@example.net"
1535 "href": "unix:/run/foo.socket?timeout=10",
1536 "new_value": "/var/log/../run/bar.socket",
1538 "href": "unix:/var/run/bar.socket?timeout=10",
1539 "pathname": "/var/run/bar.socket"
1543 "href": "https://example.net#nav",
1544 "new_value": "home",
1546 "href": "https://example.net/home#nav",
1551 "href": "https://example.net#nav",
1552 "new_value": "../home",
1554 "href": "https://example.net/home#nav",
1559 "comment": "\\ is a segment delimiter for 'special' URLs",
1560 "href": "http://example.net/home?lang=fr#nav",
1561 "new_value": "\\a\\%2E\\b\\%2e.\\c",
1563 "href": "http://example.net/a/c?lang=fr#nav",
1568 "comment": "\\ is *not* a segment delimiter for non-'special' URLs",
1569 "href": "view-source+http://example.net/home?lang=fr#nav",
1570 "new_value": "\\a\\%2E\\b\\%2e.\\c",
1572 "href": "view-source+http://example.net/\\a\\%2E\\b\\%2e.\\c?lang=fr#nav",
1573 "pathname": "/\\a\\%2E\\b\\%2e.\\c"
1577 "comment": "UTF-8 percent encoding with the default encode set. Tabs and newlines are removed.",
1579 "new_value": "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
1581 "href": "a:/%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E%3F@AZ[\\]^_%60az%7B|%7D~%7F%C2%80%C2%81%C3%89%C3%A9",
1582 "pathname": "/%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E%3F@AZ[\\]^_%60az%7B|%7D~%7F%C2%80%C2%81%C3%89%C3%A9"
1586 "comment": "Bytes already percent-encoded are left as-is, including %2E outside dotted segments.",
1587 "href": "http://example.net",
1588 "new_value": "%2e%2E%c3%89té",
1590 "href": "http://example.net/%2e%2E%c3%89t%C3%A9",
1591 "pathname": "/%2e%2E%c3%89t%C3%A9"
1595 "comment": "? needs to be encoded",
1596 "href": "http://example.net",
1599 "href": "http://example.net/%3F",
1604 "comment": "# needs to be encoded",
1605 "href": "http://example.net",
1608 "href": "http://example.net/%23",
1613 "comment": "? needs to be encoded, non-special scheme",
1614 "href": "sc://example.net",
1617 "href": "sc://example.net/%3F",
1622 "comment": "# needs to be encoded, non-special scheme",
1623 "href": "sc://example.net",
1626 "href": "sc://example.net/%23",
1631 "comment": "File URLs and (back)slashes",
1632 "href": "file://monkey/",
1633 "new_value": "\\\\",
1635 "href": "file://monkey/",
1640 "comment": "File URLs and (back)slashes",
1641 "href": "file:///unicorn",
1642 "new_value": "//\\/",
1649 "comment": "File URLs and (back)slashes",
1650 "href": "file:///unicorn",
1651 "new_value": "//monkey/..//",
1660 "href": "https://example.net#nav",
1661 "new_value": "lang=fr",
1663 "href": "https://example.net/?lang=fr#nav",
1664 "search": "?lang=fr"
1668 "href": "https://example.net?lang=en-US#nav",
1669 "new_value": "lang=fr",
1671 "href": "https://example.net/?lang=fr#nav",
1672 "search": "?lang=fr"
1676 "href": "https://example.net?lang=en-US#nav",
1677 "new_value": "?lang=fr",
1679 "href": "https://example.net/?lang=fr#nav",
1680 "search": "?lang=fr"
1684 "href": "https://example.net?lang=en-US#nav",
1685 "new_value": "??lang=fr",
1687 "href": "https://example.net/??lang=fr#nav",
1688 "search": "??lang=fr"
1692 "href": "https://example.net?lang=en-US#nav",
1695 "href": "https://example.net/?#nav",
1700 "href": "https://example.net?lang=en-US#nav",
1703 "href": "https://example.net/#nav",
1708 "href": "https://example.net?lang=en-US",
1711 "href": "https://example.net/",
1716 "href": "https://example.net",
1719 "href": "https://example.net/",
1724 "comment": "UTF-8 percent encoding with the query encode set. Tabs and newlines are removed.",
1726 "new_value": "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
1728 "href": "a:/?%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_`az{|}~%7F%C2%80%C2%81%C3%89%C3%A9",
1729 "search": "?%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_`az{|}~%7F%C2%80%C2%81%C3%89%C3%A9"
1733 "comment": "Bytes already percent-encoded are left as-is",
1734 "href": "http://example.net",
1735 "new_value": "%c3%89té",
1737 "href": "http://example.net/?%c3%89t%C3%A9",
1738 "search": "?%c3%89t%C3%A9"
1744 "href": "https://example.net",
1745 "new_value": "main",
1747 "href": "https://example.net/#main",
1752 "href": "https://example.net#nav",
1753 "new_value": "main",
1755 "href": "https://example.net/#main",
1760 "href": "https://example.net?lang=en-US",
1761 "new_value": "##nav",
1763 "href": "https://example.net/?lang=en-US##nav",
1768 "href": "https://example.net?lang=en-US#nav",
1769 "new_value": "#main",
1771 "href": "https://example.net/?lang=en-US#main",
1776 "href": "https://example.net?lang=en-US#nav",
1779 "href": "https://example.net/?lang=en-US#",
1784 "href": "https://example.net?lang=en-US#nav",
1787 "href": "https://example.net/?lang=en-US",
1792 "href": "http://example.net",
1793 "new_value": "#foo bar",
1795 "href": "http://example.net/#foo%20bar",
1796 "hash": "#foo%20bar"
1800 "href": "http://example.net",
1801 "new_value": "#foo\"bar",
1803 "href": "http://example.net/#foo%22bar",
1804 "hash": "#foo%22bar"
1808 "href": "http://example.net",
1809 "new_value": "#foo<bar",
1811 "href": "http://example.net/#foo%3Cbar",
1812 "hash": "#foo%3Cbar"
1816 "href": "http://example.net",
1817 "new_value": "#foo>bar",
1819 "href": "http://example.net/#foo%3Ebar",
1820 "hash": "#foo%3Ebar"
1824 "href": "http://example.net",
1825 "new_value": "#foo`bar",
1827 "href": "http://example.net/#foo%60bar",
1828 "hash": "#foo%60bar"
1832 "comment": "Simple percent-encoding; tabs and newlines are removed",
1834 "new_value": "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
1836 "href": "a:/#%00%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9",
1837 "hash": "#%00%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9"
1841 "comment": "Percent-encode NULLs in fragment",
1842 "href": "http://example.net",
1843 "new_value": "a\u0000b",
1845 "href": "http://example.net/#a%00b",
1850 "comment": "Percent-encode NULLs in fragment",
1851 "href": "non-spec:/",
1852 "new_value": "a\u0000b",
1854 "href": "non-spec:/#a%00b",
1859 "comment": "Bytes already percent-encoded are left as-is",
1860 "href": "http://example.net",
1861 "new_value": "%c3%89té",
1863 "href": "http://example.net/#%c3%89t%C3%A9",
1864 "hash": "#%c3%89t%C3%A9"
1868 "href": "javascript:alert(1)",
1869 "new_value": "castle",
1871 "href": "javascript:alert(1)#castle",