diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:11:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:12:43 +0000 |
commit | cf94bdc0742c13e2a0cac864c478b8626b266e1b (patch) | |
tree | 044670aa50cc5e2b4229aa0b6b3df6676730c0a6 /vendor/url/tests | |
parent | Adding debian version 1.65.0+dfsg1-2. (diff) | |
download | rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.tar.xz rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.zip |
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/url/tests')
-rw-r--r-- | vendor/url/tests/data.rs | 79 | ||||
-rw-r--r-- | vendor/url/tests/debugger_visualizer.rs | 102 | ||||
-rw-r--r-- | vendor/url/tests/unit.rs | 54 | ||||
-rw-r--r-- | vendor/url/tests/urltestdata.json | 1625 |
4 files changed, 1481 insertions, 379 deletions
diff --git a/vendor/url/tests/data.rs b/vendor/url/tests/data.rs index b72c33306..f4001ca2b 100644 --- a/vendor/url/tests/data.rs +++ b/vendor/url/tests/data.rs @@ -8,7 +8,6 @@ //! Data-driven tests -use std::ops::Deref; use std::str::FromStr; use serde_json::Value; @@ -16,7 +15,20 @@ use url::{quirks, Url}; #[test] fn urltestdata() { - // Copied form https://github.com/w3c/web-platform-tests/blob/master/url/ + let idna_skip_inputs = [ + "http://www.foo。bar.com", + "http://Go.com", + "http://你好你好", + "https://faß.ExAmPlE/", + "http://0Xc0.0250.01", + "ftp://%e2%98%83", + "https://%e2%98%83", + "file://a\u{ad}b/p", + "file://a%C2%ADb/p", + "http://GOO\u{200b}\u{2060}\u{feff}goo.com", + ]; + + // Copied from https://github.com/web-platform-tests/wpt/blob/master/url/ let mut json = Value::from_str(include_str!("urltestdata.json")) .expect("JSON parse error in urltestdata.json"); @@ -26,25 +38,39 @@ fn urltestdata() { continue; // ignore comments } - let base = entry.take_string("base"); + let maybe_base = entry + .take_key("base") + .expect("missing base key") + .maybe_string(); let input = entry.take_string("input"); let failure = entry.take_key("failure").is_some(); - let base = match Url::parse(&base) { - Ok(base) => base, - Err(_) if failure => continue, - Err(message) => { - eprint_failure( - format!(" failed: error parsing base {:?}: {}", base, message), - &format!("parse base for {:?}", input), - None, - ); - passed = false; + { + if idna_skip_inputs.contains(&input.as_str()) { continue; } + } + + let res = if let Some(base) = maybe_base { + let base = match Url::parse(&base) { + Ok(base) => base, + Err(_) if failure => continue, + Err(message) => { + eprint_failure( + format!(" failed: error parsing base {:?}: {}", base, message), + &format!("parse base for {:?}", input), + None, + ); + passed = false; + continue; + } + }; + base.join(&input) + } else { + Url::parse(&input) }; - let url = match (base.join(&input), failure) { + let url = match (res, failure) { (Ok(url), false) => url, (Err(_), true) => continue, (Err(message), false) => { @@ -91,7 +117,6 @@ fn urltestdata() { assert!(passed) } -#[allow(clippy::option_as_ref_deref)] // introduced in 1.40, MSRV is 1.36 #[test] fn setters_tests() { let mut json = Value::from_str(include_str!("setters_tests.json")) @@ -106,15 +131,22 @@ fn setters_tests() { let mut tests = json.take_key(attr).unwrap(); for mut test in tests.as_array_mut().unwrap().drain(..) { let comment = test.take_key("comment").map(|s| s.string()); + { + if let Some(comment) = comment.as_ref() { + if comment.starts_with("IDNA Nontransitional_Processing") { + continue; + } + } + } let href = test.take_string("href"); let new_value = test.take_string("new_value"); let name = format!("{:?}.{} = {:?}", href, attr, new_value); let mut expected = test.take_key("expected").unwrap(); let mut url = Url::parse(&href).unwrap(); - let comment_ref = comment.as_ref().map(|s| s.deref()); + let comment_ref = comment.as_deref(); passed &= check_invariants(&url, &name, comment_ref); - let _ = set(&mut url, attr, &new_value); + set(&mut url, attr, &new_value); for attr in ATTRIBS { if let Some(value) = expected.take_key(attr) { @@ -153,6 +185,7 @@ fn check_invariants(url: &Url, name: &str, comment: Option<&str>) -> bool { trait JsonExt { fn take_key(&mut self, key: &str) -> Option<Value>; fn string(self) -> String; + fn maybe_string(self) -> Option<String>; fn take_string(&mut self, key: &str) -> String; } @@ -162,10 +195,14 @@ impl JsonExt for Value { } fn string(self) -> String { - if let Value::String(s) = self { - s - } else { - panic!("Not a Value::String") + self.maybe_string().expect("") + } + + fn maybe_string(self) -> Option<String> { + match self { + Value::String(s) => Some(s), + Value::Null => None, + _ => panic!("Not a Value::String or Value::Null"), } } diff --git a/vendor/url/tests/debugger_visualizer.rs b/vendor/url/tests/debugger_visualizer.rs new file mode 100644 index 000000000..4558e0701 --- /dev/null +++ b/vendor/url/tests/debugger_visualizer.rs @@ -0,0 +1,102 @@ +use debugger_test::debugger_test; +use url::Url; + +#[inline(never)] +fn __break() {} + +#[debugger_test( + debugger = "cdb", + commands = " + .nvlist + + dx base_url + + dx url_with_non_special_scheme + + dx url_with_user_pass_port_query_fragments + + dx url_blob + + dx url_with_base + + dx url_with_base_replaced + + dx url_with_comma", + expected_statements = r#" + pattern:debugger_visualizer-.*\.exe \(embedded NatVis ".*-[0-9]+\.natvis"\) + + base_url : "http://example.org/foo/bar" [Type: url::Url] + [<Raw View>] [Type: url::Url] + [scheme] : "http" + [host] : "example.org" + [path] : "/foo/bar" + + url_with_non_special_scheme : "non-special://test/x" [Type: url::Url] + [<Raw View>] [Type: url::Url] + [scheme] : "non-special" + [host] : "test" + [path] : "/x" + + url_with_user_pass_port_query_fragments : "http://user:pass@foo:21/bar;par?b#c" [Type: url::Url] + [<Raw View>] [Type: url::Url] + [scheme] : "http" + [username] : "user" + [host] : "foo" + [port] : 21 + [path] : "/bar;par" + [query] : "b" + [fragment] : "c" + + url_blob : "blob:https://example.com:443/" [Type: url::Url] + [<Raw View>] [Type: url::Url] + [scheme] : "blob" + [path] : "https://example.com:443/" + + url_with_base : "http://example.org/a%2fc" [Type: url::Url] + [<Raw View>] [Type: url::Url] + [scheme] : "http" + [host] : "example.org" + [path] : "/a%2fc" + + url_with_base_replaced : "http://[::7f00:1]/" [Type: url::Url] + [<Raw View>] [Type: url::Url] + [scheme] : "http" + [host] : "[::7f00:1]" + [path] : "/" + + url_with_comma : "data:text/html,test#test" [Type: url::Url] + [<Raw View>] [Type: url::Url] + [scheme] : "data" + [path] : "text/html,test" + [fragment] : "test" + "# +)] +fn test_url_visualizer() { + // Copied from https://github.com/web-platform-tests/wpt/blob/master/url/ + let base_url = Url::parse("http://example.org/foo/bar").unwrap(); + assert_eq!(base_url.as_str(), "http://example.org/foo/bar"); + + let url_with_non_special_scheme = Url::parse("non-special://:@test/x").unwrap(); + assert_eq!(url_with_non_special_scheme.as_str(), "non-special://test/x"); + + let url_with_user_pass_port_query_fragments = + Url::parse("http://user:pass@foo:21/bar;par?b#c").unwrap(); + assert_eq!( + url_with_user_pass_port_query_fragments.as_str(), + "http://user:pass@foo:21/bar;par?b#c" + ); + + let url_blob = Url::parse("blob:https://example.com:443/").unwrap(); + assert_eq!(url_blob.as_str(), "blob:https://example.com:443/"); + + let url_with_base = base_url.join("/a%2fc").unwrap(); + assert_eq!(url_with_base.as_str(), "http://example.org/a%2fc"); + + let url_with_base_replaced = base_url.join("http://[::127.0.0.1]").unwrap(); + assert_eq!(url_with_base_replaced.as_str(), "http://[::7f00:1]/"); + + let url_with_comma = base_url.join("data:text/html,test#test").unwrap(); + assert_eq!(url_with_comma.as_str(), "data:text/html,test#test"); + + __break(); +} diff --git a/vendor/url/tests/unit.rs b/vendor/url/tests/unit.rs index 13055a473..55ff59ada 100644 --- a/vendor/url/tests/unit.rs +++ b/vendor/url/tests/unit.rs @@ -43,6 +43,14 @@ fn test_set_empty_host() { assert_eq!(base.as_str(), "moz:/baz"); base.set_host(Some("servo")).unwrap(); assert_eq!(base.as_str(), "moz://servo/baz"); + + let mut base: Url = "file://server/share/foo/bar".parse().unwrap(); + base.set_host(None).unwrap(); + assert_eq!(base.as_str(), "file:///share/foo/bar"); + + let mut base: Url = "file://server/share/foo/bar".parse().unwrap(); + base.set_host(Some("foo")).unwrap(); + assert_eq!(base.as_str(), "file://foo/share/foo/bar"); } #[test] @@ -256,7 +264,6 @@ fn host() { 0x2001, 0x0db8, 0x85a3, 0x08d3, 0x1319, 0x8a2e, 0x0370, 0x7344, )), ); - assert_host("http://1.35.+33.49", Host::Domain("1.35.+33.49")); assert_host( "http://[::]", Host::Ipv6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0)), @@ -271,7 +278,8 @@ fn host() { ); assert_host("http://0x1232131", Host::Ipv4(Ipv4Addr::new(1, 35, 33, 49))); assert_host("http://111", Host::Ipv4(Ipv4Addr::new(0, 0, 0, 111))); - assert_host("http://2..2.3", Host::Domain("2..2.3")); + assert!(Url::parse("http://1.35.+33.49").is_err()); + assert!(Url::parse("http://2..2.3").is_err()); assert!(Url::parse("http://42.0x1232131").is_err()); assert!(Url::parse("http://192.168.0.257").is_err()); @@ -720,6 +728,34 @@ fn test_domain_encoding_quirks() { } } +#[cfg(feature = "expose_internals")] +#[test] +fn test_expose_internals() { + use url::quirks::internal_components; + use url::quirks::InternalComponents; + + let url = Url::parse("https://example.com/path/file.ext?key=val&key2=val2#fragment").unwrap(); + let InternalComponents { + scheme_end, + username_end, + host_start, + host_end, + port, + path_start, + query_start, + fragment_start, + } = internal_components(&url); + + assert_eq!(scheme_end, 5); + assert_eq!(username_end, 8); + assert_eq!(host_start, 8); + assert_eq!(host_end, 19); + assert_eq!(port, None); + assert_eq!(path_start, 19); + assert_eq!(query_start, Some(33)); + assert_eq!(fragment_start, Some(51)); +} + #[test] fn test_windows_unc_path() { if !cfg!(windows) { @@ -796,7 +832,7 @@ fn test_syntax_violation_callback_types() { ("file:/foo.txt", ExpectedFileDoubleSlash, "expected // after file:"), ("file://mozilla.org/c:/file.txt", FileWithHostAndWindowsDrive, "file: with host and Windows drive letter"), ("http://mozilla.org/^", NonUrlCodePoint, "non-URL code point"), - ("http://mozilla.org/#\00", NullInFragment, "NULL characters are ignored in URL fragment identifiers"), + ("http://mozilla.org/#\x000", NullInFragment, "NULL characters are ignored in URL fragment identifiers"), ("http://mozilla.org/%1", PercentDecode, "expected 2 hex digits after %"), ("http://mozilla.org\t/foo", TabOrNewlineIgnored, "tabs or newlines are ignored in URLs"), ("http://user@:pass@mozilla.org", UnencodedAtSign, "unencoded @ sign in username or password") @@ -1081,6 +1117,16 @@ fn test_make_relative() { "http://127.0.0.1:8080/test/video?baz=meh#456", "video?baz=meh#456", ), + ( + "http://127.0.0.1:8080/file.txt", + "http://127.0.0.1:8080/test/file.txt", + "test/file.txt", + ), + ( + "http://127.0.0.1:8080/not_equal.txt", + "http://127.0.0.1:8080/test/file.txt", + "test/file.txt", + ), ]; for (base, uri, relative) in &tests { @@ -1093,7 +1139,7 @@ fn test_make_relative() { base, uri, relative ); assert_eq!( - base_uri.join(&relative).unwrap().as_str(), + base_uri.join(relative).unwrap().as_str(), *uri, "base: {}, uri: {}, relative: {}", base, 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", @@ -541,6 +541,36 @@ "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", "href": "http://example.org/foo/::", @@ -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]/", @@ -4483,16 +4539,6 @@ "hash": "" }, { - "input": "sc://\u0000/", - "base": "about:blank", - "failure": true - }, - { - "input": "sc:// /", - "base": "about:blank", - "failure": true - }, - { "input": "sc://%/", "base": "about:blank", "href": "sc://%/", @@ -4527,21 +4573,6 @@ "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://ñ", "href": "sc://%C3%B1/x", @@ -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,6 +4668,250 @@ }, "Forbidden host code points", { + "input": "sc://a\u0000b/", + "base": "about:blank", + "failure": true + }, + { + "input": "sc://a b/", + "base": "about:blank", + "failure": true + }, + { + "input": "sc://a<b", + "base": "about:blank", + "failure": true + }, + { + "input": "sc://a>b", + "base": "about:blank", + "failure": true + }, + { + "input": "sc://a[b/", + "base": "about:blank", + "failure": true + }, + { + "input": "sc://a\\b/", + "base": "about:blank", + "failure": true + }, + { + "input": "sc://a]b/", + "base": "about:blank", + "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": "", + "pathname": "/", + "port":"", + "protocol": "foo:", + "search": "", + "username": "" + }, + { + "input": "foo://ho\u000Ast/", + "base": "about:blank", + "hash": "", + "host": "host", + "hostname": "host", + "href":"foo://host/", + "password": "", + "pathname": "/", + "port":"", + "protocol": "foo:", + "search": "", + "username": "" + }, + { + "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": "http://a\u0001b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u0002b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u0003b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u0004b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u0005b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u0006b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u0007b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u0008b/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u000Bb/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u000Cb/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://a\u000Eb/", + "base": "about:blank", + "failure": true + }, + { + "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://a<b", "base": "about:blank", "failure": true @@ -4647,51 +4922,330 @@ "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": "non-special://a<b", + "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": "non-special://a>b", + "input": "http://ho%5Dst/", "base": "about:blank", "failure": true }, { - "input": "non-special://a^b", + "input": "http://ho%7Cst/", "base": "about:blank", "failure": true }, - "Allowed host code points", { - "input": "http://\u001F!\"$&'()*+,-.;=_`{|}~/", + "input": "http://ho%7Fst/", "base": "about:blank", - "href": "http://\u001F!\"$&'()*+,-.;=_`{|}~/", - "origin": "http://\u001F!\"$&'()*+,-.;=_`{|}~", + "failure": true + }, + "Allowed host/domain code points", + { + "input": "http://!\"$&'()*+,-.;=_`{}~/", + "base": "about:blank", + "href": "http://!\"$&'()*+,-.;=_`{}~/", + "origin": "http://!\"$&'()*+,-.;=_`{}~", "protocol": "http:", "username": "", "password": "", - "host": "\u001F!\"$&'()*+,-.;=_`{|}~", - "hostname": "\u001F!\"$&'()*+,-.;=_`{|}~", + "host": "!\"$&'()*+,-.;=_`{}~", + "hostname": "!\"$&'()*+,-.;=_`{}~", "port": "", "pathname": "/", "search": "", "hash": "" }, { - "input": "sc://\u001F!\"$&'()*+,-.;=_`{|}~/", + "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://%1F!\"$&'()*+,-.;=_`{|}~/", + "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": "%1F!\"$&'()*+,-.;=_`{|}~", - "hostname": "%1F!\"$&'()*+,-.;=_`{|}~", + "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": "", @@ -4964,6 +5518,36 @@ }, "# 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/", @@ -4979,6 +5563,21 @@ "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://192.168.257.com", "base": "http://other.com/", "href": "http://192.168.257.com/", @@ -5039,6 +5638,21 @@ "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/", @@ -5119,21 +5733,6 @@ "failure": true }, { - "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:", - "username": "", - "password": "", - "host": "256.256.256.256.256", - "hostname": "256.256.256.256.256", - "port": "", - "pathname": "/", - "search": "", - "hash": "" - }, - { "input": "https://0x.0x.0", "base": "about:blank", "href": "https://0.0.0.0/", @@ -5188,6 +5787,56 @@ "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": "asdf://%43|/", + "base": "about:blank", + "failure": true + }, + { + "input": "asdf://%43%7C/", + "base": "about:blank", + "href": "asdf://%43%7C/", + "origin": "null", + "protocol": "asdf:", + "username": "", + "password": "", + "host": "%43%7C", + "hostname": "%43%7C", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, "# file URLs relative to other file URLs (via https://github.com/jsdom/whatwg-url/pull/60)", { "input": "pix/submit.gif", @@ -5247,6 +5896,20 @@ "hash": "" }, { + "input": "/", + "base": "file://h/a/b", + "href": "file://h/", + "protocol": "file:", + "username": "", + "password": "", + "host": "h", + "hostname": "h", + "port": "", + "pathname": "/", + "search": "", + "hash": "" + }, + { "input": "//d:", "base": "file:///C:/a/b", "href": "file:///d:", @@ -5388,90 +6051,6 @@ }, "# File URLs and many (back)slashes", { - "input": "file:\\\\//", - "base": "about:blank", - "href": "file:///", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/", - "search": "", - "hash": "" - }, - { - "input": "file:\\\\\\\\", - "base": "about:blank", - "href": "file:///", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/", - "search": "", - "hash": "" - }, - { - "input": "file:\\\\\\\\?fox", - "base": "about:blank", - "href": "file:///?fox", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/", - "search": "?fox", - "hash": "" - }, - { - "input": "file:\\\\\\\\#guppy", - "base": "about:blank", - "href": "file:///#guppy", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/", - "search": "", - "hash": "#guppy" - }, - { - "input": "file://spider///", - "base": "about:blank", - "href": "file://spider/", - "protocol": "file:", - "username": "", - "password": "", - "host": "spider", - "hostname": "spider", - "port": "", - "pathname": "/", - "search": "", - "hash": "" - }, - { - "input": "file:\\\\localhost//", - "base": "about:blank", - "href": "file:///", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/", - "search": "", - "hash": "" - }, - { "input": "file:///localhost//cat", "base": "about:blank", "href": "file:///localhost//cat", @@ -5486,48 +6065,6 @@ "hash": "" }, { - "input": "file://\\/localhost//cat", - "base": "about:blank", - "href": "file:///localhost//cat", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/localhost//cat", - "search": "", - "hash": "" - }, - { - "input": "file://localhost//a//../..//", - "base": "about:blank", - "href": "file:///", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/", - "search": "", - "hash": "" - }, - { - "input": "/////mouse", - "base": "file:///elephant", - "href": "file:///mouse", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/mouse", - "search": "", - "hash": "" - }, - { "input": "\\//pig", "base": "file://lion/", "href": "file:///pig", @@ -5542,48 +6079,6 @@ "hash": "" }, { - "input": "\\/localhost//pig", - "base": "file://lion/", - "href": "file:///pig", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/pig", - "search": "", - "hash": "" - }, - { - "input": "//localhost//pig", - "base": "file://lion/", - "href": "file:///pig", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/pig", - "search": "", - "hash": "" - }, - { - "input": "/..//localhost//pig", - "base": "file://lion/", - "href": "file://lion/localhost//pig", - "protocol": "file:", - "username": "", - "password": "", - "host": "lion", - "hostname": "lion", - "port": "", - "pathname": "/localhost//pig", - "search": "", - "hash": "" - }, - { "input": "file://", "base": "file://ape/", "href": "file:///", @@ -5628,90 +6123,6 @@ }, "# Windows drive letter handling with the 'file:' base URL", { - "input": "C|", - "base": "file://host/dir/file", - "href": "file:///C:", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/C:", - "search": "", - "hash": "" - }, - { - "input": "C|#", - "base": "file://host/dir/file", - "href": "file:///C:#", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/C:", - "search": "", - "hash": "" - }, - { - "input": "C|?", - "base": "file://host/dir/file", - "href": "file:///C:?", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/C:", - "search": "", - "hash": "" - }, - { - "input": "C|/", - "base": "file://host/dir/file", - "href": "file:///C:/", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/C:/", - "search": "", - "hash": "" - }, - { - "input": "C|\n/", - "base": "file://host/dir/file", - "href": "file:///C:/", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/C:/", - "search": "", - "hash": "" - }, - { - "input": "C|\\", - "base": "file://host/dir/file", - "href": "file:///C:/", - "protocol": "file:", - "username": "", - "password": "", - "host": "", - "hostname": "", - "port": "", - "pathname": "/C:/", - "search": "", - "hash": "" - }, - { "input": "C", "base": "file://host/dir/file", "href": "file://host/dir/C", @@ -5782,24 +6193,24 @@ "search": "", "hash": "" }, + "# Copy the empty host from the input in the following cases", { - "input": "/c:/foo/bar", - "base": "file://host/path", - "href": "file:///c:/foo/bar", + "input": "//C:/", + "base": "file://host/", + "href": "file:///C:/", "protocol": "file:", "username": "", "password": "", "host": "", "hostname": "", "port": "", - "pathname": "/c:/foo/bar", + "pathname": "/C:/", "search": "", "hash": "" }, - "# Windows drive letter quirk with not empty host", { - "input": "file://example.net/C:/", - "base": "about:blank", + "input": "file://C:/", + "base": "file://host/", "href": "file:///C:/", "protocol": "file:", "username": "", @@ -5812,8 +6223,8 @@ "hash": "" }, { - "input": "file://1.2.3.4/C:/", - "base": "about:blank", + "input": "///C:/", + "base": "file://host/", "href": "file:///C:/", "protocol": "file:", "username": "", @@ -5826,8 +6237,8 @@ "hash": "" }, { - "input": "file://[1::8]/C:/", - "base": "about:blank", + "input": "file:///C:/", + "base": "file://host/", "href": "file:///C:/", "protocol": "file:", "username": "", @@ -5971,7 +6382,8 @@ { "input": "\\\\\\.\\Y:", "base": "about:blank", - "failure": true + "failure": true, + "inputCanBeRelative": true }, "# file: drive letter cases from https://crbug.com/1078698 but lowercased", { @@ -6033,7 +6445,51 @@ { "input": "\\\\\\.\\y:", "base": "about:blank", - "failure": true + "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": "/one/two", + "search": "", + "hash": "" + }, + { + "input": "//one/two", + "base": "file:///", + "href": "file://one/two", + "protocol": "file:", + "username": "", + "password": "", + "host": "one", + "hostname": "one", + "port": "", + "pathname": "/two", + "search": "", + "hash": "" + }, + { + "input": "///one/two", + "base": "file:///", + "href": "file:///one/two", + "protocol": "file:", + "username": "", + "password": "", + "host": "", + "hostname": "", + "port": "", + "pathname": "/one/two", + "search": "", + "hash": "" }, "# IPv6 tests", { @@ -6527,6 +6983,7 @@ "input": "blob:https://example.com:443/", "base": "about:blank", "href": "blob:https://example.com:443/", + "origin": "https://example.com", "protocol": "blob:", "username": "", "password": "", @@ -6541,6 +6998,7 @@ "input": "blob:d3958f5c-0777-0845-9dcf-2cb28783acaf", "base": "about:blank", "href": "blob:d3958f5c-0777-0845-9dcf-2cb28783acaf", + "origin": "null", "protocol": "blob:", "username": "", "password": "", @@ -6551,21 +7009,22 @@ "search": "", "hash": "" }, - "Invalid IPv4 radix digits", { - "input": "http://0177.0.0.0189", + "input": "blob:", "base": "about:blank", - "href": "http://0177.0.0.0189/", - "protocol": "http:", + "href": "blob:", + "origin": "null", + "protocol": "blob:", "username": "", "password": "", - "host": "0177.0.0.0189", - "hostname": "0177.0.0.0189", + "host": "", + "hostname": "", "port": "", - "pathname": "/", + "pathname": "", "search": "", "hash": "" }, + "Invalid IPv4 radix digits", { "input": "http://0x7f.0.0.0x7g", "base": "about:blank", @@ -6760,17 +7219,20 @@ { "input": "a", "base": "about:blank", - "failure": true + "failure": true, + "inputCanBeRelative": true }, { "input": "a/", "base": "about:blank", - "failure": true + "failure": true, + "inputCanBeRelative": true }, { "input": "a//", "base": "about:blank", - "failure": true + "failure": true, + "inputCanBeRelative": true }, "Bases that don't fail to parse but fail to be bases", { @@ -6987,5 +7449,460 @@ "pathname": "/", "search": "", "hash": "#link" + }, + "UTF-8 percent-encode of C0 control percent-encode set and supersets", + { + "input": "non-special:cannot-be-a-base-url-\u0000\u0001\u001F\u001E\u007E\u007F\u0080", + "base": "about:blank", + "hash": "", + "host": "", + "hostname": "", + "href": "non-special:cannot-be-a-base-url-%00%01%1F%1E~%7F%C2%80", + "origin": "null", + "password": "", + "pathname": "cannot-be-a-base-url-%00%01%1F%1E~%7F%C2%80", + "port": "", + "protocol": "non-special:", + "search": "", + "username": "" + }, + { + "input": "https://www.example.com/path{\u007Fpath.html?query'\u007F=query#fragment<\u007Ffragment", + "base": "about:blank", + "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": "", + "pathname": "/path%7B%7Fpath.html", + "port": "", + "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": "", + "username": "user" + }, + "Tests for the distinct percent-encode sets", + { + "input": "foo:// !\"$%&'()*+,-.;<=>@[\\]^_`{|}~@host/", + "base": "about:blank", + "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": "", + "pathname": "/", + "port":"", + "protocol": "foo:", + "search": "", + "username": "%20!%22$%&'()*+,-.%3B%3C%3D%3E%40%5B%5C%5D%5E_%60%7B%7C%7D~" + }, + { + "input": "wss:// !\"$%&'()*+,-.;<=>@[]^_`{|}~@host/", + "base": "about:blank", + "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": "", + "pathname": "/", + "port":"", + "protocol": "wss:", + "search": "", + "username": "%20!%22$%&'()*+,-.%3B%3C%3D%3E%40%5B%5D%5E_%60%7B%7C%7D~" + }, + { + "input": "foo://joe: !\"$%&'()*+,-.:;<=>@[\\]^_`{|}~@host/", + "base": "about:blank", + "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": "wss://joe: !\"$%&'()*+,-.:;<=>@[]^_`{|}~@host/", + "base": "about:blank", + "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": "", + "username": "joe" + }, + { + "input": "foo://!\"$%&'()*+,-.;=_`{}~/", + "base": "about:blank", + "hash": "", + "host": "!\"$%&'()*+,-.;=_`{}~", + "hostname": "!\"$%&'()*+,-.;=_`{}~", + "href":"foo://!\"$%&'()*+,-.;=_`{}~/", + "origin": "null", + "password": "", + "pathname": "/", + "port":"", + "protocol": "foo:", + "search": "", + "username": "" + }, + { + "input": "wss://!\"$&'()*+,-.;=_`{}~/", + "base": "about:blank", + "hash": "", + "host": "!\"$&'()*+,-.;=_`{}~", + "hostname": "!\"$&'()*+,-.;=_`{}~", + "href":"wss://!\"$&'()*+,-.;=_`{}~/", + "origin": "wss://!\"$&'()*+,-.;=_`{}~", + "password": "", + "pathname": "/", + "port":"", + "protocol": "wss:", + "search": "", + "username": "" + }, + { + "input": "foo://host/ !\"$%&'()*+,-./:;<=>@[\\]^_`{|}~", + "base": "about:blank", + "hash": "", + "host": "host", + "hostname": "host", + "href": "foo://host/%20!%22$%&'()*+,-./:;%3C=%3E@[\\]^_%60%7B|%7D~", + "origin": "null", + "password": "", + "pathname": "/%20!%22$%&'()*+,-./:;%3C=%3E@[\\]^_%60%7B|%7D~", + "port":"", + "protocol": "foo:", + "search": "", + "username": "" + }, + { + "input": "wss://host/ !\"$%&'()*+,-./:;<=>@[\\]^_`{|}~", + "base": "about:blank", + "hash": "", + "host": "host", + "hostname": "host", + "href": "wss://host/%20!%22$%&'()*+,-./:;%3C=%3E@[/]^_%60%7B|%7D~", + "origin": "wss://host", + "password": "", + "pathname": "/%20!%22$%&'()*+,-./:;%3C=%3E@[/]^_%60%7B|%7D~", + "port":"", + "protocol": "wss:", + "search": "", + "username": "" + }, + { + "input": "foo://host/dir/? !\"$%&'()*+,-./:;<=>?@[\\]^_`{|}~", + "base": "about:blank", + "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": "" + }, + { + "input": "wss://host/dir/? !\"$%&'()*+,-./:;<=>?@[\\]^_`{|}~", + "base": "about:blank", + "hash": "", + "host": "host", + "hostname": "host", + "href": "wss://host/dir/?%20!%22$%&%27()*+,-./:;%3C=%3E?@[\\]^_`{|}~", + "origin": "wss://host", + "password": "", + "pathname": "/dir/", + "port":"", + "protocol": "wss:", + "search": "?%20!%22$%&%27()*+,-./:;%3C=%3E?@[\\]^_`{|}~", + "username": "" + }, + { + "input": "foo://host/dir/# !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", + "base": "about:blank", + "hash": "#%20!%22#$%&'()*+,-./:;%3C=%3E?@[\\]^_%60{|}~", + "host": "host", + "hostname": "host", + "href": "foo://host/dir/#%20!%22#$%&'()*+,-./:;%3C=%3E?@[\\]^_%60{|}~", + "origin": "null", + "password": "", + "pathname": "/dir/", + "port":"", + "protocol": "foo:", + "search": "", + "username": "" + }, + { + "input": "wss://host/dir/# !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", + "base": "about:blank", + "hash": "#%20!%22#$%&'()*+,-./:;%3C=%3E?@[\\]^_%60{|}~", + "host": "host", + "hostname": "host", + "href": "wss://host/dir/#%20!%22#$%&'()*+,-./:;%3C=%3E?@[\\]^_%60{|}~", + "origin": "wss://host", + "password": "", + "pathname": "/dir/", + "port":"", + "protocol": "wss:", + "search": "", + "username": "" + }, + "Ensure that input schemes are not ignored when resolving non-special URLs", + { + "input": "abc:rootless", + "base": "abc://host/path", + "hash": "", + "host": "", + "hostname": "", + "href":"abc:rootless", + "password": "", + "pathname": "rootless", + "port":"", + "protocol": "abc:", + "search": "", + "username": "" + }, + { + "input": "abc:rootless", + "base": "abc:/path", + "hash": "", + "host": "", + "hostname": "", + "href":"abc:rootless", + "password": "", + "pathname": "rootless", + "port":"", + "protocol": "abc:", + "search": "", + "username": "" + }, + { + "input": "abc:rootless", + "base": "abc:path", + "hash": "", + "host": "", + "hostname": "", + "href":"abc:rootless", + "password": "", + "pathname": "rootless", + "port":"", + "protocol": "abc:", + "search": "", + "username": "" + }, + { + "input": "abc:/rooted", + "base": "abc://host/path", + "hash": "", + "host": "", + "hostname": "", + "href":"abc:/rooted", + "password": "", + "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://0..0x300/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://0..0x300./", + "base": "about:blank", + "failure": true + }, + { + "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", + "failure": true + }, + { + "input": "http://1.2.3.08.", + "base": "about:blank", + "failure": true + }, + { + "input": "http://1.2.3.09", + "base": "about:blank", + "failure": true + }, + { + "input": "http://09.2.3.4", + "base": "about:blank", + "failure": true + }, + { + "input": "http://09.2.3.4.", + "base": "about:blank", + "failure": true + }, + { + "input": "http://01.2.3.4.5", + "base": "about:blank", + "failure": true + }, + { + "input": "http://01.2.3.4.5.", + "base": "about:blank", + "failure": true + }, + { + "input": "http://0x100.2.3.4", + "base": "about:blank", + "failure": true + }, + { + "input": "http://0x100.2.3.4.", + "base": "about:blank", + "failure": true + }, + { + "input": "http://0x1.2.3.4.5", + "base": "about:blank", + "failure": true + }, + { + "input": "http://0x1.2.3.4.5.", + "base": "about:blank", + "failure": true + }, + { + "input": "http://foo.1.2.3.4", + "base": "about:blank", + "failure": true + }, + { + "input": "http://foo.1.2.3.4.", + "base": "about:blank", + "failure": true + }, + { + "input": "http://foo.2.3.4", + "base": "about:blank", + "failure": true + }, + { + "input": "http://foo.2.3.4.", + "base": "about:blank", + "failure": true + }, + { + "input": "http://foo.09", + "base": "about:blank", + "failure": true + }, + { + "input": "http://foo.09.", + "base": "about:blank", + "failure": true + }, + { + "input": "http://foo.0x4", + "base": "about:blank", + "failure": true + }, + { + "input": "http://foo.0x4.", + "base": "about:blank", + "failure": true + }, + { + "input": "http://foo.09..", + "base": "about:blank", + "hash": "", + "host": "foo.09..", + "hostname": "foo.09..", + "href":"http://foo.09../", + "password": "", + "pathname": "/", + "port":"", + "protocol": "http:", + "search": "", + "username": "" + }, + { + "input": "http://0999999999999999999/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://foo.0x", + "base": "about:blank", + "failure": true + }, + { + "input": "http://foo.0XFfFfFfFfFfFfFfFfFfAcE123", + "base": "about:blank", + "failure": true + }, + { + "input": "http://💩.123/", + "base": "about:blank", + "failure": true } ] |