PageRenderTime 63ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/testing/web-platform/tests/url/resources/urltestdata.json

https://bitbucket.org/vionika/spin.android
JSON | 6670 lines | 6670 code | 0 blank | 0 comment | 0 complexity | 243ef6fb13ffdb7886dcbfb05d59d59b MD5 | raw file
Possible License(s): JSON, 0BSD, AGPL-1.0, BSD-2-Clause, GPL-3.0, LGPL-2.1, LGPL-3.0, CC0-1.0, AGPL-3.0, MPL-2.0, Apache-2.0, MIT, BSD-3-Clause, MPL-2.0-no-copyleft-exception, GPL-2.0, Unlicense
  1. [
  2. "# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/segments.js",
  3. {
  4. "input": "http://example\t.\norg",
  5. "base": "http://example.org/foo/bar",
  6. "href": "http://example.org/",
  7. "origin": "http://example.org",
  8. "protocol": "http:",
  9. "username": "",
  10. "password": "",
  11. "host": "example.org",
  12. "hostname": "example.org",
  13. "port": "",
  14. "pathname": "/",
  15. "search": "",
  16. "hash": ""
  17. },
  18. {
  19. "input": "http://user:pass@foo:21/bar;par?b#c",
  20. "base": "http://example.org/foo/bar",
  21. "href": "http://user:pass@foo:21/bar;par?b#c",
  22. "origin": "http://foo:21",
  23. "protocol": "http:",
  24. "username": "user",
  25. "password": "pass",
  26. "host": "foo:21",
  27. "hostname": "foo",
  28. "port": "21",
  29. "pathname": "/bar;par",
  30. "search": "?b",
  31. "hash": "#c"
  32. },
  33. {
  34. "input": "https://test:@test",
  35. "base": "about:blank",
  36. "href": "https://test@test/",
  37. "origin": "https://test",
  38. "protocol": "https:",
  39. "username": "test",
  40. "password": "",
  41. "host": "test",
  42. "hostname": "test",
  43. "port": "",
  44. "pathname": "/",
  45. "search": "",
  46. "hash": ""
  47. },
  48. {
  49. "input": "https://:@test",
  50. "base": "about:blank",
  51. "href": "https://test/",
  52. "origin": "https://test",
  53. "protocol": "https:",
  54. "username": "",
  55. "password": "",
  56. "host": "test",
  57. "hostname": "test",
  58. "port": "",
  59. "pathname": "/",
  60. "search": "",
  61. "hash": ""
  62. },
  63. {
  64. "input": "non-special://test:@test/x",
  65. "base": "about:blank",
  66. "href": "non-special://test@test/x",
  67. "origin": "null",
  68. "protocol": "non-special:",
  69. "username": "test",
  70. "password": "",
  71. "host": "test",
  72. "hostname": "test",
  73. "port": "",
  74. "pathname": "/x",
  75. "search": "",
  76. "hash": ""
  77. },
  78. {
  79. "input": "non-special://:@test/x",
  80. "base": "about:blank",
  81. "href": "non-special://test/x",
  82. "origin": "null",
  83. "protocol": "non-special:",
  84. "username": "",
  85. "password": "",
  86. "host": "test",
  87. "hostname": "test",
  88. "port": "",
  89. "pathname": "/x",
  90. "search": "",
  91. "hash": ""
  92. },
  93. {
  94. "input": "http:foo.com",
  95. "base": "http://example.org/foo/bar",
  96. "href": "http://example.org/foo/foo.com",
  97. "origin": "http://example.org",
  98. "protocol": "http:",
  99. "username": "",
  100. "password": "",
  101. "host": "example.org",
  102. "hostname": "example.org",
  103. "port": "",
  104. "pathname": "/foo/foo.com",
  105. "search": "",
  106. "hash": ""
  107. },
  108. {
  109. "input": "\t :foo.com \n",
  110. "base": "http://example.org/foo/bar",
  111. "href": "http://example.org/foo/:foo.com",
  112. "origin": "http://example.org",
  113. "protocol": "http:",
  114. "username": "",
  115. "password": "",
  116. "host": "example.org",
  117. "hostname": "example.org",
  118. "port": "",
  119. "pathname": "/foo/:foo.com",
  120. "search": "",
  121. "hash": ""
  122. },
  123. {
  124. "input": " foo.com ",
  125. "base": "http://example.org/foo/bar",
  126. "href": "http://example.org/foo/foo.com",
  127. "origin": "http://example.org",
  128. "protocol": "http:",
  129. "username": "",
  130. "password": "",
  131. "host": "example.org",
  132. "hostname": "example.org",
  133. "port": "",
  134. "pathname": "/foo/foo.com",
  135. "search": "",
  136. "hash": ""
  137. },
  138. {
  139. "input": "a:\t foo.com",
  140. "base": "http://example.org/foo/bar",
  141. "href": "a: foo.com",
  142. "origin": "null",
  143. "protocol": "a:",
  144. "username": "",
  145. "password": "",
  146. "host": "",
  147. "hostname": "",
  148. "port": "",
  149. "pathname": " foo.com",
  150. "search": "",
  151. "hash": ""
  152. },
  153. {
  154. "input": "http://f:21/ b ? d # e ",
  155. "base": "http://example.org/foo/bar",
  156. "href": "http://f:21/%20b%20?%20d%20#%20e",
  157. "origin": "http://f:21",
  158. "protocol": "http:",
  159. "username": "",
  160. "password": "",
  161. "host": "f:21",
  162. "hostname": "f",
  163. "port": "21",
  164. "pathname": "/%20b%20",
  165. "search": "?%20d%20",
  166. "hash": "#%20e"
  167. },
  168. {
  169. "input": "lolscheme:x x#x x",
  170. "base": "about:blank",
  171. "href": "lolscheme:x x#x%20x",
  172. "protocol": "lolscheme:",
  173. "username": "",
  174. "password": "",
  175. "host": "",
  176. "hostname": "",
  177. "port": "",
  178. "pathname": "x x",
  179. "search": "",
  180. "hash": "#x%20x"
  181. },
  182. {
  183. "input": "http://f:/c",
  184. "base": "http://example.org/foo/bar",
  185. "href": "http://f/c",
  186. "origin": "http://f",
  187. "protocol": "http:",
  188. "username": "",
  189. "password": "",
  190. "host": "f",
  191. "hostname": "f",
  192. "port": "",
  193. "pathname": "/c",
  194. "search": "",
  195. "hash": ""
  196. },
  197. {
  198. "input": "http://f:0/c",
  199. "base": "http://example.org/foo/bar",
  200. "href": "http://f:0/c",
  201. "origin": "http://f:0",
  202. "protocol": "http:",
  203. "username": "",
  204. "password": "",
  205. "host": "f:0",
  206. "hostname": "f",
  207. "port": "0",
  208. "pathname": "/c",
  209. "search": "",
  210. "hash": ""
  211. },
  212. {
  213. "input": "http://f:00000000000000/c",
  214. "base": "http://example.org/foo/bar",
  215. "href": "http://f:0/c",
  216. "origin": "http://f:0",
  217. "protocol": "http:",
  218. "username": "",
  219. "password": "",
  220. "host": "f:0",
  221. "hostname": "f",
  222. "port": "0",
  223. "pathname": "/c",
  224. "search": "",
  225. "hash": ""
  226. },
  227. {
  228. "input": "http://f:00000000000000000000080/c",
  229. "base": "http://example.org/foo/bar",
  230. "href": "http://f/c",
  231. "origin": "http://f",
  232. "protocol": "http:",
  233. "username": "",
  234. "password": "",
  235. "host": "f",
  236. "hostname": "f",
  237. "port": "",
  238. "pathname": "/c",
  239. "search": "",
  240. "hash": ""
  241. },
  242. {
  243. "input": "http://f:b/c",
  244. "base": "http://example.org/foo/bar",
  245. "failure": true
  246. },
  247. {
  248. "input": "http://f: /c",
  249. "base": "http://example.org/foo/bar",
  250. "failure": true
  251. },
  252. {
  253. "input": "http://f:\n/c",
  254. "base": "http://example.org/foo/bar",
  255. "href": "http://f/c",
  256. "origin": "http://f",
  257. "protocol": "http:",
  258. "username": "",
  259. "password": "",
  260. "host": "f",
  261. "hostname": "f",
  262. "port": "",
  263. "pathname": "/c",
  264. "search": "",
  265. "hash": ""
  266. },
  267. {
  268. "input": "http://f:fifty-two/c",
  269. "base": "http://example.org/foo/bar",
  270. "failure": true
  271. },
  272. {
  273. "input": "http://f:999999/c",
  274. "base": "http://example.org/foo/bar",
  275. "failure": true
  276. },
  277. {
  278. "input": "non-special://f:999999/c",
  279. "base": "http://example.org/foo/bar",
  280. "failure": true
  281. },
  282. {
  283. "input": "http://f: 21 / b ? d # e ",
  284. "base": "http://example.org/foo/bar",
  285. "failure": true
  286. },
  287. {
  288. "input": "",
  289. "base": "http://example.org/foo/bar",
  290. "href": "http://example.org/foo/bar",
  291. "origin": "http://example.org",
  292. "protocol": "http:",
  293. "username": "",
  294. "password": "",
  295. "host": "example.org",
  296. "hostname": "example.org",
  297. "port": "",
  298. "pathname": "/foo/bar",
  299. "search": "",
  300. "hash": ""
  301. },
  302. {
  303. "input": " \t",
  304. "base": "http://example.org/foo/bar",
  305. "href": "http://example.org/foo/bar",
  306. "origin": "http://example.org",
  307. "protocol": "http:",
  308. "username": "",
  309. "password": "",
  310. "host": "example.org",
  311. "hostname": "example.org",
  312. "port": "",
  313. "pathname": "/foo/bar",
  314. "search": "",
  315. "hash": ""
  316. },
  317. {
  318. "input": ":foo.com/",
  319. "base": "http://example.org/foo/bar",
  320. "href": "http://example.org/foo/:foo.com/",
  321. "origin": "http://example.org",
  322. "protocol": "http:",
  323. "username": "",
  324. "password": "",
  325. "host": "example.org",
  326. "hostname": "example.org",
  327. "port": "",
  328. "pathname": "/foo/:foo.com/",
  329. "search": "",
  330. "hash": ""
  331. },
  332. {
  333. "input": ":foo.com\\",
  334. "base": "http://example.org/foo/bar",
  335. "href": "http://example.org/foo/:foo.com/",
  336. "origin": "http://example.org",
  337. "protocol": "http:",
  338. "username": "",
  339. "password": "",
  340. "host": "example.org",
  341. "hostname": "example.org",
  342. "port": "",
  343. "pathname": "/foo/:foo.com/",
  344. "search": "",
  345. "hash": ""
  346. },
  347. {
  348. "input": ":",
  349. "base": "http://example.org/foo/bar",
  350. "href": "http://example.org/foo/:",
  351. "origin": "http://example.org",
  352. "protocol": "http:",
  353. "username": "",
  354. "password": "",
  355. "host": "example.org",
  356. "hostname": "example.org",
  357. "port": "",
  358. "pathname": "/foo/:",
  359. "search": "",
  360. "hash": ""
  361. },
  362. {
  363. "input": ":a",
  364. "base": "http://example.org/foo/bar",
  365. "href": "http://example.org/foo/:a",
  366. "origin": "http://example.org",
  367. "protocol": "http:",
  368. "username": "",
  369. "password": "",
  370. "host": "example.org",
  371. "hostname": "example.org",
  372. "port": "",
  373. "pathname": "/foo/:a",
  374. "search": "",
  375. "hash": ""
  376. },
  377. {
  378. "input": ":/",
  379. "base": "http://example.org/foo/bar",
  380. "href": "http://example.org/foo/:/",
  381. "origin": "http://example.org",
  382. "protocol": "http:",
  383. "username": "",
  384. "password": "",
  385. "host": "example.org",
  386. "hostname": "example.org",
  387. "port": "",
  388. "pathname": "/foo/:/",
  389. "search": "",
  390. "hash": ""
  391. },
  392. {
  393. "input": ":\\",
  394. "base": "http://example.org/foo/bar",
  395. "href": "http://example.org/foo/:/",
  396. "origin": "http://example.org",
  397. "protocol": "http:",
  398. "username": "",
  399. "password": "",
  400. "host": "example.org",
  401. "hostname": "example.org",
  402. "port": "",
  403. "pathname": "/foo/:/",
  404. "search": "",
  405. "hash": ""
  406. },
  407. {
  408. "input": ":#",
  409. "base": "http://example.org/foo/bar",
  410. "href": "http://example.org/foo/:#",
  411. "origin": "http://example.org",
  412. "protocol": "http:",
  413. "username": "",
  414. "password": "",
  415. "host": "example.org",
  416. "hostname": "example.org",
  417. "port": "",
  418. "pathname": "/foo/:",
  419. "search": "",
  420. "hash": ""
  421. },
  422. {
  423. "input": "#",
  424. "base": "http://example.org/foo/bar",
  425. "href": "http://example.org/foo/bar#",
  426. "origin": "http://example.org",
  427. "protocol": "http:",
  428. "username": "",
  429. "password": "",
  430. "host": "example.org",
  431. "hostname": "example.org",
  432. "port": "",
  433. "pathname": "/foo/bar",
  434. "search": "",
  435. "hash": ""
  436. },
  437. {
  438. "input": "#/",
  439. "base": "http://example.org/foo/bar",
  440. "href": "http://example.org/foo/bar#/",
  441. "origin": "http://example.org",
  442. "protocol": "http:",
  443. "username": "",
  444. "password": "",
  445. "host": "example.org",
  446. "hostname": "example.org",
  447. "port": "",
  448. "pathname": "/foo/bar",
  449. "search": "",
  450. "hash": "#/"
  451. },
  452. {
  453. "input": "#\\",
  454. "base": "http://example.org/foo/bar",
  455. "href": "http://example.org/foo/bar#\\",
  456. "origin": "http://example.org",
  457. "protocol": "http:",
  458. "username": "",
  459. "password": "",
  460. "host": "example.org",
  461. "hostname": "example.org",
  462. "port": "",
  463. "pathname": "/foo/bar",
  464. "search": "",
  465. "hash": "#\\"
  466. },
  467. {
  468. "input": "#;?",
  469. "base": "http://example.org/foo/bar",
  470. "href": "http://example.org/foo/bar#;?",
  471. "origin": "http://example.org",
  472. "protocol": "http:",
  473. "username": "",
  474. "password": "",
  475. "host": "example.org",
  476. "hostname": "example.org",
  477. "port": "",
  478. "pathname": "/foo/bar",
  479. "search": "",
  480. "hash": "#;?"
  481. },
  482. {
  483. "input": "?",
  484. "base": "http://example.org/foo/bar",
  485. "href": "http://example.org/foo/bar?",
  486. "origin": "http://example.org",
  487. "protocol": "http:",
  488. "username": "",
  489. "password": "",
  490. "host": "example.org",
  491. "hostname": "example.org",
  492. "port": "",
  493. "pathname": "/foo/bar",
  494. "search": "",
  495. "hash": ""
  496. },
  497. {
  498. "input": "/",
  499. "base": "http://example.org/foo/bar",
  500. "href": "http://example.org/",
  501. "origin": "http://example.org",
  502. "protocol": "http:",
  503. "username": "",
  504. "password": "",
  505. "host": "example.org",
  506. "hostname": "example.org",
  507. "port": "",
  508. "pathname": "/",
  509. "search": "",
  510. "hash": ""
  511. },
  512. {
  513. "input": ":23",
  514. "base": "http://example.org/foo/bar",
  515. "href": "http://example.org/foo/:23",
  516. "origin": "http://example.org",
  517. "protocol": "http:",
  518. "username": "",
  519. "password": "",
  520. "host": "example.org",
  521. "hostname": "example.org",
  522. "port": "",
  523. "pathname": "/foo/:23",
  524. "search": "",
  525. "hash": ""
  526. },
  527. {
  528. "input": "/:23",
  529. "base": "http://example.org/foo/bar",
  530. "href": "http://example.org/:23",
  531. "origin": "http://example.org",
  532. "protocol": "http:",
  533. "username": "",
  534. "password": "",
  535. "host": "example.org",
  536. "hostname": "example.org",
  537. "port": "",
  538. "pathname": "/:23",
  539. "search": "",
  540. "hash": ""
  541. },
  542. {
  543. "input": "::",
  544. "base": "http://example.org/foo/bar",
  545. "href": "http://example.org/foo/::",
  546. "origin": "http://example.org",
  547. "protocol": "http:",
  548. "username": "",
  549. "password": "",
  550. "host": "example.org",
  551. "hostname": "example.org",
  552. "port": "",
  553. "pathname": "/foo/::",
  554. "search": "",
  555. "hash": ""
  556. },
  557. {
  558. "input": "::23",
  559. "base": "http://example.org/foo/bar",
  560. "href": "http://example.org/foo/::23",
  561. "origin": "http://example.org",
  562. "protocol": "http:",
  563. "username": "",
  564. "password": "",
  565. "host": "example.org",
  566. "hostname": "example.org",
  567. "port": "",
  568. "pathname": "/foo/::23",
  569. "search": "",
  570. "hash": ""
  571. },
  572. {
  573. "input": "foo://",
  574. "base": "http://example.org/foo/bar",
  575. "href": "foo://",
  576. "origin": "null",
  577. "protocol": "foo:",
  578. "username": "",
  579. "password": "",
  580. "host": "",
  581. "hostname": "",
  582. "port": "",
  583. "pathname": "",
  584. "search": "",
  585. "hash": ""
  586. },
  587. {
  588. "input": "http://a:b@c:29/d",
  589. "base": "http://example.org/foo/bar",
  590. "href": "http://a:b@c:29/d",
  591. "origin": "http://c:29",
  592. "protocol": "http:",
  593. "username": "a",
  594. "password": "b",
  595. "host": "c:29",
  596. "hostname": "c",
  597. "port": "29",
  598. "pathname": "/d",
  599. "search": "",
  600. "hash": ""
  601. },
  602. {
  603. "input": "http::@c:29",
  604. "base": "http://example.org/foo/bar",
  605. "href": "http://example.org/foo/:@c:29",
  606. "origin": "http://example.org",
  607. "protocol": "http:",
  608. "username": "",
  609. "password": "",
  610. "host": "example.org",
  611. "hostname": "example.org",
  612. "port": "",
  613. "pathname": "/foo/:@c:29",
  614. "search": "",
  615. "hash": ""
  616. },
  617. {
  618. "input": "http://&a:foo(b]c@d:2/",
  619. "base": "http://example.org/foo/bar",
  620. "href": "http://&a:foo(b%5Dc@d:2/",
  621. "origin": "http://d:2",
  622. "protocol": "http:",
  623. "username": "&a",
  624. "password": "foo(b%5Dc",
  625. "host": "d:2",
  626. "hostname": "d",
  627. "port": "2",
  628. "pathname": "/",
  629. "search": "",
  630. "hash": ""
  631. },
  632. {
  633. "input": "http://::@c@d:2",
  634. "base": "http://example.org/foo/bar",
  635. "href": "http://:%3A%40c@d:2/",
  636. "origin": "http://d:2",
  637. "protocol": "http:",
  638. "username": "",
  639. "password": "%3A%40c",
  640. "host": "d:2",
  641. "hostname": "d",
  642. "port": "2",
  643. "pathname": "/",
  644. "search": "",
  645. "hash": ""
  646. },
  647. {
  648. "input": "http://foo.com:b@d/",
  649. "base": "http://example.org/foo/bar",
  650. "href": "http://foo.com:b@d/",
  651. "origin": "http://d",
  652. "protocol": "http:",
  653. "username": "foo.com",
  654. "password": "b",
  655. "host": "d",
  656. "hostname": "d",
  657. "port": "",
  658. "pathname": "/",
  659. "search": "",
  660. "hash": ""
  661. },
  662. {
  663. "input": "http://foo.com/\\@",
  664. "base": "http://example.org/foo/bar",
  665. "href": "http://foo.com//@",
  666. "origin": "http://foo.com",
  667. "protocol": "http:",
  668. "username": "",
  669. "password": "",
  670. "host": "foo.com",
  671. "hostname": "foo.com",
  672. "port": "",
  673. "pathname": "//@",
  674. "search": "",
  675. "hash": ""
  676. },
  677. {
  678. "input": "http:\\\\foo.com\\",
  679. "base": "http://example.org/foo/bar",
  680. "href": "http://foo.com/",
  681. "origin": "http://foo.com",
  682. "protocol": "http:",
  683. "username": "",
  684. "password": "",
  685. "host": "foo.com",
  686. "hostname": "foo.com",
  687. "port": "",
  688. "pathname": "/",
  689. "search": "",
  690. "hash": ""
  691. },
  692. {
  693. "input": "http:\\\\a\\b:c\\d@foo.com\\",
  694. "base": "http://example.org/foo/bar",
  695. "href": "http://a/b:c/d@foo.com/",
  696. "origin": "http://a",
  697. "protocol": "http:",
  698. "username": "",
  699. "password": "",
  700. "host": "a",
  701. "hostname": "a",
  702. "port": "",
  703. "pathname": "/b:c/d@foo.com/",
  704. "search": "",
  705. "hash": ""
  706. },
  707. {
  708. "input": "foo:/",
  709. "base": "http://example.org/foo/bar",
  710. "href": "foo:/",
  711. "origin": "null",
  712. "protocol": "foo:",
  713. "username": "",
  714. "password": "",
  715. "host": "",
  716. "hostname": "",
  717. "port": "",
  718. "pathname": "/",
  719. "search": "",
  720. "hash": ""
  721. },
  722. {
  723. "input": "foo:/bar.com/",
  724. "base": "http://example.org/foo/bar",
  725. "href": "foo:/bar.com/",
  726. "origin": "null",
  727. "protocol": "foo:",
  728. "username": "",
  729. "password": "",
  730. "host": "",
  731. "hostname": "",
  732. "port": "",
  733. "pathname": "/bar.com/",
  734. "search": "",
  735. "hash": ""
  736. },
  737. {
  738. "input": "foo://///////",
  739. "base": "http://example.org/foo/bar",
  740. "href": "foo://///////",
  741. "origin": "null",
  742. "protocol": "foo:",
  743. "username": "",
  744. "password": "",
  745. "host": "",
  746. "hostname": "",
  747. "port": "",
  748. "pathname": "///////",
  749. "search": "",
  750. "hash": ""
  751. },
  752. {
  753. "input": "foo://///////bar.com/",
  754. "base": "http://example.org/foo/bar",
  755. "href": "foo://///////bar.com/",
  756. "origin": "null",
  757. "protocol": "foo:",
  758. "username": "",
  759. "password": "",
  760. "host": "",
  761. "hostname": "",
  762. "port": "",
  763. "pathname": "///////bar.com/",
  764. "search": "",
  765. "hash": ""
  766. },
  767. {
  768. "input": "foo:////://///",
  769. "base": "http://example.org/foo/bar",
  770. "href": "foo:////://///",
  771. "origin": "null",
  772. "protocol": "foo:",
  773. "username": "",
  774. "password": "",
  775. "host": "",
  776. "hostname": "",
  777. "port": "",
  778. "pathname": "//://///",
  779. "search": "",
  780. "hash": ""
  781. },
  782. {
  783. "input": "c:/foo",
  784. "base": "http://example.org/foo/bar",
  785. "href": "c:/foo",
  786. "origin": "null",
  787. "protocol": "c:",
  788. "username": "",
  789. "password": "",
  790. "host": "",
  791. "hostname": "",
  792. "port": "",
  793. "pathname": "/foo",
  794. "search": "",
  795. "hash": ""
  796. },
  797. {
  798. "input": "//foo/bar",
  799. "base": "http://example.org/foo/bar",
  800. "href": "http://foo/bar",
  801. "origin": "http://foo",
  802. "protocol": "http:",
  803. "username": "",
  804. "password": "",
  805. "host": "foo",
  806. "hostname": "foo",
  807. "port": "",
  808. "pathname": "/bar",
  809. "search": "",
  810. "hash": ""
  811. },
  812. {
  813. "input": "http://foo/path;a??e#f#g",
  814. "base": "http://example.org/foo/bar",
  815. "href": "http://foo/path;a??e#f#g",
  816. "origin": "http://foo",
  817. "protocol": "http:",
  818. "username": "",
  819. "password": "",
  820. "host": "foo",
  821. "hostname": "foo",
  822. "port": "",
  823. "pathname": "/path;a",
  824. "search": "??e",
  825. "hash": "#f#g"
  826. },
  827. {
  828. "input": "http://foo/abcd?efgh?ijkl",
  829. "base": "http://example.org/foo/bar",
  830. "href": "http://foo/abcd?efgh?ijkl",
  831. "origin": "http://foo",
  832. "protocol": "http:",
  833. "username": "",
  834. "password": "",
  835. "host": "foo",
  836. "hostname": "foo",
  837. "port": "",
  838. "pathname": "/abcd",
  839. "search": "?efgh?ijkl",
  840. "hash": ""
  841. },
  842. {
  843. "input": "http://foo/abcd#foo?bar",
  844. "base": "http://example.org/foo/bar",
  845. "href": "http://foo/abcd#foo?bar",
  846. "origin": "http://foo",
  847. "protocol": "http:",
  848. "username": "",
  849. "password": "",
  850. "host": "foo",
  851. "hostname": "foo",
  852. "port": "",
  853. "pathname": "/abcd",
  854. "search": "",
  855. "hash": "#foo?bar"
  856. },
  857. {
  858. "input": "[61:24:74]:98",
  859. "base": "http://example.org/foo/bar",
  860. "href": "http://example.org/foo/[61:24:74]:98",
  861. "origin": "http://example.org",
  862. "protocol": "http:",
  863. "username": "",
  864. "password": "",
  865. "host": "example.org",
  866. "hostname": "example.org",
  867. "port": "",
  868. "pathname": "/foo/[61:24:74]:98",
  869. "search": "",
  870. "hash": ""
  871. },
  872. {
  873. "input": "http:[61:27]/:foo",
  874. "base": "http://example.org/foo/bar",
  875. "href": "http://example.org/foo/[61:27]/:foo",
  876. "origin": "http://example.org",
  877. "protocol": "http:",
  878. "username": "",
  879. "password": "",
  880. "host": "example.org",
  881. "hostname": "example.org",
  882. "port": "",
  883. "pathname": "/foo/[61:27]/:foo",
  884. "search": "",
  885. "hash": ""
  886. },
  887. {
  888. "input": "http://[1::2]:3:4",
  889. "base": "http://example.org/foo/bar",
  890. "failure": true
  891. },
  892. {
  893. "input": "http://2001::1",
  894. "base": "http://example.org/foo/bar",
  895. "failure": true
  896. },
  897. {
  898. "input": "http://2001::1]",
  899. "base": "http://example.org/foo/bar",
  900. "failure": true
  901. },
  902. {
  903. "input": "http://2001::1]:80",
  904. "base": "http://example.org/foo/bar",
  905. "failure": true
  906. },
  907. {
  908. "input": "http://[2001::1]",
  909. "base": "http://example.org/foo/bar",
  910. "href": "http://[2001::1]/",
  911. "origin": "http://[2001::1]",
  912. "protocol": "http:",
  913. "username": "",
  914. "password": "",
  915. "host": "[2001::1]",
  916. "hostname": "[2001::1]",
  917. "port": "",
  918. "pathname": "/",
  919. "search": "",
  920. "hash": ""
  921. },
  922. {
  923. "input": "http://[::127.0.0.1]",
  924. "base": "http://example.org/foo/bar",
  925. "href": "http://[::7f00:1]/",
  926. "origin": "http://[::7f00:1]",
  927. "protocol": "http:",
  928. "username": "",
  929. "password": "",
  930. "host": "[::7f00:1]",
  931. "hostname": "[::7f00:1]",
  932. "port": "",
  933. "pathname": "/",
  934. "search": "",
  935. "hash": ""
  936. },
  937. {
  938. "input": "http://[0:0:0:0:0:0:13.1.68.3]",
  939. "base": "http://example.org/foo/bar",
  940. "href": "http://[::d01:4403]/",
  941. "origin": "http://[::d01:4403]",
  942. "protocol": "http:",
  943. "username": "",
  944. "password": "",
  945. "host": "[::d01:4403]",
  946. "hostname": "[::d01:4403]",
  947. "port": "",
  948. "pathname": "/",
  949. "search": "",
  950. "hash": ""
  951. },
  952. {
  953. "input": "http://[2001::1]:80",
  954. "base": "http://example.org/foo/bar",
  955. "href": "http://[2001::1]/",
  956. "origin": "http://[2001::1]",
  957. "protocol": "http:",
  958. "username": "",
  959. "password": "",
  960. "host": "[2001::1]",
  961. "hostname": "[2001::1]",
  962. "port": "",
  963. "pathname": "/",
  964. "search": "",
  965. "hash": ""
  966. },
  967. {
  968. "input": "http:/example.com/",
  969. "base": "http://example.org/foo/bar",
  970. "href": "http://example.org/example.com/",
  971. "origin": "http://example.org",
  972. "protocol": "http:",
  973. "username": "",
  974. "password": "",
  975. "host": "example.org",
  976. "hostname": "example.org",
  977. "port": "",
  978. "pathname": "/example.com/",
  979. "search": "",
  980. "hash": ""
  981. },
  982. {
  983. "input": "ftp:/example.com/",
  984. "base": "http://example.org/foo/bar",
  985. "href": "ftp://example.com/",
  986. "origin": "ftp://example.com",
  987. "protocol": "ftp:",
  988. "username": "",
  989. "password": "",
  990. "host": "example.com",
  991. "hostname": "example.com",
  992. "port": "",
  993. "pathname": "/",
  994. "search": "",
  995. "hash": ""
  996. },
  997. {
  998. "input": "https:/example.com/",
  999. "base": "http://example.org/foo/bar",
  1000. "href": "https://example.com/",
  1001. "origin": "https://example.com",
  1002. "protocol": "https:",
  1003. "username": "",
  1004. "password": "",
  1005. "host": "example.com",
  1006. "hostname": "example.com",
  1007. "port": "",
  1008. "pathname": "/",
  1009. "search": "",
  1010. "hash": ""
  1011. },
  1012. {
  1013. "input": "madeupscheme:/example.com/",
  1014. "base": "http://example.org/foo/bar",
  1015. "href": "madeupscheme:/example.com/",
  1016. "origin": "null",
  1017. "protocol": "madeupscheme:",
  1018. "username": "",
  1019. "password": "",
  1020. "host": "",
  1021. "hostname": "",
  1022. "port": "",
  1023. "pathname": "/example.com/",
  1024. "search": "",
  1025. "hash": ""
  1026. },
  1027. {
  1028. "input": "file:/example.com/",
  1029. "base": "http://example.org/foo/bar",
  1030. "href": "file:///example.com/",
  1031. "protocol": "file:",
  1032. "username": "",
  1033. "password": "",
  1034. "host": "",
  1035. "hostname": "",
  1036. "port": "",
  1037. "pathname": "/example.com/",
  1038. "search": "",
  1039. "hash": ""
  1040. },
  1041. {
  1042. "input": "file://example:1/",
  1043. "base": "about:blank",
  1044. "failure": true
  1045. },
  1046. {
  1047. "input": "file://example:test/",
  1048. "base": "about:blank",
  1049. "failure": true
  1050. },
  1051. {
  1052. "input": "file://example%/",
  1053. "base": "about:blank",
  1054. "failure": true
  1055. },
  1056. {
  1057. "input": "file://[example]/",
  1058. "base": "about:blank",
  1059. "failure": true
  1060. },
  1061. {
  1062. "input": "ftps:/example.com/",
  1063. "base": "http://example.org/foo/bar",
  1064. "href": "ftps:/example.com/",
  1065. "origin": "null",
  1066. "protocol": "ftps:",
  1067. "username": "",
  1068. "password": "",
  1069. "host": "",
  1070. "hostname": "",
  1071. "port": "",
  1072. "pathname": "/example.com/",
  1073. "search": "",
  1074. "hash": ""
  1075. },
  1076. {
  1077. "input": "gopher:/example.com/",
  1078. "base": "http://example.org/foo/bar",
  1079. "href": "gopher://example.com/",
  1080. "origin": "gopher://example.com",
  1081. "protocol": "gopher:",
  1082. "username": "",
  1083. "password": "",
  1084. "host": "example.com",
  1085. "hostname": "example.com",
  1086. "port": "",
  1087. "pathname": "/",
  1088. "search": "",
  1089. "hash": ""
  1090. },
  1091. {
  1092. "input": "ws:/example.com/",
  1093. "base": "http://example.org/foo/bar",
  1094. "href": "ws://example.com/",
  1095. "origin": "ws://example.com",
  1096. "protocol": "ws:",
  1097. "username": "",
  1098. "password": "",
  1099. "host": "example.com",
  1100. "hostname": "example.com",
  1101. "port": "",
  1102. "pathname": "/",
  1103. "search": "",
  1104. "hash": ""
  1105. },
  1106. {
  1107. "input": "wss:/example.com/",
  1108. "base": "http://example.org/foo/bar",
  1109. "href": "wss://example.com/",
  1110. "origin": "wss://example.com",
  1111. "protocol": "wss:",
  1112. "username": "",
  1113. "password": "",
  1114. "host": "example.com",
  1115. "hostname": "example.com",
  1116. "port": "",
  1117. "pathname": "/",
  1118. "search": "",
  1119. "hash": ""
  1120. },
  1121. {
  1122. "input": "data:/example.com/",
  1123. "base": "http://example.org/foo/bar",
  1124. "href": "data:/example.com/",
  1125. "origin": "null",
  1126. "protocol": "data:",
  1127. "username": "",
  1128. "password": "",
  1129. "host": "",
  1130. "hostname": "",
  1131. "port": "",
  1132. "pathname": "/example.com/",
  1133. "search": "",
  1134. "hash": ""
  1135. },
  1136. {
  1137. "input": "javascript:/example.com/",
  1138. "base": "http://example.org/foo/bar",
  1139. "href": "javascript:/example.com/",
  1140. "origin": "null",
  1141. "protocol": "javascript:",
  1142. "username": "",
  1143. "password": "",
  1144. "host": "",
  1145. "hostname": "",
  1146. "port": "",
  1147. "pathname": "/example.com/",
  1148. "search": "",
  1149. "hash": ""
  1150. },
  1151. {
  1152. "input": "mailto:/example.com/",
  1153. "base": "http://example.org/foo/bar",
  1154. "href": "mailto:/example.com/",
  1155. "origin": "null",
  1156. "protocol": "mailto:",
  1157. "username": "",
  1158. "password": "",
  1159. "host": "",
  1160. "hostname": "",
  1161. "port": "",
  1162. "pathname": "/example.com/",
  1163. "search": "",
  1164. "hash": ""
  1165. },
  1166. {
  1167. "input": "http:example.com/",
  1168. "base": "http://example.org/foo/bar",
  1169. "href": "http://example.org/foo/example.com/",
  1170. "origin": "http://example.org",
  1171. "protocol": "http:",
  1172. "username": "",
  1173. "password": "",
  1174. "host": "example.org",
  1175. "hostname": "example.org",
  1176. "port": "",
  1177. "pathname": "/foo/example.com/",
  1178. "search": "",
  1179. "hash": ""
  1180. },
  1181. {
  1182. "input": "ftp:example.com/",
  1183. "base": "http://example.org/foo/bar",
  1184. "href": "ftp://example.com/",
  1185. "origin": "ftp://example.com",
  1186. "protocol": "ftp:",
  1187. "username": "",
  1188. "password": "",
  1189. "host": "example.com",
  1190. "hostname": "example.com",
  1191. "port": "",
  1192. "pathname": "/",
  1193. "search": "",
  1194. "hash": ""
  1195. },
  1196. {
  1197. "input": "https:example.com/",
  1198. "base": "http://example.org/foo/bar",
  1199. "href": "https://example.com/",
  1200. "origin": "https://example.com",
  1201. "protocol": "https:",
  1202. "username": "",
  1203. "password": "",
  1204. "host": "example.com",
  1205. "hostname": "example.com",
  1206. "port": "",
  1207. "pathname": "/",
  1208. "search": "",
  1209. "hash": ""
  1210. },
  1211. {
  1212. "input": "madeupscheme:example.com/",
  1213. "base": "http://example.org/foo/bar",
  1214. "href": "madeupscheme:example.com/",
  1215. "origin": "null",
  1216. "protocol": "madeupscheme:",
  1217. "username": "",
  1218. "password": "",
  1219. "host": "",
  1220. "hostname": "",
  1221. "port": "",
  1222. "pathname": "example.com/",
  1223. "search": "",
  1224. "hash": ""
  1225. },
  1226. {
  1227. "input": "ftps:example.com/",
  1228. "base": "http://example.org/foo/bar",
  1229. "href": "ftps:example.com/",
  1230. "origin": "null",
  1231. "protocol": "ftps:",
  1232. "username": "",
  1233. "password": "",
  1234. "host": "",
  1235. "hostname": "",
  1236. "port": "",
  1237. "pathname": "example.com/",
  1238. "search": "",
  1239. "hash": ""
  1240. },
  1241. {
  1242. "input": "gopher:example.com/",
  1243. "base": "http://example.org/foo/bar",
  1244. "href": "gopher://example.com/",
  1245. "origin": "gopher://example.com",
  1246. "protocol": "gopher:",
  1247. "username": "",
  1248. "password": "",
  1249. "host": "example.com",
  1250. "hostname": "example.com",
  1251. "port": "",
  1252. "pathname": "/",
  1253. "search": "",
  1254. "hash": ""
  1255. },
  1256. {
  1257. "input": "ws:example.com/",
  1258. "base": "http://example.org/foo/bar",
  1259. "href": "ws://example.com/",
  1260. "origin": "ws://example.com",
  1261. "protocol": "ws:",
  1262. "username": "",
  1263. "password": "",
  1264. "host": "example.com",
  1265. "hostname": "example.com",
  1266. "port": "",
  1267. "pathname": "/",
  1268. "search": "",
  1269. "hash": ""
  1270. },
  1271. {
  1272. "input": "wss:example.com/",
  1273. "base": "http://example.org/foo/bar",
  1274. "href": "wss://example.com/",
  1275. "origin": "wss://example.com",
  1276. "protocol": "wss:",
  1277. "username": "",
  1278. "password": "",
  1279. "host": "example.com",
  1280. "hostname": "example.com",
  1281. "port": "",
  1282. "pathname": "/",
  1283. "search": "",
  1284. "hash": ""
  1285. },
  1286. {
  1287. "input": "data:example.com/",
  1288. "base": "http://example.org/foo/bar",
  1289. "href": "data:example.com/",
  1290. "origin": "null",
  1291. "protocol": "data:",
  1292. "username": "",
  1293. "password": "",
  1294. "host": "",
  1295. "hostname": "",
  1296. "port": "",
  1297. "pathname": "example.com/",
  1298. "search": "",
  1299. "hash": ""
  1300. },
  1301. {
  1302. "input": "javascript:example.com/",
  1303. "base": "http://example.org/foo/bar",
  1304. "href": "javascript:example.com/",
  1305. "origin": "null",
  1306. "protocol": "javascript:",
  1307. "username": "",
  1308. "password": "",
  1309. "host": "",
  1310. "hostname": "",
  1311. "port": "",
  1312. "pathname": "example.com/",
  1313. "search": "",
  1314. "hash": ""
  1315. },
  1316. {
  1317. "input": "mailto:example.com/",
  1318. "base": "http://example.org/foo/bar",
  1319. "href": "mailto:example.com/",
  1320. "origin": "null",
  1321. "protocol": "mailto:",
  1322. "username": "",
  1323. "password": "",
  1324. "host": "",
  1325. "hostname": "",
  1326. "port": "",
  1327. "pathname": "example.com/",
  1328. "search": "",
  1329. "hash": ""
  1330. },
  1331. {
  1332. "input": "/a/b/c",
  1333. "base": "http://example.org/foo/bar",
  1334. "href": "http://example.org/a/b/c",
  1335. "origin": "http://example.org",
  1336. "protocol": "http:",
  1337. "username": "",
  1338. "password": "",
  1339. "host": "example.org",
  1340. "hostname": "example.org",
  1341. "port": "",
  1342. "pathname": "/a/b/c",
  1343. "search": "",
  1344. "hash": ""
  1345. },
  1346. {
  1347. "input": "/a/ /c",
  1348. "base": "http://example.org/foo/bar",
  1349. "href": "http://example.org/a/%20/c",
  1350. "origin": "http://example.org",
  1351. "protocol": "http:",
  1352. "username": "",
  1353. "password": "",
  1354. "host": "example.org",
  1355. "hostname": "example.org",
  1356. "port": "",
  1357. "pathname": "/a/%20/c",
  1358. "search": "",
  1359. "hash": ""
  1360. },
  1361. {
  1362. "input": "/a%2fc",
  1363. "base": "http://example.org/foo/bar",
  1364. "href": "http://example.org/a%2fc",
  1365. "origin": "http://example.org",
  1366. "protocol": "http:",
  1367. "username": "",
  1368. "password": "",
  1369. "host": "example.org",
  1370. "hostname": "example.org",
  1371. "port": "",
  1372. "pathname": "/a%2fc",
  1373. "search": "",
  1374. "hash": ""
  1375. },
  1376. {
  1377. "input": "/a/%2f/c",
  1378. "base": "http://example.org/foo/bar",
  1379. "href": "http://example.org/a/%2f/c",
  1380. "origin": "http://example.org",
  1381. "protocol": "http:",
  1382. "username": "",
  1383. "password": "",
  1384. "host": "example.org",
  1385. "hostname": "example.org",
  1386. "port": "",
  1387. "pathname": "/a/%2f/c",
  1388. "search": "",
  1389. "hash": ""
  1390. },
  1391. {
  1392. "input": "#β",
  1393. "base": "http://example.org/foo/bar",
  1394. "href": "http://example.org/foo/bar#%CE%B2",
  1395. "origin": "http://example.org",
  1396. "protocol": "http:",
  1397. "username": "",
  1398. "password": "",
  1399. "host": "example.org",
  1400. "hostname": "example.org",
  1401. "port": "",
  1402. "pathname": "/foo/bar",
  1403. "search": "",
  1404. "hash": "#%CE%B2"
  1405. },
  1406. {
  1407. "input": "data:text/html,test#test",
  1408. "base": "http://example.org/foo/bar",
  1409. "href": "data:text/html,test#test",
  1410. "origin": "null",
  1411. "protocol": "data:",
  1412. "username": "",
  1413. "password": "",
  1414. "host": "",
  1415. "hostname": "",
  1416. "port": "",
  1417. "pathname": "text/html,test",
  1418. "search": "",
  1419. "hash": "#test"
  1420. },
  1421. {
  1422. "input": "tel:1234567890",
  1423. "base": "http://example.org/foo/bar",
  1424. "href": "tel:1234567890",
  1425. "origin": "null",
  1426. "protocol": "tel:",
  1427. "username": "",
  1428. "password": "",
  1429. "host": "",
  1430. "hostname": "",
  1431. "port": "",
  1432. "pathname": "1234567890",
  1433. "search": "",
  1434. "hash": ""
  1435. },
  1436. "# Based on https://felixfbecker.github.io/whatwg-url-custom-host-repro/",
  1437. {
  1438. "input": "ssh://example.com/foo/bar.git",
  1439. "base": "http://example.org/",
  1440. "href": "ssh://example.com/foo/bar.git",
  1441. "origin": "null",
  1442. "protocol": "ssh:",
  1443. "username": "",
  1444. "password": "",
  1445. "host": "example.com",
  1446. "hostname": "example.com",
  1447. "port": "",
  1448. "pathname": "/foo/bar.git",
  1449. "search": "",
  1450. "hash": ""
  1451. },
  1452. "# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/file.html",
  1453. {
  1454. "input": "file:c:\\foo\\bar.html",
  1455. "base": "file:///tmp/mock/path",
  1456. "href": "file:///c:/foo/bar.html",
  1457. "protocol": "file:",
  1458. "username": "",
  1459. "password": "",
  1460. "host": "",
  1461. "hostname": "",
  1462. "port": "",
  1463. "pathname": "/c:/foo/bar.html",
  1464. "search": "",
  1465. "hash": ""
  1466. },
  1467. {
  1468. "input": " File:c|////foo\\bar.html",
  1469. "base": "file:///tmp/mock/path",
  1470. "href": "file:///c:////foo/bar.html",
  1471. "protocol": "file:",
  1472. "username": "",
  1473. "password": "",
  1474. "host": "",
  1475. "hostname": "",
  1476. "port": "",
  1477. "pathname": "/c:////foo/bar.html",
  1478. "search": "",
  1479. "hash": ""
  1480. },
  1481. {
  1482. "input": "C|/foo/bar",
  1483. "base": "file:///tmp/mock/path",
  1484. "href": "file:///C:/foo/bar",
  1485. "protocol": "file:",
  1486. "username": "",
  1487. "password": "",
  1488. "host": "",
  1489. "hostname": "",
  1490. "port": "",
  1491. "pathname": "/C:/foo/bar",
  1492. "search": "",
  1493. "hash": ""
  1494. },
  1495. {
  1496. "input": "/C|\\foo\\bar",
  1497. "base": "file:///tmp/mock/path",
  1498. "href": "file:///C:/foo/bar",
  1499. "protocol": "file:",
  1500. "username": "",
  1501. "password": "",
  1502. "host": "",
  1503. "hostname": "",
  1504. "port": "",
  1505. "pathname": "/C:/foo/bar",
  1506. "search": "",
  1507. "hash": ""
  1508. },
  1509. {
  1510. "input": "//C|/foo/bar",
  1511. "base": "file:///tmp/mock/path",
  1512. "href": "file:///C:/foo/bar",
  1513. "protocol": "file:",
  1514. "username": "",
  1515. "password": "",
  1516. "host": "",
  1517. "hostname": "",
  1518. "port": "",
  1519. "pathname": "/C:/foo/bar",
  1520. "search": "",
  1521. "hash": ""
  1522. },
  1523. {
  1524. "input": "//server/file",
  1525. "base": "file:///tmp/mock/path",
  1526. "href": "file://server/file",
  1527. "protocol": "file:",
  1528. "username": "",
  1529. "password": "",
  1530. "host": "server",
  1531. "hostname": "server",
  1532. "port": "",
  1533. "pathname": "/file",
  1534. "search": "",
  1535. "hash": ""
  1536. },
  1537. {
  1538. "input": "\\\\server\\file",
  1539. "base": "file:///tmp/mock/path",
  1540. "href": "file://server/file",
  1541. "protocol": "file:",
  1542. "username": "",
  1543. "password": "",
  1544. "host": "server",
  1545. "hostname": "server",
  1546. "port": "",
  1547. "pathname": "/file",
  1548. "search": "",
  1549. "hash": ""
  1550. },
  1551. {
  1552. "input": "/\\server/file",
  1553. "base": "file:///tmp/mock/path",
  1554. "href": "file://server/file",
  1555. "protocol": "file:",
  1556. "username": "",
  1557. "password": "",
  1558. "host": "server",
  1559. "hostname": "server",
  1560. "port": "",
  1561. "pathname": "/file",
  1562. "search": "",
  1563. "hash": ""
  1564. },
  1565. {
  1566. "input": "file:///foo/bar.txt",
  1567. "base": "file:///tmp/mock/path",
  1568. "href": "file:///foo/bar.txt",
  1569. "protocol": "file:",
  1570. "username": "",
  1571. "password": "",
  1572. "host": "",
  1573. "hostname": "",
  1574. "port": "",
  1575. "pathname": "/foo/bar.txt",
  1576. "search": "",
  1577. "hash": ""
  1578. },
  1579. {
  1580. "input": "file:///home/me",
  1581. "base": "file:///tmp/mock/path",
  1582. "href": "file:///home/me",
  1583. "protocol": "file:",
  1584. "username": "",
  1585. "password": "",
  1586. "host": "",
  1587. "hostname": "",
  1588. "port": "",
  1589. "pathname": "/home/me",
  1590. "search": "",
  1591. "hash": ""
  1592. },
  1593. {
  1594. "input": "//",
  1595. "base": "file:///tmp/mock/path",
  1596. "href": "file:///",
  1597. "protocol": "file:",
  1598. "username": "",
  1599. "password": "",
  1600. "host": "",
  1601. "hostname": "",
  1602. "port": "",
  1603. "pathname": "/",
  1604. "search": "",
  1605. "hash": ""
  1606. },
  1607. {
  1608. "input": "///",
  1609. "base": "file:///tmp/mock/path",
  1610. "href": "file:///",
  1611. "protocol": "file:",
  1612. "username": "",
  1613. "password": "",
  1614. "host": "",
  1615. "hostname": "",
  1616. "port": "",
  1617. "pathname": "/",
  1618. "search": "",
  1619. "hash": ""
  1620. },
  1621. {
  1622. "input": "///test",
  1623. "base": "file:///tmp/mock/path",
  1624. "href": "file:///test",
  1625. "protocol": "file:",
  1626. "username": "",
  1627. "password": "",
  1628. "host": "",
  1629. "hostname": "",
  1630. "port": "",
  1631. "pathname": "/test",
  1632. "search": "",
  1633. "hash": ""
  1634. },
  1635. {
  1636. "input": "file://test",
  1637. "base": "file:///tmp/mock/path",
  1638. "href": "file://test/",
  1639. "protocol": "file:",
  1640. "username": "",
  1641. "password": "",
  1642. "host": "test",
  1643. "hostname": "test",
  1644. "port": "",
  1645. "pathname": "/",
  1646. "search": "",
  1647. "hash": ""
  1648. },
  1649. {
  1650. "input": "file://localhost",
  1651. "base": "file:///tmp/mock/path",
  1652. "href": "file:///",
  1653. "protocol": "file:",
  1654. "username": "",
  1655. "password": "",
  1656. "host": "",
  1657. "hostname": "",
  1658. "port": "",
  1659. "pathname": "/",
  1660. "search": "",
  1661. "hash": ""
  1662. },
  1663. {
  1664. "input": "file://localhost/",
  1665. "base": "file:///tmp/mock/path",
  1666. "href": "file:///",
  1667. "protocol": "file:",
  1668. "username": "",
  1669. "password": "",
  1670. "host": "",
  1671. "hostname": "",
  1672. "port": "",
  1673. "pathname": "/",
  1674. "search": "",
  1675. "hash": ""
  1676. },
  1677. {
  1678. "input": "file://localhost/test",
  1679. "base": "file:///tmp/mock/path",
  1680. "href": "file:///test",
  1681. "protocol": "file:",
  1682. "username": "",
  1683. "password": "",
  1684. "host": "",
  1685. "hostname": "",
  1686. "port": "",
  1687. "pathname": "/test",
  1688. "search": "",
  1689. "hash": ""
  1690. },
  1691. {
  1692. "input": "test",
  1693. "base": "file:///tmp/mock/path",
  1694. "href": "file:///tmp/mock/test",
  1695. "protocol": "file:",
  1696. "username": "",
  1697. "password": "",
  1698. "host": "",
  1699. "hostname": "",
  1700. "port": "",
  1701. "pathname": "/tmp/mock/test",
  1702. "search": "",
  1703. "hash": ""
  1704. },
  1705. {
  1706. "input": "file:test",
  1707. "base": "file:///tmp/mock/path",
  1708. "href": "file:///tmp/mock/test",
  1709. "protocol": "file:",
  1710. "username": "",
  1711. "password": "",
  1712. "host": "",
  1713. "hostname": "",
  1714. "port": "",
  1715. "pathname": "/tmp/mock/test",
  1716. "search": "",
  1717. "hash": ""
  1718. },
  1719. "# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/path.js",
  1720. {
  1721. "input": "http://example.com/././foo",
  1722. "base": "about:blank",
  1723. "href": "http://example.com/foo",
  1724. "origin": "http://example.com",
  1725. "protocol": "http:",
  1726. "username": "",
  1727. "password": "",
  1728. "host": "example.com",
  1729. "hostname": "example.com",
  1730. "port": "",
  1731. "pathname": "/foo",
  1732. "search": "",
  1733. "hash": ""
  1734. },
  1735. {
  1736. "input": "http://example.com/./.foo",
  1737. "base": "about:blank",
  1738. "href": "http://example.com/.foo",
  1739. "origin": "http://example.com",
  1740. "protocol": "http:",
  1741. "username": "",
  1742. "password": "",
  1743. "host": "example.com",
  1744. "hostname": "example.com",
  1745. "port": "",
  1746. "pathname": "/.foo",
  1747. "search": "",
  1748. "hash": ""
  1749. },
  1750. {
  1751. "input": "http://example.com/foo/.",
  1752. "base": "about:blank",
  1753. "href": "http://example.com/foo/",
  1754. "origin": "http://example.com",
  1755. "protocol": "http:",
  1756. "username": "",
  1757. "password": "",
  1758. "host": "example.com",
  1759. "hostname": "example.com",
  1760. "port": "",
  1761. "pathname": "/foo/",
  1762. "search": "",
  1763. "hash": ""
  1764. },
  1765. {
  1766. "input": "http://example.com/foo/./",
  1767. "base": "about:blank",
  1768. "href": "http://example.com/foo/",
  1769. "origin": "http://example.com",
  1770. "protocol": "http:",
  1771. "username": "",
  1772. "password": "",
  1773. "host": "example.com",
  1774. "hostname": "example.com",
  1775. "port": "",
  1776. "pathname": "/foo/",
  1777. "search": "",
  1778. "hash": ""
  1779. },
  1780. {
  1781. "input": "http://example.com/foo/bar/..",
  1782. "base": "about:blank",
  1783. "href": "http://example.com/foo/",
  1784. "origin": "http://example.com",
  1785. "protocol": "http:",
  1786. "username": "",
  1787. "password": "",
  1788. "host": "example.com",
  1789. "hostname": "example.com",
  1790. "port": "",
  1791. "pathname": "/foo/",
  1792. "search": "",
  1793. "hash": ""
  1794. },
  1795. {
  1796. "input": "http://example.com/foo/bar/../",
  1797. "base": "about:blank",
  1798. "href": "http://example.com/foo/",
  1799. "origin": "http://example.com",
  1800. "protocol": "http:",
  1801. "username": "",
  1802. "password": "",
  1803. "host": "example.com",
  1804. "hostname": "example.com",
  1805. "port": "",
  1806. "pathname": "/foo/",
  1807. "search": "",
  1808. "hash": ""
  1809. },
  1810. {
  1811. "input": "http://example.com/foo/..bar",
  1812. "base": "about:blank",
  1813. "href": "http://example.com/foo/..bar",
  1814. "origin": "http://example.com",
  1815. "protocol": "http:",
  1816. "username": "",
  1817. "password": "",
  1818. "host": "example.com",
  1819. "hostname": "example.com",
  1820. "port": "",
  1821. "pathname": "/foo/..bar",
  1822. "search": "",
  1823. "hash": ""
  1824. },
  1825. {
  1826. "input": "http://example.com/foo/bar/../ton",
  1827. "base": "about:blank",
  1828. "href": "http://example.com/foo/ton",
  1829. "origin": "http://example.com",
  1830. "protocol": "http:",
  1831. "username": "",
  1832. "password": "",
  1833. "host": "example.com",
  1834. "hostname": "example.com",
  1835. "port": "",
  1836. "pathname": "/foo/ton",
  1837. "search": "",
  1838. "hash": ""
  1839. },
  1840. {
  1841. "input": "http://example.com/foo/bar/../ton/../../a",
  1842. "base": "about:blank",
  1843. "href": "http://example.com/a",
  1844. "origin": "http://example.com",
  1845. "protocol": "http:",
  1846. "username": "",
  1847. "password": "",
  1848. "host": "example.com",
  1849. "hostname": "example.com",
  1850. "port": "",
  1851. "pathname": "/a",
  1852. "search": "",
  1853. "hash": ""
  1854. },
  1855. {
  1856. "input": "http://example.com/foo/../../..",
  1857. "base": "about:blank",
  1858. "href": "http://example.com/",
  1859. "origin": "http://example.com",
  1860. "protocol": "http:",
  1861. "username": "",
  1862. "password": "",
  1863. "host": "example.com",
  1864. "hostname": "example.com",
  1865. "port": "",
  1866. "pathname": "/",
  1867. "search": "",
  1868. "hash": ""
  1869. },
  1870. {
  1871. "input": "http://example.com/foo/../../../ton",
  1872. "base": "about:blank",
  1873. "href": "http://example.com/ton",
  1874. "origin": "http://example.com",
  1875. "protocol": "http:",
  1876. "username": "",
  1877. "password": "",
  1878. "host": "example.com",
  1879. "hostname": "example.com",
  1880. "port": "",
  1881. "pathname": "/ton",
  1882. "search": "",
  1883. "hash": ""
  1884. },
  1885. {
  1886. "input": "http://example.com/foo/%2e",
  1887. "base": "about:blank",
  1888. "href": "http://example.com/foo/",
  1889. "origin": "http://example.com",
  1890. "protocol": "http:",
  1891. "username": "",
  1892. "password": "",
  1893. "host": "example.com",
  1894. "hostname": "example.com",
  1895. "port": "",
  1896. "pathname": "/foo/",
  1897. "search": "",
  1898. "hash": ""
  1899. },
  1900. {
  1901. "input": "http://example.com/foo/%2e%2",
  1902. "base": "about:blank",
  1903. "href": "http://example.com/foo/%2e%2",
  1904. "origin": "http://example.com",
  1905. "protocol": "http:",
  1906. "username": "",
  1907. "password": "",
  1908. "host": "example.com",
  1909. "hostname": "example.com",
  1910. "port": "",
  1911. "pathname": "/foo/%2e%2",
  1912. "search": "",
  1913. "hash": ""
  1914. },
  1915. {
  1916. "input": "http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar",
  1917. "base": "about:blank",
  1918. "href": "http://example.com/%2e.bar",
  1919. "origin": "http://example.com",
  1920. "protocol": "http:",
  1921. "username": "",
  1922. "password": "",
  1923. "host": "example.com",
  1924. "hostname": "example.com",
  1925. "port": "",
  1926. "pathname": "/%2e.bar",
  1927. "search": "",
  1928. "hash": ""
  1929. },
  1930. {
  1931. "input": "http://example.com////../..",
  1932. "base": "about:blank",
  1933. "href": "http://example.com//",
  1934. "origin": "http://example.com",
  1935. "protocol": "http:",
  1936. "username": "",
  1937. "password": "",
  1938. "host": "example.com",
  1939. "hostname": "example.com",
  1940. "port": "",
  1941. "pathname": "//",
  1942. "search": "",
  1943. "hash": ""
  1944. },
  1945. {
  1946. "input": "http://example.com/foo/bar//../..",
  1947. "base": "about:blank",
  1948. "href": "http://example.com/foo/",
  1949. "origin": "http://example.com",
  1950. "protocol": "http:",
  1951. "username": "",
  1952. "password": "",
  1953. "host": "example.com",
  1954. "hostname": "example.com",
  1955. "port": "",
  1956. "pathname": "/foo/",
  1957. "search": "",
  1958. "hash": ""
  1959. },
  1960. {
  1961. "input": "http://example.com/foo/bar//..",
  1962. "base": "about:blank",
  1963. "href": "http://example.com/foo/bar/",
  1964. "origin": "http://example.com",
  1965. "protocol": "http:",
  1966. "username": "",
  1967. "password": "",
  1968. "host": "example.com",
  1969. "hostname": "example.com",
  1970. "port": "",
  1971. "pathname": "/foo/bar/",
  1972. "search": "",
  1973. "hash": ""
  1974. },
  1975. {
  1976. "input": "http://example.com/foo",
  1977. "base": "about:blank",
  1978. "href": "http://example.com/foo",
  1979. "origin": "http://example.com",
  1980. "protocol": "http:",
  1981. "username": "",
  1982. "password": "",
  1983. "host": "example.com",
  1984. "hostname": "example.com",
  1985. "port": "",
  1986. "pathname": "/foo",
  1987. "search": "",
  1988. "hash": ""
  1989. },
  1990. {
  1991. "input": "http://example.com/%20foo",
  1992. "base": "about:blank",
  1993. "href": "http://example.com/%20foo",
  1994. "origin": "http://example.com",
  1995. "protocol": "http:",
  1996. "username": "",
  1997. "password": "",
  1998. "host": "example.com",
  1999. "hostname": "example.com",
  2000. "port": "",
  2001. "pathname": "/%20foo",
  2002. "search": "",
  2003. "hash": ""
  2004. },
  2005. {
  2006. "input": "http://example.com/foo%",
  2007. "base": "about:blank",
  2008. "href": "http://example.com/foo%",
  2009. "origin": "http://example.com",
  2010. "protocol": "http:",
  2011. "username": "",
  2012. "password": "",
  2013. "host": "example.com",
  2014. "hostname": "example.com",
  2015. "port": "",
  2016. "pathname": "/foo%",
  2017. "search": "",
  2018. "hash": ""
  2019. },
  2020. {
  2021. "input": "http://example.com/foo%2",
  2022. "base": "about:blank",
  2023. "href": "http://example.com/foo%2",
  2024. "origin": "http://example.com",
  2025. "protocol": "http:",
  2026. "username": "",
  2027. "password": "",
  2028. "host": "example.com",
  2029. "hostname": "example.com",
  2030. "port": "",
  2031. "pathname": "/foo%2",
  2032. "search": "",
  2033. "hash": ""
  2034. },
  2035. {
  2036. "input": "http://example.com/foo%2zbar",
  2037. "base": "about:blank",
  2038. "href": "http://example.com/foo%2zbar",
  2039. "origin": "http://example.com",
  2040. "protocol": "http:",
  2041. "username": "",
  2042. "password": "",
  2043. "host": "example.com",
  2044. "hostname": "example.com",
  2045. "port": "",
  2046. "pathname": "/foo%2zbar",
  2047. "search": "",
  2048. "hash": ""
  2049. },
  2050. {
  2051. "input": "http://example.com/foo%2©zbar",
  2052. "base": "about:blank",
  2053. "href": "http://example.com/foo%2%C3%82%C2%A9zbar",
  2054. "origin": "http://example.com",
  2055. "protocol": "http:",
  2056. "username": "",
  2057. "password": "",
  2058. "host": "example.com",
  2059. "hostname": "example.com",
  2060. "port": "",
  2061. "pathname": "/foo%2%C3%82%C2%A9zbar",
  2062. "search": "",
  2063. "hash": ""
  2064. },
  2065. {
  2066. "input": "http://example.com/foo%41%7a",
  2067. "base": "about:blank",
  2068. "href": "http://example.com/foo%41%7a",
  2069. "origin": "http://example.com",
  2070. "protocol": "http:",
  2071. "username": "",
  2072. "password": "",
  2073. "host": "example.com",
  2074. "hostname": "example.com",
  2075. "port": "",
  2076. "pathname": "/foo%41%7a",
  2077. "search": "",
  2078. "hash": ""
  2079. },
  2080. {
  2081. "input": "http://example.com/foo\t\u0091%91",
  2082. "base": "about:blank",
  2083. "href": "http://example.com/foo%C2%91%91",
  2084. "origin": "http://example.com",
  2085. "protocol": "http:",
  2086. "username": "",
  2087. "password": "",
  2088. "host": "example.com",
  2089. "hostname": "example.com",
  2090. "port": "",
  2091. "pathname": "/foo%C2%91%91",
  2092. "search": "",
  2093. "hash": ""
  2094. },
  2095. {
  2096. "input": "http://example.com/foo%00%51",
  2097. "base": "about:blank",
  2098. "href": "http://example.com/foo%00%51",
  2099. "origin": "http://example.com",
  2100. "protocol": "http:",
  2101. "username": "",
  2102. "password": "",
  2103. "host": "example.com",
  2104. "hostname": "example.com",
  2105. "port": "",
  2106. "pathname": "/foo%00%51",
  2107. "search": "",
  2108. "hash": ""
  2109. },
  2110. {
  2111. "input": "http://example.com/(%28:%3A%29)",
  2112. "base": "about:blank",
  2113. "href": "http://example.com/(%28:%3A%29)",
  2114. "origin": "http://example.com",
  2115. "protocol": "http:",
  2116. "username": "",
  2117. "password": "",
  2118. "host": "example.com",
  2119. "hostname": "example.com",
  2120. "port": "",
  2121. "pathname": "/(%28:%3A%29)",
  2122. "search": "",
  2123. "hash": ""
  2124. },
  2125. {
  2126. "input": "http://example.com/%3A%3a%3C%3c",
  2127. "base": "about:blank",
  2128. "href": "http://example.com/%3A%3a%3C%3c",
  2129. "origin": "http://example.com",
  2130. "protocol": "http:",
  2131. "username": "",
  2132. "password": "",
  2133. "host": "example.com",
  2134. "hostname": "example.com",
  2135. "port": "",
  2136. "pathname": "/%3A%3a%3C%3c",
  2137. "search": "",
  2138. "hash": ""
  2139. },
  2140. {
  2141. "input": "http://example.com/foo\tbar",
  2142. "base": "about:blank",
  2143. "href": "http://example.com/foobar",
  2144. "origin": "http://example.com",
  2145. "protocol": "http:",
  2146. "username": "",
  2147. "password": "",
  2148. "host": "example.com",
  2149. "hostname": "example.com",
  2150. "port": "",
  2151. "pathname": "/foobar",
  2152. "search": "",
  2153. "hash": ""
  2154. },
  2155. {
  2156. "input": "http://example.com\\\\foo\\\\bar",
  2157. "base": "about:blank",
  2158. "href": "http://example.com//foo//bar",
  2159. "origin": "http://example.com",
  2160. "protocol": "http:",
  2161. "username": "",
  2162. "password": "",
  2163. "host": "example.com",
  2164. "hostname": "example.com",
  2165. "port": "",
  2166. "pathname": "//foo//bar",
  2167. "search": "",
  2168. "hash": ""
  2169. },
  2170. {
  2171. "input": "http://example.com/%7Ffp3%3Eju%3Dduvgw%3Dd",
  2172. "base": "about:blank",
  2173. "href": "http://example.com/%7Ffp3%3Eju%3Dduvgw%3Dd",
  2174. "origin": "http://example.com",
  2175. "protocol": "http:",
  2176. "username": "",
  2177. "password": "",
  2178. "host": "example.com",
  2179. "hostname": "example.com",
  2180. "port": "",
  2181. "pathname": "/%7Ffp3%3Eju%3Dduvgw%3Dd",
  2182. "search": "",
  2183. "hash": ""
  2184. },
  2185. {
  2186. "input": "http://example.com/@asdf%40",
  2187. "base": "about:blank",
  2188. "href": "http://example.com/@asdf%40",
  2189. "origin": "http://example.com",
  2190. "protocol": "http:",
  2191. "username": "",
  2192. "password": "",
  2193. "host": "example.com",
  2194. "hostname": "example.com",
  2195. "port": "",
  2196. "pathname": "/@asdf%40",
  2197. "search": "",
  2198. "hash": ""
  2199. },
  2200. {
  2201. "input": "http://example.com/你好你好",
  2202. "base": "about:blank",
  2203. "href": "http://example.com/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD",
  2204. "origin": "http://example.com",
  2205. "protocol": "http:",
  2206. "username": "",
  2207. "password": "",
  2208. "host": "example.com",
  2209. "hostname": "example.com",
  2210. "port": "",
  2211. "pathname": "/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD",
  2212. "search": "",
  2213. "hash": ""
  2214. },
  2215. {
  2216. "input": "http://example.com/‥/foo",
  2217. "base": "about:blank",
  2218. "href": "http://example.com/%E2%80%A5/foo",
  2219. "origin": "http://example.com",
  2220. "protocol": "http:",
  2221. "username": "",
  2222. "password": "",
  2223. "host": "example.com",
  2224. "hostname": "example.com",
  2225. "port": "",
  2226. "pathname": "/%E2%80%A5/foo",
  2227. "search": "",
  2228. "hash": ""
  2229. },
  2230. {
  2231. "input": "http://example.com//foo",
  2232. "base": "about:blank",
  2233. "href": "http://example.com/%EF%BB%BF/foo",
  2234. "origin": "http://example.com",
  2235. "protocol": "http:",
  2236. "username": "",
  2237. "password": "",
  2238. "host": "example.com",
  2239. "hostname": "example.com",
  2240. "port": "",
  2241. "pathname": "/%EF%BB%BF/foo",
  2242. "search": "",
  2243. "hash": ""
  2244. },
  2245. {
  2246. "input": "http://example.com/‮/foo/‭/bar",
  2247. "base": "about:blank",
  2248. "href": "http://example.com/%E2%80%AE/foo/%E2%80%AD/bar",
  2249. "origin": "http://example.com",
  2250. "protocol": "http:",
  2251. "username": "",
  2252. "password": "",
  2253. "host": "example.com",
  2254. "hostname": "example.com",
  2255. "port": "",
  2256. "pathname": "/%E2%80%AE/foo/%E2%80%AD/bar",
  2257. "search": "",
  2258. "hash": ""
  2259. },
  2260. "# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/relative.js",
  2261. {
  2262. "input": "http://www.google.com/foo?bar=baz#",
  2263. "base": "about:blank",
  2264. "href": "http://www.google.com/foo?bar=baz#",
  2265. "origin": "http://www.google.com",
  2266. "protocol": "http:",
  2267. "username": "",
  2268. "password": "",
  2269. "host": "www.google.com",
  2270. "hostname": "www.google.com",
  2271. "port": "",
  2272. "pathname": "/foo",
  2273. "search": "?bar=baz",
  2274. "hash": ""
  2275. },
  2276. {
  2277. "input": "http://www.google.com/foo?bar=baz# »",
  2278. "base": "about:blank",
  2279. "href": "http://www.google.com/foo?bar=baz#%20%C2%BB",
  2280. "origin": "http://www.google.com",
  2281. "protocol": "http:",
  2282. "username": "",
  2283. "password": "",
  2284. "host": "www.google.com",
  2285. "hostname": "www.google.com",
  2286. "port": "",
  2287. "pathname": "/foo",
  2288. "search": "?bar=baz",
  2289. "hash": "#%20%C2%BB"
  2290. },
  2291. {
  2292. "input": "data:test# »",
  2293. "base": "about:blank",
  2294. "href": "data:test#%20%C2%BB",
  2295. "origin": "null",
  2296. "protocol": "data:",
  2297. "username": "",
  2298. "password": "",
  2299. "host": "",
  2300. "hostname": "",
  2301. "port": "",
  2302. "pathname": "test",
  2303. "search": "",
  2304. "hash": "#%20%C2%BB"
  2305. },
  2306. {
  2307. "input": "http://www.google.com",
  2308. "base": "about:blank",
  2309. "href": "http://www.google.com/",
  2310. "origin": "http://www.google.com",
  2311. "protocol": "http:",
  2312. "username": "",
  2313. "password": "",
  2314. "host": "www.google.com",
  2315. "hostname": "www.google.com",
  2316. "port": "",
  2317. "pathname": "/",
  2318. "search": "",
  2319. "hash": ""
  2320. },
  2321. {
  2322. "input": "http://192.0x00A80001",
  2323. "base": "about:blank",
  2324. "href": "http://192.168.0.1/",
  2325. "origin": "http://192.168.0.1",
  2326. "protocol": "http:",
  2327. "username": "",
  2328. "password": "",
  2329. "host": "192.168.0.1",
  2330. "hostname": "192.168.0.1",
  2331. "port": "",
  2332. "pathname": "/",
  2333. "search": "",
  2334. "hash": ""
  2335. },
  2336. {
  2337. "input": "http://www/foo%2Ehtml",
  2338. "base": "about:blank",
  2339. "href": "http://www/foo%2Ehtml",
  2340. "origin": "http://www",
  2341. "protocol": "http:",
  2342. "username": "",
  2343. "password": "",
  2344. "host": "www",
  2345. "hostname": "www",
  2346. "port": "",
  2347. "pathname": "/foo%2Ehtml",
  2348. "search": "",
  2349. "hash": ""
  2350. },
  2351. {
  2352. "input": "http://www/foo/%2E/html",
  2353. "base": "about:blank",
  2354. "href": "http://www/foo/html",
  2355. "origin": "http://www",
  2356. "protocol": "http:",
  2357. "username": "",
  2358. "password": "",
  2359. "host": "www",
  2360. "hostname": "www",
  2361. "port": "",
  2362. "pathname": "/foo/html",
  2363. "search": "",
  2364. "hash": ""
  2365. },
  2366. {
  2367. "input": "http://user:pass@/",
  2368. "base": "about:blank",
  2369. "failure": true
  2370. },
  2371. {
  2372. "input": "http://%25DOMAIN:foobar@foodomain.com/",
  2373. "base": "about:blank",
  2374. "href": "http://%25DOMAIN:foobar@foodomain.com/",
  2375. "origin": "http://foodomain.com",
  2376. "protocol": "http:",
  2377. "username": "%25DOMAIN",
  2378. "password": "foobar",
  2379. "host": "foodomain.com",
  2380. "hostname": "foodomain.com",
  2381. "port": "",
  2382. "pathname": "/",
  2383. "search": "",
  2384. "hash": ""
  2385. },
  2386. {
  2387. "input": "http:\\\\www.google.com\\foo",
  2388. "base": "about:blank",
  2389. "href": "http://www.google.com/foo",
  2390. "origin": "http://www.google.com",
  2391. "protocol": "http:",
  2392. "username": "",
  2393. "password": "",
  2394. "host": "www.google.com",
  2395. "hostname": "www.google.com",
  2396. "port": "",
  2397. "pathname": "/foo",
  2398. "search": "",
  2399. "hash": ""
  2400. },
  2401. {
  2402. "input": "http://foo:80/",
  2403. "base": "about:blank",
  2404. "href": "http://foo/",
  2405. "origin": "http://foo",
  2406. "protocol": "http:",
  2407. "username": "",
  2408. "password": "",
  2409. "host": "foo",
  2410. "hostname": "foo",
  2411. "port": "",
  2412. "pathname": "/",
  2413. "search": "",
  2414. "hash": ""
  2415. },
  2416. {
  2417. "input": "http://foo:81/",
  2418. "base": "about:blank",
  2419. "href": "http://foo:81/",
  2420. "origin": "http://foo:81",
  2421. "protocol": "http:",
  2422. "username": "",
  2423. "password": "",
  2424. "host": "foo:81",
  2425. "hostname": "foo",
  2426. "port": "81",
  2427. "pathname": "/",
  2428. "search": "",
  2429. "hash": ""
  2430. },
  2431. {
  2432. "input": "httpa://foo:80/",
  2433. "base": "about:blank",
  2434. "href": "httpa://foo:80/",
  2435. "origin": "null",
  2436. "protocol": "httpa:",
  2437. "username": "",
  2438. "password": "",
  2439. "host": "foo:80",
  2440. "hostname": "foo",
  2441. "port": "80",
  2442. "pathname": "/",
  2443. "search": "",
  2444. "hash": ""
  2445. },
  2446. {
  2447. "input": "http://foo:-80/",
  2448. "base": "about:blank",
  2449. "failure": true
  2450. },
  2451. {
  2452. "input": "https://foo:443/",
  2453. "base": "about:blank",
  2454. "href": "https://foo/",
  2455. "origin": "https://foo",
  2456. "protocol": "https:",
  2457. "username": "",
  2458. "password": "",
  2459. "host": "foo",
  2460. "hostname": "foo",
  2461. "port": "",
  2462. "pathname": "/",
  2463. "search": "",
  2464. "hash": ""
  2465. },
  2466. {
  2467. "input": "https://foo:80/",
  2468. "base": "about:blank",
  2469. "href": "https://foo:80/",
  2470. "origin": "https://foo:80",
  2471. "protocol": "https:",
  2472. "username": "",
  2473. "password": "",
  2474. "host": "foo:80",
  2475. "hostname": "foo",
  2476. "port": "80",
  2477. "pathname": "/",
  2478. "search": "",
  2479. "hash": ""
  2480. },
  2481. {
  2482. "input": "ftp://foo:21/",
  2483. "base": "about:blank",
  2484. "href": "ftp://foo/",
  2485. "origin": "ftp://foo",
  2486. "protocol": "ftp:",
  2487. "username": "",
  2488. "password": "",
  2489. "host": "foo",
  2490. "hostname": "foo",
  2491. "port": "",
  2492. "pathname": "/",
  2493. "search": "",
  2494. "hash": ""
  2495. },
  2496. {
  2497. "input": "ftp://foo:80/",
  2498. "base": "about:blank",
  2499. "href": "ftp://foo:80/",
  2500. "origin": "ftp://foo:80",
  2501. "protocol": "ftp:",
  2502. "username": "",
  2503. "password": "",
  2504. "host": "foo:80",
  2505. "hostname": "foo",
  2506. "port": "80",
  2507. "pathname": "/",
  2508. "search": "",
  2509. "hash": ""
  2510. },
  2511. {
  2512. "input": "gopher://foo:70/",
  2513. "base": "about:blank",
  2514. "href": "gopher://foo/",
  2515. "origin": "gopher://foo",
  2516. "protocol": "gopher:",
  2517. "username": "",
  2518. "password": "",
  2519. "host": "foo",
  2520. "hostname": "foo",
  2521. "port": "",
  2522. "pathname": "/",
  2523. "search": "",
  2524. "hash": ""
  2525. },
  2526. {
  2527. "input": "gopher://foo:443/",
  2528. "base": "about:blank",
  2529. "href": "gopher://foo:443/",
  2530. "origin": "gopher://foo:443",
  2531. "protocol": "gopher:",
  2532. "username": "",
  2533. "password": "",
  2534. "host": "foo:443",
  2535. "hostname": "foo",
  2536. "port": "443",
  2537. "pathname": "/",
  2538. "search": "",
  2539. "hash": ""
  2540. },
  2541. {
  2542. "input": "ws://foo:80/",
  2543. "base": "about:blank",
  2544. "href": "ws://foo/",
  2545. "origin": "ws://foo",
  2546. "protocol": "ws:",
  2547. "username": "",
  2548. "password": "",
  2549. "host": "foo",
  2550. "hostname": "foo",
  2551. "port": "",
  2552. "pathname": "/",
  2553. "search": "",
  2554. "hash": ""
  2555. },
  2556. {
  2557. "input": "ws://foo:81/",
  2558. "base": "about:blank",
  2559. "href": "ws://foo:81/",
  2560. "origin": "ws://foo:81",
  2561. "protocol": "ws:",
  2562. "username": "",
  2563. "password": "",
  2564. "host": "foo:81",
  2565. "hostname": "foo",
  2566. "port": "81",
  2567. "pathname": "/",
  2568. "search": "",
  2569. "hash": ""
  2570. },
  2571. {
  2572. "input": "ws://foo:443/",
  2573. "base": "about:blank",
  2574. "href": "ws://foo:443/",
  2575. "origin": "ws://foo:443",
  2576. "protocol": "ws:",
  2577. "username": "",
  2578. "password": "",
  2579. "host": "foo:443",
  2580. "hostname": "foo",
  2581. "port": "443",
  2582. "pathname": "/",
  2583. "search": "",
  2584. "hash": ""
  2585. },
  2586. {
  2587. "input": "ws://foo:815/",
  2588. "base": "about:blank",
  2589. "href": "ws://foo:815/",
  2590. "origin": "ws://foo:815",
  2591. "protocol": "ws:",
  2592. "username": "",
  2593. "password": "",
  2594. "host": "foo:815",
  2595. "hostname": "foo",
  2596. "port": "815",
  2597. "pathname": "/",
  2598. "search": "",
  2599. "hash": ""
  2600. },
  2601. {
  2602. "input": "wss://foo:80/",
  2603. "base": "about:blank",
  2604. "href": "wss://foo:80/",
  2605. "origin": "wss://foo:80",
  2606. "protocol": "wss:",
  2607. "username": "",
  2608. "password": "",
  2609. "host": "foo:80",
  2610. "hostname": "foo",
  2611. "port": "80",
  2612. "pathname": "/",
  2613. "search": "",
  2614. "hash": ""
  2615. },
  2616. {
  2617. "input": "wss://foo:81/",
  2618. "base": "about:blank",
  2619. "href": "wss://foo:81/",
  2620. "origin": "wss://foo:81",
  2621. "protocol": "wss:",
  2622. "username": "",
  2623. "password": "",
  2624. "host": "foo:81",
  2625. "hostname": "foo",
  2626. "port": "81",
  2627. "pathname": "/",
  2628. "search": "",
  2629. "hash": ""
  2630. },
  2631. {
  2632. "input": "wss://foo:443/",
  2633. "base": "about:blank",
  2634. "href": "wss://foo/",
  2635. "origin": "wss://foo",
  2636. "protocol": "wss:",
  2637. "username": "",
  2638. "password": "",
  2639. "host": "foo",
  2640. "hostname": "foo",
  2641. "port": "",
  2642. "pathname": "/",
  2643. "search": "",
  2644. "hash": ""
  2645. },
  2646. {
  2647. "input": "wss://foo:815/",
  2648. "base": "about:blank",
  2649. "href": "wss://foo:815/",
  2650. "origin": "wss://foo:815",
  2651. "protocol": "wss:",
  2652. "username": "",
  2653. "password": "",
  2654. "host": "foo:815",
  2655. "hostname": "foo",
  2656. "port": "815",
  2657. "pathname": "/",
  2658. "search": "",
  2659. "hash": ""
  2660. },
  2661. {
  2662. "input": "http:/example.com/",
  2663. "base": "about:blank",
  2664. "href": "http://example.com/",
  2665. "origin": "http://example.com",
  2666. "protocol": "http:",
  2667. "username": "",
  2668. "password": "",
  2669. "host": "example.com",
  2670. "hostname": "example.com",
  2671. "port": "",
  2672. "pathname": "/",
  2673. "search": "",
  2674. "hash": ""
  2675. },
  2676. {
  2677. "input": "ftp:/example.com/",
  2678. "base": "about:blank",
  2679. "href": "ftp://example.com/",
  2680. "origin": "ftp://example.com",
  2681. "protocol": "ftp:",
  2682. "username": "",
  2683. "password": "",
  2684. "host": "example.com",
  2685. "hostname": "example.com",
  2686. "port": "",
  2687. "pathname": "/",
  2688. "search": "",
  2689. "hash": ""
  2690. },
  2691. {
  2692. "input": "https:/example.com/",
  2693. "base": "about:blank",
  2694. "href": "https://example.com/",
  2695. "origin": "https://example.com",
  2696. "protocol": "https:",
  2697. "username": "",
  2698. "password": "",
  2699. "host": "example.com",
  2700. "hostname": "example.com",
  2701. "port": "",
  2702. "pathname": "/",
  2703. "search": "",
  2704. "hash": ""
  2705. },
  2706. {
  2707. "input": "madeupscheme:/example.com/",
  2708. "base": "about:blank",
  2709. "href": "madeupscheme:/example.com/",
  2710. "origin": "null",
  2711. "protocol": "madeupscheme:",
  2712. "username": "",
  2713. "password": "",
  2714. "host": "",
  2715. "hostname": "",
  2716. "port": "",
  2717. "pathname": "/example.com/",
  2718. "search": "",
  2719. "hash": ""
  2720. },
  2721. {
  2722. "input": "file:/example.com/",
  2723. "base": "about:blank",
  2724. "href": "file:///example.com/",
  2725. "protocol": "file:",
  2726. "username": "",
  2727. "password": "",
  2728. "host": "",
  2729. "hostname": "",
  2730. "port": "",
  2731. "pathname": "/example.com/",
  2732. "search": "",
  2733. "hash": ""
  2734. },
  2735. {
  2736. "input": "ftps:/example.com/",
  2737. "base": "about:blank",
  2738. "href": "ftps:/example.com/",
  2739. "origin": "null",
  2740. "protocol": "ftps:",
  2741. "username": "",
  2742. "password": "",
  2743. "host": "",
  2744. "hostname": "",
  2745. "port": "",
  2746. "pathname": "/example.com/",
  2747. "search": "",
  2748. "hash": ""
  2749. },
  2750. {
  2751. "input": "gopher:/example.com/",
  2752. "base": "about:blank",
  2753. "href": "gopher://example.com/",
  2754. "origin": "gopher://example.com",
  2755. "protocol": "gopher:",
  2756. "username": "",
  2757. "password": "",
  2758. "host": "example.com",
  2759. "hostname": "example.com",
  2760. "port": "",
  2761. "pathname": "/",
  2762. "search": "",
  2763. "hash": ""
  2764. },
  2765. {
  2766. "input": "ws:/example.com/",
  2767. "base": "about:blank",
  2768. "href": "ws://example.com/",
  2769. "origin": "ws://example.com",
  2770. "protocol": "ws:",
  2771. "username": "",
  2772. "password": "",
  2773. "host": "example.com",
  2774. "hostname": "example.com",
  2775. "port": "",
  2776. "pathname": "/",
  2777. "search": "",
  2778. "hash": ""
  2779. },
  2780. {
  2781. "input": "wss:/example.com/",
  2782. "base": "about:blank",
  2783. "href": "wss://example.com/",
  2784. "origin": "wss://example.com",
  2785. "protocol": "wss:",
  2786. "username": "",
  2787. "password": "",
  2788. "host": "example.com",
  2789. "hostname": "example.com",
  2790. "port": "",
  2791. "pathname": "/",
  2792. "search": "",
  2793. "hash": ""
  2794. },
  2795. {
  2796. "input": "data:/example.com/",
  2797. "base": "about:blank",
  2798. "href": "data:/example.com/",
  2799. "origin": "null",
  2800. "protocol": "data:",
  2801. "username": "",
  2802. "password": "",
  2803. "host": "",
  2804. "hostname": "",
  2805. "port": "",
  2806. "pathname": "/example.com/",
  2807. "search": "",
  2808. "hash": ""
  2809. },
  2810. {
  2811. "input": "javascript:/example.com/",
  2812. "base": "about:blank",
  2813. "href": "javascript:/example.com/",
  2814. "origin": "null",
  2815. "protocol": "javascript:",
  2816. "username": "",
  2817. "password": "",
  2818. "host": "",
  2819. "hostname": "",
  2820. "port": "",
  2821. "pathname": "/example.com/",
  2822. "search": "",
  2823. "hash": ""
  2824. },
  2825. {
  2826. "input": "mailto:/example.com/",
  2827. "base": "about:blank",
  2828. "href": "mailto:/example.com/",
  2829. "origin": "null",
  2830. "protocol": "mailto:",
  2831. "username": "",
  2832. "password": "",
  2833. "host": "",
  2834. "hostname": "",
  2835. "port": "",
  2836. "pathname": "/example.com/",
  2837. "search": "",
  2838. "hash": ""
  2839. },
  2840. {
  2841. "input": "http:example.com/",
  2842. "base": "about:blank",
  2843. "href": "http://example.com/",
  2844. "origin": "http://example.com",
  2845. "protocol": "http:",
  2846. "username": "",
  2847. "password": "",
  2848. "host": "example.com",
  2849. "hostname": "example.com",
  2850. "port": "",
  2851. "pathname": "/",
  2852. "search": "",
  2853. "hash": ""
  2854. },
  2855. {
  2856. "input": "ftp:example.com/",
  2857. "base": "about:blank",
  2858. "href": "ftp://example.com/",
  2859. "origin": "ftp://example.com",
  2860. "protocol": "ftp:",
  2861. "username": "",
  2862. "password": "",
  2863. "host": "example.com",
  2864. "hostname": "example.com",
  2865. "port": "",
  2866. "pathname": "/",
  2867. "search": "",
  2868. "hash": ""
  2869. },
  2870. {
  2871. "input": "https:example.com/",
  2872. "base": "about:blank",
  2873. "href": "https://example.com/",
  2874. "origin": "https://example.com",
  2875. "protocol": "https:",
  2876. "username": "",
  2877. "password": "",
  2878. "host": "example.com",
  2879. "hostname": "example.com",
  2880. "port": "",
  2881. "pathname": "/",
  2882. "search": "",
  2883. "hash": ""
  2884. },
  2885. {
  2886. "input": "madeupscheme:example.com/",
  2887. "base": "about:blank",
  2888. "href": "madeupscheme:example.com/",
  2889. "origin": "null",
  2890. "protocol": "madeupscheme:",
  2891. "username": "",
  2892. "password": "",
  2893. "host": "",
  2894. "hostname": "",
  2895. "port": "",
  2896. "pathname": "example.com/",
  2897. "search": "",
  2898. "hash": ""
  2899. },
  2900. {
  2901. "input": "ftps:example.com/",
  2902. "base": "about:blank",
  2903. "href": "ftps:example.com/",
  2904. "origin": "null",
  2905. "protocol": "ftps:",
  2906. "username": "",
  2907. "password": "",
  2908. "host": "",
  2909. "hostname": "",
  2910. "port": "",
  2911. "pathname": "example.com/",
  2912. "search": "",
  2913. "hash": ""
  2914. },
  2915. {
  2916. "input": "gopher:example.com/",
  2917. "base": "about:blank",
  2918. "href": "gopher://example.com/",
  2919. "origin": "gopher://example.com",
  2920. "protocol": "gopher:",
  2921. "username": "",
  2922. "password": "",
  2923. "host": "example.com",
  2924. "hostname": "example.com",
  2925. "port": "",
  2926. "pathname": "/",
  2927. "search": "",
  2928. "hash": ""
  2929. },
  2930. {
  2931. "input": "ws:example.com/",
  2932. "base": "about:blank",
  2933. "href": "ws://example.com/",
  2934. "origin": "ws://example.com",
  2935. "protocol": "ws:",
  2936. "username": "",
  2937. "password": "",
  2938. "host": "example.com",
  2939. "hostname": "example.com",
  2940. "port": "",
  2941. "pathname": "/",
  2942. "search": "",
  2943. "hash": ""
  2944. },
  2945. {
  2946. "input": "wss:example.com/",
  2947. "base": "about:blank",
  2948. "href": "wss://example.com/",
  2949. "origin": "wss://example.com",
  2950. "protocol": "wss:",
  2951. "username": "",
  2952. "password": "",
  2953. "host": "example.com",
  2954. "hostname": "example.com",
  2955. "port": "",
  2956. "pathname": "/",
  2957. "search": "",
  2958. "hash": ""
  2959. },
  2960. {
  2961. "input": "data:example.com/",
  2962. "base": "about:blank",
  2963. "href": "data:example.com/",
  2964. "origin": "null",
  2965. "protocol": "data:",
  2966. "username": "",
  2967. "password": "",
  2968. "host": "",
  2969. "hostname": "",
  2970. "port": "",
  2971. "pathname": "example.com/",
  2972. "search": "",
  2973. "hash": ""
  2974. },
  2975. {
  2976. "input": "javascript:example.com/",
  2977. "base": "about:blank",
  2978. "href": "javascript:example.com/",
  2979. "origin": "null",
  2980. "protocol": "javascript:",
  2981. "username": "",
  2982. "password": "",
  2983. "host": "",
  2984. "hostname": "",
  2985. "port": "",
  2986. "pathname": "example.com/",
  2987. "search": "",
  2988. "hash": ""
  2989. },
  2990. {
  2991. "input": "mailto:example.com/",
  2992. "base": "about:blank",
  2993. "href": "mailto:example.com/",
  2994. "origin": "null",
  2995. "protocol": "mailto:",
  2996. "username": "",
  2997. "password": "",
  2998. "host": "",
  2999. "hostname": "",
  3000. "port": "",
  3001. "pathname": "example.com/",
  3002. "search": "",
  3003. "hash": ""
  3004. },
  3005. "# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/segments-userinfo-vs-host.html",
  3006. {
  3007. "input": "http:@www.example.com",
  3008. "base": "about:blank",
  3009. "href": "http://www.example.com/",
  3010. "origin": "http://www.example.com",
  3011. "protocol": "http:",
  3012. "username": "",
  3013. "password": "",
  3014. "host": "www.example.com",
  3015. "hostname": "www.example.com",
  3016. "port": "",
  3017. "pathname": "/",
  3018. "search": "",
  3019. "hash": ""
  3020. },
  3021. {
  3022. "input": "http:/@www.example.com",
  3023. "base": "about:blank",
  3024. "href": "http://www.example.com/",
  3025. "origin": "http://www.example.com",
  3026. "protocol": "http:",
  3027. "username": "",
  3028. "password": "",
  3029. "host": "www.example.com",
  3030. "hostname": "www.example.com",
  3031. "port": "",
  3032. "pathname": "/",
  3033. "search": "",
  3034. "hash": ""
  3035. },
  3036. {
  3037. "input": "http://@www.example.com",
  3038. "base": "about:blank",
  3039. "href": "http://www.example.com/",
  3040. "origin": "http://www.example.com",
  3041. "protocol": "http:",
  3042. "username": "",
  3043. "password": "",
  3044. "host": "www.example.com",
  3045. "hostname": "www.example.com",
  3046. "port": "",
  3047. "pathname": "/",
  3048. "search": "",
  3049. "hash": ""
  3050. },
  3051. {
  3052. "input": "http:a:b@www.example.com",
  3053. "base": "about:blank",
  3054. "href": "http://a:b@www.example.com/",
  3055. "origin": "http://www.example.com",
  3056. "protocol": "http:",
  3057. "username": "a",
  3058. "password": "b",
  3059. "host": "www.example.com",
  3060. "hostname": "www.example.com",
  3061. "port": "",
  3062. "pathname": "/",
  3063. "search": "",
  3064. "hash": ""
  3065. },
  3066. {
  3067. "input": "http:/a:b@www.example.com",
  3068. "base": "about:blank",
  3069. "href": "http://a:b@www.example.com/",
  3070. "origin": "http://www.example.com",
  3071. "protocol": "http:",
  3072. "username": "a",
  3073. "password": "b",
  3074. "host": "www.example.com",
  3075. "hostname": "www.example.com",
  3076. "port": "",
  3077. "pathname": "/",
  3078. "search": "",
  3079. "hash": ""
  3080. },
  3081. {
  3082. "input": "http://a:b@www.example.com",
  3083. "base": "about:blank",
  3084. "href": "http://a:b@www.example.com/",
  3085. "origin": "http://www.example.com",
  3086. "protocol": "http:",
  3087. "username": "a",
  3088. "password": "b",
  3089. "host": "www.example.com",
  3090. "hostname": "www.example.com",
  3091. "port": "",
  3092. "pathname": "/",
  3093. "search": "",
  3094. "hash": ""
  3095. },
  3096. {
  3097. "input": "http://@pple.com",
  3098. "base": "about:blank",
  3099. "href": "http://pple.com/",
  3100. "origin": "http://pple.com",
  3101. "protocol": "http:",
  3102. "username": "",
  3103. "password": "",
  3104. "host": "pple.com",
  3105. "hostname": "pple.com",
  3106. "port": "",
  3107. "pathname": "/",
  3108. "search": "",
  3109. "hash": ""
  3110. },
  3111. {
  3112. "input": "http::b@www.example.com",
  3113. "base": "about:blank",
  3114. "href": "http://:b@www.example.com/",
  3115. "origin": "http://www.example.com",
  3116. "protocol": "http:",
  3117. "username": "",
  3118. "password": "b",
  3119. "host": "www.example.com",
  3120. "hostname": "www.example.com",
  3121. "port": "",
  3122. "pathname": "/",
  3123. "search": "",
  3124. "hash": ""
  3125. },
  3126. {
  3127. "input": "http:/:b@www.example.com",
  3128. "base": "about:blank",
  3129. "href": "http://:b@www.example.com/",
  3130. "origin": "http://www.example.com",
  3131. "protocol": "http:",
  3132. "username": "",
  3133. "password": "b",
  3134. "host": "www.example.com",
  3135. "hostname": "www.example.com",
  3136. "port": "",
  3137. "pathname": "/",
  3138. "search": "",
  3139. "hash": ""
  3140. },
  3141. {
  3142. "input": "http://:b@www.example.com",
  3143. "base": "about:blank",
  3144. "href": "http://:b@www.example.com/",
  3145. "origin": "http://www.example.com",
  3146. "protocol": "http:",
  3147. "username": "",
  3148. "password": "b",
  3149. "host": "www.example.com",
  3150. "hostname": "www.example.com",
  3151. "port": "",
  3152. "pathname": "/",
  3153. "search": "",
  3154. "hash": ""
  3155. },
  3156. {
  3157. "input": "http:/:@/www.example.com",
  3158. "base": "about:blank",
  3159. "failure": true
  3160. },
  3161. {
  3162. "input": "http://user@/www.example.com",
  3163. "base": "about:blank",
  3164. "failure": true
  3165. },
  3166. {
  3167. "input": "http:@/www.example.com",
  3168. "base": "about:blank",
  3169. "failure": true
  3170. },
  3171. {
  3172. "input": "http:/@/www.example.com",
  3173. "base": "about:blank",
  3174. "failure": true
  3175. },
  3176. {
  3177. "input": "http://@/www.example.com",
  3178. "base": "about:blank",
  3179. "failure": true
  3180. },
  3181. {
  3182. "input": "https:@/www.example.com",
  3183. "base": "about:blank",
  3184. "failure": true
  3185. },
  3186. {
  3187. "input": "http:a:b@/www.example.com",
  3188. "base": "about:blank",
  3189. "failure": true
  3190. },
  3191. {
  3192. "input": "http:/a:b@/www.example.com",
  3193. "base": "about:blank",
  3194. "failure": true
  3195. },
  3196. {
  3197. "input": "http://a:b@/www.example.com",
  3198. "base": "about:blank",
  3199. "failure": true
  3200. },
  3201. {
  3202. "input": "http::@/www.example.com",
  3203. "base": "about:blank",
  3204. "failure": true
  3205. },
  3206. {
  3207. "input": "http:a:@www.example.com",
  3208. "base": "about:blank",
  3209. "href": "http://a@www.example.com/",
  3210. "origin": "http://www.example.com",
  3211. "protocol": "http:",
  3212. "username": "a",
  3213. "password": "",
  3214. "host": "www.example.com",
  3215. "hostname": "www.example.com",
  3216. "port": "",
  3217. "pathname": "/",
  3218. "search": "",
  3219. "hash": ""
  3220. },
  3221. {
  3222. "input": "http:/a:@www.example.com",
  3223. "base": "about:blank",
  3224. "href": "http://a@www.example.com/",
  3225. "origin": "http://www.example.com",
  3226. "protocol": "http:",
  3227. "username": "a",
  3228. "password": "",
  3229. "host": "www.example.com",
  3230. "hostname": "www.example.com",
  3231. "port": "",
  3232. "pathname": "/",
  3233. "search": "",
  3234. "hash": ""
  3235. },
  3236. {
  3237. "input": "http://a:@www.example.com",
  3238. "base": "about:blank",
  3239. "href": "http://a@www.example.com/",
  3240. "origin": "http://www.example.com",
  3241. "protocol": "http:",
  3242. "username": "a",
  3243. "password": "",
  3244. "host": "www.example.com",
  3245. "hostname": "www.example.com",
  3246. "port": "",
  3247. "pathname": "/",
  3248. "search": "",
  3249. "hash": ""
  3250. },
  3251. {
  3252. "input": "http://www.@pple.com",
  3253. "base": "about:blank",
  3254. "href": "http://www.@pple.com/",
  3255. "origin": "http://pple.com",
  3256. "protocol": "http:",
  3257. "username": "www.",
  3258. "password": "",
  3259. "host": "pple.com",
  3260. "hostname": "pple.com",
  3261. "port": "",
  3262. "pathname": "/",
  3263. "search": "",
  3264. "hash": ""
  3265. },
  3266. {
  3267. "input": "http:@:www.example.com",
  3268. "base": "about:blank",
  3269. "failure": true
  3270. },
  3271. {
  3272. "input": "http:/@:www.example.com",
  3273. "base": "about:blank",
  3274. "failure": true
  3275. },
  3276. {
  3277. "input": "http://@:www.example.com",
  3278. "base": "about:blank",
  3279. "failure": true
  3280. },
  3281. {
  3282. "input": "http://:@www.example.com",
  3283. "base": "about:blank",
  3284. "href": "http://www.example.com/",
  3285. "origin": "http://www.example.com",
  3286. "protocol": "http:",
  3287. "username": "",
  3288. "password": "",
  3289. "host": "www.example.com",
  3290. "hostname": "www.example.com",
  3291. "port": "",
  3292. "pathname": "/",
  3293. "search": "",
  3294. "hash": ""
  3295. },
  3296. "# Others",
  3297. {
  3298. "input": "/",
  3299. "base": "http://www.example.com/test",
  3300. "href": "http://www.example.com/",
  3301. "origin": "http://www.example.com",
  3302. "protocol": "http:",
  3303. "username": "",
  3304. "password": "",
  3305. "host": "www.example.com",
  3306. "hostname": "www.example.com",
  3307. "port": "",
  3308. "pathname": "/",
  3309. "search": "",
  3310. "hash": ""
  3311. },
  3312. {
  3313. "input": "/test.txt",
  3314. "base": "http://www.example.com/test",
  3315. "href": "http://www.example.com/test.txt",
  3316. "origin": "http://www.example.com",
  3317. "protocol": "http:",
  3318. "username": "",
  3319. "password": "",
  3320. "host": "www.example.com",
  3321. "hostname": "www.example.com",
  3322. "port": "",
  3323. "pathname": "/test.txt",
  3324. "search": "",
  3325. "hash": ""
  3326. },
  3327. {
  3328. "input": ".",
  3329. "base": "http://www.example.com/test",
  3330. "href": "http://www.example.com/",
  3331. "origin": "http://www.example.com",
  3332. "protocol": "http:",
  3333. "username": "",
  3334. "password": "",
  3335. "host": "www.example.com",
  3336. "hostname": "www.example.com",
  3337. "port": "",
  3338. "pathname": "/",
  3339. "search": "",
  3340. "hash": ""
  3341. },
  3342. {
  3343. "input": "..",
  3344. "base": "http://www.example.com/test",
  3345. "href": "http://www.example.com/",
  3346. "origin": "http://www.example.com",
  3347. "protocol": "http:",
  3348. "username": "",
  3349. "password": "",
  3350. "host": "www.example.com",
  3351. "hostname": "www.example.com",
  3352. "port": "",
  3353. "pathname": "/",
  3354. "search": "",
  3355. "hash": ""
  3356. },
  3357. {
  3358. "input": "test.txt",
  3359. "base": "http://www.example.com/test",
  3360. "href": "http://www.example.com/test.txt",
  3361. "origin": "http://www.example.com",
  3362. "protocol": "http:",
  3363. "username": "",
  3364. "password": "",
  3365. "host": "www.example.com",
  3366. "hostname": "www.example.com",
  3367. "port": "",
  3368. "pathname": "/test.txt",
  3369. "search": "",
  3370. "hash": ""
  3371. },
  3372. {
  3373. "input": "./test.txt",
  3374. "base": "http://www.example.com/test",
  3375. "href": "http://www.example.com/test.txt",
  3376. "origin": "http://www.example.com",
  3377. "protocol": "http:",
  3378. "username": "",
  3379. "password": "",
  3380. "host": "www.example.com",
  3381. "hostname": "www.example.com",
  3382. "port": "",
  3383. "pathname": "/test.txt",
  3384. "search": "",
  3385. "hash": ""
  3386. },
  3387. {
  3388. "input": "../test.txt",
  3389. "base": "http://www.example.com/test",
  3390. "href": "http://www.example.com/test.txt",
  3391. "origin": "http://www.example.com",
  3392. "protocol": "http:",
  3393. "username": "",
  3394. "password": "",
  3395. "host": "www.example.com",
  3396. "hostname": "www.example.com",
  3397. "port": "",
  3398. "pathname": "/test.txt",
  3399. "search": "",
  3400. "hash": ""
  3401. },
  3402. {
  3403. "input": "../aaa/test.txt",
  3404. "base": "http://www.example.com/test",
  3405. "href": "http://www.example.com/aaa/test.txt",
  3406. "origin": "http://www.example.com",
  3407. "protocol": "http:",
  3408. "username": "",
  3409. "password": "",
  3410. "host": "www.example.com",
  3411. "hostname": "www.example.com",
  3412. "port": "",
  3413. "pathname": "/aaa/test.txt",
  3414. "search": "",
  3415. "hash": ""
  3416. },
  3417. {
  3418. "input": "../../test.txt",
  3419. "base": "http://www.example.com/test",
  3420. "href": "http://www.example.com/test.txt",
  3421. "origin": "http://www.example.com",
  3422. "protocol": "http:",
  3423. "username": "",
  3424. "password": "",
  3425. "host": "www.example.com",
  3426. "hostname": "www.example.com",
  3427. "port": "",
  3428. "pathname": "/test.txt",
  3429. "search": "",
  3430. "hash": ""
  3431. },
  3432. {
  3433. "input": "中/test.txt",
  3434. "base": "http://www.example.com/test",
  3435. "href": "http://www.example.com/%E4%B8%AD/test.txt",
  3436. "origin": "http://www.example.com",
  3437. "protocol": "http:",
  3438. "username": "",
  3439. "password": "",
  3440. "host": "www.example.com",
  3441. "hostname": "www.example.com",
  3442. "port": "",
  3443. "pathname": "/%E4%B8%AD/test.txt",
  3444. "search": "",
  3445. "hash": ""
  3446. },
  3447. {
  3448. "input": "http://www.example2.com",
  3449. "base": "http://www.example.com/test",
  3450. "href": "http://www.example2.com/",
  3451. "origin": "http://www.example2.com",
  3452. "protocol": "http:",
  3453. "username": "",
  3454. "password": "",
  3455. "host": "www.example2.com",
  3456. "hostname": "www.example2.com",
  3457. "port": "",
  3458. "pathname": "/",
  3459. "search": "",
  3460. "hash": ""
  3461. },
  3462. {
  3463. "input": "//www.example2.com",
  3464. "base": "http://www.example.com/test",
  3465. "href": "http://www.example2.com/",
  3466. "origin": "http://www.example2.com",
  3467. "protocol": "http:",
  3468. "username": "",
  3469. "password": "",
  3470. "host": "www.example2.com",
  3471. "hostname": "www.example2.com",
  3472. "port": "",
  3473. "pathname": "/",
  3474. "search": "",
  3475. "hash": ""
  3476. },
  3477. {
  3478. "input": "file:...",
  3479. "base": "http://www.example.com/test",
  3480. "href": "file:///...",
  3481. "protocol": "file:",
  3482. "username": "",
  3483. "password": "",
  3484. "host": "",
  3485. "hostname": "",
  3486. "port": "",
  3487. "pathname": "/...",
  3488. "search": "",
  3489. "hash": ""
  3490. },
  3491. {
  3492. "input": "file:..",
  3493. "base": "http://www.example.com/test",
  3494. "href": "file:///",
  3495. "protocol": "file:",
  3496. "username": "",
  3497. "password": "",
  3498. "host": "",
  3499. "hostname": "",
  3500. "port": "",
  3501. "pathname": "/",
  3502. "search": "",
  3503. "hash": ""
  3504. },
  3505. {
  3506. "input": "file:a",
  3507. "base": "http://www.example.com/test",
  3508. "href": "file:///a",
  3509. "protocol": "file:",
  3510. "username": "",
  3511. "password": "",
  3512. "host": "",
  3513. "hostname": "",
  3514. "port": "",
  3515. "pathname": "/a",
  3516. "search": "",
  3517. "hash": ""
  3518. },
  3519. "# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/host.html",
  3520. "Basic canonicalization, uppercase should be converted to lowercase",
  3521. {
  3522. "input": "http://ExAmPlE.CoM",
  3523. "base": "http://other.com/",
  3524. "href": "http://example.com/",
  3525. "origin": "http://example.com",
  3526. "protocol": "http:",
  3527. "username": "",
  3528. "password": "",
  3529. "host": "example.com",
  3530. "hostname": "example.com",
  3531. "port": "",
  3532. "pathname": "/",
  3533. "search": "",
  3534. "hash": ""
  3535. },
  3536. {
  3537. "input": "http://example example.com",
  3538. "base": "http://other.com/",
  3539. "failure": true
  3540. },
  3541. {
  3542. "input": "http://Goo%20 goo%7C|.com",
  3543. "base": "http://other.com/",
  3544. "failure": true
  3545. },
  3546. {
  3547. "input": "http://[]",
  3548. "base": "http://other.com/",
  3549. "failure": true
  3550. },
  3551. {
  3552. "input": "http://[:]",
  3553. "base": "http://other.com/",
  3554. "failure": true
  3555. },
  3556. "U+3000 is mapped to U+0020 (space) which is disallowed",
  3557. {
  3558. "input": "http://GOO\u00a0\u3000goo.com",
  3559. "base": "http://other.com/",
  3560. "failure": true
  3561. },
  3562. "Other types of space (no-break, zero-width, zero-width-no-break) are name-prepped away to nothing. U+200B, U+2060, and U+FEFF, are ignored",
  3563. {
  3564. "input": "http://GOO\u200b\u2060\ufeffgoo.com",
  3565. "base": "http://other.com/",
  3566. "href": "http://googoo.com/",
  3567. "origin": "http://googoo.com",
  3568. "protocol": "http:",
  3569. "username": "",
  3570. "password": "",
  3571. "host": "googoo.com",
  3572. "hostname": "googoo.com",
  3573. "port": "",
  3574. "pathname": "/",
  3575. "search": "",
  3576. "hash": ""
  3577. },
  3578. "Leading and trailing C0 control or space",
  3579. {
  3580. "input": "\u0000\u001b\u0004\u0012 http://example.com/\u001f \u000d ",
  3581. "base": "about:blank",
  3582. "href": "http://example.com/",
  3583. "origin": "http://example.com",
  3584. "protocol": "http:",
  3585. "username": "",
  3586. "password": "",
  3587. "host": "example.com",
  3588. "hostname": "example.com",
  3589. "port": "",
  3590. "pathname": "/",
  3591. "search": "",
  3592. "hash": ""
  3593. },
  3594. "Ideographic full stop (full-width period for Chinese, etc.) should be treated as a dot. U+3002 is mapped to U+002E (dot)",
  3595. {
  3596. "input": "http://www.foo。bar.com",
  3597. "base": "http://other.com/",
  3598. "href": "http://www.foo.bar.com/",
  3599. "origin": "http://www.foo.bar.com",
  3600. "protocol": "http:",
  3601. "username": "",
  3602. "password": "",
  3603. "host": "www.foo.bar.com",
  3604. "hostname": "www.foo.bar.com",
  3605. "port": "",
  3606. "pathname": "/",
  3607. "search": "",
  3608. "hash": ""
  3609. },
  3610. "Invalid unicode characters should fail... U+FDD0 is disallowed; %ef%b7%90 is U+FDD0",
  3611. {
  3612. "input": "http://\ufdd0zyx.com",
  3613. "base": "http://other.com/",
  3614. "failure": true
  3615. },
  3616. "This is the same as previous but escaped",
  3617. {
  3618. "input": "http://%ef%b7%90zyx.com",
  3619. "base": "http://other.com/",
  3620. "failure": true
  3621. },
  3622. "U+FFFD",
  3623. {
  3624. "input": "https://\ufffd",
  3625. "base": "about:blank",
  3626. "failure": true
  3627. },
  3628. {
  3629. "input": "https://%EF%BF%BD",
  3630. "base": "about:blank",
  3631. "failure": true
  3632. },
  3633. {
  3634. "input": "https://x/\ufffd?\ufffd#\ufffd",
  3635. "base": "about:blank",
  3636. "href": "https://x/%EF%BF%BD?%EF%BF%BD#%EF%BF%BD",
  3637. "origin": "https://x",
  3638. "protocol": "https:",
  3639. "username": "",
  3640. "password": "",
  3641. "host": "x",
  3642. "hostname": "x",
  3643. "port": "",
  3644. "pathname": "/%EF%BF%BD",
  3645. "search": "?%EF%BF%BD",
  3646. "hash": "#%EF%BF%BD"
  3647. },
  3648. "Test name prepping, fullwidth input should be converted to ASCII and NOT IDN-ized. This is 'Go' in fullwidth UTF-8/UTF-16.",
  3649. {
  3650. "input": "http://Go.com",
  3651. "base": "http://other.com/",
  3652. "href": "http://go.com/",
  3653. "origin": "http://go.com",
  3654. "protocol": "http:",
  3655. "username": "",
  3656. "password": "",
  3657. "host": "go.com",
  3658. "hostname": "go.com",
  3659. "port": "",
  3660. "pathname": "/",
  3661. "search": "",
  3662. "hash": ""
  3663. },
  3664. "URL spec forbids the following. https://www.w3.org/Bugs/Public/show_bug.cgi?id=24257",
  3665. {
  3666. "input": "http://%41.com",
  3667. "base": "http://other.com/",
  3668. "failure": true
  3669. },
  3670. {
  3671. "input": "http://%ef%bc%85%ef%bc%94%ef%bc%91.com",
  3672. "base": "http://other.com/",
  3673. "failure": true
  3674. },
  3675. "...%00 in fullwidth should fail (also as escaped UTF-8 input)",
  3676. {
  3677. "input": "http://%00.com",
  3678. "base": "http://other.com/",
  3679. "failure": true
  3680. },
  3681. {
  3682. "input": "http://%ef%bc%85%ef%bc%90%ef%bc%90.com",
  3683. "base": "http://other.com/",
  3684. "failure": true
  3685. },
  3686. "Basic IDN support, UTF-8 and UTF-16 input should be converted to IDN",
  3687. {
  3688. "input": "http://你好你好",
  3689. "base": "http://other.com/",
  3690. "href": "http://xn--6qqa088eba/",
  3691. "origin": "http://xn--6qqa088eba",
  3692. "protocol": "http:",
  3693. "username": "",
  3694. "password": "",
  3695. "host": "xn--6qqa088eba",
  3696. "hostname": "xn--6qqa088eba",
  3697. "port": "",
  3698. "pathname": "/",
  3699. "search": "",
  3700. "hash": ""
  3701. },
  3702. {
  3703. "input": "https://faß.ExAmPlE/",
  3704. "base": "about:blank",
  3705. "href": "https://xn--fa-hia.example/",
  3706. "origin": "https://xn--fa-hia.example",
  3707. "protocol": "https:",
  3708. "username": "",
  3709. "password": "",
  3710. "host": "xn--fa-hia.example",
  3711. "hostname": "xn--fa-hia.example",
  3712. "port": "",
  3713. "pathname": "/",
  3714. "search": "",
  3715. "hash": ""
  3716. },
  3717. {
  3718. "input": "sc://faß.ExAmPlE/",
  3719. "base": "about:blank",
  3720. "href": "sc://fa%C3%9F.ExAmPlE/",
  3721. "origin": "null",
  3722. "protocol": "sc:",
  3723. "username": "",
  3724. "password": "",
  3725. "host": "fa%C3%9F.ExAmPlE",
  3726. "hostname": "fa%C3%9F.ExAmPlE",
  3727. "port": "",
  3728. "pathname": "/",
  3729. "search": "",
  3730. "hash": ""
  3731. },
  3732. "Invalid escaped characters should fail and the percents should be escaped. https://www.w3.org/Bugs/Public/show_bug.cgi?id=24191",
  3733. {
  3734. "input": "http://%zz%66%a.com",
  3735. "base": "http://other.com/",
  3736. "failure": true
  3737. },
  3738. "If we get an invalid character that has been escaped.",
  3739. {
  3740. "input": "http://%25",
  3741. "base": "http://other.com/",
  3742. "failure": true
  3743. },
  3744. {
  3745. "input": "http://hello%00",
  3746. "base": "http://other.com/",
  3747. "failure": true
  3748. },
  3749. "Escaped numbers should be treated like IP addresses if they are.",
  3750. {
  3751. "input": "http://%30%78%63%30%2e%30%32%35%30.01",
  3752. "base": "http://other.com/",
  3753. "href": "http://192.168.0.1/",
  3754. "origin": "http://192.168.0.1",
  3755. "protocol": "http:",
  3756. "username": "",
  3757. "password": "",
  3758. "host": "192.168.0.1",
  3759. "hostname": "192.168.0.1",
  3760. "port": "",
  3761. "pathname": "/",
  3762. "search": "",
  3763. "hash": ""
  3764. },
  3765. {
  3766. "input": "http://%30%78%63%30%2e%30%32%35%30.01%2e",
  3767. "base": "http://other.com/",
  3768. "href": "http://192.168.0.1/",
  3769. "origin": "http://192.168.0.1",
  3770. "protocol": "http:",
  3771. "username": "",
  3772. "password": "",
  3773. "host": "192.168.0.1",
  3774. "hostname": "192.168.0.1",
  3775. "port": "",
  3776. "pathname": "/",
  3777. "search": "",
  3778. "hash": ""
  3779. },
  3780. {
  3781. "input": "http://192.168.0.257",
  3782. "base": "http://other.com/",
  3783. "failure": true
  3784. },
  3785. "Invalid escaping in hosts causes failure",
  3786. {
  3787. "input": "http://%3g%78%63%30%2e%30%32%35%30%2E.01",
  3788. "base": "http://other.com/",
  3789. "failure": true
  3790. },
  3791. "A space in a host causes failure",
  3792. {
  3793. "input": "http://192.168.0.1 hello",
  3794. "base": "http://other.com/",
  3795. "failure": true
  3796. },
  3797. {
  3798. "input": "https://x x:12",
  3799. "base": "about:blank",
  3800. "failure": true
  3801. },
  3802. "Fullwidth and escaped UTF-8 fullwidth should still be treated as IP",
  3803. {
  3804. "input": "http://0Xc0.0250.01",
  3805. "base": "http://other.com/",
  3806. "href": "http://192.168.0.1/",
  3807. "origin": "http://192.168.0.1",
  3808. "protocol": "http:",
  3809. "username": "",
  3810. "password": "",
  3811. "host": "192.168.0.1",
  3812. "hostname": "192.168.0.1",
  3813. "port": "",
  3814. "pathname": "/",
  3815. "search": "",
  3816. "hash": ""
  3817. },
  3818. "Domains with empty labels",
  3819. {
  3820. "input": "http://./",
  3821. "base": "about:blank",
  3822. "href": "http://./",
  3823. "origin": "http://.",
  3824. "protocol": "http:",
  3825. "username": "",
  3826. "password": "",
  3827. "host": ".",
  3828. "hostname": ".",
  3829. "port": "",
  3830. "pathname": "/",
  3831. "search": "",
  3832. "hash": ""
  3833. },
  3834. {
  3835. "input": "http://../",
  3836. "base": "about:blank",
  3837. "href": "http://../",
  3838. "origin": "http://..",
  3839. "protocol": "http:",
  3840. "username": "",
  3841. "password": "",
  3842. "host": "..",
  3843. "hostname": "..",
  3844. "port": "",
  3845. "pathname": "/",
  3846. "search": "",
  3847. "hash": ""
  3848. },
  3849. {
  3850. "input": "http://0..0x300/",
  3851. "base": "about:blank",
  3852. "href": "http://0..0x300/",
  3853. "origin": "http://0..0x300",
  3854. "protocol": "http:",
  3855. "username": "",
  3856. "password": "",
  3857. "host": "0..0x300",
  3858. "hostname": "0..0x300",
  3859. "port": "",
  3860. "pathname": "/",
  3861. "search": "",
  3862. "hash": ""
  3863. },
  3864. "Broken IPv6",
  3865. {
  3866. "input": "http://[www.google.com]/",
  3867. "base": "about:blank",
  3868. "failure": true
  3869. },
  3870. {
  3871. "input": "http://[google.com]",
  3872. "base": "http://other.com/",
  3873. "failure": true
  3874. },
  3875. {
  3876. "input": "http://[::1.2.3.4x]",
  3877. "base": "http://other.com/",
  3878. "failure": true
  3879. },
  3880. {
  3881. "input": "http://[::1.2.3.]",
  3882. "base": "http://other.com/",
  3883. "failure": true
  3884. },
  3885. {
  3886. "input": "http://[::1.2.]",
  3887. "base": "http://other.com/",
  3888. "failure": true
  3889. },
  3890. {
  3891. "input": "http://[::1.]",
  3892. "base": "http://other.com/",
  3893. "failure": true
  3894. },
  3895. "Misc Unicode",
  3896. {
  3897. "input": "http://foo:💩@example.com/bar",
  3898. "base": "http://other.com/",
  3899. "href": "http://foo:%F0%9F%92%A9@example.com/bar",
  3900. "origin": "http://example.com",
  3901. "protocol": "http:",
  3902. "username": "foo",
  3903. "password": "%F0%9F%92%A9",
  3904. "host": "example.com",
  3905. "hostname": "example.com",
  3906. "port": "",
  3907. "pathname": "/bar",
  3908. "search": "",
  3909. "hash": ""
  3910. },
  3911. "# resolving a fragment against any scheme succeeds",
  3912. {
  3913. "input": "#",
  3914. "base": "test:test",
  3915. "href": "test:test#",
  3916. "origin": "null",
  3917. "protocol": "test:",
  3918. "username": "",
  3919. "password": "",
  3920. "host": "",
  3921. "hostname": "",
  3922. "port": "",
  3923. "pathname": "test",
  3924. "search": "",
  3925. "hash": ""
  3926. },
  3927. {
  3928. "input": "#x",
  3929. "base": "mailto:x@x.com",
  3930. "href": "mailto:x@x.com#x",
  3931. "origin": "null",
  3932. "protocol": "mailto:",
  3933. "username": "",
  3934. "password": "",
  3935. "host": "",
  3936. "hostname": "",
  3937. "port": "",
  3938. "pathname": "x@x.com",
  3939. "search": "",
  3940. "hash": "#x"
  3941. },
  3942. {
  3943. "input": "#x",
  3944. "base": "data:,",
  3945. "href": "data:,#x",
  3946. "origin": "null",
  3947. "protocol": "data:",
  3948. "username": "",
  3949. "password": "",
  3950. "host": "",
  3951. "hostname": "",
  3952. "port": "",
  3953. "pathname": ",",
  3954. "search": "",
  3955. "hash": "#x"
  3956. },
  3957. {
  3958. "input": "#x",
  3959. "base": "about:blank",
  3960. "href": "about:blank#x",
  3961. "origin": "null",
  3962. "protocol": "about:",
  3963. "username": "",
  3964. "password": "",
  3965. "host": "",
  3966. "hostname": "",
  3967. "port": "",
  3968. "pathname": "blank",
  3969. "search": "",
  3970. "hash": "#x"
  3971. },
  3972. {
  3973. "input": "#",
  3974. "base": "test:test?test",
  3975. "href": "test:test?test#",
  3976. "origin": "null",
  3977. "protocol": "test:",
  3978. "username": "",
  3979. "password": "",
  3980. "host": "",
  3981. "hostname": "",
  3982. "port": "",
  3983. "pathname": "test",
  3984. "search": "?test",
  3985. "hash": ""
  3986. },
  3987. "# multiple @ in authority state",
  3988. {
  3989. "input": "https://@test@test@example:800/",
  3990. "base": "http://doesnotmatter/",
  3991. "href": "https://%40test%40test@example:800/",
  3992. "origin": "https://example:800",
  3993. "protocol": "https:",
  3994. "username": "%40test%40test",
  3995. "password": "",
  3996. "host": "example:800",
  3997. "hostname": "example",
  3998. "port": "800",
  3999. "pathname": "/",
  4000. "search": "",
  4001. "hash": ""
  4002. },
  4003. {
  4004. "input": "https://@@@example",
  4005. "base": "http://doesnotmatter/",
  4006. "href": "https://%40%40@example/",
  4007. "origin": "https://example",
  4008. "protocol": "https:",
  4009. "username": "%40%40",
  4010. "password": "",
  4011. "host": "example",
  4012. "hostname": "example",
  4013. "port": "",
  4014. "pathname": "/",
  4015. "search": "",
  4016. "hash": ""
  4017. },
  4018. "non-az-09 characters",
  4019. {
  4020. "input": "http://`{}:`{}@h/`{}?`{}",
  4021. "base": "http://doesnotmatter/",
  4022. "href": "http://%60%7B%7D:%60%7B%7D@h/%60%7B%7D?`{}",
  4023. "origin": "http://h",
  4024. "protocol": "http:",
  4025. "username": "%60%7B%7D",
  4026. "password": "%60%7B%7D",
  4027. "host": "h",
  4028. "hostname": "h",
  4029. "port": "",
  4030. "pathname": "/%60%7B%7D",
  4031. "search": "?`{}",
  4032. "hash": ""
  4033. },
  4034. "byte is ' and url is special",
  4035. {
  4036. "input": "http://host/?'",
  4037. "base": "about:blank",
  4038. "href": "http://host/?%27",
  4039. "origin": "http://host",
  4040. "protocol": "http:",
  4041. "username": "",
  4042. "password": "",
  4043. "host": "host",
  4044. "hostname": "host",
  4045. "port": "",
  4046. "pathname": "/",
  4047. "search": "?%27",
  4048. "hash": ""
  4049. },
  4050. {
  4051. "input": "notspecial://host/?'",
  4052. "base": "about:blank",
  4053. "href": "notspecial://host/?'",
  4054. "origin": "null",
  4055. "protocol": "notspecial:",
  4056. "username": "",
  4057. "password": "",
  4058. "host": "host",
  4059. "hostname": "host",
  4060. "port": "",
  4061. "pathname": "/",
  4062. "search": "?'",
  4063. "hash": ""
  4064. },
  4065. "# Credentials in base",
  4066. {
  4067. "input": "/some/path",
  4068. "base": "http://user@example.org/smth",
  4069. "href": "http://user@example.org/some/path",
  4070. "origin": "http://example.org",
  4071. "protocol": "http:",
  4072. "username": "user",
  4073. "password": "",
  4074. "host": "example.org",
  4075. "hostname": "example.org",
  4076. "port": "",
  4077. "pathname": "/some/path",
  4078. "search": "",
  4079. "hash": ""
  4080. },
  4081. {
  4082. "input": "",
  4083. "base": "http://user:pass@example.org:21/smth",
  4084. "href": "http://user:pass@example.org:21/smth",
  4085. "origin": "http://example.org:21",
  4086. "protocol": "http:",
  4087. "username": "user",
  4088. "password": "pass",
  4089. "host": "example.org:21",
  4090. "hostname": "example.org",
  4091. "port": "21",
  4092. "pathname": "/smth",
  4093. "search": "",
  4094. "hash": ""
  4095. },
  4096. {
  4097. "input": "/some/path",
  4098. "base": "http://user:pass@example.org:21/smth",
  4099. "href": "http://user:pass@example.org:21/some/path",
  4100. "origin": "http://example.org:21",
  4101. "protocol": "http:",
  4102. "username": "user",
  4103. "password": "pass",
  4104. "host": "example.org:21",
  4105. "hostname": "example.org",
  4106. "port": "21",
  4107. "pathname": "/some/path",
  4108. "search": "",
  4109. "hash": ""
  4110. },
  4111. "# a set of tests designed by zcorpan for relative URLs with unknown schemes",
  4112. {
  4113. "input": "i",
  4114. "base": "sc:sd",
  4115. "failure": true
  4116. },
  4117. {
  4118. "input": "i",
  4119. "base": "sc:sd/sd",
  4120. "failure": true
  4121. },
  4122. {
  4123. "input": "i",
  4124. "base": "sc:/pa/pa",
  4125. "href": "sc:/pa/i",
  4126. "origin": "null",
  4127. "protocol": "sc:",
  4128. "username": "",
  4129. "password": "",
  4130. "host": "",
  4131. "hostname": "",
  4132. "port": "",
  4133. "pathname": "/pa/i",
  4134. "search": "",
  4135. "hash": ""
  4136. },
  4137. {
  4138. "input": "i",
  4139. "base": "sc://ho/pa",
  4140. "href": "sc://ho/i",
  4141. "origin": "null",
  4142. "protocol": "sc:",
  4143. "username": "",
  4144. "password": "",
  4145. "host": "ho",
  4146. "hostname": "ho",
  4147. "port": "",
  4148. "pathname": "/i",
  4149. "search": "",
  4150. "hash": ""
  4151. },
  4152. {
  4153. "input": "i",
  4154. "base": "sc:///pa/pa",
  4155. "href": "sc:///pa/i",
  4156. "origin": "null",
  4157. "protocol": "sc:",
  4158. "username": "",
  4159. "password": "",
  4160. "host": "",
  4161. "hostname": "",
  4162. "port": "",
  4163. "pathname": "/pa/i",
  4164. "search": "",
  4165. "hash": ""
  4166. },
  4167. {
  4168. "input": "../i",
  4169. "base": "sc:sd",
  4170. "failure": true
  4171. },
  4172. {
  4173. "input": "../i",
  4174. "base": "sc:sd/sd",
  4175. "failure": true
  4176. },
  4177. {
  4178. "input": "../i",
  4179. "base": "sc:/pa/pa",
  4180. "href": "sc:/i",
  4181. "origin": "null",
  4182. "protocol": "sc:",
  4183. "username": "",
  4184. "password": "",
  4185. "host": "",
  4186. "hostname": "",
  4187. "port": "",
  4188. "pathname": "/i",
  4189. "search": "",
  4190. "hash": ""
  4191. },
  4192. {
  4193. "input": "../i",
  4194. "base": "sc://ho/pa",
  4195. "href": "sc://ho/i",
  4196. "origin": "null",
  4197. "protocol": "sc:",
  4198. "username": "",
  4199. "password": "",
  4200. "host": "ho",
  4201. "hostname": "ho",
  4202. "port": "",
  4203. "pathname": "/i",
  4204. "search": "",
  4205. "hash": ""
  4206. },
  4207. {
  4208. "input": "../i",
  4209. "base": "sc:///pa/pa",
  4210. "href": "sc:///i",
  4211. "origin": "null",
  4212. "protocol": "sc:",
  4213. "username": "",
  4214. "password": "",
  4215. "host": "",
  4216. "hostname": "",
  4217. "port": "",
  4218. "pathname": "/i",
  4219. "search": "",
  4220. "hash": ""
  4221. },
  4222. {
  4223. "input": "/i",
  4224. "base": "sc:sd",
  4225. "failure": true
  4226. },
  4227. {
  4228. "input": "/i",
  4229. "base": "sc:sd/sd",
  4230. "failure": true
  4231. },
  4232. {
  4233. "input": "/i",
  4234. "base": "sc:/pa/pa",
  4235. "href": "sc:/i",
  4236. "origin": "null",
  4237. "protocol": "sc:",
  4238. "username": "",
  4239. "password": "",
  4240. "host": "",
  4241. "hostname": "",
  4242. "port": "",
  4243. "pathname": "/i",
  4244. "search": "",
  4245. "hash": ""
  4246. },
  4247. {
  4248. "input": "/i",
  4249. "base": "sc://ho/pa",
  4250. "href": "sc://ho/i",
  4251. "origin": "null",
  4252. "protocol": "sc:",
  4253. "username": "",
  4254. "password": "",
  4255. "host": "ho",
  4256. "hostname": "ho",
  4257. "port": "",
  4258. "pathname": "/i",
  4259. "search": "",
  4260. "hash": ""
  4261. },
  4262. {
  4263. "input": "/i",
  4264. "base": "sc:///pa/pa",
  4265. "href": "sc:///i",
  4266. "origin": "null",
  4267. "protocol": "sc:",
  4268. "username": "",
  4269. "password": "",
  4270. "host": "",
  4271. "hostname": "",
  4272. "port": "",
  4273. "pathname": "/i",
  4274. "search": "",
  4275. "hash": ""
  4276. },
  4277. {
  4278. "input": "?i",
  4279. "base": "sc:sd",
  4280. "failure": true
  4281. },
  4282. {
  4283. "input": "?i",
  4284. "base": "sc:sd/sd",
  4285. "failure": true
  4286. },
  4287. {
  4288. "input": "?i",
  4289. "base": "sc:/pa/pa",
  4290. "href": "sc:/pa/pa?i",
  4291. "origin": "null",
  4292. "protocol": "sc:",
  4293. "username": "",
  4294. "password": "",
  4295. "host": "",
  4296. "hostname": "",
  4297. "port": "",
  4298. "pathname": "/pa/pa",
  4299. "search": "?i",
  4300. "hash": ""
  4301. },
  4302. {
  4303. "input": "?i",
  4304. "base": "sc://ho/pa",
  4305. "href": "sc://ho/pa?i",
  4306. "origin": "null",
  4307. "protocol": "sc:",
  4308. "username": "",
  4309. "password": "",
  4310. "host": "ho",
  4311. "hostname": "ho",
  4312. "port": "",
  4313. "pathname": "/pa",
  4314. "search": "?i",
  4315. "hash": ""
  4316. },
  4317. {
  4318. "input": "?i",
  4319. "base": "sc:///pa/pa",
  4320. "href": "sc:///pa/pa?i",
  4321. "origin": "null",
  4322. "protocol": "sc:",
  4323. "username": "",
  4324. "password": "",
  4325. "host": "",
  4326. "hostname": "",
  4327. "port": "",
  4328. "pathname": "/pa/pa",
  4329. "search": "?i",
  4330. "hash": ""
  4331. },
  4332. {
  4333. "input": "#i",
  4334. "base": "sc:sd",
  4335. "href": "sc:sd#i",
  4336. "origin": "null",
  4337. "protocol": "sc:",
  4338. "username": "",
  4339. "password": "",
  4340. "host": "",
  4341. "hostname": "",
  4342. "port": "",
  4343. "pathname": "sd",
  4344. "search": "",
  4345. "hash": "#i"
  4346. },
  4347. {
  4348. "input": "#i",
  4349. "base": "sc:sd/sd",
  4350. "href": "sc:sd/sd#i",
  4351. "origin": "null",
  4352. "protocol": "sc:",
  4353. "username": "",
  4354. "password": "",
  4355. "host": "",
  4356. "hostname": "",
  4357. "port": "",
  4358. "pathname": "sd/sd",
  4359. "search": "",
  4360. "hash": "#i"
  4361. },
  4362. {
  4363. "input": "#i",
  4364. "base": "sc:/pa/pa",
  4365. "href": "sc:/pa/pa#i",
  4366. "origin": "null",
  4367. "protocol": "sc:",
  4368. "username": "",
  4369. "password": "",
  4370. "host": "",
  4371. "hostname": "",
  4372. "port": "",
  4373. "pathname": "/pa/pa",
  4374. "search": "",
  4375. "hash": "#i"
  4376. },
  4377. {
  4378. "input": "#i",
  4379. "base": "sc://ho/pa",
  4380. "href": "sc://ho/pa#i",
  4381. "origin": "null",
  4382. "protocol": "sc:",
  4383. "username": "",
  4384. "password": "",
  4385. "host": "ho",
  4386. "hostname": "ho",
  4387. "port": "",
  4388. "pathname": "/pa",
  4389. "search": "",
  4390. "hash": "#i"
  4391. },
  4392. {
  4393. "input": "#i",
  4394. "base": "sc:///pa/pa",
  4395. "href": "sc:///pa/pa#i",
  4396. "origin": "null",
  4397. "protocol": "sc:",
  4398. "username": "",
  4399. "password": "",
  4400. "host": "",
  4401. "hostname": "",
  4402. "port": "",
  4403. "pathname": "/pa/pa",
  4404. "search": "",
  4405. "hash": "#i"
  4406. },
  4407. "# make sure that relative URL logic works on known typically non-relative schemes too",
  4408. {
  4409. "input": "about:/../",
  4410. "base": "about:blank",
  4411. "href": "about:/",
  4412. "origin": "null",
  4413. "protocol": "about:",
  4414. "username": "",
  4415. "password": "",
  4416. "host": "",
  4417. "hostname": "",
  4418. "port": "",
  4419. "pathname": "/",
  4420. "search": "",
  4421. "hash": ""
  4422. },
  4423. {
  4424. "input": "data:/../",
  4425. "base": "about:blank",
  4426. "href": "data:/",
  4427. "origin": "null",
  4428. "protocol": "data:",
  4429. "username": "",
  4430. "password": "",
  4431. "host": "",
  4432. "hostname": "",
  4433. "port": "",
  4434. "pathname": "/",
  4435. "search": "",
  4436. "hash": ""
  4437. },
  4438. {
  4439. "input": "javascript:/../",
  4440. "base": "about:blank",
  4441. "href": "javascript:/",
  4442. "origin": "null",
  4443. "protocol": "javascript:",
  4444. "username": "",
  4445. "password": "",
  4446. "host": "",
  4447. "hostname": "",
  4448. "port": "",
  4449. "pathname": "/",
  4450. "search": "",
  4451. "hash": ""
  4452. },
  4453. {
  4454. "input": "mailto:/../",
  4455. "base": "about:blank",
  4456. "href": "mailto:/",
  4457. "origin": "null",
  4458. "protocol": "mailto:",
  4459. "username": "",
  4460. "password": "",
  4461. "host": "",
  4462. "hostname": "",
  4463. "port": "",
  4464. "pathname": "/",
  4465. "search": "",
  4466. "hash": ""
  4467. },
  4468. "# unknown schemes and their hosts",
  4469. {
  4470. "input": "sc://ñ.test/",
  4471. "base": "about:blank",
  4472. "href": "sc://%C3%B1.test/",
  4473. "origin": "null",
  4474. "protocol": "sc:",
  4475. "username": "",
  4476. "password": "",
  4477. "host": "%C3%B1.test",
  4478. "hostname": "%C3%B1.test",
  4479. "port": "",
  4480. "pathname": "/",
  4481. "search": "",
  4482. "hash": ""
  4483. },
  4484. {
  4485. "input": "sc://\u001F!\"$&'()*+,-.;<=>^_`{|}~/",
  4486. "base": "about:blank",
  4487. "href": "sc://%1F!\"$&'()*+,-.;<=>^_`{|}~/",
  4488. "origin": "null",
  4489. "protocol": "sc:",
  4490. "username": "",
  4491. "password": "",
  4492. "host": "%1F!\"$&'()*+,-.;<=>^_`{|}~",
  4493. "hostname": "%1F!\"$&'()*+,-.;<=>^_`{|}~",
  4494. "port": "",
  4495. "pathname": "/",
  4496. "search": "",
  4497. "hash": ""
  4498. },
  4499. {
  4500. "input": "sc://\u0000/",
  4501. "base": "about:blank",
  4502. "failure": true
  4503. },
  4504. {
  4505. "input": "sc:// /",
  4506. "base": "about:blank",
  4507. "failure": true
  4508. },
  4509. {
  4510. "input": "sc://%/",
  4511. "base": "about:blank",
  4512. "href": "sc://%/",
  4513. "protocol": "sc:",
  4514. "username": "",
  4515. "password": "",
  4516. "host": "%",
  4517. "hostname": "%",
  4518. "port": "",
  4519. "pathname": "/",
  4520. "search": "",
  4521. "hash": ""
  4522. },
  4523. {
  4524. "input": "sc://@/",
  4525. "base": "about:blank",
  4526. "failure": true
  4527. },
  4528. {
  4529. "input": "sc://te@s:t@/",
  4530. "base": "about:blank",
  4531. "failure": true
  4532. },
  4533. {
  4534. "input": "sc://:/",
  4535. "base": "about:blank",
  4536. "failure": true
  4537. },
  4538. {
  4539. "input": "sc://:12/",
  4540. "base": "about:blank",
  4541. "failure": true
  4542. },
  4543. {
  4544. "input": "sc://[/",
  4545. "base": "about:blank",
  4546. "failure": true
  4547. },
  4548. {
  4549. "input": "sc://\\/",
  4550. "base": "about:blank",
  4551. "failure": true
  4552. },
  4553. {
  4554. "input": "sc://]/",
  4555. "base": "about:blank",
  4556. "failure": true
  4557. },
  4558. {
  4559. "input": "x",
  4560. "base": "sc://ñ",
  4561. "href": "sc://%C3%B1/x",
  4562. "origin": "null",
  4563. "protocol": "sc:",
  4564. "username": "",
  4565. "password": "",
  4566. "host": "%C3%B1",
  4567. "hostname": "%C3%B1",
  4568. "port": "",
  4569. "pathname": "/x",
  4570. "search": "",
  4571. "hash": ""
  4572. },
  4573. "# unknown schemes and backslashes",
  4574. {
  4575. "input": "sc:\\../",
  4576. "base": "about:blank",
  4577. "href": "sc:\\../",
  4578. "origin": "null",
  4579. "protocol": "sc:",
  4580. "username": "",
  4581. "password": "",
  4582. "host": "",
  4583. "hostname": "",
  4584. "port": "",
  4585. "pathname": "\\../",
  4586. "search": "",
  4587. "hash": ""
  4588. },
  4589. "# unknown scheme with path looking like a password",
  4590. {
  4591. "input": "sc::a@example.net",
  4592. "base": "about:blank",
  4593. "href": "sc::a@example.net",
  4594. "origin": "null",
  4595. "protocol": "sc:",
  4596. "username": "",
  4597. "password": "",
  4598. "host": "",
  4599. "hostname": "",
  4600. "port": "",
  4601. "pathname": ":a@example.net",
  4602. "search": "",
  4603. "hash": ""
  4604. },
  4605. "# unknown scheme with bogus percent-encoding",
  4606. {
  4607. "input": "wow:%NBD",
  4608. "base": "about:blank",
  4609. "href": "wow:%NBD",
  4610. "origin": "null",
  4611. "protocol": "wow:",
  4612. "username": "",
  4613. "password": "",
  4614. "host": "",
  4615. "hostname": "",
  4616. "port": "",
  4617. "pathname": "%NBD",
  4618. "search": "",
  4619. "hash": ""
  4620. },
  4621. {
  4622. "input": "wow:%1G",
  4623. "base": "about:blank",
  4624. "href": "wow:%1G",
  4625. "origin": "null",
  4626. "protocol": "wow:",
  4627. "username": "",
  4628. "password": "",
  4629. "host": "",
  4630. "hostname": "",
  4631. "port": "",
  4632. "pathname": "%1G",
  4633. "search": "",
  4634. "hash": ""
  4635. },
  4636. "# Hosts and percent-encoding",
  4637. {
  4638. "input": "ftp://example.com%80/",
  4639. "base": "about:blank",
  4640. "failure": true
  4641. },
  4642. {
  4643. "input": "ftp://example.com%A0/",
  4644. "base": "about:blank",
  4645. "failure": true
  4646. },
  4647. {
  4648. "input": "https://example.com%80/",
  4649. "base": "about:blank",
  4650. "failure": true
  4651. },
  4652. {
  4653. "input": "https://example.com%A0/",
  4654. "base": "about:blank",
  4655. "failure": true
  4656. },
  4657. {
  4658. "input": "ftp://%e2%98%83",
  4659. "base": "about:blank",
  4660. "href": "ftp://xn--n3h/",
  4661. "origin": "ftp://xn--n3h",
  4662. "protocol": "ftp:",
  4663. "username": "",
  4664. "password": "",
  4665. "host": "xn--n3h",
  4666. "hostname": "xn--n3h",
  4667. "port": "",
  4668. "pathname": "/",
  4669. "search": "",
  4670. "hash": ""
  4671. },
  4672. {
  4673. "input": "https://%e2%98%83",
  4674. "base": "about:blank",
  4675. "href": "https://xn--n3h/",
  4676. "origin": "https://xn--n3h",
  4677. "protocol": "https:",
  4678. "username": "",
  4679. "password": "",
  4680. "host": "xn--n3h",
  4681. "hostname": "xn--n3h",
  4682. "port": "",
  4683. "pathname": "/",
  4684. "search": "",
  4685. "hash": ""
  4686. },
  4687. "# tests from jsdom/whatwg-url designed for code coverage",
  4688. {
  4689. "input": "http://127.0.0.1:10100/relative_import.html",
  4690. "base": "about:blank",
  4691. "href": "http://127.0.0.1:10100/relative_import.html",
  4692. "origin": "http://127.0.0.1:10100",
  4693. "protocol": "http:",
  4694. "username": "",
  4695. "password": "",
  4696. "host": "127.0.0.1:10100",
  4697. "hostname": "127.0.0.1",
  4698. "port": "10100",
  4699. "pathname": "/relative_import.html",
  4700. "search": "",
  4701. "hash": ""
  4702. },
  4703. {
  4704. "input": "http://facebook.com/?foo=%7B%22abc%22",
  4705. "base": "about:blank",
  4706. "href": "http://facebook.com/?foo=%7B%22abc%22",
  4707. "origin": "http://facebook.com",
  4708. "protocol": "http:",
  4709. "username": "",
  4710. "password": "",
  4711. "host": "facebook.com",
  4712. "hostname": "facebook.com",
  4713. "port": "",
  4714. "pathname": "/",
  4715. "search": "?foo=%7B%22abc%22",
  4716. "hash": ""
  4717. },
  4718. {
  4719. "input": "https://localhost:3000/jqueryui@1.2.3",
  4720. "base": "about:blank",
  4721. "href": "https://localhost:3000/jqueryui@1.2.3",
  4722. "origin": "https://localhost:3000",
  4723. "protocol": "https:",
  4724. "username": "",
  4725. "password": "",
  4726. "host": "localhost:3000",
  4727. "hostname": "localhost",
  4728. "port": "3000",
  4729. "pathname": "/jqueryui@1.2.3",
  4730. "search": "",
  4731. "hash": ""
  4732. },
  4733. "# tab/LF/CR",
  4734. {
  4735. "input": "h\tt\nt\rp://h\to\ns\rt:9\t0\n0\r0/p\ta\nt\rh?q\tu\ne\rry#f\tr\na\rg",
  4736. "base": "about:blank",
  4737. "href": "http://host:9000/path?query#frag",
  4738. "origin": "http://host:9000",
  4739. "protocol": "http:",
  4740. "username": "",
  4741. "password": "",
  4742. "host": "host:9000",
  4743. "hostname": "host",
  4744. "port": "9000",
  4745. "pathname": "/path",
  4746. "search": "?query",
  4747. "hash": "#frag"
  4748. },
  4749. "# Stringification of URL.searchParams",
  4750. {
  4751. "input": "?a=b&c=d",
  4752. "base": "http://example.org/foo/bar",
  4753. "href": "http://example.org/foo/bar?a=b&c=d",
  4754. "origin": "http://example.org",
  4755. "protocol": "http:",
  4756. "username": "",
  4757. "password": "",
  4758. "host": "example.org",
  4759. "hostname": "example.org",
  4760. "port": "",
  4761. "pathname": "/foo/bar",
  4762. "search": "?a=b&c=d",
  4763. "searchParams": "a=b&c=d",
  4764. "hash": ""
  4765. },
  4766. {
  4767. "input": "??a=b&c=d",
  4768. "base": "http://example.org/foo/bar",
  4769. "href": "http://example.org/foo/bar??a=b&c=d",
  4770. "origin": "http://example.org",
  4771. "protocol": "http:",
  4772. "username": "",
  4773. "password": "",
  4774. "host": "example.org",
  4775. "hostname": "example.org",
  4776. "port": "",
  4777. "pathname": "/foo/bar",
  4778. "search": "??a=b&c=d",
  4779. "searchParams": "%3Fa=b&c=d",
  4780. "hash": ""
  4781. },
  4782. "# Scheme only",
  4783. {
  4784. "input": "http:",
  4785. "base": "http://example.org/foo/bar",
  4786. "href": "http://example.org/foo/bar",
  4787. "origin": "http://example.org",
  4788. "protocol": "http:",
  4789. "username": "",
  4790. "password": "",
  4791. "host": "example.org",
  4792. "hostname": "example.org",
  4793. "port": "",
  4794. "pathname": "/foo/bar",
  4795. "search": "",
  4796. "searchParams": "",
  4797. "hash": ""
  4798. },
  4799. {
  4800. "input": "http:",
  4801. "base": "https://example.org/foo/bar",
  4802. "failure": true
  4803. },
  4804. {
  4805. "input": "sc:",
  4806. "base": "https://example.org/foo/bar",
  4807. "href": "sc:",
  4808. "origin": "null",
  4809. "protocol": "sc:",
  4810. "username": "",
  4811. "password": "",
  4812. "host": "",
  4813. "hostname": "",
  4814. "port": "",
  4815. "pathname": "",
  4816. "search": "",
  4817. "searchParams": "",
  4818. "hash": ""
  4819. },
  4820. "# Percent encoding of fragments",
  4821. {
  4822. "input": "http://foo.bar/baz?qux#foo\bbar",
  4823. "base": "about:blank",
  4824. "href": "http://foo.bar/baz?qux#foo%08bar",
  4825. "origin": "http://foo.bar",
  4826. "protocol": "http:",
  4827. "username": "",
  4828. "password": "",
  4829. "host": "foo.bar",
  4830. "hostname": "foo.bar",
  4831. "port": "",
  4832. "pathname": "/baz",
  4833. "search": "?qux",
  4834. "searchParams": "qux=",
  4835. "hash": "#foo%08bar"
  4836. },
  4837. {
  4838. "input": "http://foo.bar/baz?qux#foo\"bar",
  4839. "base": "about:blank",
  4840. "href": "http://foo.bar/baz?qux#foo%22bar",
  4841. "origin": "http://foo.bar",
  4842. "protocol": "http:",
  4843. "username": "",
  4844. "password": "",
  4845. "host": "foo.bar",
  4846. "hostname": "foo.bar",
  4847. "port": "",
  4848. "pathname": "/baz",
  4849. "search": "?qux",
  4850. "searchParams": "qux=",
  4851. "hash": "#foo%22bar"
  4852. },
  4853. {
  4854. "input": "http://foo.bar/baz?qux#foo<bar",
  4855. "base": "about:blank",
  4856. "href": "http://foo.bar/baz?qux#foo%3Cbar",
  4857. "origin": "http://foo.bar",
  4858. "protocol": "http:",
  4859. "username": "",
  4860. "password": "",
  4861. "host": "foo.bar",
  4862. "hostname": "foo.bar",
  4863. "port": "",
  4864. "pathname": "/baz",
  4865. "search": "?qux",
  4866. "searchParams": "qux=",
  4867. "hash": "#foo%3Cbar"
  4868. },
  4869. {
  4870. "input": "http://foo.bar/baz?qux#foo>bar",
  4871. "base": "about:blank",
  4872. "href": "http://foo.bar/baz?qux#foo%3Ebar",
  4873. "origin": "http://foo.bar",
  4874. "protocol": "http:",
  4875. "username": "",
  4876. "password": "",
  4877. "host": "foo.bar",
  4878. "hostname": "foo.bar",
  4879. "port": "",
  4880. "pathname": "/baz",
  4881. "search": "?qux",
  4882. "searchParams": "qux=",
  4883. "hash": "#foo%3Ebar"
  4884. },
  4885. {
  4886. "input": "http://foo.bar/baz?qux#foo`bar",
  4887. "base": "about:blank",
  4888. "href": "http://foo.bar/baz?qux#foo%60bar",
  4889. "origin": "http://foo.bar",
  4890. "protocol": "http:",
  4891. "username": "",
  4892. "password": "",
  4893. "host": "foo.bar",
  4894. "hostname": "foo.bar",
  4895. "port": "",
  4896. "pathname": "/baz",
  4897. "search": "?qux",
  4898. "searchParams": "qux=",
  4899. "hash": "#foo%60bar"
  4900. },
  4901. "# IPv4 parsing (via https://github.com/nodejs/node/pull/10317)",
  4902. {
  4903. "input": "http://192.168.257",
  4904. "base": "http://other.com/",
  4905. "href": "http://192.168.1.1/",
  4906. "origin": "http://192.168.1.1",
  4907. "protocol": "http:",
  4908. "username": "",
  4909. "password": "",
  4910. "host": "192.168.1.1",
  4911. "hostname": "192.168.1.1",
  4912. "port": "",
  4913. "pathname": "/",
  4914. "search": "",
  4915. "hash": ""
  4916. },
  4917. {
  4918. "input": "http://192.168.257.com",
  4919. "base": "http://other.com/",
  4920. "href": "http://192.168.257.com/",
  4921. "origin": "http://192.168.257.com",
  4922. "protocol": "http:",
  4923. "username": "",
  4924. "password": "",
  4925. "host": "192.168.257.com",
  4926. "hostname": "192.168.257.com",
  4927. "port": "",
  4928. "pathname": "/",
  4929. "search": "",
  4930. "hash": ""
  4931. },
  4932. {
  4933. "input": "http://256",
  4934. "base": "http://other.com/",
  4935. "href": "http://0.0.1.0/",
  4936. "origin": "http://0.0.1.0",
  4937. "protocol": "http:",
  4938. "username": "",
  4939. "password": "",
  4940. "host": "0.0.1.0",
  4941. "hostname": "0.0.1.0",
  4942. "port": "",
  4943. "pathname": "/",
  4944. "search": "",
  4945. "hash": ""
  4946. },
  4947. {
  4948. "input": "http://256.com",
  4949. "base": "http://other.com/",
  4950. "href": "http://256.com/",
  4951. "origin": "http://256.com",
  4952. "protocol": "http:",
  4953. "username": "",
  4954. "password": "",
  4955. "host": "256.com",
  4956. "hostname": "256.com",
  4957. "port": "",
  4958. "pathname": "/",
  4959. "search": "",
  4960. "hash": ""
  4961. },
  4962. {
  4963. "input": "http://999999999",
  4964. "base": "http://other.com/",
  4965. "href": "http://59.154.201.255/",
  4966. "origin": "http://59.154.201.255",
  4967. "protocol": "http:",
  4968. "username": "",
  4969. "password": "",
  4970. "host": "59.154.201.255",
  4971. "hostname": "59.154.201.255",
  4972. "port": "",
  4973. "pathname": "/",
  4974. "search": "",
  4975. "hash": ""
  4976. },
  4977. {
  4978. "input": "http://999999999.com",
  4979. "base": "http://other.com/",
  4980. "href": "http://999999999.com/",
  4981. "origin": "http://999999999.com",
  4982. "protocol": "http:",
  4983. "username": "",
  4984. "password": "",
  4985. "host": "999999999.com",
  4986. "hostname": "999999999.com",
  4987. "port": "",
  4988. "pathname": "/",
  4989. "search": "",
  4990. "hash": ""
  4991. },
  4992. {
  4993. "input": "http://10000000000",
  4994. "base": "http://other.com/",
  4995. "failure": true
  4996. },
  4997. {
  4998. "input": "http://10000000000.com",
  4999. "base": "http://other.com/",
  5000. "href": "http://10000000000.com/",
  5001. "origin": "http://10000000000.com",
  5002. "protocol": "http:",
  5003. "username": "",
  5004. "password": "",
  5005. "host": "10000000000.com",
  5006. "hostname": "10000000000.com",
  5007. "port": "",
  5008. "pathname": "/",
  5009. "search": "",
  5010. "hash": ""
  5011. },
  5012. {
  5013. "input": "http://4294967295",
  5014. "base": "http://other.com/",
  5015. "href": "http://255.255.255.255/",
  5016. "origin": "http://255.255.255.255",
  5017. "protocol": "http:",
  5018. "username": "",
  5019. "password": "",
  5020. "host": "255.255.255.255",
  5021. "hostname": "255.255.255.255",
  5022. "port": "",
  5023. "pathname": "/",
  5024. "search": "",
  5025. "hash": ""
  5026. },
  5027. {
  5028. "input": "http://4294967296",
  5029. "base": "http://other.com/",
  5030. "failure": true
  5031. },
  5032. {
  5033. "input": "http://0xffffffff",
  5034. "base": "http://other.com/",
  5035. "href": "http://255.255.255.255/",
  5036. "origin": "http://255.255.255.255",
  5037. "protocol": "http:",
  5038. "username": "",
  5039. "password": "",
  5040. "host": "255.255.255.255",
  5041. "hostname": "255.255.255.255",
  5042. "port": "",
  5043. "pathname": "/",
  5044. "search": "",
  5045. "hash": ""
  5046. },
  5047. {
  5048. "input": "http://0xffffffff1",
  5049. "base": "http://other.com/",
  5050. "failure": true
  5051. },
  5052. {
  5053. "input": "http://256.256.256.256",
  5054. "base": "http://other.com/",
  5055. "failure": true
  5056. },
  5057. {
  5058. "input": "http://256.256.256.256.256",
  5059. "base": "http://other.com/",
  5060. "href": "http://256.256.256.256.256/",
  5061. "origin": "http://256.256.256.256.256",
  5062. "protocol": "http:",
  5063. "username": "",
  5064. "password": "",
  5065. "host": "256.256.256.256.256",
  5066. "hostname": "256.256.256.256.256",
  5067. "port": "",
  5068. "pathname": "/",
  5069. "search": "",
  5070. "hash": ""
  5071. },
  5072. {
  5073. "input": "https://0x.0x.0",
  5074. "base": "about:blank",
  5075. "href": "https://0.0.0.0/",
  5076. "origin": "https://0.0.0.0",
  5077. "protocol": "https:",
  5078. "username": "",
  5079. "password": "",
  5080. "host": "0.0.0.0",
  5081. "hostname": "0.0.0.0",
  5082. "port": "",
  5083. "pathname": "/",
  5084. "search": "",
  5085. "hash": ""
  5086. },
  5087. "More IPv4 parsing (via https://github.com/jsdom/whatwg-url/issues/92)",
  5088. {
  5089. "input": "https://0x100000000/test",
  5090. "base": "about:blank",
  5091. "failure": true
  5092. },
  5093. {
  5094. "input": "https://256.0.0.1/test",
  5095. "base": "about:blank",
  5096. "failure": true
  5097. },
  5098. "# file URLs containing percent-encoded Windows drive letters (shouldn't work)",
  5099. {
  5100. "input": "file:///C%3A/",
  5101. "base": "about:blank",
  5102. "href": "file:///C%3A/",
  5103. "protocol": "file:",
  5104. "username": "",
  5105. "password": "",
  5106. "host": "",
  5107. "hostname": "",
  5108. "port": "",
  5109. "pathname": "/C%3A/",
  5110. "search": "",
  5111. "hash": ""
  5112. },
  5113. {
  5114. "input": "file:///C%7C/",
  5115. "base": "about:blank",
  5116. "href": "file:///C%7C/",
  5117. "protocol": "file:",
  5118. "username": "",
  5119. "password": "",
  5120. "host": "",
  5121. "hostname": "",
  5122. "port": "",
  5123. "pathname": "/C%7C/",
  5124. "search": "",
  5125. "hash": ""
  5126. },
  5127. "# file URLs relative to other file URLs (via https://github.com/jsdom/whatwg-url/pull/60)",
  5128. {
  5129. "input": "pix/submit.gif",
  5130. "base": "file:///C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/anchor.html",
  5131. "href": "file:///C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/pix/submit.gif",
  5132. "protocol": "file:",
  5133. "username": "",
  5134. "password": "",
  5135. "host": "",
  5136. "hostname": "",
  5137. "port": "",
  5138. "pathname": "/C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/pix/submit.gif",
  5139. "search": "",
  5140. "hash": ""
  5141. },
  5142. {
  5143. "input": "..",
  5144. "base": "file:///C:/",
  5145. "href": "file:///C:/",
  5146. "protocol": "file:",
  5147. "username": "",
  5148. "password": "",
  5149. "host": "",
  5150. "hostname": "",
  5151. "port": "",
  5152. "pathname": "/C:/",
  5153. "search": "",
  5154. "hash": ""
  5155. },
  5156. {
  5157. "input": "..",
  5158. "base": "file:///",
  5159. "href": "file:///",
  5160. "protocol": "file:",
  5161. "username": "",
  5162. "password": "",
  5163. "host": "",
  5164. "hostname": "",
  5165. "port": "",
  5166. "pathname": "/",
  5167. "search": "",
  5168. "hash": ""
  5169. },
  5170. "# More file URL tests by zcorpan and annevk",
  5171. {
  5172. "input": "/",
  5173. "base": "file:///C:/a/b",
  5174. "href": "file:///C:/",
  5175. "protocol": "file:",
  5176. "username": "",
  5177. "password": "",
  5178. "host": "",
  5179. "hostname": "",
  5180. "port": "",
  5181. "pathname": "/C:/",
  5182. "search": "",
  5183. "hash": ""
  5184. },
  5185. {
  5186. "input": "//d:",
  5187. "base": "file:///C:/a/b",
  5188. "href": "file:///d:",
  5189. "protocol": "file:",
  5190. "username": "",
  5191. "password": "",
  5192. "host": "",
  5193. "hostname": "",
  5194. "port": "",
  5195. "pathname": "/d:",
  5196. "search": "",
  5197. "hash": ""
  5198. },
  5199. {
  5200. "input": "//d:/..",
  5201. "base": "file:///C:/a/b",
  5202. "href": "file:///d:/",
  5203. "protocol": "file:",
  5204. "username": "",
  5205. "password": "",
  5206. "host": "",
  5207. "hostname": "",
  5208. "port": "",
  5209. "pathname": "/d:/",
  5210. "search": "",
  5211. "hash": ""
  5212. },
  5213. {
  5214. "input": "..",
  5215. "base": "file:///ab:/",
  5216. "href": "file:///",
  5217. "protocol": "file:",
  5218. "username": "",
  5219. "password": "",
  5220. "host": "",
  5221. "hostname": "",
  5222. "port": "",
  5223. "pathname": "/",
  5224. "search": "",
  5225. "hash": ""
  5226. },
  5227. {
  5228. "input": "..",
  5229. "base": "file:///1:/",
  5230. "href": "file:///",
  5231. "protocol": "file:",
  5232. "username": "",
  5233. "password": "",
  5234. "host": "",
  5235. "hostname": "",
  5236. "port": "",
  5237. "pathname": "/",
  5238. "search": "",
  5239. "hash": ""
  5240. },
  5241. {
  5242. "input": "",
  5243. "base": "file:///test?test#test",
  5244. "href": "file:///test?test",
  5245. "protocol": "file:",
  5246. "username": "",
  5247. "password": "",
  5248. "host": "",
  5249. "hostname": "",
  5250. "port": "",
  5251. "pathname": "/test",
  5252. "search": "?test",
  5253. "hash": ""
  5254. },
  5255. {
  5256. "input": "file:",
  5257. "base": "file:///test?test#test",
  5258. "href": "file:///test?test",
  5259. "protocol": "file:",
  5260. "username": "",
  5261. "password": "",
  5262. "host": "",
  5263. "hostname": "",
  5264. "port": "",
  5265. "pathname": "/test",
  5266. "search": "?test",
  5267. "hash": ""
  5268. },
  5269. {
  5270. "input": "?x",
  5271. "base": "file:///test?test#test",
  5272. "href": "file:///test?x",
  5273. "protocol": "file:",
  5274. "username": "",
  5275. "password": "",
  5276. "host": "",
  5277. "hostname": "",
  5278. "port": "",
  5279. "pathname": "/test",
  5280. "search": "?x",
  5281. "hash": ""
  5282. },
  5283. {
  5284. "input": "file:?x",
  5285. "base": "file:///test?test#test",
  5286. "href": "file:///test?x",
  5287. "protocol": "file:",
  5288. "username": "",
  5289. "password": "",
  5290. "host": "",
  5291. "hostname": "",
  5292. "port": "",
  5293. "pathname": "/test",
  5294. "search": "?x",
  5295. "hash": ""
  5296. },
  5297. {
  5298. "input": "#x",
  5299. "base": "file:///test?test#test",
  5300. "href": "file:///test?test#x",
  5301. "protocol": "file:",
  5302. "username": "",
  5303. "password": "",
  5304. "host": "",
  5305. "hostname": "",
  5306. "port": "",
  5307. "pathname": "/test",
  5308. "search": "?test",
  5309. "hash": "#x"
  5310. },
  5311. {
  5312. "input": "file:#x",
  5313. "base": "file:///test?test#test",
  5314. "href": "file:///test?test#x",
  5315. "protocol": "file:",
  5316. "username": "",
  5317. "password": "",
  5318. "host": "",
  5319. "hostname": "",
  5320. "port": "",
  5321. "pathname": "/test",
  5322. "search": "?test",
  5323. "hash": "#x"
  5324. },
  5325. "# File URLs and many (back)slashes",
  5326. {
  5327. "input": "file:\\\\//",
  5328. "base": "about:blank",
  5329. "href": "file:///",
  5330. "protocol": "file:",
  5331. "username": "",
  5332. "password": "",
  5333. "host": "",
  5334. "hostname": "",
  5335. "port": "",
  5336. "pathname": "/",
  5337. "search": "",
  5338. "hash": ""
  5339. },
  5340. {
  5341. "input": "file:\\\\\\\\",
  5342. "base": "about:blank",
  5343. "href": "file:///",
  5344. "protocol": "file:",
  5345. "username": "",
  5346. "password": "",
  5347. "host": "",
  5348. "hostname": "",
  5349. "port": "",
  5350. "pathname": "/",
  5351. "search": "",
  5352. "hash": ""
  5353. },
  5354. {
  5355. "input": "file:\\\\\\\\?fox",
  5356. "base": "about:blank",
  5357. "href": "file:///?fox",
  5358. "protocol": "file:",
  5359. "username": "",
  5360. "password": "",
  5361. "host": "",
  5362. "hostname": "",
  5363. "port": "",
  5364. "pathname": "/",
  5365. "search": "?fox",
  5366. "hash": ""
  5367. },
  5368. {
  5369. "input": "file:\\\\\\\\#guppy",
  5370. "base": "about:blank",
  5371. "href": "file:///#guppy",
  5372. "protocol": "file:",
  5373. "username": "",
  5374. "password": "",
  5375. "host": "",
  5376. "hostname": "",
  5377. "port": "",
  5378. "pathname": "/",
  5379. "search": "",
  5380. "hash": "#guppy"
  5381. },
  5382. {
  5383. "input": "file://spider///",
  5384. "base": "about:blank",
  5385. "href": "file://spider/",
  5386. "protocol": "file:",
  5387. "username": "",
  5388. "password": "",
  5389. "host": "spider",
  5390. "hostname": "spider",
  5391. "port": "",
  5392. "pathname": "/",
  5393. "search": "",
  5394. "hash": ""
  5395. },
  5396. {
  5397. "input": "file:\\\\localhost//",
  5398. "base": "about:blank",
  5399. "href": "file:///",
  5400. "protocol": "file:",
  5401. "username": "",
  5402. "password": "",
  5403. "host": "",
  5404. "hostname": "",
  5405. "port": "",
  5406. "pathname": "/",
  5407. "search": "",
  5408. "hash": ""
  5409. },
  5410. {
  5411. "input": "file:///localhost//cat",
  5412. "base": "about:blank",
  5413. "href": "file:///localhost//cat",
  5414. "protocol": "file:",
  5415. "username": "",
  5416. "password": "",
  5417. "host": "",
  5418. "hostname": "",
  5419. "port": "",
  5420. "pathname": "/localhost//cat",
  5421. "search": "",
  5422. "hash": ""
  5423. },
  5424. {
  5425. "input": "file://\\/localhost//cat",
  5426. "base": "about:blank",
  5427. "href": "file:///localhost//cat",
  5428. "protocol": "file:",
  5429. "username": "",
  5430. "password": "",
  5431. "host": "",
  5432. "hostname": "",
  5433. "port": "",
  5434. "pathname": "/localhost//cat",
  5435. "search": "",
  5436. "hash": ""
  5437. },
  5438. {
  5439. "input": "file://localhost//a//../..//",
  5440. "base": "about:blank",
  5441. "href": "file:///",
  5442. "protocol": "file:",
  5443. "username": "",
  5444. "password": "",
  5445. "host": "",
  5446. "hostname": "",
  5447. "port": "",
  5448. "pathname": "/",
  5449. "search": "",
  5450. "hash": ""
  5451. },
  5452. {
  5453. "input": "/////mouse",
  5454. "base": "file:///elephant",
  5455. "href": "file:///mouse",
  5456. "protocol": "file:",
  5457. "username": "",
  5458. "password": "",
  5459. "host": "",
  5460. "hostname": "",
  5461. "port": "",
  5462. "pathname": "/mouse",
  5463. "search": "",
  5464. "hash": ""
  5465. },
  5466. {
  5467. "input": "\\//pig",
  5468. "base": "file://lion/",
  5469. "href": "file:///pig",
  5470. "protocol": "file:",
  5471. "username": "",
  5472. "password": "",
  5473. "host": "",
  5474. "hostname": "",
  5475. "port": "",
  5476. "pathname": "/pig",
  5477. "search": "",
  5478. "hash": ""
  5479. },
  5480. {
  5481. "input": "\\/localhost//pig",
  5482. "base": "file://lion/",
  5483. "href": "file:///pig",
  5484. "protocol": "file:",
  5485. "username": "",
  5486. "password": "",
  5487. "host": "",
  5488. "hostname": "",
  5489. "port": "",
  5490. "pathname": "/pig",
  5491. "search": "",
  5492. "hash": ""
  5493. },
  5494. {
  5495. "input": "//localhost//pig",
  5496. "base": "file://lion/",
  5497. "href": "file:///pig",
  5498. "protocol": "file:",
  5499. "username": "",
  5500. "password": "",
  5501. "host": "",
  5502. "hostname": "",
  5503. "port": "",
  5504. "pathname": "/pig",
  5505. "search": "",
  5506. "hash": ""
  5507. },
  5508. {
  5509. "input": "/..//localhost//pig",
  5510. "base": "file://lion/",
  5511. "href": "file://lion/localhost//pig",
  5512. "protocol": "file:",
  5513. "username": "",
  5514. "password": "",
  5515. "host": "lion",
  5516. "hostname": "lion",
  5517. "port": "",
  5518. "pathname": "/localhost//pig",
  5519. "search": "",
  5520. "hash": ""
  5521. },
  5522. {
  5523. "input": "file://",
  5524. "base": "file://ape/",
  5525. "href": "file:///",
  5526. "protocol": "file:",
  5527. "username": "",
  5528. "password": "",
  5529. "host": "",
  5530. "hostname": "",
  5531. "port": "",
  5532. "pathname": "/",
  5533. "search": "",
  5534. "hash": ""
  5535. },
  5536. "# File URLs with non-empty hosts",
  5537. {
  5538. "input": "/rooibos",
  5539. "base": "file://tea/",
  5540. "href": "file://tea/rooibos",
  5541. "protocol": "file:",
  5542. "username": "",
  5543. "password": "",
  5544. "host": "tea",
  5545. "hostname": "tea",
  5546. "port": "",
  5547. "pathname": "/rooibos",
  5548. "search": "",
  5549. "hash": ""
  5550. },
  5551. {
  5552. "input": "/?chai",
  5553. "base": "file://tea/",
  5554. "href": "file://tea/?chai",
  5555. "protocol": "file:",
  5556. "username": "",
  5557. "password": "",
  5558. "host": "tea",
  5559. "hostname": "tea",
  5560. "port": "",
  5561. "pathname": "/",
  5562. "search": "?chai",
  5563. "hash": ""
  5564. },
  5565. "# Windows drive letter handling with the 'file:' base URL",
  5566. {
  5567. "input": "C|",
  5568. "base": "file://host/dir/file",
  5569. "href": "file:///C:",
  5570. "protocol": "file:",
  5571. "username": "",
  5572. "password": "",
  5573. "host": "",
  5574. "hostname": "",
  5575. "port": "",
  5576. "pathname": "/C:",
  5577. "search": "",
  5578. "hash": ""
  5579. },
  5580. {
  5581. "input": "C|#",
  5582. "base": "file://host/dir/file",
  5583. "href": "file:///C:#",
  5584. "protocol": "file:",
  5585. "username": "",
  5586. "password": "",
  5587. "host": "",
  5588. "hostname": "",
  5589. "port": "",
  5590. "pathname": "/C:",
  5591. "search": "",
  5592. "hash": ""
  5593. },
  5594. {
  5595. "input": "C|?",
  5596. "base": "file://host/dir/file",
  5597. "href": "file:///C:?",
  5598. "protocol": "file:",
  5599. "username": "",
  5600. "password": "",
  5601. "host": "",
  5602. "hostname": "",
  5603. "port": "",
  5604. "pathname": "/C:",
  5605. "search": "",
  5606. "hash": ""
  5607. },
  5608. {
  5609. "input": "C|/",
  5610. "base": "file://host/dir/file",
  5611. "href": "file:///C:/",
  5612. "protocol": "file:",
  5613. "username": "",
  5614. "password": "",
  5615. "host": "",
  5616. "hostname": "",
  5617. "port": "",
  5618. "pathname": "/C:/",
  5619. "search": "",
  5620. "hash": ""
  5621. },
  5622. {
  5623. "input": "C|\n/",
  5624. "base": "file://host/dir/file",
  5625. "href": "file:///C:/",
  5626. "protocol": "file:",
  5627. "username": "",
  5628. "password": "",
  5629. "host": "",
  5630. "hostname": "",
  5631. "port": "",
  5632. "pathname": "/C:/",
  5633. "search": "",
  5634. "hash": ""
  5635. },
  5636. {
  5637. "input": "C|\\",
  5638. "base": "file://host/dir/file",
  5639. "href": "file:///C:/",
  5640. "protocol": "file:",
  5641. "username": "",
  5642. "password": "",
  5643. "host": "",
  5644. "hostname": "",
  5645. "port": "",
  5646. "pathname": "/C:/",
  5647. "search": "",
  5648. "hash": ""
  5649. },
  5650. {
  5651. "input": "C",
  5652. "base": "file://host/dir/file",
  5653. "href": "file://host/dir/C",
  5654. "protocol": "file:",
  5655. "username": "",
  5656. "password": "",
  5657. "host": "host",
  5658. "hostname": "host",
  5659. "port": "",
  5660. "pathname": "/dir/C",
  5661. "search": "",
  5662. "hash": ""
  5663. },
  5664. {
  5665. "input": "C|a",
  5666. "base": "file://host/dir/file",
  5667. "href": "file://host/dir/C|a",
  5668. "protocol": "file:",
  5669. "username": "",
  5670. "password": "",
  5671. "host": "host",
  5672. "hostname": "host",
  5673. "port": "",
  5674. "pathname": "/dir/C|a",
  5675. "search": "",
  5676. "hash": ""
  5677. },
  5678. "# Windows drive letter quirk in the file slash state",
  5679. {
  5680. "input": "/c:/foo/bar",
  5681. "base": "file:///c:/baz/qux",
  5682. "href": "file:///c:/foo/bar",
  5683. "protocol": "file:",
  5684. "username": "",
  5685. "password": "",
  5686. "host": "",
  5687. "hostname": "",
  5688. "port": "",
  5689. "pathname": "/c:/foo/bar",
  5690. "search": "",
  5691. "hash": ""
  5692. },
  5693. {
  5694. "input": "/c|/foo/bar",
  5695. "base": "file:///c:/baz/qux",
  5696. "href": "file:///c:/foo/bar",
  5697. "protocol": "file:",
  5698. "username": "",
  5699. "password": "",
  5700. "host": "",
  5701. "hostname": "",
  5702. "port": "",
  5703. "pathname": "/c:/foo/bar",
  5704. "search": "",
  5705. "hash": ""
  5706. },
  5707. {
  5708. "input": "file:\\c:\\foo\\bar",
  5709. "base": "file:///c:/baz/qux",
  5710. "href": "file:///c:/foo/bar",
  5711. "protocol": "file:",
  5712. "username": "",
  5713. "password": "",
  5714. "host": "",
  5715. "hostname": "",
  5716. "port": "",
  5717. "pathname": "/c:/foo/bar",
  5718. "search": "",
  5719. "hash": ""
  5720. },
  5721. {
  5722. "input": "/c:/foo/bar",
  5723. "base": "file://host/path",
  5724. "href": "file:///c:/foo/bar",
  5725. "protocol": "file:",
  5726. "username": "",
  5727. "password": "",
  5728. "host": "",
  5729. "hostname": "",
  5730. "port": "",
  5731. "pathname": "/c:/foo/bar",
  5732. "search": "",
  5733. "hash": ""
  5734. },
  5735. "# Windows drive letter quirk with not empty host",
  5736. {
  5737. "input": "file://example.net/C:/",
  5738. "base": "about:blank",
  5739. "href": "file:///C:/",
  5740. "protocol": "file:",
  5741. "username": "",
  5742. "password": "",
  5743. "host": "",
  5744. "hostname": "",
  5745. "port": "",
  5746. "pathname": "/C:/",
  5747. "search": "",
  5748. "hash": ""
  5749. },
  5750. {
  5751. "input": "file://1.2.3.4/C:/",
  5752. "base": "about:blank",
  5753. "href": "file:///C:/",
  5754. "protocol": "file:",
  5755. "username": "",
  5756. "password": "",
  5757. "host": "",
  5758. "hostname": "",
  5759. "port": "",
  5760. "pathname": "/C:/",
  5761. "search": "",
  5762. "hash": ""
  5763. },
  5764. {
  5765. "input": "file://[1::8]/C:/",
  5766. "base": "about:blank",
  5767. "href": "file:///C:/",
  5768. "protocol": "file:",
  5769. "username": "",
  5770. "password": "",
  5771. "host": "",
  5772. "hostname": "",
  5773. "port": "",
  5774. "pathname": "/C:/",
  5775. "search": "",
  5776. "hash": ""
  5777. },
  5778. "# Windows drive letter quirk (no host)",
  5779. {
  5780. "input": "file:/C|/",
  5781. "base": "about:blank",
  5782. "href": "file:///C:/",
  5783. "protocol": "file:",
  5784. "username": "",
  5785. "password": "",
  5786. "host": "",
  5787. "hostname": "",
  5788. "port": "",
  5789. "pathname": "/C:/",
  5790. "search": "",
  5791. "hash": ""
  5792. },
  5793. {
  5794. "input": "file://C|/",
  5795. "base": "about:blank",
  5796. "href": "file:///C:/",
  5797. "protocol": "file:",
  5798. "username": "",
  5799. "password": "",
  5800. "host": "",
  5801. "hostname": "",
  5802. "port": "",
  5803. "pathname": "/C:/",
  5804. "search": "",
  5805. "hash": ""
  5806. },
  5807. "# file URLs without base URL by Rimas Misevičius",
  5808. {
  5809. "input": "file:",
  5810. "base": "about:blank",
  5811. "href": "file:///",
  5812. "protocol": "file:",
  5813. "username": "",
  5814. "password": "",
  5815. "host": "",
  5816. "hostname": "",
  5817. "port": "",
  5818. "pathname": "/",
  5819. "search": "",
  5820. "hash": ""
  5821. },
  5822. {
  5823. "input": "file:?q=v",
  5824. "base": "about:blank",
  5825. "href": "file:///?q=v",
  5826. "protocol": "file:",
  5827. "username": "",
  5828. "password": "",
  5829. "host": "",
  5830. "hostname": "",
  5831. "port": "",
  5832. "pathname": "/",
  5833. "search": "?q=v",
  5834. "hash": ""
  5835. },
  5836. {
  5837. "input": "file:#frag",
  5838. "base": "about:blank",
  5839. "href": "file:///#frag",
  5840. "protocol": "file:",
  5841. "username": "",
  5842. "password": "",
  5843. "host": "",
  5844. "hostname": "",
  5845. "port": "",
  5846. "pathname": "/",
  5847. "search": "",
  5848. "hash": "#frag"
  5849. },
  5850. "# IPv6 tests",
  5851. {
  5852. "input": "http://[1:0::]",
  5853. "base": "http://example.net/",
  5854. "href": "http://[1::]/",
  5855. "origin": "http://[1::]",
  5856. "protocol": "http:",
  5857. "username": "",
  5858. "password": "",
  5859. "host": "[1::]",
  5860. "hostname": "[1::]",
  5861. "port": "",
  5862. "pathname": "/",
  5863. "search": "",
  5864. "hash": ""
  5865. },
  5866. {
  5867. "input": "http://[0:1:2:3:4:5:6:7:8]",
  5868. "base": "http://example.net/",
  5869. "failure": true
  5870. },
  5871. {
  5872. "input": "https://[0::0::0]",
  5873. "base": "about:blank",
  5874. "failure": true
  5875. },
  5876. {
  5877. "input": "https://[0:.0]",
  5878. "base": "about:blank",
  5879. "failure": true
  5880. },
  5881. {
  5882. "input": "https://[0:0:]",
  5883. "base": "about:blank",
  5884. "failure": true
  5885. },
  5886. {
  5887. "input": "https://[0:1:2:3:4:5:6:7.0.0.0.1]",
  5888. "base": "about:blank",
  5889. "failure": true
  5890. },
  5891. {
  5892. "input": "https://[0:1.00.0.0.0]",
  5893. "base": "about:blank",
  5894. "failure": true
  5895. },
  5896. {
  5897. "input": "https://[0:1.290.0.0.0]",
  5898. "base": "about:blank",
  5899. "failure": true
  5900. },
  5901. {
  5902. "input": "https://[0:1.23.23]",
  5903. "base": "about:blank",
  5904. "failure": true
  5905. },
  5906. "# Empty host",
  5907. {
  5908. "input": "http://?",
  5909. "base": "about:blank",
  5910. "failure": true
  5911. },
  5912. {
  5913. "input": "http://#",
  5914. "base": "about:blank",
  5915. "failure": true
  5916. },
  5917. "Port overflow (2^32 + 81)",
  5918. {
  5919. "input": "http://f:4294967377/c",
  5920. "base": "http://example.org/",
  5921. "failure": true
  5922. },
  5923. "Port overflow (2^64 + 81)",
  5924. {
  5925. "input": "http://f:18446744073709551697/c",
  5926. "base": "http://example.org/",
  5927. "failure": true
  5928. },
  5929. "Port overflow (2^128 + 81)",
  5930. {
  5931. "input": "http://f:340282366920938463463374607431768211537/c",
  5932. "base": "http://example.org/",
  5933. "failure": true
  5934. },
  5935. "# Non-special-URL path tests",
  5936. {
  5937. "input": "sc://ñ",
  5938. "base": "about:blank",
  5939. "href": "sc://%C3%B1",
  5940. "origin": "null",
  5941. "protocol": "sc:",
  5942. "username": "",
  5943. "password": "",
  5944. "host": "%C3%B1",
  5945. "hostname": "%C3%B1",
  5946. "port": "",
  5947. "pathname": "",
  5948. "search": "",
  5949. "hash": ""
  5950. },
  5951. {
  5952. "input": "sc://ñ?x",
  5953. "base": "about:blank",
  5954. "href": "sc://%C3%B1?x",
  5955. "origin": "null",
  5956. "protocol": "sc:",
  5957. "username": "",
  5958. "password": "",
  5959. "host": "%C3%B1",
  5960. "hostname": "%C3%B1",
  5961. "port": "",
  5962. "pathname": "",
  5963. "search": "?x",
  5964. "hash": ""
  5965. },
  5966. {
  5967. "input": "sc://ñ#x",
  5968. "base": "about:blank",
  5969. "href": "sc://%C3%B1#x",
  5970. "origin": "null",
  5971. "protocol": "sc:",
  5972. "username": "",
  5973. "password": "",
  5974. "host": "%C3%B1",
  5975. "hostname": "%C3%B1",
  5976. "port": "",
  5977. "pathname": "",
  5978. "search": "",
  5979. "hash": "#x"
  5980. },
  5981. {
  5982. "input": "#x",
  5983. "base": "sc://ñ",
  5984. "href": "sc://%C3%B1#x",
  5985. "origin": "null",
  5986. "protocol": "sc:",
  5987. "username": "",
  5988. "password": "",
  5989. "host": "%C3%B1",
  5990. "hostname": "%C3%B1",
  5991. "port": "",
  5992. "pathname": "",
  5993. "search": "",
  5994. "hash": "#x"
  5995. },
  5996. {
  5997. "input": "?x",
  5998. "base": "sc://ñ",
  5999. "href": "sc://%C3%B1?x",
  6000. "origin": "null",
  6001. "protocol": "sc:",
  6002. "username": "",
  6003. "password": "",
  6004. "host": "%C3%B1",
  6005. "hostname": "%C3%B1",
  6006. "port": "",
  6007. "pathname": "",
  6008. "search": "?x",
  6009. "hash": ""
  6010. },
  6011. {
  6012. "input": "sc://?",
  6013. "base": "about:blank",
  6014. "href": "sc://?",
  6015. "protocol": "sc:",
  6016. "username": "",
  6017. "password": "",
  6018. "host": "",
  6019. "hostname": "",
  6020. "port": "",
  6021. "pathname": "",
  6022. "search": "",
  6023. "hash": ""
  6024. },
  6025. {
  6026. "input": "sc://#",
  6027. "base": "about:blank",
  6028. "href": "sc://#",
  6029. "protocol": "sc:",
  6030. "username": "",
  6031. "password": "",
  6032. "host": "",
  6033. "hostname": "",
  6034. "port": "",
  6035. "pathname": "",
  6036. "search": "",
  6037. "hash": ""
  6038. },
  6039. {
  6040. "input": "///",
  6041. "base": "sc://x/",
  6042. "href": "sc:///",
  6043. "protocol": "sc:",
  6044. "username": "",
  6045. "password": "",
  6046. "host": "",
  6047. "hostname": "",
  6048. "port": "",
  6049. "pathname": "/",
  6050. "search": "",
  6051. "hash": ""
  6052. },
  6053. {
  6054. "input": "////",
  6055. "base": "sc://x/",
  6056. "href": "sc:////",
  6057. "protocol": "sc:",
  6058. "username": "",
  6059. "password": "",
  6060. "host": "",
  6061. "hostname": "",
  6062. "port": "",
  6063. "pathname": "//",
  6064. "search": "",
  6065. "hash": ""
  6066. },
  6067. {
  6068. "input": "////x/",
  6069. "base": "sc://x/",
  6070. "href": "sc:////x/",
  6071. "protocol": "sc:",
  6072. "username": "",
  6073. "password": "",
  6074. "host": "",
  6075. "hostname": "",
  6076. "port": "",
  6077. "pathname": "//x/",
  6078. "search": "",
  6079. "hash": ""
  6080. },
  6081. {
  6082. "input": "tftp://foobar.com/someconfig;mode=netascii",
  6083. "base": "about:blank",
  6084. "href": "tftp://foobar.com/someconfig;mode=netascii",
  6085. "origin": "null",
  6086. "protocol": "tftp:",
  6087. "username": "",
  6088. "password": "",
  6089. "host": "foobar.com",
  6090. "hostname": "foobar.com",
  6091. "port": "",
  6092. "pathname": "/someconfig;mode=netascii",
  6093. "search": "",
  6094. "hash": ""
  6095. },
  6096. {
  6097. "input": "telnet://user:pass@foobar.com:23/",
  6098. "base": "about:blank",
  6099. "href": "telnet://user:pass@foobar.com:23/",
  6100. "origin": "null",
  6101. "protocol": "telnet:",
  6102. "username": "user",
  6103. "password": "pass",
  6104. "host": "foobar.com:23",
  6105. "hostname": "foobar.com",
  6106. "port": "23",
  6107. "pathname": "/",
  6108. "search": "",
  6109. "hash": ""
  6110. },
  6111. {
  6112. "input": "ut2004://10.10.10.10:7777/Index.ut2",
  6113. "base": "about:blank",
  6114. "href": "ut2004://10.10.10.10:7777/Index.ut2",
  6115. "origin": "null",
  6116. "protocol": "ut2004:",
  6117. "username": "",
  6118. "password": "",
  6119. "host": "10.10.10.10:7777",
  6120. "hostname": "10.10.10.10",
  6121. "port": "7777",
  6122. "pathname": "/Index.ut2",
  6123. "search": "",
  6124. "hash": ""
  6125. },
  6126. {
  6127. "input": "redis://foo:bar@somehost:6379/0?baz=bam&qux=baz",
  6128. "base": "about:blank",
  6129. "href": "redis://foo:bar@somehost:6379/0?baz=bam&qux=baz",
  6130. "origin": "null",
  6131. "protocol": "redis:",
  6132. "username": "foo",
  6133. "password": "bar",
  6134. "host": "somehost:6379",
  6135. "hostname": "somehost",
  6136. "port": "6379",
  6137. "pathname": "/0",
  6138. "search": "?baz=bam&qux=baz",
  6139. "hash": ""
  6140. },
  6141. {
  6142. "input": "rsync://foo@host:911/sup",
  6143. "base": "about:blank",
  6144. "href": "rsync://foo@host:911/sup",
  6145. "origin": "null",
  6146. "protocol": "rsync:",
  6147. "username": "foo",
  6148. "password": "",
  6149. "host": "host:911",
  6150. "hostname": "host",
  6151. "port": "911",
  6152. "pathname": "/sup",
  6153. "search": "",
  6154. "hash": ""
  6155. },
  6156. {
  6157. "input": "git://github.com/foo/bar.git",
  6158. "base": "about:blank",
  6159. "href": "git://github.com/foo/bar.git",
  6160. "origin": "null",
  6161. "protocol": "git:",
  6162. "username": "",
  6163. "password": "",
  6164. "host": "github.com",
  6165. "hostname": "github.com",
  6166. "port": "",
  6167. "pathname": "/foo/bar.git",
  6168. "search": "",
  6169. "hash": ""
  6170. },
  6171. {
  6172. "input": "irc://myserver.com:6999/channel?passwd",
  6173. "base": "about:blank",
  6174. "href": "irc://myserver.com:6999/channel?passwd",
  6175. "origin": "null",
  6176. "protocol": "irc:",
  6177. "username": "",
  6178. "password": "",
  6179. "host": "myserver.com:6999",
  6180. "hostname": "myserver.com",
  6181. "port": "6999",
  6182. "pathname": "/channel",
  6183. "search": "?passwd",
  6184. "hash": ""
  6185. },
  6186. {
  6187. "input": "dns://fw.example.org:9999/foo.bar.org?type=TXT",
  6188. "base": "about:blank",
  6189. "href": "dns://fw.example.org:9999/foo.bar.org?type=TXT",
  6190. "origin": "null",
  6191. "protocol": "dns:",
  6192. "username": "",
  6193. "password": "",
  6194. "host": "fw.example.org:9999",
  6195. "hostname": "fw.example.org",
  6196. "port": "9999",
  6197. "pathname": "/foo.bar.org",
  6198. "search": "?type=TXT",
  6199. "hash": ""
  6200. },
  6201. {
  6202. "input": "ldap://localhost:389/ou=People,o=JNDITutorial",
  6203. "base": "about:blank",
  6204. "href": "ldap://localhost:389/ou=People,o=JNDITutorial",
  6205. "origin": "null",
  6206. "protocol": "ldap:",
  6207. "username": "",
  6208. "password": "",
  6209. "host": "localhost:389",
  6210. "hostname": "localhost",
  6211. "port": "389",
  6212. "pathname": "/ou=People,o=JNDITutorial",
  6213. "search": "",
  6214. "hash": ""
  6215. },
  6216. {
  6217. "input": "git+https://github.com/foo/bar",
  6218. "base": "about:blank",
  6219. "href": "git+https://github.com/foo/bar",
  6220. "origin": "null",
  6221. "protocol": "git+https:",
  6222. "username": "",
  6223. "password": "",
  6224. "host": "github.com",
  6225. "hostname": "github.com",
  6226. "port": "",
  6227. "pathname": "/foo/bar",
  6228. "search": "",
  6229. "hash": ""
  6230. },
  6231. {
  6232. "input": "urn:ietf:rfc:2648",
  6233. "base": "about:blank",
  6234. "href": "urn:ietf:rfc:2648",
  6235. "origin": "null",
  6236. "protocol": "urn:",
  6237. "username": "",
  6238. "password": "",
  6239. "host": "",
  6240. "hostname": "",
  6241. "port": "",
  6242. "pathname": "ietf:rfc:2648",
  6243. "search": "",
  6244. "hash": ""
  6245. },
  6246. {
  6247. "input": "tag:joe@example.org,2001:foo/bar",
  6248. "base": "about:blank",
  6249. "href": "tag:joe@example.org,2001:foo/bar",
  6250. "origin": "null",
  6251. "protocol": "tag:",
  6252. "username": "",
  6253. "password": "",
  6254. "host": "",
  6255. "hostname": "",
  6256. "port": "",
  6257. "pathname": "joe@example.org,2001:foo/bar",
  6258. "search": "",
  6259. "hash": ""
  6260. },
  6261. "# percent encoded hosts in non-special-URLs",
  6262. {
  6263. "input": "non-special://%E2%80%A0/",
  6264. "base": "about:blank",
  6265. "href": "non-special://%E2%80%A0/",
  6266. "protocol": "non-special:",
  6267. "username": "",
  6268. "password": "",
  6269. "host": "%E2%80%A0",
  6270. "hostname": "%E2%80%A0",
  6271. "port": "",
  6272. "pathname": "/",
  6273. "search": "",
  6274. "hash": ""
  6275. },
  6276. {
  6277. "input": "non-special://H%4fSt/path",
  6278. "base": "about:blank",
  6279. "href": "non-special://H%4fSt/path",
  6280. "protocol": "non-special:",
  6281. "username": "",
  6282. "password": "",
  6283. "host": "H%4fSt",
  6284. "hostname": "H%4fSt",
  6285. "port": "",
  6286. "pathname": "/path",
  6287. "search": "",
  6288. "hash": ""
  6289. },
  6290. "# IPv6 in non-special-URLs",
  6291. {
  6292. "input": "non-special://[1:2:0:0:5:0:0:0]/",
  6293. "base": "about:blank",
  6294. "href": "non-special://[1:2:0:0:5::]/",
  6295. "protocol": "non-special:",
  6296. "username": "",
  6297. "password": "",
  6298. "host": "[1:2:0:0:5::]",
  6299. "hostname": "[1:2:0:0:5::]",
  6300. "port": "",
  6301. "pathname": "/",
  6302. "search": "",
  6303. "hash": ""
  6304. },
  6305. {
  6306. "input": "non-special://[1:2:0:0:0:0:0:3]/",
  6307. "base": "about:blank",
  6308. "href": "non-special://[1:2::3]/",
  6309. "protocol": "non-special:",
  6310. "username": "",
  6311. "password": "",
  6312. "host": "[1:2::3]",
  6313. "hostname": "[1:2::3]",
  6314. "port": "",
  6315. "pathname": "/",
  6316. "search": "",
  6317. "hash": ""
  6318. },
  6319. {
  6320. "input": "non-special://[1:2::3]:80/",
  6321. "base": "about:blank",
  6322. "href": "non-special://[1:2::3]:80/",
  6323. "protocol": "non-special:",
  6324. "username": "",
  6325. "password": "",
  6326. "host": "[1:2::3]:80",
  6327. "hostname": "[1:2::3]",
  6328. "port": "80",
  6329. "pathname": "/",
  6330. "search": "",
  6331. "hash": ""
  6332. },
  6333. {
  6334. "input": "non-special://[:80/",
  6335. "base": "about:blank",
  6336. "failure": true
  6337. },
  6338. {
  6339. "input": "blob:https://example.com:443/",
  6340. "base": "about:blank",
  6341. "href": "blob:https://example.com:443/",
  6342. "protocol": "blob:",
  6343. "username": "",
  6344. "password": "",
  6345. "host": "",
  6346. "hostname": "",
  6347. "port": "",
  6348. "pathname": "https://example.com:443/",
  6349. "search": "",
  6350. "hash": ""
  6351. },
  6352. {
  6353. "input": "blob:d3958f5c-0777-0845-9dcf-2cb28783acaf",
  6354. "base": "about:blank",
  6355. "href": "blob:d3958f5c-0777-0845-9dcf-2cb28783acaf",
  6356. "protocol": "blob:",
  6357. "username": "",
  6358. "password": "",
  6359. "host": "",
  6360. "hostname": "",
  6361. "port": "",
  6362. "pathname": "d3958f5c-0777-0845-9dcf-2cb28783acaf",
  6363. "search": "",
  6364. "hash": ""
  6365. },
  6366. "Invalid IPv4 radix digits",
  6367. {
  6368. "input": "http://0177.0.0.0189",
  6369. "base": "about:blank",
  6370. "href": "http://0177.0.0.0189/",
  6371. "protocol": "http:",
  6372. "username": "",
  6373. "password": "",
  6374. "host": "0177.0.0.0189",
  6375. "hostname": "0177.0.0.0189",
  6376. "port": "",
  6377. "pathname": "/",
  6378. "search": "",
  6379. "hash": ""
  6380. },
  6381. {
  6382. "input": "http://0x7f.0.0.0x7g",
  6383. "base": "about:blank",
  6384. "href": "http://0x7f.0.0.0x7g/",
  6385. "protocol": "http:",
  6386. "username": "",
  6387. "password": "",
  6388. "host": "0x7f.0.0.0x7g",
  6389. "hostname": "0x7f.0.0.0x7g",
  6390. "port": "",
  6391. "pathname": "/",
  6392. "search": "",
  6393. "hash": ""
  6394. },
  6395. {
  6396. "input": "http://0X7F.0.0.0X7G",
  6397. "base": "about:blank",
  6398. "href": "http://0x7f.0.0.0x7g/",
  6399. "protocol": "http:",
  6400. "username": "",
  6401. "password": "",
  6402. "host": "0x7f.0.0.0x7g",
  6403. "hostname": "0x7f.0.0.0x7g",
  6404. "port": "",
  6405. "pathname": "/",
  6406. "search": "",
  6407. "hash": ""
  6408. },
  6409. "Invalid IPv4 portion of IPv6 address",
  6410. {
  6411. "input": "http://[::127.0.0.0.1]",
  6412. "base": "about:blank",
  6413. "failure": true
  6414. },
  6415. "Uncompressed IPv6 addresses with 0",
  6416. {
  6417. "input": "http://[0:1:0:1:0:1:0:1]",
  6418. "base": "about:blank",
  6419. "href": "http://[0:1:0:1:0:1:0:1]/",
  6420. "protocol": "http:",
  6421. "username": "",
  6422. "password": "",
  6423. "host": "[0:1:0:1:0:1:0:1]",
  6424. "hostname": "[0:1:0:1:0:1:0:1]",
  6425. "port": "",
  6426. "pathname": "/",
  6427. "search": "",
  6428. "hash": ""
  6429. },
  6430. {
  6431. "input": "http://[1:0:1:0:1:0:1:0]",
  6432. "base": "about:blank",
  6433. "href": "http://[1:0:1:0:1:0:1:0]/",
  6434. "protocol": "http:",
  6435. "username": "",
  6436. "password": "",
  6437. "host": "[1:0:1:0:1:0:1:0]",
  6438. "hostname": "[1:0:1:0:1:0:1:0]",
  6439. "port": "",
  6440. "pathname": "/",
  6441. "search": "",
  6442. "hash": ""
  6443. },
  6444. "Percent-encoded query and fragment",
  6445. {
  6446. "input": "http://example.org/test?\u0022",
  6447. "base": "about:blank",
  6448. "href": "http://example.org/test?%22",
  6449. "protocol": "http:",
  6450. "username": "",
  6451. "password": "",
  6452. "host": "example.org",
  6453. "hostname": "example.org",
  6454. "port": "",
  6455. "pathname": "/test",
  6456. "search": "?%22",
  6457. "hash": ""
  6458. },
  6459. {
  6460. "input": "http://example.org/test?\u0023",
  6461. "base": "about:blank",
  6462. "href": "http://example.org/test?#",
  6463. "protocol": "http:",
  6464. "username": "",
  6465. "password": "",
  6466. "host": "example.org",
  6467. "hostname": "example.org",
  6468. "port": "",
  6469. "pathname": "/test",
  6470. "search": "",
  6471. "hash": ""
  6472. },
  6473. {
  6474. "input": "http://example.org/test?\u003C",
  6475. "base": "about:blank",
  6476. "href": "http://example.org/test?%3C",
  6477. "protocol": "http:",
  6478. "username": "",
  6479. "password": "",
  6480. "host": "example.org",
  6481. "hostname": "example.org",
  6482. "port": "",
  6483. "pathname": "/test",
  6484. "search": "?%3C",
  6485. "hash": ""
  6486. },
  6487. {
  6488. "input": "http://example.org/test?\u003E",
  6489. "base": "about:blank",
  6490. "href": "http://example.org/test?%3E",
  6491. "protocol": "http:",
  6492. "username": "",
  6493. "password": "",
  6494. "host": "example.org",
  6495. "hostname": "example.org",
  6496. "port": "",
  6497. "pathname": "/test",
  6498. "search": "?%3E",
  6499. "hash": ""
  6500. },
  6501. {
  6502. "input": "http://example.org/test?\u2323",
  6503. "base": "about:blank",
  6504. "href": "http://example.org/test?%E2%8C%A3",
  6505. "protocol": "http:",
  6506. "username": "",
  6507. "password": "",
  6508. "host": "example.org",
  6509. "hostname": "example.org",
  6510. "port": "",
  6511. "pathname": "/test",
  6512. "search": "?%E2%8C%A3",
  6513. "hash": ""
  6514. },
  6515. {
  6516. "input": "http://example.org/test?%23%23",
  6517. "base": "about:blank",
  6518. "href": "http://example.org/test?%23%23",
  6519. "protocol": "http:",
  6520. "username": "",
  6521. "password": "",
  6522. "host": "example.org",
  6523. "hostname": "example.org",
  6524. "port": "",
  6525. "pathname": "/test",
  6526. "search": "?%23%23",
  6527. "hash": ""
  6528. },
  6529. {
  6530. "input": "http://example.org/test?%GH",
  6531. "base": "about:blank",
  6532. "href": "http://example.org/test?%GH",
  6533. "protocol": "http:",
  6534. "username": "",
  6535. "password": "",
  6536. "host": "example.org",
  6537. "hostname": "example.org",
  6538. "port": "",
  6539. "pathname": "/test",
  6540. "search": "?%GH",
  6541. "hash": ""
  6542. },
  6543. {
  6544. "input": "http://example.org/test?a#%EF",
  6545. "base": "about:blank",
  6546. "href": "http://example.org/test?a#%EF",
  6547. "protocol": "http:",
  6548. "username": "",
  6549. "password": "",
  6550. "host": "example.org",
  6551. "hostname": "example.org",
  6552. "port": "",
  6553. "pathname": "/test",
  6554. "search": "?a",
  6555. "hash": "#%EF"
  6556. },
  6557. {
  6558. "input": "http://example.org/test?a#%GH",
  6559. "base": "about:blank",
  6560. "href": "http://example.org/test?a#%GH",
  6561. "protocol": "http:",
  6562. "username": "",
  6563. "password": "",
  6564. "host": "example.org",
  6565. "hostname": "example.org",
  6566. "port": "",
  6567. "pathname": "/test",
  6568. "search": "?a",
  6569. "hash": "#%GH"
  6570. },
  6571. "URLs that require a non-about:blank base. (Also serve as invalid base tests.)",
  6572. {
  6573. "input": "a",
  6574. "base": "about:blank",
  6575. "failure": true
  6576. },
  6577. {
  6578. "input": "a/",
  6579. "base": "about:blank",
  6580. "failure": true
  6581. },
  6582. {
  6583. "input": "a//",
  6584. "base": "about:blank",
  6585. "failure": true
  6586. },
  6587. "Bases that don't fail to parse but fail to be bases",
  6588. {
  6589. "input": "test-a-colon.html",
  6590. "base": "a:",
  6591. "failure": true
  6592. },
  6593. {
  6594. "input": "test-a-colon-b.html",
  6595. "base": "a:b",
  6596. "failure": true
  6597. },
  6598. "Other base URL tests, that must succeed",
  6599. {
  6600. "input": "test-a-colon-slash.html",
  6601. "base": "a:/",
  6602. "href": "a:/test-a-colon-slash.html",
  6603. "protocol": "a:",
  6604. "username": "",
  6605. "password": "",
  6606. "host": "",
  6607. "hostname": "",
  6608. "port": "",
  6609. "pathname": "/test-a-colon-slash.html",
  6610. "search": "",
  6611. "hash": ""
  6612. },
  6613. {
  6614. "input": "test-a-colon-slash-slash.html",
  6615. "base": "a://",
  6616. "href": "a:///test-a-colon-slash-slash.html",
  6617. "protocol": "a:",
  6618. "username": "",
  6619. "password": "",
  6620. "host": "",
  6621. "hostname": "",
  6622. "port": "",
  6623. "pathname": "/test-a-colon-slash-slash.html",
  6624. "search": "",
  6625. "hash": ""
  6626. },
  6627. {
  6628. "input": "test-a-colon-slash-b.html",
  6629. "base": "a:/b",
  6630. "href": "a:/test-a-colon-slash-b.html",
  6631. "protocol": "a:",
  6632. "username": "",
  6633. "password": "",
  6634. "host": "",
  6635. "hostname": "",
  6636. "port": "",
  6637. "pathname": "/test-a-colon-slash-b.html",
  6638. "search": "",
  6639. "hash": ""
  6640. },
  6641. {
  6642. "input": "test-a-colon-slash-slash-b.html",
  6643. "base": "a://b",
  6644. "href": "a://b/test-a-colon-slash-slash-b.html",
  6645. "protocol": "a:",
  6646. "username": "",
  6647. "password": "",
  6648. "host": "b",
  6649. "hostname": "b",
  6650. "port": "",
  6651. "pathname": "/test-a-colon-slash-slash-b.html",
  6652. "search": "",
  6653. "hash": ""
  6654. },
  6655. "Null code point in fragment",
  6656. {
  6657. "input": "http://example.org/test?a#b\u0000c",
  6658. "base": "about:blank",
  6659. "href": "http://example.org/test?a#bc",
  6660. "protocol": "http:",
  6661. "username": "",
  6662. "password": "",
  6663. "host": "example.org",
  6664. "hostname": "example.org",
  6665. "port": "",
  6666. "pathname": "/test",
  6667. "search": "?a",
  6668. "hash": "#bc"
  6669. }
  6670. ]