setters_tests.json 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786
  1. {
  2. "comment": [
  3. "## Tests for setters of https://url.spec.whatwg.org/#urlutils-members",
  4. "",
  5. "This file contains a JSON object.",
  6. "Other than 'comment', each key is an attribute of the `URL` interface",
  7. "defined in WHATWG’s URL Standard.",
  8. "The values are arrays of test case objects for that attribute.",
  9. "",
  10. "To run a test case for the attribute `attr`:",
  11. "",
  12. "* Create a new `URL` object with the value for the 'href' key",
  13. " the constructor single parameter. (Without a base URL.)",
  14. " This must not throw.",
  15. "* Set the attribute `attr` to (invoke its setter with)",
  16. " with the value of for 'new_value' key.",
  17. "* The value for the 'expected' key is another object.",
  18. " For each `key` / `value` pair of that object,",
  19. " get the attribute `key` (invoke its getter).",
  20. " The returned string must be equal to `value`.",
  21. "",
  22. "Note: the 'href' setter is already covered by urltestdata.json."
  23. ],
  24. "protocol": [
  25. {
  26. "comment": "The empty string is not a valid scheme. Setter leaves the URL unchanged.",
  27. "href": "a://example.net",
  28. "new_value": "",
  29. "expected": {
  30. "href": "a://example.net/",
  31. "protocol": "a:"
  32. }
  33. },
  34. {
  35. "href": "a://example.net",
  36. "new_value": "b",
  37. "expected": {
  38. "href": "b://example.net/",
  39. "protocol": "b:"
  40. }
  41. },
  42. {
  43. "comment": "Upper-case ASCII is lower-cased",
  44. "href": "a://example.net",
  45. "new_value": "B",
  46. "expected": {
  47. "href": "b://example.net/",
  48. "protocol": "b:"
  49. }
  50. },
  51. {
  52. "comment": "Non-ASCII is rejected",
  53. "href": "a://example.net",
  54. "new_value": "é",
  55. "expected": {
  56. "href": "a://example.net/",
  57. "protocol": "a:"
  58. }
  59. },
  60. {
  61. "comment": "No leading digit",
  62. "href": "a://example.net",
  63. "new_value": "0b",
  64. "expected": {
  65. "href": "a://example.net/",
  66. "protocol": "a:"
  67. }
  68. },
  69. {
  70. "comment": "No leading punctuation",
  71. "href": "a://example.net",
  72. "new_value": "+b",
  73. "expected": {
  74. "href": "a://example.net/",
  75. "protocol": "a:"
  76. }
  77. },
  78. {
  79. "href": "a://example.net",
  80. "new_value": "bC0+-.",
  81. "expected": {
  82. "href": "bc0+-.://example.net/",
  83. "protocol": "bc0+-.:"
  84. }
  85. },
  86. {
  87. "comment": "Only some punctuation is acceptable",
  88. "href": "a://example.net",
  89. "new_value": "b,c",
  90. "expected": {
  91. "href": "a://example.net/",
  92. "protocol": "a:"
  93. }
  94. },
  95. {
  96. "comment": "Non-ASCII is rejected",
  97. "href": "a://example.net",
  98. "new_value": "bé",
  99. "expected": {
  100. "href": "a://example.net/",
  101. "protocol": "a:"
  102. }
  103. },
  104. {
  105. "comment": "Spec deviation: from special scheme to not is not problematic. https://github.com/whatwg/url/issues/104",
  106. "href": "http://example.net",
  107. "new_value": "b",
  108. "expected": {
  109. "href": "b://example.net/",
  110. "protocol": "b:"
  111. }
  112. },
  113. {
  114. "comment": "Cannot-be-a-base URL doesn’t have a host, but URL in a special scheme must.",
  115. "href": "mailto:me@example.net",
  116. "new_value": "http",
  117. "expected": {
  118. "href": "mailto:me@example.net",
  119. "protocol": "mailto:"
  120. }
  121. },
  122. {
  123. "comment": "Spec deviation: from non-special scheme with a host to special is not problematic. https://github.com/whatwg/url/issues/104",
  124. "href": "ssh://me@example.net",
  125. "new_value": "http",
  126. "expected": {
  127. "href": "http://me@example.net/",
  128. "protocol": "http:"
  129. }
  130. },
  131. {
  132. "comment": "Stuff after the first ':' is ignored",
  133. "href": "http://example.net",
  134. "new_value": "https:foo : bar",
  135. "expected": {
  136. "href": "https://example.net/",
  137. "protocol": "https:"
  138. }
  139. },
  140. {
  141. "comment": "Stuff after the first ':' is ignored",
  142. "href": "data:text/html,<p>Test",
  143. "new_value": "view-source+data:foo : bar",
  144. "expected": {
  145. "href": "view-source+data:text/html,<p>Test",
  146. "protocol": "view-source+data:"
  147. }
  148. }
  149. ],
  150. "username": [
  151. {
  152. "comment": "No host means no username",
  153. "href": "file:///home/you/index.html",
  154. "new_value": "me",
  155. "expected": {
  156. "href": "file:///home/you/index.html",
  157. "username": ""
  158. }
  159. },
  160. {
  161. "comment": "No host means no username",
  162. "href": "unix:/run/foo.socket",
  163. "new_value": "me",
  164. "expected": {
  165. "href": "unix:/run/foo.socket",
  166. "username": ""
  167. }
  168. },
  169. {
  170. "comment": "Cannot-be-a-base means no username",
  171. "href": "mailto:you@example.net",
  172. "new_value": "me",
  173. "expected": {
  174. "href": "mailto:you@example.net",
  175. "username": ""
  176. }
  177. },
  178. {
  179. "href": "http://example.net",
  180. "new_value": "me",
  181. "expected": {
  182. "href": "http://me@example.net/",
  183. "username": "me"
  184. }
  185. },
  186. {
  187. "href": "http://:secret@example.net",
  188. "new_value": "me",
  189. "expected": {
  190. "href": "http://me:secret@example.net/",
  191. "username": "me"
  192. }
  193. },
  194. {
  195. "href": "http://me@example.net",
  196. "new_value": "",
  197. "expected": {
  198. "href": "http://example.net/",
  199. "username": ""
  200. }
  201. },
  202. {
  203. "href": "http://me:secret@example.net",
  204. "new_value": "",
  205. "expected": {
  206. "href": "http://:secret@example.net/",
  207. "username": ""
  208. }
  209. },
  210. {
  211. "comment": "UTF-8 percent encoding with the userinfo encode set.",
  212. "href": "http://example.net",
  213. "new_value": "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
  214. "expected": {
  215. "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/",
  216. "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"
  217. }
  218. },
  219. {
  220. "comment": "Bytes already percent-encoded are left as-is.",
  221. "href": "http://example.net",
  222. "new_value": "%c3%89t%c3%a9",
  223. "expected": {
  224. "href": "http://%c3%89t%c3%a9@example.net/",
  225. "username": "%c3%89t%c3%a9"
  226. }
  227. }
  228. ],
  229. "password": [
  230. {
  231. "comment": "No host means no password",
  232. "href": "file:///home/me/index.html",
  233. "new_value": "secret",
  234. "expected": {
  235. "href": "file:///home/me/index.html",
  236. "password": ""
  237. }
  238. },
  239. {
  240. "comment": "No host means no password",
  241. "href": "unix:/run/foo.socket",
  242. "new_value": "secret",
  243. "expected": {
  244. "href": "unix:/run/foo.socket",
  245. "password": ""
  246. }
  247. },
  248. {
  249. "comment": "Cannot-be-a-base means no password",
  250. "href": "mailto:me@example.net",
  251. "new_value": "secret",
  252. "expected": {
  253. "href": "mailto:me@example.net",
  254. "password": ""
  255. }
  256. },
  257. {
  258. "href": "http://example.net",
  259. "new_value": "secret",
  260. "expected": {
  261. "href": "http://:secret@example.net/",
  262. "password": "secret"
  263. }
  264. },
  265. {
  266. "href": "http://me@example.net",
  267. "new_value": "secret",
  268. "expected": {
  269. "href": "http://me:secret@example.net/",
  270. "password": "secret"
  271. }
  272. },
  273. {
  274. "href": "http://:secret@example.net",
  275. "new_value": "",
  276. "expected": {
  277. "href": "http://example.net/",
  278. "password": ""
  279. }
  280. },
  281. {
  282. "href": "http://me:secret@example.net",
  283. "new_value": "",
  284. "expected": {
  285. "href": "http://me@example.net/",
  286. "password": ""
  287. }
  288. },
  289. {
  290. "comment": "UTF-8 percent encoding with the userinfo encode set.",
  291. "href": "http://example.net",
  292. "new_value": "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
  293. "expected": {
  294. "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/",
  295. "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"
  296. }
  297. },
  298. {
  299. "comment": "Bytes already percent-encoded are left as-is.",
  300. "href": "http://example.net",
  301. "new_value": "%c3%89t%c3%a9",
  302. "expected": {
  303. "href": "http://:%c3%89t%c3%a9@example.net/",
  304. "password": "%c3%89t%c3%a9"
  305. }
  306. }
  307. ],
  308. "host": [
  309. {
  310. "comment": "Cannot-be-a-base means no host",
  311. "href": "mailto:me@example.net",
  312. "new_value": "example.com",
  313. "expected": {
  314. "href": "mailto:me@example.net",
  315. "host": ""
  316. }
  317. },
  318. {
  319. "comment": "Cannot-be-a-base means no password",
  320. "href": "data:text/plain,Stuff",
  321. "new_value": "example.net",
  322. "expected": {
  323. "href": "data:text/plain,Stuff",
  324. "host": ""
  325. }
  326. },
  327. {
  328. "href": "http://example.net",
  329. "new_value": "example.com:8080",
  330. "expected": {
  331. "href": "http://example.com:8080/",
  332. "host": "example.com:8080",
  333. "hostname": "example.com",
  334. "port": "8080"
  335. }
  336. },
  337. {
  338. "comment": "Port number is unchanged if not specified in the new value",
  339. "href": "http://example.net:8080",
  340. "new_value": "example.com",
  341. "expected": {
  342. "href": "http://example.com:8080/",
  343. "host": "example.com:8080",
  344. "hostname": "example.com",
  345. "port": "8080"
  346. }
  347. },
  348. {
  349. "comment": "Port number is removed if empty in the new value: https://github.com/whatwg/url/pull/113",
  350. "href": "http://example.net:8080",
  351. "new_value": "example.com:",
  352. "expected": {
  353. "href": "http://example.com/",
  354. "host": "example.com",
  355. "hostname": "example.com",
  356. "port": ""
  357. }
  358. },
  359. {
  360. "comment": "Port number can be removed",
  361. "href": "http://example.net:8080",
  362. "new_value": "example.com:",
  363. "expected": {
  364. "href": "http://example.com/",
  365. "host": "example.com",
  366. "hostname": "example.com",
  367. "port": ""
  368. }
  369. },
  370. {
  371. "comment": "The empty host is not valid for special schemes",
  372. "href": "http://example.net",
  373. "new_value": "",
  374. "expected": {
  375. "href": "http://example.net/",
  376. "host": "example.net"
  377. }
  378. },
  379. {
  380. "comment": "The empty host is OK for non-special schemes",
  381. "href": "view-source+http://example.net/foo",
  382. "new_value": "",
  383. "expected": {
  384. "href": "view-source+http:///foo",
  385. "host": ""
  386. }
  387. },
  388. {
  389. "comment": "Path-only URLs can gain a host",
  390. "href": "a:/foo",
  391. "new_value": "example.net",
  392. "expected": {
  393. "href": "a://example.net/foo",
  394. "host": "example.net"
  395. }
  396. },
  397. {
  398. "comment": "Path-only URLs can gain a host",
  399. "href": "a:/foo",
  400. "new_value": "example.net",
  401. "expected": {
  402. "href": "a://example.net/foo",
  403. "host": "example.net"
  404. }
  405. },
  406. {
  407. "comment": "IPv4 address syntax is normalized",
  408. "href": "http://example.net",
  409. "new_value": "0x7F000001:8080",
  410. "expected": {
  411. "href": "http://127.0.0.1:8080/",
  412. "host": "127.0.0.1:8080",
  413. "hostname": "127.0.0.1",
  414. "port": "8080"
  415. }
  416. },
  417. {
  418. "comment": "IPv6 address syntax is normalized",
  419. "href": "http://example.net",
  420. "new_value": "[::0:01]:2",
  421. "expected": {
  422. "href": "http://[::1]:2/",
  423. "host": "[::1]:2",
  424. "hostname": "[::1]",
  425. "port": "2"
  426. }
  427. },
  428. {
  429. "comment": "Default port number is removed",
  430. "href": "http://example.net",
  431. "new_value": "example.com:80",
  432. "expected": {
  433. "href": "http://example.com/",
  434. "host": "example.com",
  435. "hostname": "example.com",
  436. "port": ""
  437. }
  438. },
  439. {
  440. "comment": "Default port number is removed",
  441. "href": "https://example.net",
  442. "new_value": "example.com:443",
  443. "expected": {
  444. "href": "https://example.com/",
  445. "host": "example.com",
  446. "hostname": "example.com",
  447. "port": ""
  448. }
  449. },
  450. {
  451. "comment": "Default port number is only removed for the relevant scheme",
  452. "href": "https://example.net",
  453. "new_value": "example.com:80",
  454. "expected": {
  455. "href": "https://example.com:80/",
  456. "host": "example.com:80",
  457. "hostname": "example.com",
  458. "port": "80"
  459. }
  460. },
  461. {
  462. "comment": "Stuff after a / delimiter is ignored",
  463. "href": "http://example.net/path",
  464. "new_value": "example.com/stuff",
  465. "expected": {
  466. "href": "http://example.com/path",
  467. "host": "example.com",
  468. "hostname": "example.com",
  469. "port": ""
  470. }
  471. },
  472. {
  473. "comment": "Stuff after a / delimiter is ignored",
  474. "href": "http://example.net/path",
  475. "new_value": "example.com:8080/stuff",
  476. "expected": {
  477. "href": "http://example.com:8080/path",
  478. "host": "example.com:8080",
  479. "hostname": "example.com",
  480. "port": "8080"
  481. }
  482. },
  483. {
  484. "comment": "Stuff after a ? delimiter is ignored",
  485. "href": "http://example.net/path",
  486. "new_value": "example.com?stuff",
  487. "expected": {
  488. "href": "http://example.com/path",
  489. "host": "example.com",
  490. "hostname": "example.com",
  491. "port": ""
  492. }
  493. },
  494. {
  495. "comment": "Stuff after a ? delimiter is ignored",
  496. "href": "http://example.net/path",
  497. "new_value": "example.com:8080?stuff",
  498. "expected": {
  499. "href": "http://example.com:8080/path",
  500. "host": "example.com:8080",
  501. "hostname": "example.com",
  502. "port": "8080"
  503. }
  504. },
  505. {
  506. "comment": "Stuff after a # delimiter is ignored",
  507. "href": "http://example.net/path",
  508. "new_value": "example.com#stuff",
  509. "expected": {
  510. "href": "http://example.com/path",
  511. "host": "example.com",
  512. "hostname": "example.com",
  513. "port": ""
  514. }
  515. },
  516. {
  517. "comment": "Stuff after a # delimiter is ignored",
  518. "href": "http://example.net/path",
  519. "new_value": "example.com:8080#stuff",
  520. "expected": {
  521. "href": "http://example.com:8080/path",
  522. "host": "example.com:8080",
  523. "hostname": "example.com",
  524. "port": "8080"
  525. }
  526. },
  527. {
  528. "comment": "Stuff after a \\ delimiter is ignored for special schemes",
  529. "href": "http://example.net/path",
  530. "new_value": "example.com\\stuff",
  531. "expected": {
  532. "href": "http://example.com/path",
  533. "host": "example.com",
  534. "hostname": "example.com",
  535. "port": ""
  536. }
  537. },
  538. {
  539. "comment": "Stuff after a \\ delimiter is ignored for special schemes",
  540. "href": "http://example.net/path",
  541. "new_value": "example.com:8080\\stuff",
  542. "expected": {
  543. "href": "http://example.com:8080/path",
  544. "host": "example.com:8080",
  545. "hostname": "example.com",
  546. "port": "8080"
  547. }
  548. },
  549. {
  550. "comment": "\\ is not a delimiter for non-special schemes, and it’s invalid in a domain",
  551. "href": "view-source+http://example.net/path",
  552. "new_value": "example.com\\stuff",
  553. "expected": {
  554. "href": "view-source+http://example.net/path",
  555. "host": "example.net",
  556. "hostname": "example.net",
  557. "port": ""
  558. }
  559. },
  560. {
  561. "comment": "Anything other than ASCII digit stops the port parser in a setter but is not an error",
  562. "href": "view-source+http://example.net/path",
  563. "new_value": "example.com:8080stuff2",
  564. "expected": {
  565. "href": "view-source+http://example.com:8080/path",
  566. "host": "example.com:8080",
  567. "hostname": "example.com",
  568. "port": "8080"
  569. }
  570. },
  571. {
  572. "comment": "Anything other than ASCII digit stops the port parser in a setter but is not an error",
  573. "href": "http://example.net/path",
  574. "new_value": "example.com:8080stuff2",
  575. "expected": {
  576. "href": "http://example.com:8080/path",
  577. "host": "example.com:8080",
  578. "hostname": "example.com",
  579. "port": "8080"
  580. }
  581. },
  582. {
  583. "comment": "Anything other than ASCII digit stops the port parser in a setter but is not an error",
  584. "href": "http://example.net/path",
  585. "new_value": "example.com:8080+2",
  586. "expected": {
  587. "href": "http://example.com:8080/path",
  588. "host": "example.com:8080",
  589. "hostname": "example.com",
  590. "port": "8080"
  591. }
  592. },
  593. {
  594. "comment": "Port numbers are 16 bit integers",
  595. "href": "http://example.net/path",
  596. "new_value": "example.com:65535",
  597. "expected": {
  598. "href": "http://example.com:65535/path",
  599. "host": "example.com:65535",
  600. "hostname": "example.com",
  601. "port": "65535"
  602. }
  603. },
  604. {
  605. "comment": "Port numbers are 16 bit integers, overflowing is an error. Hostname is still set, though.",
  606. "href": "http://example.net/path",
  607. "new_value": "example.com:65536",
  608. "expected": {
  609. "href": "http://example.com/path",
  610. "host": "example.com",
  611. "hostname": "example.com",
  612. "port": ""
  613. }
  614. }
  615. ],
  616. "hostname": [
  617. {
  618. "comment": "Cannot-be-a-base means no host",
  619. "href": "mailto:me@example.net",
  620. "new_value": "example.com",
  621. "expected": {
  622. "href": "mailto:me@example.net",
  623. "host": ""
  624. }
  625. },
  626. {
  627. "comment": "Cannot-be-a-base means no password",
  628. "href": "data:text/plain,Stuff",
  629. "new_value": "example.net",
  630. "expected": {
  631. "href": "data:text/plain,Stuff",
  632. "host": ""
  633. }
  634. },
  635. {
  636. "href": "http://example.net:8080",
  637. "new_value": "example.com",
  638. "expected": {
  639. "href": "http://example.com:8080/",
  640. "host": "example.com:8080",
  641. "hostname": "example.com",
  642. "port": "8080"
  643. }
  644. },
  645. {
  646. "comment": "The empty host is not valid for special schemes",
  647. "href": "http://example.net",
  648. "new_value": "",
  649. "expected": {
  650. "href": "http://example.net/",
  651. "host": "example.net"
  652. }
  653. },
  654. {
  655. "comment": "The empty host is OK for non-special schemes",
  656. "href": "view-source+http://example.net/foo",
  657. "new_value": "",
  658. "expected": {
  659. "href": "view-source+http:///foo",
  660. "host": ""
  661. }
  662. },
  663. {
  664. "comment": "Path-only URLs can gain a host",
  665. "href": "a:/foo",
  666. "new_value": "example.net",
  667. "expected": {
  668. "href": "a://example.net/foo",
  669. "host": "example.net"
  670. }
  671. },
  672. {
  673. "comment": "Path-only URLs can gain a host",
  674. "href": "a:/foo",
  675. "new_value": "example.net",
  676. "expected": {
  677. "href": "a://example.net/foo",
  678. "host": "example.net"
  679. }
  680. },
  681. {
  682. "comment": "IPv4 address syntax is normalized",
  683. "href": "http://example.net:8080",
  684. "new_value": "0x7F000001",
  685. "expected": {
  686. "href": "http://127.0.0.1:8080/",
  687. "host": "127.0.0.1:8080",
  688. "hostname": "127.0.0.1",
  689. "port": "8080"
  690. }
  691. },
  692. {
  693. "comment": "IPv6 address syntax is normalized",
  694. "href": "http://example.net",
  695. "new_value": "[::0:01]",
  696. "expected": {
  697. "href": "http://[::1]/",
  698. "host": "[::1]",
  699. "hostname": "[::1]",
  700. "port": ""
  701. }
  702. },
  703. {
  704. "comment": "Stuff after a : delimiter is ignored",
  705. "href": "http://example.net/path",
  706. "new_value": "example.com:8080",
  707. "expected": {
  708. "href": "http://example.com/path",
  709. "host": "example.com",
  710. "hostname": "example.com",
  711. "port": ""
  712. }
  713. },
  714. {
  715. "comment": "Stuff after a : delimiter is ignored",
  716. "href": "http://example.net:8080/path",
  717. "new_value": "example.com:",
  718. "expected": {
  719. "href": "http://example.com:8080/path",
  720. "host": "example.com:8080",
  721. "hostname": "example.com",
  722. "port": "8080"
  723. }
  724. },
  725. {
  726. "comment": "Stuff after a / delimiter is ignored",
  727. "href": "http://example.net/path",
  728. "new_value": "example.com/stuff",
  729. "expected": {
  730. "href": "http://example.com/path",
  731. "host": "example.com",
  732. "hostname": "example.com",
  733. "port": ""
  734. }
  735. },
  736. {
  737. "comment": "Stuff after a ? delimiter is ignored",
  738. "href": "http://example.net/path",
  739. "new_value": "example.com?stuff",
  740. "expected": {
  741. "href": "http://example.com/path",
  742. "host": "example.com",
  743. "hostname": "example.com",
  744. "port": ""
  745. }
  746. },
  747. {
  748. "comment": "Stuff after a # delimiter is ignored",
  749. "href": "http://example.net/path",
  750. "new_value": "example.com#stuff",
  751. "expected": {
  752. "href": "http://example.com/path",
  753. "host": "example.com",
  754. "hostname": "example.com",
  755. "port": ""
  756. }
  757. },
  758. {
  759. "comment": "Stuff after a \\ delimiter is ignored for special schemes",
  760. "href": "http://example.net/path",
  761. "new_value": "example.com\\stuff",
  762. "expected": {
  763. "href": "http://example.com/path",
  764. "host": "example.com",
  765. "hostname": "example.com",
  766. "port": ""
  767. }
  768. },
  769. {
  770. "comment": "\\ is not a delimiter for non-special schemes, and it’s invalid in a domain",
  771. "href": "view-source+http://example.net/path",
  772. "new_value": "example.com\\stuff",
  773. "expected": {
  774. "href": "view-source+http://example.net/path",
  775. "host": "example.net",
  776. "hostname": "example.net",
  777. "port": ""
  778. }
  779. }
  780. ],
  781. "port": [
  782. ],
  783. "pathname": [],
  784. "search": [],
  785. "hash": []
  786. }