From 94a0819fe3a0d679c3042a77bfe6a2afc505daea Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:28 +0200 Subject: Adding upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/url/tests/urltestdata.json | 3661 +++++++++++++++++++++++-------------- 1 file changed, 2289 insertions(+), 1372 deletions(-) (limited to 'vendor/url/tests/urltestdata.json') diff --git a/vendor/url/tests/urltestdata.json b/vendor/url/tests/urltestdata.json index 554e61914..4265f5928 100644 --- a/vendor/url/tests/urltestdata.json +++ b/vendor/url/tests/urltestdata.json @@ -1,6 +1,6 @@ [ "# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/segments.js", - "# AS OF https://github.com/jsdom/whatwg-url/commit/35f04dfd3048cf6362f4398745bb13375c5020c2", + "# AS OF https://github.com/web-platform-tests/wpt/commit/2a64dae4641fbd61bd4257df460e188f425b492e", { "input": "http://example\t.\norg", "base": "http://example.org/foo/bar", @@ -540,6 +540,36 @@ "search": "", "hash": "" }, + { + "input": "\\x", + "base": "http://example.org/foo/bar", + "href": "http://example.org/x", + "origin": "http://example.org", + "protocol": "http:", + "username": "", + "password": "", + "host": "example.org", + "hostname": "example.org", + "port": "", + "pathname": "/x", + "search": "", + "hash": "" + }, + { + "input": "\\\\x\\hello", + "base": "http://example.org/foo/bar", + "href": "http://x/hello", + "origin": "http://x", + "protocol": "http:", + "username": "", + "password": "", + "host": "x", + "hostname": "x", + "port": "", + "pathname": "/hello", + "search": "", + "hash": "" + }, { "input": "::", "base": "http://example.org/foo/bar", @@ -3157,7 +3187,8 @@ { "input": "http:/:@/www.example.com", "base": "about:blank", - "failure": true + "failure": true, + "inputCanBeRelative": true }, { "input": "http://user@/www.example.com", @@ -3167,12 +3198,14 @@ { "input": "http:@/www.example.com", "base": "about:blank", - "failure": true + "failure": true, + "inputCanBeRelative": true }, { "input": "http:/@/www.example.com", "base": "about:blank", - "failure": true + "failure": true, + "inputCanBeRelative": true }, { "input": "http://@/www.example.com", @@ -3182,17 +3215,20 @@ { "input": "https:@/www.example.com", "base": "about:blank", - "failure": true + "failure": true, + "inputCanBeRelative": true }, { "input": "http:a:b@/www.example.com", "base": "about:blank", - "failure": true + "failure": true, + "inputCanBeRelative": true }, { "input": "http:/a:b@/www.example.com", "base": "about:blank", - "failure": true + "failure": true, + "inputCanBeRelative": true }, { "input": "http://a:b@/www.example.com", @@ -3202,7 +3238,8 @@ { "input": "http::@/www.example.com", "base": "about:blank", - "failure": true + "failure": true, + "inputCanBeRelative": true }, { "input": "http:a:@www.example.com", @@ -3267,12 +3304,14 @@ { "input": "http:@:www.example.com", "base": "about:blank", - "failure": true + "failure": true, + "inputCanBeRelative": true }, { "input": "http:/@:www.example.com", "base": "about:blank", - "failure": true + "failure": true, + "inputCanBeRelative": true }, { "input": "http://@:www.example.com", @@ -3646,6 +3685,38 @@ "search": "?%EF%BF%BD", "hash": "#%EF%BF%BD" }, + "Domain is ASCII, but a label is invalid IDNA", + { + "input": "http://a.b.c.xn--pokxncvks", + "base": "about:blank", + "failure": true + }, + { + "input": "http://10.0.0.xn--pokxncvks", + "base": "about:blank", + "failure": true + }, + "IDNA labels should be matched case-insensitively", + { + "input": "http://a.b.c.XN--pokxncvks", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a.b.c.Xn--pokxncvks", + "base": "about:blank", + "failure": true + }, + { + "input": "http://10.0.0.XN--pokxncvks", + "base": "about:blank", + "failure": true + }, + { + "input": "http://10.0.0.xN--pokxncvks", + "base": "about:blank", + "failure": true + }, "Test name prepping, fullwidth input should be converted to ASCII and NOT IDN-ized. This is 'Go' in fullwidth UTF-8/UTF-16.", { "input": "http://Go.com", @@ -3847,21 +3918,6 @@ "search": "", "hash": "" }, - { - "input": "http://0..0x300/", - "base": "about:blank", - "href": "http://0..0x300/", - "origin": "http://0..0x300", - "protocol": "http:", - "username": "", - "password": "", - "host": "0..0x300", - "hostname": "0..0x300", - "port": "", - "pathname": "/", - "search": "", - "hash": "" - }, "Broken IPv6", { "input": "http://[www.google.com]/", @@ -4482,16 +4538,6 @@ "search": "", "hash": "" }, - { - "input": "sc://\u0000/", - "base": "about:blank", - "failure": true - }, - { - "input": "sc:// /", - "base": "about:blank", - "failure": true - }, { "input": "sc://%/", "base": "about:blank", @@ -4526,21 +4572,6 @@ "base": "about:blank", "failure": true }, - { - "input": "sc://[/", - "base": "about:blank", - "failure": true - }, - { - "input": "sc://\\/", - "base": "about:blank", - "failure": true - }, - { - "input": "sc://]/", - "base": "about:blank", - "failure": true - }, { "input": "x", "base": "sc://ñ", @@ -4619,7 +4650,7 @@ "search": "", "hash": "" }, - "# unknown scheme with non-URL characters in the path", + "# unknown scheme with non-URL characters", { "input": "wow:\uFFFF", "base": "about:blank", @@ -4637,758 +4668,1620 @@ }, "Forbidden host code points", { - "input": "http://ab", + "input": "sc://a b/", "base": "about:blank", "failure": true }, { - "input": "http://a^b", + "input": "sc://ab", "base": "about:blank", "failure": true }, { - "input": "non-special://a>b", + "input": "sc://a[b/", "base": "about:blank", "failure": true }, { - "input": "non-special://a^b", + "input": "sc://a\\b/", "base": "about:blank", "failure": true }, - "Allowed host code points", { - "input": "http://\u001F!\"$&'()*+,-.;=_`{|}~/", + "input": "sc://a]b/", "base": "about:blank", - "href": "http://\u001F!\"$&'()*+,-.;=_`{|}~/", - "origin": "http://\u001F!\"$&'()*+,-.;=_`{|}~", - "protocol": "http:", - "username": "", + "failure": true + }, + { + "input": "sc://a^b", + "base": "about:blank", + "failure": true + }, + { + "input": "sc://a|b/", + "base": "about:blank", + "failure": true + }, + "Forbidden host codepoints: tabs and newlines are removed during preprocessing", + { + "input": "foo://ho\u0009st/", + "base": "about:blank", + "hash": "", + "host": "host", + "hostname": "host", + "href":"foo://host/", "password": "", - "host": "\u001F!\"$&'()*+,-.;=_`{|}~", - "hostname": "\u001F!\"$&'()*+,-.;=_`{|}~", - "port": "", "pathname": "/", + "port":"", + "protocol": "foo:", "search": "", - "hash": "" + "username": "" }, { - "input": "sc://\u001F!\"$&'()*+,-.;=_`{|}~/", + "input": "foo://ho\u000Ast/", "base": "about:blank", - "href": "sc://%1F!\"$&'()*+,-.;=_`{|}~/", - "origin": "null", - "protocol": "sc:", - "username": "", + "hash": "", + "host": "host", + "hostname": "host", + "href":"foo://host/", "password": "", - "host": "%1F!\"$&'()*+,-.;=_`{|}~", - "hostname": "%1F!\"$&'()*+,-.;=_`{|}~", - "port": "", "pathname": "/", + "port":"", + "protocol": "foo:", "search": "", - "hash": "" + "username": "" }, - "# Hosts and percent-encoding", { - "input": "ftp://example.com%80/", + "input": "foo://ho\u000Dst/", + "base": "about:blank", + "hash": "", + "host": "host", + "hostname": "host", + "href":"foo://host/", + "password": "", + "pathname": "/", + "port":"", + "protocol": "foo:", + "search": "", + "username": "" + }, + "Forbidden domain code-points", + { + "input": "http://a\u0000b/", "base": "about:blank", "failure": true }, { - "input": "ftp://example.com%A0/", + "input": "http://a\u0001b/", "base": "about:blank", "failure": true }, { - "input": "https://example.com%80/", + "input": "http://a\u0002b/", "base": "about:blank", "failure": true }, { - "input": "https://example.com%A0/", + "input": "http://a\u0003b/", "base": "about:blank", "failure": true }, { - "input": "ftp://%e2%98%83", + "input": "http://a\u0004b/", "base": "about:blank", - "href": "ftp://xn--n3h/", - "origin": "ftp://xn--n3h", - "protocol": "ftp:", - "username": "", - "password": "", - "host": "xn--n3h", - "hostname": "xn--n3h", - "port": "", - "pathname": "/", - "search": "", - "hash": "" + "failure": true }, { - "input": "https://%e2%98%83", + "input": "http://a\u0005b/", "base": "about:blank", - "href": "https://xn--n3h/", - "origin": "https://xn--n3h", - "protocol": "https:", - "username": "", - "password": "", - "host": "xn--n3h", - "hostname": "xn--n3h", - "port": "", - "pathname": "/", - "search": "", - "hash": "" + "failure": true }, - "# tests from jsdom/whatwg-url designed for code coverage", { - "input": "http://127.0.0.1:10100/relative_import.html", + "input": "http://a\u0006b/", "base": "about:blank", - "href": "http://127.0.0.1:10100/relative_import.html", - "origin": "http://127.0.0.1:10100", - "protocol": "http:", - "username": "", - "password": "", - "host": "127.0.0.1:10100", - "hostname": "127.0.0.1", - "port": "10100", - "pathname": "/relative_import.html", - "search": "", - "hash": "" + "failure": true }, { - "input": "http://facebook.com/?foo=%7B%22abc%22", + "input": "http://a\u0007b/", "base": "about:blank", - "href": "http://facebook.com/?foo=%7B%22abc%22", - "origin": "http://facebook.com", - "protocol": "http:", - "username": "", - "password": "", - "host": "facebook.com", - "hostname": "facebook.com", - "port": "", - "pathname": "/", - "search": "?foo=%7B%22abc%22", - "hash": "" + "failure": true }, { - "input": "https://localhost:3000/jqueryui@1.2.3", + "input": "http://a\u0008b/", "base": "about:blank", - "href": "https://localhost:3000/jqueryui@1.2.3", - "origin": "https://localhost:3000", - "protocol": "https:", - "username": "", - "password": "", - "host": "localhost:3000", - "hostname": "localhost", - "port": "3000", - "pathname": "/jqueryui@1.2.3", - "search": "", - "hash": "" + "failure": true }, - "# tab/LF/CR", { - "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", + "input": "http://a\u000Bb/", "base": "about:blank", - "href": "http://host:9000/path?query#frag", - "origin": "http://host:9000", - "protocol": "http:", - "username": "", - "password": "", - "host": "host:9000", - "hostname": "host", - "port": "9000", - "pathname": "/path", - "search": "?query", - "hash": "#frag" + "failure": true }, - "# Stringification of URL.searchParams", { - "input": "?a=b&c=d", - "base": "http://example.org/foo/bar", - "href": "http://example.org/foo/bar?a=b&c=d", - "origin": "http://example.org", - "protocol": "http:", - "username": "", - "password": "", - "host": "example.org", - "hostname": "example.org", - "port": "", - "pathname": "/foo/bar", - "search": "?a=b&c=d", - "searchParams": "a=b&c=d", - "hash": "" + "input": "http://a\u000Cb/", + "base": "about:blank", + "failure": true }, { - "input": "??a=b&c=d", - "base": "http://example.org/foo/bar", - "href": "http://example.org/foo/bar??a=b&c=d", - "origin": "http://example.org", - "protocol": "http:", - "username": "", - "password": "", - "host": "example.org", - "hostname": "example.org", - "port": "", - "pathname": "/foo/bar", - "search": "??a=b&c=d", - "searchParams": "%3Fa=b&c=d", - "hash": "" + "input": "http://a\u000Eb/", + "base": "about:blank", + "failure": true }, - "# Scheme only", { - "input": "http:", - "base": "http://example.org/foo/bar", - "href": "http://example.org/foo/bar", - "origin": "http://example.org", - "protocol": "http:", - "username": "", - "password": "", - "host": "example.org", - "hostname": "example.org", - "port": "", + "input": "http://a\u000Fb/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u0010b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u0011b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u0012b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u0013b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u0014b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u0015b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u0016b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u0017b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u0018b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u0019b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u001Ab/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u001Bb/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u001Cb/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u001Db/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u001Eb/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u001Fb/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a%b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ab", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a[b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a]b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a^b", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a|b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u007Fb/", + "base": "about:blank", + "failure": true + }, + "Forbidden domain codepoints: tabs and newlines are removed during preprocessing", + { + "input": "http://ho\u0009st/", + "base": "about:blank", + "hash": "", + "host": "host", + "hostname": "host", + "href":"http://host/", + "password": "", + "pathname": "/", + "port":"", + "protocol": "http:", + "search": "", + "username": "" + }, + { + "input": "http://ho\u000Ast/", + "base": "about:blank", + "hash": "", + "host": "host", + "hostname": "host", + "href":"http://host/", + "password": "", + "pathname": "/", + "port":"", + "protocol": "http:", + "search": "", + "username": "" + }, + { + "input": "http://ho\u000Dst/", + "base": "about:blank", + "hash": "", + "host": "host", + "hostname": "host", + "href":"http://host/", + "password": "", + "pathname": "/", + "port":"", + "protocol": "http:", + "search": "", + "username": "" + }, + "Encoded forbidden domain codepoints in special URLs", + { + "input": "http://ho%00st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%01st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%02st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%03st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%04st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%05st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%06st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%07st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%08st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%09st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%0Ast/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%0Bst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%0Cst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%0Dst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%0Est/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%0Fst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%10st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%11st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%12st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%13st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%14st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%15st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%16st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%17st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%18st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%19st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%1Ast/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%1Bst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%1Cst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%1Dst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%1Est/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%1Fst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%20st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%23st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%25st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%2Fst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%3Ast/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%3Cst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%3Est/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%3Fst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%40st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%5Bst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%5Cst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%5Dst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%7Cst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%7Fst/", + "base": "about:blank", + "failure": true + }, + "Allowed host/domain code points", + { + "input": "http://!\"$&'()*+,-.;=_`{}~/", + "base": "about:blank", + "href": "http://!\"$&'()*+,-.;=_`{}~/", + "origin": "http://!\"$&'()*+,-.;=_`{}~", + "protocol": "http:", + "username": "", + "password": "", + "host": "!\"$&'()*+,-.;=_`{}~", + "hostname": "!\"$&'()*+,-.;=_`{}~", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "sc://\u0001\u0002\u0003\u0004\u0005\u0006\u0007\u0008\u000B\u000C\u000E\u000F\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F\u007F!\"$%&'()*+,-.;=_`{}~/", + "base": "about:blank", + "href": "sc://%01%02%03%04%05%06%07%08%0B%0C%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%7F!\"$%&'()*+,-.;=_`{}~/", + "origin": "null", + "protocol": "sc:", + "username": "", + "password": "", + "host": "%01%02%03%04%05%06%07%08%0B%0C%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%7F!\"$%&'()*+,-.;=_`{}~", + "hostname": "%01%02%03%04%05%06%07%08%0B%0C%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%7F!\"$%&'()*+,-.;=_`{}~", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + "# Hosts and percent-encoding", + { + "input": "ftp://example.com%80/", + "base": "about:blank", + "failure": true + }, + { + "input": "ftp://example.com%A0/", + "base": "about:blank", + "failure": true + }, + { + "input": "https://example.com%80/", + "base": "about:blank", + "failure": true + }, + { + "input": "https://example.com%A0/", + "base": "about:blank", + "failure": true + }, + { + "input": "ftp://%e2%98%83", + "base": "about:blank", + "href": "ftp://xn--n3h/", + "origin": "ftp://xn--n3h", + "protocol": "ftp:", + "username": "", + "password": "", + "host": "xn--n3h", + "hostname": "xn--n3h", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "https://%e2%98%83", + "base": "about:blank", + "href": "https://xn--n3h/", + "origin": "https://xn--n3h", + "protocol": "https:", + "username": "", + "password": "", + "host": "xn--n3h", + "hostname": "xn--n3h", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + "# tests from jsdom/whatwg-url designed for code coverage", + { + "input": "http://127.0.0.1:10100/relative_import.html", + "base": "about:blank", + "href": "http://127.0.0.1:10100/relative_import.html", + "origin": "http://127.0.0.1:10100", + "protocol": "http:", + "username": "", + "password": "", + "host": "127.0.0.1:10100", + "hostname": "127.0.0.1", + "port": "10100", + "pathname": "/relative_import.html", + "search": "", + "hash": "" + }, + { + "input": "http://facebook.com/?foo=%7B%22abc%22", + "base": "about:blank", + "href": "http://facebook.com/?foo=%7B%22abc%22", + "origin": "http://facebook.com", + "protocol": "http:", + "username": "", + "password": "", + "host": "facebook.com", + "hostname": "facebook.com", + "port": "", + "pathname": "/", + "search": "?foo=%7B%22abc%22", + "hash": "" + }, + { + "input": "https://localhost:3000/jqueryui@1.2.3", + "base": "about:blank", + "href": "https://localhost:3000/jqueryui@1.2.3", + "origin": "https://localhost:3000", + "protocol": "https:", + "username": "", + "password": "", + "host": "localhost:3000", + "hostname": "localhost", + "port": "3000", + "pathname": "/jqueryui@1.2.3", + "search": "", + "hash": "" + }, + "# tab/LF/CR", + { + "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", + "base": "about:blank", + "href": "http://host:9000/path?query#frag", + "origin": "http://host:9000", + "protocol": "http:", + "username": "", + "password": "", + "host": "host:9000", + "hostname": "host", + "port": "9000", + "pathname": "/path", + "search": "?query", + "hash": "#frag" + }, + "# Stringification of URL.searchParams", + { + "input": "?a=b&c=d", + "base": "http://example.org/foo/bar", + "href": "http://example.org/foo/bar?a=b&c=d", + "origin": "http://example.org", + "protocol": "http:", + "username": "", + "password": "", + "host": "example.org", + "hostname": "example.org", + "port": "", + "pathname": "/foo/bar", + "search": "?a=b&c=d", + "searchParams": "a=b&c=d", + "hash": "" + }, + { + "input": "??a=b&c=d", + "base": "http://example.org/foo/bar", + "href": "http://example.org/foo/bar??a=b&c=d", + "origin": "http://example.org", + "protocol": "http:", + "username": "", + "password": "", + "host": "example.org", + "hostname": "example.org", + "port": "", + "pathname": "/foo/bar", + "search": "??a=b&c=d", + "searchParams": "%3Fa=b&c=d", + "hash": "" + }, + "# Scheme only", + { + "input": "http:", + "base": "http://example.org/foo/bar", + "href": "http://example.org/foo/bar", + "origin": "http://example.org", + "protocol": "http:", + "username": "", + "password": "", + "host": "example.org", + "hostname": "example.org", + "port": "", "pathname": "/foo/bar", "search": "", - "searchParams": "", + "searchParams": "", + "hash": "" + }, + { + "input": "http:", + "base": "https://example.org/foo/bar", + "failure": true + }, + { + "input": "sc:", + "base": "https://example.org/foo/bar", + "href": "sc:", + "origin": "null", + "protocol": "sc:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "", + "search": "", + "searchParams": "", + "hash": "" + }, + "# Percent encoding of fragments", + { + "input": "http://foo.bar/baz?qux#foo\bbar", + "base": "about:blank", + "href": "http://foo.bar/baz?qux#foo%08bar", + "origin": "http://foo.bar", + "protocol": "http:", + "username": "", + "password": "", + "host": "foo.bar", + "hostname": "foo.bar", + "port": "", + "pathname": "/baz", + "search": "?qux", + "searchParams": "qux=", + "hash": "#foo%08bar" + }, + { + "input": "http://foo.bar/baz?qux#foo\"bar", + "base": "about:blank", + "href": "http://foo.bar/baz?qux#foo%22bar", + "origin": "http://foo.bar", + "protocol": "http:", + "username": "", + "password": "", + "host": "foo.bar", + "hostname": "foo.bar", + "port": "", + "pathname": "/baz", + "search": "?qux", + "searchParams": "qux=", + "hash": "#foo%22bar" + }, + { + "input": "http://foo.bar/baz?qux#foobar", + "base": "about:blank", + "href": "http://foo.bar/baz?qux#foo%3Ebar", + "origin": "http://foo.bar", + "protocol": "http:", + "username": "", + "password": "", + "host": "foo.bar", + "hostname": "foo.bar", + "port": "", + "pathname": "/baz", + "search": "?qux", + "searchParams": "qux=", + "hash": "#foo%3Ebar" + }, + { + "input": "http://foo.bar/baz?qux#foo`bar", + "base": "about:blank", + "href": "http://foo.bar/baz?qux#foo%60bar", + "origin": "http://foo.bar", + "protocol": "http:", + "username": "", + "password": "", + "host": "foo.bar", + "hostname": "foo.bar", + "port": "", + "pathname": "/baz", + "search": "?qux", + "searchParams": "qux=", + "hash": "#foo%60bar" + }, + "# IPv4 parsing (via https://github.com/nodejs/node/pull/10317)", + { + "input": "http://1.2.3.4/", + "base": "http://other.com/", + "href": "http://1.2.3.4/", + "origin": "http://1.2.3.4", + "protocol": "http:", + "username": "", + "password": "", + "host": "1.2.3.4", + "hostname": "1.2.3.4", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "http://1.2.3.4./", + "base": "http://other.com/", + "href": "http://1.2.3.4/", + "origin": "http://1.2.3.4", + "protocol": "http:", + "username": "", + "password": "", + "host": "1.2.3.4", + "hostname": "1.2.3.4", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "http://192.168.257", + "base": "http://other.com/", + "href": "http://192.168.1.1/", + "origin": "http://192.168.1.1", + "protocol": "http:", + "username": "", + "password": "", + "host": "192.168.1.1", + "hostname": "192.168.1.1", + "port": "", + "pathname": "/", + "search": "", "hash": "" }, { - "input": "http:", - "base": "https://example.org/foo/bar", + "input": "http://192.168.257.", + "base": "http://other.com/", + "href": "http://192.168.1.1/", + "origin": "http://192.168.1.1", + "protocol": "http:", + "username": "", + "password": "", + "host": "192.168.1.1", + "hostname": "192.168.1.1", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "http://192.168.257.com", + "base": "http://other.com/", + "href": "http://192.168.257.com/", + "origin": "http://192.168.257.com", + "protocol": "http:", + "username": "", + "password": "", + "host": "192.168.257.com", + "hostname": "192.168.257.com", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "http://256", + "base": "http://other.com/", + "href": "http://0.0.1.0/", + "origin": "http://0.0.1.0", + "protocol": "http:", + "username": "", + "password": "", + "host": "0.0.1.0", + "hostname": "0.0.1.0", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "http://256.com", + "base": "http://other.com/", + "href": "http://256.com/", + "origin": "http://256.com", + "protocol": "http:", + "username": "", + "password": "", + "host": "256.com", + "hostname": "256.com", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "http://999999999", + "base": "http://other.com/", + "href": "http://59.154.201.255/", + "origin": "http://59.154.201.255", + "protocol": "http:", + "username": "", + "password": "", + "host": "59.154.201.255", + "hostname": "59.154.201.255", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "http://999999999.", + "base": "http://other.com/", + "href": "http://59.154.201.255/", + "origin": "http://59.154.201.255", + "protocol": "http:", + "username": "", + "password": "", + "host": "59.154.201.255", + "hostname": "59.154.201.255", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "http://999999999.com", + "base": "http://other.com/", + "href": "http://999999999.com/", + "origin": "http://999999999.com", + "protocol": "http:", + "username": "", + "password": "", + "host": "999999999.com", + "hostname": "999999999.com", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "http://10000000000", + "base": "http://other.com/", "failure": true }, { - "input": "sc:", - "base": "https://example.org/foo/bar", - "href": "sc:", - "origin": "null", - "protocol": "sc:", + "input": "http://10000000000.com", + "base": "http://other.com/", + "href": "http://10000000000.com/", + "origin": "http://10000000000.com", + "protocol": "http:", + "username": "", + "password": "", + "host": "10000000000.com", + "hostname": "10000000000.com", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "http://4294967295", + "base": "http://other.com/", + "href": "http://255.255.255.255/", + "origin": "http://255.255.255.255", + "protocol": "http:", + "username": "", + "password": "", + "host": "255.255.255.255", + "hostname": "255.255.255.255", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "http://4294967296", + "base": "http://other.com/", + "failure": true + }, + { + "input": "http://0xffffffff", + "base": "http://other.com/", + "href": "http://255.255.255.255/", + "origin": "http://255.255.255.255", + "protocol": "http:", + "username": "", + "password": "", + "host": "255.255.255.255", + "hostname": "255.255.255.255", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { + "input": "http://0xffffffff1", + "base": "http://other.com/", + "failure": true + }, + { + "input": "http://256.256.256.256", + "base": "http://other.com/", + "failure": true + }, + { + "input": "https://0x.0x.0", + "base": "about:blank", + "href": "https://0.0.0.0/", + "origin": "https://0.0.0.0", + "protocol": "https:", + "username": "", + "password": "", + "host": "0.0.0.0", + "hostname": "0.0.0.0", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + "More IPv4 parsing (via https://github.com/jsdom/whatwg-url/issues/92)", + { + "input": "https://0x100000000/test", + "base": "about:blank", + "failure": true + }, + { + "input": "https://256.0.0.1/test", + "base": "about:blank", + "failure": true + }, + "# file URLs containing percent-encoded Windows drive letters (shouldn't work)", + { + "input": "file:///C%3A/", + "base": "about:blank", + "href": "file:///C%3A/", + "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "", + "pathname": "/C%3A/", "search": "", - "searchParams": "", "hash": "" }, - "# Percent encoding of fragments", { - "input": "http://foo.bar/baz?qux#foo\bbar", + "input": "file:///C%7C/", "base": "about:blank", - "href": "http://foo.bar/baz?qux#foo%08bar", - "origin": "http://foo.bar", - "protocol": "http:", + "href": "file:///C%7C/", + "protocol": "file:", "username": "", "password": "", - "host": "foo.bar", - "hostname": "foo.bar", + "host": "", + "hostname": "", "port": "", - "pathname": "/baz", - "search": "?qux", - "searchParams": "qux=", - "hash": "#foo%08bar" + "pathname": "/C%7C/", + "search": "", + "hash": "" + }, + { + "input": "file://%43%3A", + "base": "about:blank", + "failure": true + }, + { + "input": "file://%43%7C", + "base": "about:blank", + "failure": true + }, + { + "input": "file://%43|", + "base": "about:blank", + "failure": true + }, + { + "input": "file://C%7C", + "base": "about:blank", + "failure": true + }, + { + "input": "file://%43%7C/", + "base": "about:blank", + "failure": true + }, + { + "input": "https://%43%7C/", + "base": "about:blank", + "failure": true }, { - "input": "http://foo.bar/baz?qux#foo\"bar", + "input": "asdf://%43|/", "base": "about:blank", - "href": "http://foo.bar/baz?qux#foo%22bar", - "origin": "http://foo.bar", - "protocol": "http:", - "username": "", - "password": "", - "host": "foo.bar", - "hostname": "foo.bar", - "port": "", - "pathname": "/baz", - "search": "?qux", - "searchParams": "qux=", - "hash": "#foo%22bar" + "failure": true }, { - "input": "http://foo.bar/baz?qux#foobar", - "base": "about:blank", - "href": "http://foo.bar/baz?qux#foo%3Ebar", - "origin": "http://foo.bar", - "protocol": "http:", + "input": "pix/submit.gif", + "base": "file:///C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/anchor.html", + "href": "file:///C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/pix/submit.gif", + "protocol": "file:", "username": "", "password": "", - "host": "foo.bar", - "hostname": "foo.bar", + "host": "", + "hostname": "", "port": "", - "pathname": "/baz", - "search": "?qux", - "searchParams": "qux=", - "hash": "#foo%3Ebar" + "pathname": "/C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/pix/submit.gif", + "search": "", + "hash": "" }, { - "input": "http://foo.bar/baz?qux#foo`bar", - "base": "about:blank", - "href": "http://foo.bar/baz?qux#foo%60bar", - "origin": "http://foo.bar", - "protocol": "http:", + "input": "..", + "base": "file:///C:/", + "href": "file:///C:/", + "protocol": "file:", "username": "", "password": "", - "host": "foo.bar", - "hostname": "foo.bar", + "host": "", + "hostname": "", "port": "", - "pathname": "/baz", - "search": "?qux", - "searchParams": "qux=", - "hash": "#foo%60bar" + "pathname": "/C:/", + "search": "", + "hash": "" }, - "# IPv4 parsing (via https://github.com/nodejs/node/pull/10317)", { - "input": "http://192.168.257", - "base": "http://other.com/", - "href": "http://192.168.1.1/", - "origin": "http://192.168.1.1", - "protocol": "http:", + "input": "..", + "base": "file:///", + "href": "file:///", + "protocol": "file:", "username": "", "password": "", - "host": "192.168.1.1", - "hostname": "192.168.1.1", + "host": "", + "hostname": "", "port": "", "pathname": "/", "search": "", "hash": "" }, + "# More file URL tests by zcorpan and annevk", { - "input": "http://192.168.257.com", - "base": "http://other.com/", - "href": "http://192.168.257.com/", - "origin": "http://192.168.257.com", - "protocol": "http:", + "input": "/", + "base": "file:///C:/a/b", + "href": "file:///C:/", + "protocol": "file:", "username": "", "password": "", - "host": "192.168.257.com", - "hostname": "192.168.257.com", + "host": "", + "hostname": "", "port": "", - "pathname": "/", + "pathname": "/C:/", "search": "", "hash": "" }, { - "input": "http://256", - "base": "http://other.com/", - "href": "http://0.0.1.0/", - "origin": "http://0.0.1.0", - "protocol": "http:", + "input": "/", + "base": "file://h/a/b", + "href": "file://h/", + "protocol": "file:", "username": "", "password": "", - "host": "0.0.1.0", - "hostname": "0.0.1.0", + "host": "h", + "hostname": "h", "port": "", "pathname": "/", "search": "", "hash": "" }, { - "input": "http://256.com", - "base": "http://other.com/", - "href": "http://256.com/", - "origin": "http://256.com", - "protocol": "http:", + "input": "//d:", + "base": "file:///C:/a/b", + "href": "file:///d:", + "protocol": "file:", "username": "", "password": "", - "host": "256.com", - "hostname": "256.com", + "host": "", + "hostname": "", "port": "", - "pathname": "/", + "pathname": "/d:", "search": "", "hash": "" }, { - "input": "http://999999999", - "base": "http://other.com/", - "href": "http://59.154.201.255/", - "origin": "http://59.154.201.255", - "protocol": "http:", + "input": "//d:/..", + "base": "file:///C:/a/b", + "href": "file:///d:/", + "protocol": "file:", "username": "", "password": "", - "host": "59.154.201.255", - "hostname": "59.154.201.255", + "host": "", + "hostname": "", "port": "", - "pathname": "/", + "pathname": "/d:/", "search": "", "hash": "" }, { - "input": "http://999999999.com", - "base": "http://other.com/", - "href": "http://999999999.com/", - "origin": "http://999999999.com", - "protocol": "http:", + "input": "..", + "base": "file:///ab:/", + "href": "file:///", + "protocol": "file:", "username": "", "password": "", - "host": "999999999.com", - "hostname": "999999999.com", + "host": "", + "hostname": "", "port": "", "pathname": "/", "search": "", "hash": "" }, { - "input": "http://10000000000", - "base": "http://other.com/", - "failure": true - }, - { - "input": "http://10000000000.com", - "base": "http://other.com/", - "href": "http://10000000000.com/", - "origin": "http://10000000000.com", - "protocol": "http:", + "input": "..", + "base": "file:///1:/", + "href": "file:///", + "protocol": "file:", "username": "", "password": "", - "host": "10000000000.com", - "hostname": "10000000000.com", + "host": "", + "hostname": "", "port": "", "pathname": "/", "search": "", "hash": "" }, { - "input": "http://4294967295", - "base": "http://other.com/", - "href": "http://255.255.255.255/", - "origin": "http://255.255.255.255", - "protocol": "http:", + "input": "", + "base": "file:///test?test#test", + "href": "file:///test?test", + "protocol": "file:", "username": "", "password": "", - "host": "255.255.255.255", - "hostname": "255.255.255.255", + "host": "", + "hostname": "", "port": "", - "pathname": "/", - "search": "", + "pathname": "/test", + "search": "?test", "hash": "" }, { - "input": "http://4294967296", - "base": "http://other.com/", - "failure": true - }, - { - "input": "http://0xffffffff", - "base": "http://other.com/", - "href": "http://255.255.255.255/", - "origin": "http://255.255.255.255", - "protocol": "http:", + "input": "file:", + "base": "file:///test?test#test", + "href": "file:///test?test", + "protocol": "file:", "username": "", "password": "", - "host": "255.255.255.255", - "hostname": "255.255.255.255", + "host": "", + "hostname": "", "port": "", - "pathname": "/", - "search": "", + "pathname": "/test", + "search": "?test", "hash": "" }, { - "input": "http://0xffffffff1", - "base": "http://other.com/", - "failure": true - }, - { - "input": "http://256.256.256.256", - "base": "http://other.com/", - "failure": true + "input": "?x", + "base": "file:///test?test#test", + "href": "file:///test?x", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/test", + "search": "?x", + "hash": "" }, { - "input": "http://256.256.256.256.256", - "base": "http://other.com/", - "href": "http://256.256.256.256.256/", - "origin": "http://256.256.256.256.256", - "protocol": "http:", + "input": "file:?x", + "base": "file:///test?test#test", + "href": "file:///test?x", + "protocol": "file:", "username": "", "password": "", - "host": "256.256.256.256.256", - "hostname": "256.256.256.256.256", + "host": "", + "hostname": "", "port": "", - "pathname": "/", - "search": "", + "pathname": "/test", + "search": "?x", "hash": "" }, { - "input": "https://0x.0x.0", - "base": "about:blank", - "href": "https://0.0.0.0/", - "origin": "https://0.0.0.0", - "protocol": "https:", + "input": "#x", + "base": "file:///test?test#test", + "href": "file:///test?test#x", + "protocol": "file:", "username": "", "password": "", - "host": "0.0.0.0", - "hostname": "0.0.0.0", + "host": "", + "hostname": "", "port": "", - "pathname": "/", - "search": "", - "hash": "" - }, - "More IPv4 parsing (via https://github.com/jsdom/whatwg-url/issues/92)", - { - "input": "https://0x100000000/test", - "base": "about:blank", - "failure": true + "pathname": "/test", + "search": "?test", + "hash": "#x" }, { - "input": "https://256.0.0.1/test", - "base": "about:blank", - "failure": true + "input": "file:#x", + "base": "file:///test?test#test", + "href": "file:///test?test#x", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/test", + "search": "?test", + "hash": "#x" }, - "# file URLs containing percent-encoded Windows drive letters (shouldn't work)", + "# File URLs and many (back)slashes", { - "input": "file:///C%3A/", + "input": "file:///localhost//cat", "base": "about:blank", - "href": "file:///C%3A/", + "href": "file:///localhost//cat", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/C%3A/", + "pathname": "/localhost//cat", "search": "", "hash": "" }, { - "input": "file:///C%7C/", - "base": "about:blank", - "href": "file:///C%7C/", + "input": "\\//pig", + "base": "file://lion/", + "href": "file:///pig", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/C%7C/", + "pathname": "/pig", "search": "", "hash": "" }, - "# file URLs relative to other file URLs (via https://github.com/jsdom/whatwg-url/pull/60)", { - "input": "pix/submit.gif", - "base": "file:///C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/anchor.html", - "href": "file:///C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/pix/submit.gif", + "input": "file://", + "base": "file://ape/", + "href": "file:///", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/C:/Users/Domenic/Dropbox/GitHub/tmpvar/jsdom/test/level2/html/files/pix/submit.gif", + "pathname": "/", "search": "", "hash": "" }, + "# File URLs with non-empty hosts", { - "input": "..", - "base": "file:///C:/", - "href": "file:///C:/", + "input": "/rooibos", + "base": "file://tea/", + "href": "file://tea/rooibos", "protocol": "file:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "tea", + "hostname": "tea", "port": "", - "pathname": "/C:/", + "pathname": "/rooibos", "search": "", "hash": "" }, { - "input": "..", - "base": "file:///", - "href": "file:///", + "input": "/?chai", + "base": "file://tea/", + "href": "file://tea/?chai", "protocol": "file:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "tea", + "hostname": "tea", "port": "", "pathname": "/", - "search": "", + "search": "?chai", "hash": "" }, - "# More file URL tests by zcorpan and annevk", + "# Windows drive letter handling with the 'file:' base URL", { - "input": "/", - "base": "file:///C:/a/b", - "href": "file:///C:/", + "input": "C", + "base": "file://host/dir/file", + "href": "file://host/dir/C", "protocol": "file:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "host", + "hostname": "host", "port": "", - "pathname": "/C:/", + "pathname": "/dir/C", "search": "", "hash": "" }, { - "input": "//d:", - "base": "file:///C:/a/b", - "href": "file:///d:", + "input": "C|a", + "base": "file://host/dir/file", + "href": "file://host/dir/C|a", "protocol": "file:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "host", + "hostname": "host", "port": "", - "pathname": "/d:", + "pathname": "/dir/C|a", "search": "", "hash": "" }, + "# Windows drive letter quirk in the file slash state", { - "input": "//d:/..", - "base": "file:///C:/a/b", - "href": "file:///d:/", + "input": "/c:/foo/bar", + "base": "file:///c:/baz/qux", + "href": "file:///c:/foo/bar", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/d:/", + "pathname": "/c:/foo/bar", "search": "", "hash": "" }, { - "input": "..", - "base": "file:///ab:/", - "href": "file:///", + "input": "/c|/foo/bar", + "base": "file:///c:/baz/qux", + "href": "file:///c:/foo/bar", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/", + "pathname": "/c:/foo/bar", "search": "", "hash": "" }, { - "input": "..", - "base": "file:///1:/", - "href": "file:///", + "input": "file:\\c:\\foo\\bar", + "base": "file:///c:/baz/qux", + "href": "file:///c:/foo/bar", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/", + "pathname": "/c:/foo/bar", "search": "", "hash": "" }, + "# Copy the empty host from the input in the following cases", { - "input": "", - "base": "file:///test?test#test", - "href": "file:///test?test", + "input": "//C:/", + "base": "file://host/", + "href": "file:///C:/", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/test", - "search": "?test", + "pathname": "/C:/", + "search": "", "hash": "" }, { - "input": "file:", - "base": "file:///test?test#test", - "href": "file:///test?test", + "input": "file://C:/", + "base": "file://host/", + "href": "file:///C:/", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/test", - "search": "?test", + "pathname": "/C:/", + "search": "", "hash": "" }, { - "input": "?x", - "base": "file:///test?test#test", - "href": "file:///test?x", + "input": "///C:/", + "base": "file://host/", + "href": "file:///C:/", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/test", - "search": "?x", + "pathname": "/C:/", + "search": "", "hash": "" }, { - "input": "file:?x", - "base": "file:///test?test#test", - "href": "file:///test?x", + "input": "file:///C:/", + "base": "file://host/", + "href": "file:///C:/", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/test", - "search": "?x", + "pathname": "/C:/", + "search": "", "hash": "" }, + "# Windows drive letter quirk (no host)", { - "input": "#x", - "base": "file:///test?test#test", - "href": "file:///test?test#x", + "input": "file:/C|/", + "base": "about:blank", + "href": "file:///C:/", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/test", - "search": "?test", - "hash": "#x" + "pathname": "/C:/", + "search": "", + "hash": "" }, { - "input": "file:#x", - "base": "file:///test?test#test", - "href": "file:///test?test#x", + "input": "file://C|/", + "base": "about:blank", + "href": "file:///C:/", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/test", - "search": "?test", - "hash": "#x" + "pathname": "/C:/", + "search": "", + "hash": "" }, - "# File URLs and many (back)slashes", + "# file URLs without base URL by Rimas Misevičius", { - "input": "file:\\\\//", + "input": "file:", "base": "about:blank", "href": "file:///", "protocol": "file:", @@ -5402,9 +6295,9 @@ "hash": "" }, { - "input": "file:\\\\\\\\", + "input": "file:?q=v", "base": "about:blank", - "href": "file:///", + "href": "file:///?q=v", "protocol": "file:", "username": "", "password": "", @@ -5412,13 +6305,13 @@ "hostname": "", "port": "", "pathname": "/", - "search": "", + "search": "?q=v", "hash": "" }, { - "input": "file:\\\\\\\\?fox", + "input": "file:#frag", "base": "about:blank", - "href": "file:///?fox", + "href": "file:///#frag", "protocol": "file:", "username": "", "password": "", @@ -5426,1566 +6319,1590 @@ "hostname": "", "port": "", "pathname": "/", - "search": "?fox", - "hash": "" + "search": "", + "hash": "#frag" }, + "# file: drive letter cases from https://crbug.com/1078698", { - "input": "file:\\\\\\\\#guppy", + "input": "file:///Y:", "base": "about:blank", - "href": "file:///#guppy", + "href": "file:///Y:", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/", + "pathname": "/Y:", "search": "", - "hash": "#guppy" + "hash": "" }, { - "input": "file://spider///", + "input": "file:///Y:/", "base": "about:blank", - "href": "file://spider/", + "href": "file:///Y:/", "protocol": "file:", "username": "", "password": "", - "host": "spider", - "hostname": "spider", + "host": "", + "hostname": "", "port": "", - "pathname": "/", + "pathname": "/Y:/", "search": "", "hash": "" }, { - "input": "file:\\\\localhost//", + "input": "file:///./Y", "base": "about:blank", - "href": "file:///", + "href": "file:///Y", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/", + "pathname": "/Y", "search": "", "hash": "" }, { - "input": "file:///localhost//cat", + "input": "file:///./Y:", "base": "about:blank", - "href": "file:///localhost//cat", + "href": "file:///Y:", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/localhost//cat", + "pathname": "/Y:", "search": "", "hash": "" }, { - "input": "file://\\/localhost//cat", + "input": "\\\\\\.\\Y:", "base": "about:blank", - "href": "file:///localhost//cat", + "failure": true, + "inputCanBeRelative": true + }, + "# file: drive letter cases from https://crbug.com/1078698 but lowercased", + { + "input": "file:///y:", + "base": "about:blank", + "href": "file:///y:", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/localhost//cat", + "pathname": "/y:", "search": "", "hash": "" }, { - "input": "file://localhost//a//../..//", + "input": "file:///y:/", "base": "about:blank", - "href": "file:///", + "href": "file:///y:/", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/", + "pathname": "/y:/", "search": "", "hash": "" }, { - "input": "/////mouse", - "base": "file:///elephant", - "href": "file:///mouse", + "input": "file:///./y", + "base": "about:blank", + "href": "file:///y", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/mouse", + "pathname": "/y", "search": "", "hash": "" }, { - "input": "\\//pig", - "base": "file://lion/", - "href": "file:///pig", + "input": "file:///./y:", + "base": "about:blank", + "href": "file:///y:", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/pig", + "pathname": "/y:", "search": "", "hash": "" }, { - "input": "\\/localhost//pig", - "base": "file://lion/", - "href": "file:///pig", + "input": "\\\\\\.\\y:", + "base": "about:blank", + "failure": true, + "inputCanBeRelative": true + }, + "# Additional file URL tests for (https://github.com/whatwg/url/issues/405)", + { + "input": "file:///one/two", + "base": "file:///", + "href": "file:///one/two", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/pig", + "pathname": "/one/two", "search": "", "hash": "" }, { - "input": "//localhost//pig", - "base": "file://lion/", - "href": "file:///pig", + "input": "//one/two", + "base": "file:///", + "href": "file://one/two", "protocol": "file:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "one", + "hostname": "one", "port": "", - "pathname": "/pig", + "pathname": "/two", "search": "", "hash": "" }, { - "input": "/..//localhost//pig", - "base": "file://lion/", - "href": "file://lion/localhost//pig", + "input": "///one/two", + "base": "file:///", + "href": "file:///one/two", "protocol": "file:", "username": "", "password": "", - "host": "lion", - "hostname": "lion", + "host": "", + "hostname": "", "port": "", - "pathname": "/localhost//pig", + "pathname": "/one/two", "search": "", "hash": "" }, + "# IPv6 tests", { - "input": "file://", - "base": "file://ape/", - "href": "file:///", - "protocol": "file:", + "input": "http://[1:0::]", + "base": "http://example.net/", + "href": "http://[1::]/", + "origin": "http://[1::]", + "protocol": "http:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "[1::]", + "hostname": "[1::]", "port": "", "pathname": "/", "search": "", "hash": "" }, - "# File URLs with non-empty hosts", { - "input": "/rooibos", - "base": "file://tea/", - "href": "file://tea/rooibos", - "protocol": "file:", + "input": "http://[0:1:2:3:4:5:6:7:8]", + "base": "http://example.net/", + "failure": true + }, + { + "input": "https://[0::0::0]", + "base": "about:blank", + "failure": true + }, + { + "input": "https://[0:.0]", + "base": "about:blank", + "failure": true + }, + { + "input": "https://[0:0:]", + "base": "about:blank", + "failure": true + }, + { + "input": "https://[0:1:2:3:4:5:6:7.0.0.0.1]", + "base": "about:blank", + "failure": true + }, + { + "input": "https://[0:1.00.0.0.0]", + "base": "about:blank", + "failure": true + }, + { + "input": "https://[0:1.290.0.0.0]", + "base": "about:blank", + "failure": true + }, + { + "input": "https://[0:1.23.23]", + "base": "about:blank", + "failure": true + }, + "# Empty host", + { + "input": "http://?", + "base": "about:blank", + "failure": true + }, + { + "input": "http://#", + "base": "about:blank", + "failure": true + }, + "Port overflow (2^32 + 81)", + { + "input": "http://f:4294967377/c", + "base": "http://example.org/", + "failure": true + }, + "Port overflow (2^64 + 81)", + { + "input": "http://f:18446744073709551697/c", + "base": "http://example.org/", + "failure": true + }, + "Port overflow (2^128 + 81)", + { + "input": "http://f:340282366920938463463374607431768211537/c", + "base": "http://example.org/", + "failure": true + }, + "# Non-special-URL path tests", + { + "input": "sc://ñ", + "base": "about:blank", + "href": "sc://%C3%B1", + "origin": "null", + "protocol": "sc:", "username": "", "password": "", - "host": "tea", - "hostname": "tea", + "host": "%C3%B1", + "hostname": "%C3%B1", "port": "", - "pathname": "/rooibos", + "pathname": "", "search": "", "hash": "" }, { - "input": "/?chai", - "base": "file://tea/", - "href": "file://tea/?chai", - "protocol": "file:", + "input": "sc://ñ?x", + "base": "about:blank", + "href": "sc://%C3%B1?x", + "origin": "null", + "protocol": "sc:", "username": "", "password": "", - "host": "tea", - "hostname": "tea", + "host": "%C3%B1", + "hostname": "%C3%B1", "port": "", - "pathname": "/", - "search": "?chai", + "pathname": "", + "search": "?x", "hash": "" }, - "# Windows drive letter handling with the 'file:' base URL", { - "input": "C|", - "base": "file://host/dir/file", - "href": "file:///C:", - "protocol": "file:", + "input": "sc://ñ#x", + "base": "about:blank", + "href": "sc://%C3%B1#x", + "origin": "null", + "protocol": "sc:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "%C3%B1", + "hostname": "%C3%B1", "port": "", - "pathname": "/C:", + "pathname": "", "search": "", - "hash": "" + "hash": "#x" }, { - "input": "C|#", - "base": "file://host/dir/file", - "href": "file:///C:#", - "protocol": "file:", + "input": "#x", + "base": "sc://ñ", + "href": "sc://%C3%B1#x", + "origin": "null", + "protocol": "sc:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "%C3%B1", + "hostname": "%C3%B1", "port": "", - "pathname": "/C:", + "pathname": "", "search": "", - "hash": "" + "hash": "#x" }, { - "input": "C|?", - "base": "file://host/dir/file", - "href": "file:///C:?", - "protocol": "file:", + "input": "?x", + "base": "sc://ñ", + "href": "sc://%C3%B1?x", + "origin": "null", + "protocol": "sc:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "%C3%B1", + "hostname": "%C3%B1", "port": "", - "pathname": "/C:", - "search": "", + "pathname": "", + "search": "?x", "hash": "" }, { - "input": "C|/", - "base": "file://host/dir/file", - "href": "file:///C:/", - "protocol": "file:", + "input": "sc://?", + "base": "about:blank", + "href": "sc://?", + "protocol": "sc:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/C:/", + "pathname": "", "search": "", "hash": "" }, { - "input": "C|\n/", - "base": "file://host/dir/file", - "href": "file:///C:/", - "protocol": "file:", + "input": "sc://#", + "base": "about:blank", + "href": "sc://#", + "protocol": "sc:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/C:/", + "pathname": "", "search": "", "hash": "" }, { - "input": "C|\\", - "base": "file://host/dir/file", - "href": "file:///C:/", - "protocol": "file:", + "input": "///", + "base": "sc://x/", + "href": "sc:///", + "protocol": "sc:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/C:/", + "pathname": "/", "search": "", "hash": "" }, { - "input": "C", - "base": "file://host/dir/file", - "href": "file://host/dir/C", - "protocol": "file:", + "input": "////", + "base": "sc://x/", + "href": "sc:////", + "protocol": "sc:", "username": "", "password": "", - "host": "host", - "hostname": "host", + "host": "", + "hostname": "", "port": "", - "pathname": "/dir/C", + "pathname": "//", "search": "", "hash": "" }, { - "input": "C|a", - "base": "file://host/dir/file", - "href": "file://host/dir/C|a", - "protocol": "file:", + "input": "////x/", + "base": "sc://x/", + "href": "sc:////x/", + "protocol": "sc:", "username": "", "password": "", - "host": "host", - "hostname": "host", + "host": "", + "hostname": "", "port": "", - "pathname": "/dir/C|a", + "pathname": "//x/", "search": "", "hash": "" }, - "# Windows drive letter quirk in the file slash state", { - "input": "/c:/foo/bar", - "base": "file:///c:/baz/qux", - "href": "file:///c:/foo/bar", - "protocol": "file:", + "input": "tftp://foobar.com/someconfig;mode=netascii", + "base": "about:blank", + "href": "tftp://foobar.com/someconfig;mode=netascii", + "origin": "null", + "protocol": "tftp:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "foobar.com", + "hostname": "foobar.com", "port": "", - "pathname": "/c:/foo/bar", + "pathname": "/someconfig;mode=netascii", "search": "", "hash": "" }, { - "input": "/c|/foo/bar", - "base": "file:///c:/baz/qux", - "href": "file:///c:/foo/bar", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/c:/foo/bar", + "input": "telnet://user:pass@foobar.com:23/", + "base": "about:blank", + "href": "telnet://user:pass@foobar.com:23/", + "origin": "null", + "protocol": "telnet:", + "username": "user", + "password": "pass", + "host": "foobar.com:23", + "hostname": "foobar.com", + "port": "23", + "pathname": "/", "search": "", "hash": "" }, { - "input": "file:\\c:\\foo\\bar", - "base": "file:///c:/baz/qux", - "href": "file:///c:/foo/bar", - "protocol": "file:", + "input": "ut2004://10.10.10.10:7777/Index.ut2", + "base": "about:blank", + "href": "ut2004://10.10.10.10:7777/Index.ut2", + "origin": "null", + "protocol": "ut2004:", "username": "", "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/c:/foo/bar", + "host": "10.10.10.10:7777", + "hostname": "10.10.10.10", + "port": "7777", + "pathname": "/Index.ut2", "search": "", "hash": "" }, { - "input": "/c:/foo/bar", - "base": "file://host/path", - "href": "file:///c:/foo/bar", - "protocol": "file:", - "username": "", + "input": "redis://foo:bar@somehost:6379/0?baz=bam&qux=baz", + "base": "about:blank", + "href": "redis://foo:bar@somehost:6379/0?baz=bam&qux=baz", + "origin": "null", + "protocol": "redis:", + "username": "foo", + "password": "bar", + "host": "somehost:6379", + "hostname": "somehost", + "port": "6379", + "pathname": "/0", + "search": "?baz=bam&qux=baz", + "hash": "" + }, + { + "input": "rsync://foo@host:911/sup", + "base": "about:blank", + "href": "rsync://foo@host:911/sup", + "origin": "null", + "protocol": "rsync:", + "username": "foo", "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/c:/foo/bar", + "host": "host:911", + "hostname": "host", + "port": "911", + "pathname": "/sup", "search": "", "hash": "" }, - "# Windows drive letter quirk with not empty host", { - "input": "file://example.net/C:/", + "input": "git://github.com/foo/bar.git", "base": "about:blank", - "href": "file:///C:/", - "protocol": "file:", + "href": "git://github.com/foo/bar.git", + "origin": "null", + "protocol": "git:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "github.com", + "hostname": "github.com", "port": "", - "pathname": "/C:/", + "pathname": "/foo/bar.git", "search": "", "hash": "" }, { - "input": "file://1.2.3.4/C:/", + "input": "irc://myserver.com:6999/channel?passwd", "base": "about:blank", - "href": "file:///C:/", - "protocol": "file:", + "href": "irc://myserver.com:6999/channel?passwd", + "origin": "null", + "protocol": "irc:", "username": "", "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/C:/", - "search": "", + "host": "myserver.com:6999", + "hostname": "myserver.com", + "port": "6999", + "pathname": "/channel", + "search": "?passwd", "hash": "" }, { - "input": "file://[1::8]/C:/", + "input": "dns://fw.example.org:9999/foo.bar.org?type=TXT", "base": "about:blank", - "href": "file:///C:/", - "protocol": "file:", + "href": "dns://fw.example.org:9999/foo.bar.org?type=TXT", + "origin": "null", + "protocol": "dns:", "username": "", "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/C:/", - "search": "", + "host": "fw.example.org:9999", + "hostname": "fw.example.org", + "port": "9999", + "pathname": "/foo.bar.org", + "search": "?type=TXT", "hash": "" }, - "# Windows drive letter quirk (no host)", { - "input": "file:/C|/", + "input": "ldap://localhost:389/ou=People,o=JNDITutorial", "base": "about:blank", - "href": "file:///C:/", - "protocol": "file:", + "href": "ldap://localhost:389/ou=People,o=JNDITutorial", + "origin": "null", + "protocol": "ldap:", "username": "", "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/C:/", + "host": "localhost:389", + "hostname": "localhost", + "port": "389", + "pathname": "/ou=People,o=JNDITutorial", "search": "", "hash": "" }, { - "input": "file://C|/", + "input": "git+https://github.com/foo/bar", "base": "about:blank", - "href": "file:///C:/", - "protocol": "file:", + "href": "git+https://github.com/foo/bar", + "origin": "null", + "protocol": "git+https:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "github.com", + "hostname": "github.com", "port": "", - "pathname": "/C:/", + "pathname": "/foo/bar", "search": "", "hash": "" }, - "# file URLs without base URL by Rimas Misevičius", { - "input": "file:", + "input": "urn:ietf:rfc:2648", "base": "about:blank", - "href": "file:///", - "protocol": "file:", + "href": "urn:ietf:rfc:2648", + "origin": "null", + "protocol": "urn:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/", + "pathname": "ietf:rfc:2648", "search": "", "hash": "" }, { - "input": "file:?q=v", + "input": "tag:joe@example.org,2001:foo/bar", "base": "about:blank", - "href": "file:///?q=v", - "protocol": "file:", + "href": "tag:joe@example.org,2001:foo/bar", + "origin": "null", + "protocol": "tag:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/", - "search": "?q=v", + "pathname": "joe@example.org,2001:foo/bar", + "search": "", "hash": "" }, + "# percent encoded hosts in non-special-URLs", { - "input": "file:#frag", + "input": "non-special://%E2%80%A0/", "base": "about:blank", - "href": "file:///#frag", - "protocol": "file:", + "href": "non-special://%E2%80%A0/", + "protocol": "non-special:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "%E2%80%A0", + "hostname": "%E2%80%A0", "port": "", "pathname": "/", "search": "", - "hash": "#frag" + "hash": "" }, - "# file: drive letter cases from https://crbug.com/1078698", { - "input": "file:///Y:", + "input": "non-special://H%4fSt/path", "base": "about:blank", - "href": "file:///Y:", - "protocol": "file:", + "href": "non-special://H%4fSt/path", + "protocol": "non-special:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "H%4fSt", + "hostname": "H%4fSt", "port": "", - "pathname": "/Y:", + "pathname": "/path", "search": "", "hash": "" }, + "# IPv6 in non-special-URLs", { - "input": "file:///Y:/", + "input": "non-special://[1:2:0:0:5:0:0:0]/", "base": "about:blank", - "href": "file:///Y:/", - "protocol": "file:", + "href": "non-special://[1:2:0:0:5::]/", + "protocol": "non-special:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "[1:2:0:0:5::]", + "hostname": "[1:2:0:0:5::]", "port": "", - "pathname": "/Y:/", + "pathname": "/", "search": "", "hash": "" }, { - "input": "file:///./Y", + "input": "non-special://[1:2:0:0:0:0:0:3]/", "base": "about:blank", - "href": "file:///Y", - "protocol": "file:", + "href": "non-special://[1:2::3]/", + "protocol": "non-special:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "[1:2::3]", + "hostname": "[1:2::3]", "port": "", - "pathname": "/Y", + "pathname": "/", "search": "", "hash": "" }, { - "input": "file:///./Y:", + "input": "non-special://[1:2::3]:80/", "base": "about:blank", - "href": "file:///Y:", - "protocol": "file:", + "href": "non-special://[1:2::3]:80/", + "protocol": "non-special:", "username": "", "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/Y:", + "host": "[1:2::3]:80", + "hostname": "[1:2::3]", + "port": "80", + "pathname": "/", "search": "", "hash": "" }, { - "input": "\\\\\\.\\Y:", + "input": "non-special://[:80/", "base": "about:blank", "failure": true }, - "# file: drive letter cases from https://crbug.com/1078698 but lowercased", - { - "input": "file:///y:", - "base": "about:blank", - "href": "file:///y:", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/y:", - "search": "", - "hash": "" - }, { - "input": "file:///y:/", + "input": "blob:https://example.com:443/", "base": "about:blank", - "href": "file:///y:/", - "protocol": "file:", + "href": "blob:https://example.com:443/", + "origin": "https://example.com", + "protocol": "blob:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/y:/", + "pathname": "https://example.com:443/", "search": "", "hash": "" }, { - "input": "file:///./y", + "input": "blob:d3958f5c-0777-0845-9dcf-2cb28783acaf", "base": "about:blank", - "href": "file:///y", - "protocol": "file:", + "href": "blob:d3958f5c-0777-0845-9dcf-2cb28783acaf", + "origin": "null", + "protocol": "blob:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/y", + "pathname": "d3958f5c-0777-0845-9dcf-2cb28783acaf", "search": "", "hash": "" }, { - "input": "file:///./y:", + "input": "blob:", "base": "about:blank", - "href": "file:///y:", - "protocol": "file:", + "href": "blob:", + "origin": "null", + "protocol": "blob:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/y:", + "pathname": "", "search": "", "hash": "" }, + "Invalid IPv4 radix digits", { - "input": "\\\\\\.\\y:", + "input": "http://0x7f.0.0.0x7g", "base": "about:blank", - "failure": true - }, - "# IPv6 tests", - { - "input": "http://[1:0::]", - "base": "http://example.net/", - "href": "http://[1::]/", - "origin": "http://[1::]", + "href": "http://0x7f.0.0.0x7g/", "protocol": "http:", "username": "", "password": "", - "host": "[1::]", - "hostname": "[1::]", + "host": "0x7f.0.0.0x7g", + "hostname": "0x7f.0.0.0x7g", "port": "", "pathname": "/", "search": "", "hash": "" }, { - "input": "http://[0:1:2:3:4:5:6:7:8]", - "base": "http://example.net/", - "failure": true - }, - { - "input": "https://[0::0::0]", - "base": "about:blank", - "failure": true - }, - { - "input": "https://[0:.0]", - "base": "about:blank", - "failure": true - }, - { - "input": "https://[0:0:]", + "input": "http://0X7F.0.0.0X7G", "base": "about:blank", - "failure": true + "href": "http://0x7f.0.0.0x7g/", + "protocol": "http:", + "username": "", + "password": "", + "host": "0x7f.0.0.0x7g", + "hostname": "0x7f.0.0.0x7g", + "port": "", + "pathname": "/", + "search": "", + "hash": "" }, + "Invalid IPv4 portion of IPv6 address", { - "input": "https://[0:1:2:3:4:5:6:7.0.0.0.1]", + "input": "http://[::127.0.0.0.1]", "base": "about:blank", "failure": true }, + "Uncompressed IPv6 addresses with 0", { - "input": "https://[0:1.00.0.0.0]", + "input": "http://[0:1:0:1:0:1:0:1]", "base": "about:blank", - "failure": true + "href": "http://[0:1:0:1:0:1:0:1]/", + "protocol": "http:", + "username": "", + "password": "", + "host": "[0:1:0:1:0:1:0:1]", + "hostname": "[0:1:0:1:0:1:0:1]", + "port": "", + "pathname": "/", + "search": "", + "hash": "" }, { - "input": "https://[0:1.290.0.0.0]", + "input": "http://[1:0:1:0:1:0:1:0]", "base": "about:blank", - "failure": true + "href": "http://[1:0:1:0:1:0:1:0]/", + "protocol": "http:", + "username": "", + "password": "", + "host": "[1:0:1:0:1:0:1:0]", + "hostname": "[1:0:1:0:1:0:1:0]", + "port": "", + "pathname": "/", + "search": "", + "hash": "" }, + "Percent-encoded query and fragment", { - "input": "https://[0:1.23.23]", + "input": "http://example.org/test?\u0022", "base": "about:blank", - "failure": true + "href": "http://example.org/test?%22", + "protocol": "http:", + "username": "", + "password": "", + "host": "example.org", + "hostname": "example.org", + "port": "", + "pathname": "/test", + "search": "?%22", + "hash": "" }, - "# Empty host", { - "input": "http://?", + "input": "http://example.org/test?\u0023", "base": "about:blank", - "failure": true + "href": "http://example.org/test?#", + "protocol": "http:", + "username": "", + "password": "", + "host": "example.org", + "hostname": "example.org", + "port": "", + "pathname": "/test", + "search": "", + "hash": "" }, { - "input": "http://#", + "input": "http://example.org/test?\u003C", "base": "about:blank", - "failure": true - }, - "Port overflow (2^32 + 81)", - { - "input": "http://f:4294967377/c", - "base": "http://example.org/", - "failure": true - }, - "Port overflow (2^64 + 81)", - { - "input": "http://f:18446744073709551697/c", - "base": "http://example.org/", - "failure": true - }, - "Port overflow (2^128 + 81)", - { - "input": "http://f:340282366920938463463374607431768211537/c", - "base": "http://example.org/", - "failure": true + "href": "http://example.org/test?%3C", + "protocol": "http:", + "username": "", + "password": "", + "host": "example.org", + "hostname": "example.org", + "port": "", + "pathname": "/test", + "search": "?%3C", + "hash": "" }, - "# Non-special-URL path tests", { - "input": "sc://ñ", + "input": "http://example.org/test?\u003E", "base": "about:blank", - "href": "sc://%C3%B1", - "origin": "null", - "protocol": "sc:", + "href": "http://example.org/test?%3E", + "protocol": "http:", "username": "", "password": "", - "host": "%C3%B1", - "hostname": "%C3%B1", + "host": "example.org", + "hostname": "example.org", "port": "", - "pathname": "", - "search": "", + "pathname": "/test", + "search": "?%3E", "hash": "" }, { - "input": "sc://ñ?x", + "input": "http://example.org/test?\u2323", "base": "about:blank", - "href": "sc://%C3%B1?x", - "origin": "null", - "protocol": "sc:", + "href": "http://example.org/test?%E2%8C%A3", + "protocol": "http:", "username": "", "password": "", - "host": "%C3%B1", - "hostname": "%C3%B1", + "host": "example.org", + "hostname": "example.org", "port": "", - "pathname": "", - "search": "?x", + "pathname": "/test", + "search": "?%E2%8C%A3", "hash": "" }, { - "input": "sc://ñ#x", + "input": "http://example.org/test?%23%23", "base": "about:blank", - "href": "sc://%C3%B1#x", - "origin": "null", - "protocol": "sc:", + "href": "http://example.org/test?%23%23", + "protocol": "http:", "username": "", "password": "", - "host": "%C3%B1", - "hostname": "%C3%B1", + "host": "example.org", + "hostname": "example.org", "port": "", - "pathname": "", - "search": "", - "hash": "#x" + "pathname": "/test", + "search": "?%23%23", + "hash": "" }, { - "input": "#x", - "base": "sc://ñ", - "href": "sc://%C3%B1#x", - "origin": "null", - "protocol": "sc:", + "input": "http://example.org/test?%GH", + "base": "about:blank", + "href": "http://example.org/test?%GH", + "protocol": "http:", "username": "", "password": "", - "host": "%C3%B1", - "hostname": "%C3%B1", + "host": "example.org", + "hostname": "example.org", "port": "", - "pathname": "", - "search": "", - "hash": "#x" + "pathname": "/test", + "search": "?%GH", + "hash": "" }, { - "input": "?x", - "base": "sc://ñ", - "href": "sc://%C3%B1?x", - "origin": "null", - "protocol": "sc:", + "input": "http://example.org/test?a#%EF", + "base": "about:blank", + "href": "http://example.org/test?a#%EF", + "protocol": "http:", "username": "", "password": "", - "host": "%C3%B1", - "hostname": "%C3%B1", + "host": "example.org", + "hostname": "example.org", "port": "", - "pathname": "", - "search": "?x", - "hash": "" + "pathname": "/test", + "search": "?a", + "hash": "#%EF" }, { - "input": "sc://?", + "input": "http://example.org/test?a#%GH", "base": "about:blank", - "href": "sc://?", - "protocol": "sc:", + "href": "http://example.org/test?a#%GH", + "protocol": "http:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "example.org", + "hostname": "example.org", "port": "", - "pathname": "", - "search": "", - "hash": "" + "pathname": "/test", + "search": "?a", + "hash": "#%GH" + }, + "URLs that require a non-about:blank base. (Also serve as invalid base tests.)", + { + "input": "a", + "base": "about:blank", + "failure": true, + "inputCanBeRelative": true + }, + { + "input": "a/", + "base": "about:blank", + "failure": true, + "inputCanBeRelative": true + }, + { + "input": "a//", + "base": "about:blank", + "failure": true, + "inputCanBeRelative": true + }, + "Bases that don't fail to parse but fail to be bases", + { + "input": "test-a-colon.html", + "base": "a:", + "failure": true }, { - "input": "sc://#", - "base": "about:blank", - "href": "sc://#", - "protocol": "sc:", + "input": "test-a-colon-b.html", + "base": "a:b", + "failure": true + }, + "Other base URL tests, that must succeed", + { + "input": "test-a-colon-slash.html", + "base": "a:/", + "href": "a:/test-a-colon-slash.html", + "protocol": "a:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "", + "pathname": "/test-a-colon-slash.html", "search": "", "hash": "" }, { - "input": "///", - "base": "sc://x/", - "href": "sc:///", - "protocol": "sc:", + "input": "test-a-colon-slash-slash.html", + "base": "a://", + "href": "a:///test-a-colon-slash-slash.html", + "protocol": "a:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/", + "pathname": "/test-a-colon-slash-slash.html", "search": "", "hash": "" }, { - "input": "////", - "base": "sc://x/", - "href": "sc:////", - "protocol": "sc:", + "input": "test-a-colon-slash-b.html", + "base": "a:/b", + "href": "a:/test-a-colon-slash-b.html", + "protocol": "a:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "//", + "pathname": "/test-a-colon-slash-b.html", "search": "", "hash": "" }, { - "input": "////x/", - "base": "sc://x/", - "href": "sc:////x/", - "protocol": "sc:", + "input": "test-a-colon-slash-slash-b.html", + "base": "a://b", + "href": "a://b/test-a-colon-slash-slash-b.html", + "protocol": "a:", "username": "", "password": "", - "host": "", - "hostname": "", + "host": "b", + "hostname": "b", "port": "", - "pathname": "//x/", + "pathname": "/test-a-colon-slash-slash-b.html", "search": "", "hash": "" }, + "Null code point in fragment", { - "input": "tftp://foobar.com/someconfig;mode=netascii", + "input": "http://example.org/test?a#b\u0000c", "base": "about:blank", - "href": "tftp://foobar.com/someconfig;mode=netascii", - "origin": "null", - "protocol": "tftp:", + "href": "http://example.org/test?a#b%00c", + "protocol": "http:", "username": "", "password": "", - "host": "foobar.com", - "hostname": "foobar.com", + "host": "example.org", + "hostname": "example.org", "port": "", - "pathname": "/someconfig;mode=netascii", - "search": "", - "hash": "" - }, - { - "input": "telnet://user:pass@foobar.com:23/", - "base": "about:blank", - "href": "telnet://user:pass@foobar.com:23/", - "origin": "null", - "protocol": "telnet:", - "username": "user", - "password": "pass", - "host": "foobar.com:23", - "hostname": "foobar.com", - "port": "23", - "pathname": "/", - "search": "", - "hash": "" + "pathname": "/test", + "search": "?a", + "hash": "#b%00c" }, { - "input": "ut2004://10.10.10.10:7777/Index.ut2", + "input": "non-spec://example.org/test?a#b\u0000c", "base": "about:blank", - "href": "ut2004://10.10.10.10:7777/Index.ut2", - "origin": "null", - "protocol": "ut2004:", + "href": "non-spec://example.org/test?a#b%00c", + "protocol": "non-spec:", "username": "", "password": "", - "host": "10.10.10.10:7777", - "hostname": "10.10.10.10", - "port": "7777", - "pathname": "/Index.ut2", - "search": "", - "hash": "" - }, - { - "input": "redis://foo:bar@somehost:6379/0?baz=bam&qux=baz", - "base": "about:blank", - "href": "redis://foo:bar@somehost:6379/0?baz=bam&qux=baz", - "origin": "null", - "protocol": "redis:", - "username": "foo", - "password": "bar", - "host": "somehost:6379", - "hostname": "somehost", - "port": "6379", - "pathname": "/0", - "search": "?baz=bam&qux=baz", - "hash": "" + "host": "example.org", + "hostname": "example.org", + "port": "", + "pathname": "/test", + "search": "?a", + "hash": "#b%00c" }, { - "input": "rsync://foo@host:911/sup", + "input": "non-spec:/test?a#b\u0000c", "base": "about:blank", - "href": "rsync://foo@host:911/sup", - "origin": "null", - "protocol": "rsync:", - "username": "foo", + "href": "non-spec:/test?a#b%00c", + "protocol": "non-spec:", + "username": "", "password": "", - "host": "host:911", - "hostname": "host", - "port": "911", - "pathname": "/sup", - "search": "", - "hash": "" + "host": "", + "hostname": "", + "port": "", + "pathname": "/test", + "search": "?a", + "hash": "#b%00c" }, + "First scheme char - not allowed: https://github.com/whatwg/url/issues/464", { - "input": "git://github.com/foo/bar.git", - "base": "about:blank", - "href": "git://github.com/foo/bar.git", - "origin": "null", - "protocol": "git:", + "input": "10.0.0.7:8080/foo.html", + "base": "file:///some/dir/bar.html", + "href": "file:///some/dir/10.0.0.7:8080/foo.html", + "protocol": "file:", "username": "", "password": "", - "host": "github.com", - "hostname": "github.com", + "host": "", + "hostname": "", "port": "", - "pathname": "/foo/bar.git", + "pathname": "/some/dir/10.0.0.7:8080/foo.html", "search": "", "hash": "" }, + "Subsequent scheme chars - not allowed", { - "input": "irc://myserver.com:6999/channel?passwd", - "base": "about:blank", - "href": "irc://myserver.com:6999/channel?passwd", - "origin": "null", - "protocol": "irc:", + "input": "a!@$*=/foo.html", + "base": "file:///some/dir/bar.html", + "href": "file:///some/dir/a!@$*=/foo.html", + "protocol": "file:", "username": "", "password": "", - "host": "myserver.com:6999", - "hostname": "myserver.com", - "port": "6999", - "pathname": "/channel", - "search": "?passwd", + "host": "", + "hostname": "", + "port": "", + "pathname": "/some/dir/a!@$*=/foo.html", + "search": "", "hash": "" }, + "First and subsequent scheme chars - allowed", { - "input": "dns://fw.example.org:9999/foo.bar.org?type=TXT", - "base": "about:blank", - "href": "dns://fw.example.org:9999/foo.bar.org?type=TXT", - "origin": "null", - "protocol": "dns:", + "input": "a1234567890-+.:foo/bar", + "base": "http://example.com/dir/file", + "href": "a1234567890-+.:foo/bar", + "protocol": "a1234567890-+.:", "username": "", "password": "", - "host": "fw.example.org:9999", - "hostname": "fw.example.org", - "port": "9999", - "pathname": "/foo.bar.org", - "search": "?type=TXT", + "host": "", + "hostname": "", + "port": "", + "pathname": "foo/bar", + "search": "", "hash": "" }, + "IDNA ignored code points in file URLs hosts", { - "input": "ldap://localhost:389/ou=People,o=JNDITutorial", + "input": "file://a\u00ADb/p", "base": "about:blank", - "href": "ldap://localhost:389/ou=People,o=JNDITutorial", - "origin": "null", - "protocol": "ldap:", + "href": "file://ab/p", + "protocol": "file:", "username": "", "password": "", - "host": "localhost:389", - "hostname": "localhost", - "port": "389", - "pathname": "/ou=People,o=JNDITutorial", + "host": "ab", + "hostname": "ab", + "port": "", + "pathname": "/p", "search": "", "hash": "" }, { - "input": "git+https://github.com/foo/bar", + "input": "file://a%C2%ADb/p", "base": "about:blank", - "href": "git+https://github.com/foo/bar", - "origin": "null", - "protocol": "git+https:", + "href": "file://ab/p", + "protocol": "file:", "username": "", "password": "", - "host": "github.com", - "hostname": "github.com", + "host": "ab", + "hostname": "ab", "port": "", - "pathname": "/foo/bar", + "pathname": "/p", "search": "", "hash": "" }, + "Empty host after the domain to ASCII", + { + "input": "file://\u00ad/p", + "base": "about:blank", + "failure": true + }, { - "input": "urn:ietf:rfc:2648", + "input": "file://%C2%AD/p", "base": "about:blank", - "href": "urn:ietf:rfc:2648", - "origin": "null", - "protocol": "urn:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "ietf:rfc:2648", - "search": "", - "hash": "" + "failure": true }, { - "input": "tag:joe@example.org,2001:foo/bar", + "input": "file://xn--/p", "base": "about:blank", - "href": "tag:joe@example.org,2001:foo/bar", - "origin": "null", - "protocol": "tag:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "joe@example.org,2001:foo/bar", - "search": "", - "hash": "" + "failure": true }, - "# percent encoded hosts in non-special-URLs", + "https://bugzilla.mozilla.org/show_bug.cgi?id=1647058", { - "input": "non-special://%E2%80%A0/", - "base": "about:blank", - "href": "non-special://%E2%80%A0/", - "protocol": "non-special:", + "input": "#link", + "base": "https://example.org/##link", + "href": "https://example.org/#link", + "protocol": "https:", "username": "", "password": "", - "host": "%E2%80%A0", - "hostname": "%E2%80%A0", + "host": "example.org", + "hostname": "example.org", "port": "", "pathname": "/", "search": "", - "hash": "" + "hash": "#link" }, + "UTF-8 percent-encode of C0 control percent-encode set and supersets", { - "input": "non-special://H%4fSt/path", + "input": "non-special:cannot-be-a-base-url-\u0000\u0001\u001F\u001E\u007E\u007F\u0080", "base": "about:blank", - "href": "non-special://H%4fSt/path", - "protocol": "non-special:", - "username": "", + "hash": "", + "host": "", + "hostname": "", + "href": "non-special:cannot-be-a-base-url-%00%01%1F%1E~%7F%C2%80", + "origin": "null", "password": "", - "host": "H%4fSt", - "hostname": "H%4fSt", + "pathname": "cannot-be-a-base-url-%00%01%1F%1E~%7F%C2%80", "port": "", - "pathname": "/path", + "protocol": "non-special:", "search": "", - "hash": "" + "username": "" }, - "# IPv6 in non-special-URLs", { - "input": "non-special://[1:2:0:0:5:0:0:0]/", + "input": "https://www.example.com/path{\u007Fpath.html?query'\u007F=query#fragment<\u007Ffragment", "base": "about:blank", - "href": "non-special://[1:2:0:0:5::]/", - "protocol": "non-special:", - "username": "", + "hash": "#fragment%3C%7Ffragment", + "host": "www.example.com", + "hostname": "www.example.com", + "href": "https://www.example.com/path%7B%7Fpath.html?query%27%7F=query#fragment%3C%7Ffragment", + "origin": "https://www.example.com", "password": "", - "host": "[1:2:0:0:5::]", - "hostname": "[1:2:0:0:5::]", + "pathname": "/path%7B%7Fpath.html", "port": "", - "pathname": "/", + "protocol": "https:", + "search": "?query%27%7F=query", + "username": "" + }, + { + "input": "https://user:pass[\u007F@foo/bar", + "base": "http://example.org", + "hash": "", + "host": "foo", + "hostname": "foo", + "href": "https://user:pass%5B%7F@foo/bar", + "origin": "https://foo", + "password": "pass%5B%7F", + "pathname": "/bar", + "port": "", + "protocol": "https:", "search": "", - "hash": "" + "username": "user" }, + "Tests for the distinct percent-encode sets", { - "input": "non-special://[1:2:0:0:0:0:0:3]/", + "input": "foo:// !\"$%&'()*+,-.;<=>@[\\]^_`{|}~@host/", "base": "about:blank", - "href": "non-special://[1:2::3]/", - "protocol": "non-special:", - "username": "", + "hash": "", + "host": "host", + "hostname": "host", + "href": "foo://%20!%22$%&'()*+,-.%3B%3C%3D%3E%40%5B%5C%5D%5E_%60%7B%7C%7D~@host/", + "origin": "null", "password": "", - "host": "[1:2::3]", - "hostname": "[1:2::3]", - "port": "", "pathname": "/", + "port":"", + "protocol": "foo:", "search": "", - "hash": "" + "username": "%20!%22$%&'()*+,-.%3B%3C%3D%3E%40%5B%5C%5D%5E_%60%7B%7C%7D~" }, { - "input": "non-special://[1:2::3]:80/", + "input": "wss:// !\"$%&'()*+,-.;<=>@[]^_`{|}~@host/", "base": "about:blank", - "href": "non-special://[1:2::3]:80/", - "protocol": "non-special:", - "username": "", + "hash": "", + "host": "host", + "hostname": "host", + "href": "wss://%20!%22$%&'()*+,-.%3B%3C%3D%3E%40%5B%5D%5E_%60%7B%7C%7D~@host/", + "origin": "wss://host", "password": "", - "host": "[1:2::3]:80", - "hostname": "[1:2::3]", - "port": "80", "pathname": "/", + "port":"", + "protocol": "wss:", "search": "", - "hash": "" + "username": "%20!%22$%&'()*+,-.%3B%3C%3D%3E%40%5B%5D%5E_%60%7B%7C%7D~" }, { - "input": "non-special://[:80/", + "input": "foo://joe: !\"$%&'()*+,-.:;<=>@[\\]^_`{|}~@host/", "base": "about:blank", - "failure": true + "hash": "", + "host": "host", + "hostname": "host", + "href": "foo://joe:%20!%22$%&'()*+,-.%3A%3B%3C%3D%3E%40%5B%5C%5D%5E_%60%7B%7C%7D~@host/", + "origin": "null", + "password": "%20!%22$%&'()*+,-.%3A%3B%3C%3D%3E%40%5B%5C%5D%5E_%60%7B%7C%7D~", + "pathname": "/", + "port":"", + "protocol": "foo:", + "search": "", + "username": "joe" }, { - "input": "blob:https://example.com:443/", + "input": "wss://joe: !\"$%&'()*+,-.:;<=>@[]^_`{|}~@host/", "base": "about:blank", - "href": "blob:https://example.com:443/", - "protocol": "blob:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "https://example.com:443/", + "hash": "", + "host": "host", + "hostname": "host", + "href": "wss://joe:%20!%22$%&'()*+,-.%3A%3B%3C%3D%3E%40%5B%5D%5E_%60%7B%7C%7D~@host/", + "origin": "wss://host", + "password": "%20!%22$%&'()*+,-.%3A%3B%3C%3D%3E%40%5B%5D%5E_%60%7B%7C%7D~", + "pathname": "/", + "port":"", + "protocol": "wss:", "search": "", - "hash": "" + "username": "joe" }, { - "input": "blob:d3958f5c-0777-0845-9dcf-2cb28783acaf", + "input": "foo://!\"$%&'()*+,-.;=_`{}~/", "base": "about:blank", - "href": "blob:d3958f5c-0777-0845-9dcf-2cb28783acaf", - "protocol": "blob:", - "username": "", + "hash": "", + "host": "!\"$%&'()*+,-.;=_`{}~", + "hostname": "!\"$%&'()*+,-.;=_`{}~", + "href":"foo://!\"$%&'()*+,-.;=_`{}~/", + "origin": "null", "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "d3958f5c-0777-0845-9dcf-2cb28783acaf", + "pathname": "/", + "port":"", + "protocol": "foo:", "search": "", - "hash": "" + "username": "" }, - "Invalid IPv4 radix digits", { - "input": "http://0177.0.0.0189", + "input": "wss://!\"$&'()*+,-.;=_`{}~/", "base": "about:blank", - "href": "http://0177.0.0.0189/", - "protocol": "http:", - "username": "", + "hash": "", + "host": "!\"$&'()*+,-.;=_`{}~", + "hostname": "!\"$&'()*+,-.;=_`{}~", + "href":"wss://!\"$&'()*+,-.;=_`{}~/", + "origin": "wss://!\"$&'()*+,-.;=_`{}~", "password": "", - "host": "0177.0.0.0189", - "hostname": "0177.0.0.0189", - "port": "", "pathname": "/", + "port":"", + "protocol": "wss:", "search": "", - "hash": "" + "username": "" }, { - "input": "http://0x7f.0.0.0x7g", + "input": "foo://host/ !\"$%&'()*+,-./:;<=>@[\\]^_`{|}~", "base": "about:blank", - "href": "http://0x7f.0.0.0x7g/", - "protocol": "http:", - "username": "", + "hash": "", + "host": "host", + "hostname": "host", + "href": "foo://host/%20!%22$%&'()*+,-./:;%3C=%3E@[\\]^_%60%7B|%7D~", + "origin": "null", "password": "", - "host": "0x7f.0.0.0x7g", - "hostname": "0x7f.0.0.0x7g", - "port": "", - "pathname": "/", + "pathname": "/%20!%22$%&'()*+,-./:;%3C=%3E@[\\]^_%60%7B|%7D~", + "port":"", + "protocol": "foo:", "search": "", - "hash": "" + "username": "" }, { - "input": "http://0X7F.0.0.0X7G", + "input": "wss://host/ !\"$%&'()*+,-./:;<=>@[\\]^_`{|}~", "base": "about:blank", - "href": "http://0x7f.0.0.0x7g/", - "protocol": "http:", - "username": "", + "hash": "", + "host": "host", + "hostname": "host", + "href": "wss://host/%20!%22$%&'()*+,-./:;%3C=%3E@[/]^_%60%7B|%7D~", + "origin": "wss://host", "password": "", - "host": "0x7f.0.0.0x7g", - "hostname": "0x7f.0.0.0x7g", - "port": "", - "pathname": "/", + "pathname": "/%20!%22$%&'()*+,-./:;%3C=%3E@[/]^_%60%7B|%7D~", + "port":"", + "protocol": "wss:", "search": "", - "hash": "" + "username": "" }, - "Invalid IPv4 portion of IPv6 address", { - "input": "http://[::127.0.0.0.1]", + "input": "foo://host/dir/? !\"$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "base": "about:blank", - "failure": true + "hash": "", + "host": "host", + "hostname": "host", + "href": "foo://host/dir/?%20!%22$%&'()*+,-./:;%3C=%3E?@[\\]^_`{|}~", + "origin": "null", + "password": "", + "pathname": "/dir/", + "port":"", + "protocol": "foo:", + "search": "?%20!%22$%&'()*+,-./:;%3C=%3E?@[\\]^_`{|}~", + "username": "" }, - "Uncompressed IPv6 addresses with 0", { - "input": "http://[0:1:0:1:0:1:0:1]", + "input": "wss://host/dir/? !\"$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "base": "about:blank", - "href": "http://[0:1:0:1:0:1:0:1]/", - "protocol": "http:", - "username": "", + "hash": "", + "host": "host", + "hostname": "host", + "href": "wss://host/dir/?%20!%22$%&%27()*+,-./:;%3C=%3E?@[\\]^_`{|}~", + "origin": "wss://host", "password": "", - "host": "[0:1:0:1:0:1:0:1]", - "hostname": "[0:1:0:1:0:1:0:1]", - "port": "", - "pathname": "/", - "search": "", - "hash": "" + "pathname": "/dir/", + "port":"", + "protocol": "wss:", + "search": "?%20!%22$%&%27()*+,-./:;%3C=%3E?@[\\]^_`{|}~", + "username": "" }, { - "input": "http://[1:0:1:0:1:0:1:0]", + "input": "foo://host/dir/# !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "base": "about:blank", - "href": "http://[1:0:1:0:1:0:1:0]/", - "protocol": "http:", - "username": "", + "hash": "#%20!%22#$%&'()*+,-./:;%3C=%3E?@[\\]^_%60{|}~", + "host": "host", + "hostname": "host", + "href": "foo://host/dir/#%20!%22#$%&'()*+,-./:;%3C=%3E?@[\\]^_%60{|}~", + "origin": "null", "password": "", - "host": "[1:0:1:0:1:0:1:0]", - "hostname": "[1:0:1:0:1:0:1:0]", - "port": "", - "pathname": "/", + "pathname": "/dir/", + "port":"", + "protocol": "foo:", "search": "", - "hash": "" + "username": "" }, - "Percent-encoded query and fragment", { - "input": "http://example.org/test?\u0022", + "input": "wss://host/dir/# !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "base": "about:blank", - "href": "http://example.org/test?%22", - "protocol": "http:", - "username": "", + "hash": "#%20!%22#$%&'()*+,-./:;%3C=%3E?@[\\]^_%60{|}~", + "host": "host", + "hostname": "host", + "href": "wss://host/dir/#%20!%22#$%&'()*+,-./:;%3C=%3E?@[\\]^_%60{|}~", + "origin": "wss://host", "password": "", - "host": "example.org", - "hostname": "example.org", - "port": "", - "pathname": "/test", - "search": "?%22", - "hash": "" + "pathname": "/dir/", + "port":"", + "protocol": "wss:", + "search": "", + "username": "" }, + "Ensure that input schemes are not ignored when resolving non-special URLs", { - "input": "http://example.org/test?\u0023", - "base": "about:blank", - "href": "http://example.org/test?#", - "protocol": "http:", - "username": "", + "input": "abc:rootless", + "base": "abc://host/path", + "hash": "", + "host": "", + "hostname": "", + "href":"abc:rootless", "password": "", - "host": "example.org", - "hostname": "example.org", - "port": "", - "pathname": "/test", + "pathname": "rootless", + "port":"", + "protocol": "abc:", "search": "", - "hash": "" + "username": "" }, { - "input": "http://example.org/test?\u003C", - "base": "about:blank", - "href": "http://example.org/test?%3C", - "protocol": "http:", - "username": "", + "input": "abc:rootless", + "base": "abc:/path", + "hash": "", + "host": "", + "hostname": "", + "href":"abc:rootless", "password": "", - "host": "example.org", - "hostname": "example.org", - "port": "", - "pathname": "/test", - "search": "?%3C", - "hash": "" + "pathname": "rootless", + "port":"", + "protocol": "abc:", + "search": "", + "username": "" }, { - "input": "http://example.org/test?\u003E", - "base": "about:blank", - "href": "http://example.org/test?%3E", - "protocol": "http:", - "username": "", + "input": "abc:rootless", + "base": "abc:path", + "hash": "", + "host": "", + "hostname": "", + "href":"abc:rootless", "password": "", - "host": "example.org", - "hostname": "example.org", - "port": "", - "pathname": "/test", - "search": "?%3E", - "hash": "" + "pathname": "rootless", + "port":"", + "protocol": "abc:", + "search": "", + "username": "" }, { - "input": "http://example.org/test?\u2323", - "base": "about:blank", - "href": "http://example.org/test?%E2%8C%A3", - "protocol": "http:", - "username": "", + "input": "abc:/rooted", + "base": "abc://host/path", + "hash": "", + "host": "", + "hostname": "", + "href":"abc:/rooted", "password": "", - "host": "example.org", - "hostname": "example.org", - "port": "", - "pathname": "/test", - "search": "?%E2%8C%A3", - "hash": "" + "pathname": "/rooted", + "port":"", + "protocol": "abc:", + "search": "", + "username": "" + }, + "Empty query and fragment with blank should throw an error", + { + "input": "#", + "base": null, + "failure": true + }, + { + "input": "?", + "base": null, + "failure": true + }, + "Last component looks like a number, but not valid IPv4", + { + "input": "http://1.2.3.4.5", + "base": "http://other.com/", + "failure": true + }, + { + "input": "http://1.2.3.4.5.", + "base": "http://other.com/", + "failure": true }, { - "input": "http://example.org/test?%23%23", + "input": "http://0..0x300/", "base": "about:blank", - "href": "http://example.org/test?%23%23", - "protocol": "http:", - "username": "", - "password": "", - "host": "example.org", - "hostname": "example.org", - "port": "", - "pathname": "/test", - "search": "?%23%23", - "hash": "" + "failure": true }, { - "input": "http://example.org/test?%GH", + "input": "http://0..0x300./", "base": "about:blank", - "href": "http://example.org/test?%GH", - "protocol": "http:", - "username": "", - "password": "", - "host": "example.org", - "hostname": "example.org", - "port": "", - "pathname": "/test", - "search": "?%GH", - "hash": "" + "failure": true }, { - "input": "http://example.org/test?a#%EF", + "input": "http://256.256.256.256.256", + "base": "http://other.com/", + "failure": true + }, + { + "input": "http://256.256.256.256.256.", + "base": "http://other.com/", + "failure": true + }, + { + "input": "http://1.2.3.08", "base": "about:blank", - "href": "http://example.org/test?a#%EF", - "protocol": "http:", - "username": "", - "password": "", - "host": "example.org", - "hostname": "example.org", - "port": "", - "pathname": "/test", - "search": "?a", - "hash": "#%EF" + "failure": true }, { - "input": "http://example.org/test?a#%GH", + "input": "http://1.2.3.08.", "base": "about:blank", - "href": "http://example.org/test?a#%GH", - "protocol": "http:", - "username": "", - "password": "", - "host": "example.org", - "hostname": "example.org", - "port": "", - "pathname": "/test", - "search": "?a", - "hash": "#%GH" + "failure": true }, - "URLs that require a non-about:blank base. (Also serve as invalid base tests.)", { - "input": "a", + "input": "http://1.2.3.09", "base": "about:blank", "failure": true }, { - "input": "a/", + "input": "http://09.2.3.4", "base": "about:blank", "failure": true }, { - "input": "a//", + "input": "http://09.2.3.4.", "base": "about:blank", "failure": true }, - "Bases that don't fail to parse but fail to be bases", { - "input": "test-a-colon.html", - "base": "a:", + "input": "http://01.2.3.4.5", + "base": "about:blank", "failure": true }, { - "input": "test-a-colon-b.html", - "base": "a:b", + "input": "http://01.2.3.4.5.", + "base": "about:blank", "failure": true }, - "Other base URL tests, that must succeed", { - "input": "test-a-colon-slash.html", - "base": "a:/", - "href": "a:/test-a-colon-slash.html", - "protocol": "a:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/test-a-colon-slash.html", - "search": "", - "hash": "" + "input": "http://0x100.2.3.4", + "base": "about:blank", + "failure": true }, { - "input": "test-a-colon-slash-slash.html", - "base": "a://", - "href": "a:///test-a-colon-slash-slash.html", - "protocol": "a:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/test-a-colon-slash-slash.html", - "search": "", - "hash": "" + "input": "http://0x100.2.3.4.", + "base": "about:blank", + "failure": true }, { - "input": "test-a-colon-slash-b.html", - "base": "a:/b", - "href": "a:/test-a-colon-slash-b.html", - "protocol": "a:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/test-a-colon-slash-b.html", - "search": "", - "hash": "" + "input": "http://0x1.2.3.4.5", + "base": "about:blank", + "failure": true }, { - "input": "test-a-colon-slash-slash-b.html", - "base": "a://b", - "href": "a://b/test-a-colon-slash-slash-b.html", - "protocol": "a:", - "username": "", - "password": "", - "host": "b", - "hostname": "b", - "port": "", - "pathname": "/test-a-colon-slash-slash-b.html", - "search": "", - "hash": "" + "input": "http://0x1.2.3.4.5.", + "base": "about:blank", + "failure": true }, - "Null code point in fragment", { - "input": "http://example.org/test?a#b\u0000c", + "input": "http://foo.1.2.3.4", "base": "about:blank", - "href": "http://example.org/test?a#b%00c", - "protocol": "http:", - "username": "", - "password": "", - "host": "example.org", - "hostname": "example.org", - "port": "", - "pathname": "/test", - "search": "?a", - "hash": "#b%00c" + "failure": true }, { - "input": "non-spec://example.org/test?a#b\u0000c", + "input": "http://foo.1.2.3.4.", "base": "about:blank", - "href": "non-spec://example.org/test?a#b%00c", - "protocol": "non-spec:", - "username": "", - "password": "", - "host": "example.org", - "hostname": "example.org", - "port": "", - "pathname": "/test", - "search": "?a", - "hash": "#b%00c" + "failure": true }, { - "input": "non-spec:/test?a#b\u0000c", + "input": "http://foo.2.3.4", "base": "about:blank", - "href": "non-spec:/test?a#b%00c", - "protocol": "non-spec:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/test", - "search": "?a", - "hash": "#b%00c" + "failure": true }, - "First scheme char - not allowed: https://github.com/whatwg/url/issues/464", { - "input": "10.0.0.7:8080/foo.html", - "base": "file:///some/dir/bar.html", - "href": "file:///some/dir/10.0.0.7:8080/foo.html", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/some/dir/10.0.0.7:8080/foo.html", - "search": "", - "hash": "" + "input": "http://foo.2.3.4.", + "base": "about:blank", + "failure": true }, - "Subsequent scheme chars - not allowed", { - "input": "a!@$*=/foo.html", - "base": "file:///some/dir/bar.html", - "href": "file:///some/dir/a!@$*=/foo.html", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/some/dir/a!@$*=/foo.html", - "search": "", - "hash": "" + "input": "http://foo.09", + "base": "about:blank", + "failure": true }, - "First and subsequent scheme chars - allowed", { - "input": "a1234567890-+.:foo/bar", - "base": "http://example.com/dir/file", - "href": "a1234567890-+.:foo/bar", - "protocol": "a1234567890-+.:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "foo/bar", - "search": "", - "hash": "" + "input": "http://foo.09.", + "base": "about:blank", + "failure": true }, - "IDNA ignored code points in file URLs hosts", { - "input": "file://a\u00ADb/p", + "input": "http://foo.0x4", "base": "about:blank", - "href": "file://ab/p", - "protocol": "file:", - "username": "", - "password": "", - "host": "ab", - "hostname": "ab", - "port": "", - "pathname": "/p", - "search": "", - "hash": "" + "failure": true }, { - "input": "file://a%C2%ADb/p", + "input": "http://foo.0x4.", "base": "about:blank", - "href": "file://ab/p", - "protocol": "file:", - "username": "", + "failure": true + }, + { + "input": "http://foo.09..", + "base": "about:blank", + "hash": "", + "host": "foo.09..", + "hostname": "foo.09..", + "href":"http://foo.09../", "password": "", - "host": "ab", - "hostname": "ab", - "port": "", - "pathname": "/p", + "pathname": "/", + "port":"", + "protocol": "http:", "search": "", - "hash": "" + "username": "" }, - "Empty host after the domain to ASCII", { - "input": "file://\u00ad/p", + "input": "http://0999999999999999999/", "base": "about:blank", "failure": true }, { - "input": "file://%C2%AD/p", + "input": "http://foo.0x", "base": "about:blank", "failure": true }, { - "input": "file://xn--/p", + "input": "http://foo.0XFfFfFfFfFfFfFfFfFfAcE123", "base": "about:blank", "failure": true }, - "https://bugzilla.mozilla.org/show_bug.cgi?id=1647058", { - "input": "#link", - "base": "https://example.org/##link", - "href": "https://example.org/#link", - "protocol": "https:", - "username": "", - "password": "", - "host": "example.org", - "hostname": "example.org", - "port": "", - "pathname": "/", - "search": "", - "hash": "#link" + "input": "http://💩.123/", + "base": "about:blank", + "failure": true } ] -- cgit v1.2.3