|
@@ -27,7 +27,7 @@
|
|
|
"href": "a://example.net",
|
|
"href": "a://example.net",
|
|
|
"new_value": "",
|
|
"new_value": "",
|
|
|
"expected": {
|
|
"expected": {
|
|
|
- "href": "a://example.net/",
|
|
|
|
|
|
|
+ "href": "a://example.net",
|
|
|
"protocol": "a:"
|
|
"protocol": "a:"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -35,16 +35,24 @@
|
|
|
"href": "a://example.net",
|
|
"href": "a://example.net",
|
|
|
"new_value": "b",
|
|
"new_value": "b",
|
|
|
"expected": {
|
|
"expected": {
|
|
|
- "href": "b://example.net/",
|
|
|
|
|
|
|
+ "href": "b://example.net",
|
|
|
"protocol": "b:"
|
|
"protocol": "b:"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "javascript:alert(1)",
|
|
|
|
|
+ "new_value": "defuse",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "defuse:alert(1)",
|
|
|
|
|
+ "protocol": "defuse:"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
"comment": "Upper-case ASCII is lower-cased",
|
|
"comment": "Upper-case ASCII is lower-cased",
|
|
|
"href": "a://example.net",
|
|
"href": "a://example.net",
|
|
|
"new_value": "B",
|
|
"new_value": "B",
|
|
|
"expected": {
|
|
"expected": {
|
|
|
- "href": "b://example.net/",
|
|
|
|
|
|
|
+ "href": "b://example.net",
|
|
|
"protocol": "b:"
|
|
"protocol": "b:"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -53,7 +61,7 @@
|
|
|
"href": "a://example.net",
|
|
"href": "a://example.net",
|
|
|
"new_value": "é",
|
|
"new_value": "é",
|
|
|
"expected": {
|
|
"expected": {
|
|
|
- "href": "a://example.net/",
|
|
|
|
|
|
|
+ "href": "a://example.net",
|
|
|
"protocol": "a:"
|
|
"protocol": "a:"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -62,7 +70,7 @@
|
|
|
"href": "a://example.net",
|
|
"href": "a://example.net",
|
|
|
"new_value": "0b",
|
|
"new_value": "0b",
|
|
|
"expected": {
|
|
"expected": {
|
|
|
- "href": "a://example.net/",
|
|
|
|
|
|
|
+ "href": "a://example.net",
|
|
|
"protocol": "a:"
|
|
"protocol": "a:"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -71,7 +79,7 @@
|
|
|
"href": "a://example.net",
|
|
"href": "a://example.net",
|
|
|
"new_value": "+b",
|
|
"new_value": "+b",
|
|
|
"expected": {
|
|
"expected": {
|
|
|
- "href": "a://example.net/",
|
|
|
|
|
|
|
+ "href": "a://example.net",
|
|
|
"protocol": "a:"
|
|
"protocol": "a:"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -79,7 +87,7 @@
|
|
|
"href": "a://example.net",
|
|
"href": "a://example.net",
|
|
|
"new_value": "bC0+-.",
|
|
"new_value": "bC0+-.",
|
|
|
"expected": {
|
|
"expected": {
|
|
|
- "href": "bc0+-.://example.net/",
|
|
|
|
|
|
|
+ "href": "bc0+-.://example.net",
|
|
|
"protocol": "bc0+-.:"
|
|
"protocol": "bc0+-.:"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -88,7 +96,7 @@
|
|
|
"href": "a://example.net",
|
|
"href": "a://example.net",
|
|
|
"new_value": "b,c",
|
|
"new_value": "b,c",
|
|
|
"expected": {
|
|
"expected": {
|
|
|
- "href": "a://example.net/",
|
|
|
|
|
|
|
+ "href": "a://example.net",
|
|
|
"protocol": "a:"
|
|
"protocol": "a:"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -97,10 +105,35 @@
|
|
|
"href": "a://example.net",
|
|
"href": "a://example.net",
|
|
|
"new_value": "bé",
|
|
"new_value": "bé",
|
|
|
"expected": {
|
|
"expected": {
|
|
|
- "href": "a://example.net/",
|
|
|
|
|
|
|
+ "href": "a://example.net",
|
|
|
"protocol": "a:"
|
|
"protocol": "a:"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ "comment": "Can’t switch from URL containing username/password/port to file",
|
|
|
|
|
+ "href": "http://test@example.net",
|
|
|
|
|
+ "new_value": "file",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "http://test@example.net/",
|
|
|
|
|
+ "protocol": "http:"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "gopher://example.net:1234",
|
|
|
|
|
+ "new_value": "file",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "gopher://example.net:1234/",
|
|
|
|
|
+ "protocol": "gopher:"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "wss://x:x@example.net:1234",
|
|
|
|
|
+ "new_value": "file",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "wss://x:x@example.net:1234/",
|
|
|
|
|
+ "protocol": "wss:"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
"comment": "Can’t switch from file URL with no host",
|
|
"comment": "Can’t switch from file URL with no host",
|
|
|
"href": "file://localhost/",
|
|
"href": "file://localhost/",
|
|
@@ -127,12 +160,36 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "comment": "Spec deviation: from special scheme to not is not problematic. https://github.com/whatwg/url/issues/104",
|
|
|
|
|
|
|
+ "comment": "Can’t switch from special scheme to non-special",
|
|
|
"href": "http://example.net",
|
|
"href": "http://example.net",
|
|
|
"new_value": "b",
|
|
"new_value": "b",
|
|
|
"expected": {
|
|
"expected": {
|
|
|
- "href": "b://example.net/",
|
|
|
|
|
- "protocol": "b:"
|
|
|
|
|
|
|
+ "href": "http://example.net/",
|
|
|
|
|
+ "protocol": "http:"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "file://hi/path",
|
|
|
|
|
+ "new_value": "s",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "file://hi/path",
|
|
|
|
|
+ "protocol": "file:"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "https://example.net",
|
|
|
|
|
+ "new_value": "s",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "https://example.net/",
|
|
|
|
|
+ "protocol": "https:"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "ftp://example.net",
|
|
|
|
|
+ "new_value": "test",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "ftp://example.net/",
|
|
|
|
|
+ "protocol": "ftp:"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -145,12 +202,44 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "comment": "Spec deviation: from non-special scheme with a host to special is not problematic. https://github.com/whatwg/url/issues/104",
|
|
|
|
|
|
|
+ "comment": "Can’t switch from non-special scheme to special",
|
|
|
"href": "ssh://me@example.net",
|
|
"href": "ssh://me@example.net",
|
|
|
"new_value": "http",
|
|
"new_value": "http",
|
|
|
"expected": {
|
|
"expected": {
|
|
|
- "href": "http://me@example.net/",
|
|
|
|
|
- "protocol": "http:"
|
|
|
|
|
|
|
+ "href": "ssh://me@example.net",
|
|
|
|
|
+ "protocol": "ssh:"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "ssh://me@example.net",
|
|
|
|
|
+ "new_value": "gopher",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "ssh://me@example.net",
|
|
|
|
|
+ "protocol": "ssh:"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "ssh://me@example.net",
|
|
|
|
|
+ "new_value": "file",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "ssh://me@example.net",
|
|
|
|
|
+ "protocol": "ssh:"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "ssh://example.net",
|
|
|
|
|
+ "new_value": "file",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "ssh://example.net",
|
|
|
|
|
+ "protocol": "ssh:"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "nonsense:///test",
|
|
|
|
|
+ "new_value": "https",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "nonsense:///test",
|
|
|
|
|
+ "protocol": "nonsense:"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -170,6 +259,16 @@
|
|
|
"href": "view-source+data:text/html,<p>Test",
|
|
"href": "view-source+data:text/html,<p>Test",
|
|
|
"protocol": "view-source+data:"
|
|
"protocol": "view-source+data:"
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "comment": "Port is set to null if it is the default for new scheme.",
|
|
|
|
|
+ "href": "http://foo.com:443/",
|
|
|
|
|
+ "new_value": "https",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "https://foo.com/",
|
|
|
|
|
+ "protocol": "https:",
|
|
|
|
|
+ "port": ""
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
],
|
|
],
|
|
|
"username": [
|
|
"username": [
|
|
@@ -266,14 +365,6 @@
|
|
|
"username": ""
|
|
"username": ""
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- {
|
|
|
|
|
- "href": "file://test/",
|
|
|
|
|
- "new_value": "test",
|
|
|
|
|
- "expected": {
|
|
|
|
|
- "href": "file://test/",
|
|
|
|
|
- "username": ""
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
{
|
|
{
|
|
|
"href": "javascript://x/",
|
|
"href": "javascript://x/",
|
|
|
"new_value": "wario",
|
|
"new_value": "wario",
|
|
@@ -281,6 +372,14 @@
|
|
|
"href": "javascript://wario@x/",
|
|
"href": "javascript://wario@x/",
|
|
|
"username": "wario"
|
|
"username": "wario"
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "file://test/",
|
|
|
|
|
+ "new_value": "test",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "file://test/",
|
|
|
|
|
+ "username": ""
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
],
|
|
],
|
|
|
"password": [
|
|
"password": [
|
|
@@ -369,14 +468,6 @@
|
|
|
"password": ""
|
|
"password": ""
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- {
|
|
|
|
|
- "href": "file://test/",
|
|
|
|
|
- "new_value": "test",
|
|
|
|
|
- "expected": {
|
|
|
|
|
- "href": "file://test/",
|
|
|
|
|
- "password": ""
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
{
|
|
{
|
|
|
"href": "javascript://x/",
|
|
"href": "javascript://x/",
|
|
|
"new_value": "bowser",
|
|
"new_value": "bowser",
|
|
@@ -384,9 +475,27 @@
|
|
|
"href": "javascript://:bowser@x/",
|
|
"href": "javascript://:bowser@x/",
|
|
|
"password": "bowser"
|
|
"password": "bowser"
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "file://test/",
|
|
|
|
|
+ "new_value": "test",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "file://test/",
|
|
|
|
|
+ "password": ""
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
],
|
|
],
|
|
|
"host": [
|
|
"host": [
|
|
|
|
|
+ {
|
|
|
|
|
+ "comment": "Non-special scheme",
|
|
|
|
|
+ "href": "sc://x/",
|
|
|
|
|
+ "new_value": "\u0000",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "sc://x/",
|
|
|
|
|
+ "host": "x",
|
|
|
|
|
+ "hostname": "x"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
"href": "sc://x/",
|
|
"href": "sc://x/",
|
|
|
"new_value": "\u0009",
|
|
"new_value": "\u0009",
|
|
@@ -414,6 +523,15 @@
|
|
|
"hostname": ""
|
|
"hostname": ""
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "sc://x/",
|
|
|
|
|
+ "new_value": " ",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "sc://x/",
|
|
|
|
|
+ "host": "x",
|
|
|
|
|
+ "hostname": "x"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
"href": "sc://x/",
|
|
"href": "sc://x/",
|
|
|
"new_value": "#",
|
|
"new_value": "#",
|
|
@@ -459,6 +577,16 @@
|
|
|
"hostname": "%C3%9F"
|
|
"hostname": "%C3%9F"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ "comment": "IDNA Nontransitional_Processing",
|
|
|
|
|
+ "href": "https://x/",
|
|
|
|
|
+ "new_value": "ß",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "https://xn--zca/",
|
|
|
|
|
+ "host": "xn--zca",
|
|
|
|
|
+ "hostname": "xn--zca"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
"comment": "Cannot-be-a-base means no host",
|
|
"comment": "Cannot-be-a-base means no host",
|
|
|
"href": "mailto:me@example.net",
|
|
"href": "mailto:me@example.net",
|
|
@@ -499,14 +627,14 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "comment": "Port number is removed if empty in the new value: https://github.com/whatwg/url/pull/113",
|
|
|
|
|
|
|
+ "comment": "Port number is unchanged if not specified",
|
|
|
"href": "http://example.net:8080",
|
|
"href": "http://example.net:8080",
|
|
|
"new_value": "example.com:",
|
|
"new_value": "example.com:",
|
|
|
"expected": {
|
|
"expected": {
|
|
|
- "href": "http://example.com/",
|
|
|
|
|
- "host": "example.com",
|
|
|
|
|
|
|
+ "href": "http://example.com:8080/",
|
|
|
|
|
+ "host": "example.com:8080",
|
|
|
"hostname": "example.com",
|
|
"hostname": "example.com",
|
|
|
- "port": ""
|
|
|
|
|
|
|
+ "port": "8080"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -591,6 +719,17 @@
|
|
|
"port": "80"
|
|
"port": "80"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ "comment": "Port number is removed if new port is scheme default and existing URL has a non-default port",
|
|
|
|
|
+ "href": "http://example.net:8080",
|
|
|
|
|
+ "new_value": "example.com:80",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "http://example.com/",
|
|
|
|
|
+ "host": "example.com",
|
|
|
|
|
+ "hostname": "example.com",
|
|
|
|
|
+ "port": ""
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
"comment": "Stuff after a / delimiter is ignored",
|
|
"comment": "Stuff after a / delimiter is ignored",
|
|
|
"href": "http://example.net/path",
|
|
"href": "http://example.net/path",
|
|
@@ -790,9 +929,69 @@
|
|
|
"host": "example.net",
|
|
"host": "example.net",
|
|
|
"hostname": "example.net"
|
|
"hostname": "example.net"
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "file://y/",
|
|
|
|
|
+ "new_value": "x:123",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "file://y/",
|
|
|
|
|
+ "host": "y",
|
|
|
|
|
+ "hostname": "y",
|
|
|
|
|
+ "port": ""
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "file://y/",
|
|
|
|
|
+ "new_value": "loc%41lhost",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "file:///",
|
|
|
|
|
+ "host": "",
|
|
|
|
|
+ "hostname": "",
|
|
|
|
|
+ "port": ""
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "file://hi/x",
|
|
|
|
|
+ "new_value": "",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "file:///x",
|
|
|
|
|
+ "host": "",
|
|
|
|
|
+ "hostname": "",
|
|
|
|
|
+ "port": ""
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "sc://test@test/",
|
|
|
|
|
+ "new_value": "",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "sc://test@test/",
|
|
|
|
|
+ "host": "test",
|
|
|
|
|
+ "hostname": "test",
|
|
|
|
|
+ "username": "test"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "sc://test:12/",
|
|
|
|
|
+ "new_value": "",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "sc://test:12/",
|
|
|
|
|
+ "host": "test:12",
|
|
|
|
|
+ "hostname": "test",
|
|
|
|
|
+ "port": "12"
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
],
|
|
],
|
|
|
"hostname": [
|
|
"hostname": [
|
|
|
|
|
+ {
|
|
|
|
|
+ "comment": "Non-special scheme",
|
|
|
|
|
+ "href": "sc://x/",
|
|
|
|
|
+ "new_value": "\u0000",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "sc://x/",
|
|
|
|
|
+ "host": "x",
|
|
|
|
|
+ "hostname": "x"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
"href": "sc://x/",
|
|
"href": "sc://x/",
|
|
|
"new_value": "\u0009",
|
|
"new_value": "\u0009",
|
|
@@ -820,6 +1019,15 @@
|
|
|
"hostname": ""
|
|
"hostname": ""
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "sc://x/",
|
|
|
|
|
+ "new_value": " ",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "sc://x/",
|
|
|
|
|
+ "host": "x",
|
|
|
|
|
+ "hostname": "x"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
"href": "sc://x/",
|
|
"href": "sc://x/",
|
|
|
"new_value": "#",
|
|
"new_value": "#",
|
|
@@ -1055,6 +1263,56 @@
|
|
|
"host": "example.net",
|
|
"host": "example.net",
|
|
|
"hostname": "example.net"
|
|
"hostname": "example.net"
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "file://y/",
|
|
|
|
|
+ "new_value": "x:123",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "file://y/",
|
|
|
|
|
+ "host": "y",
|
|
|
|
|
+ "hostname": "y",
|
|
|
|
|
+ "port": ""
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "file://y/",
|
|
|
|
|
+ "new_value": "loc%41lhost",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "file:///",
|
|
|
|
|
+ "host": "",
|
|
|
|
|
+ "hostname": "",
|
|
|
|
|
+ "port": ""
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "file://hi/x",
|
|
|
|
|
+ "new_value": "",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "file:///x",
|
|
|
|
|
+ "host": "",
|
|
|
|
|
+ "hostname": "",
|
|
|
|
|
+ "port": ""
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "sc://test@test/",
|
|
|
|
|
+ "new_value": "",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "sc://test@test/",
|
|
|
|
|
+ "host": "test",
|
|
|
|
|
+ "hostname": "test",
|
|
|
|
|
+ "username": "test"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "sc://test:12/",
|
|
|
|
|
+ "new_value": "",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "sc://test:12/",
|
|
|
|
|
+ "host": "test:12",
|
|
|
|
|
+ "hostname": "test",
|
|
|
|
|
+ "port": "12"
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
],
|
|
],
|
|
|
"port": [
|
|
"port": [
|
|
@@ -1324,12 +1582,12 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "comment": "UTF-8 percent encoding with the default encode set. Tabs and newlines are removed. Leading or training C0 controls and space are removed.",
|
|
|
|
|
|
|
+ "comment": "UTF-8 percent encoding with the default encode set. Tabs and newlines are removed.",
|
|
|
"href": "a:/",
|
|
"href": "a:/",
|
|
|
- "new_value": "\u0000\u0001\t\n\r\u001f !\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
|
|
|
|
|
|
|
+ "new_value": "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
|
|
|
"expected": {
|
|
"expected": {
|
|
|
- "href": "a:/!%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E%3F@AZ[\\]^_%60az%7B|%7D~%7F%C2%80%C2%81%C3%89%C3%A9",
|
|
|
|
|
- "pathname": "/!%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E%3F@AZ[\\]^_%60az%7B|%7D~%7F%C2%80%C2%81%C3%89%C3%A9"
|
|
|
|
|
|
|
+ "href": "a:/%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E%3F@AZ[\\]^_%60az%7B|%7D~%7F%C2%80%C2%81%C3%89%C3%A9",
|
|
|
|
|
+ "pathname": "/%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E%3F@AZ[\\]^_%60az%7B|%7D~%7F%C2%80%C2%81%C3%89%C3%A9"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -1376,6 +1634,33 @@
|
|
|
"href": "sc://example.net/%23",
|
|
"href": "sc://example.net/%23",
|
|
|
"pathname": "/%23"
|
|
"pathname": "/%23"
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "comment": "File URLs and (back)slashes",
|
|
|
|
|
+ "href": "file://monkey/",
|
|
|
|
|
+ "new_value": "\\\\",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "file://monkey/",
|
|
|
|
|
+ "pathname": "/"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "comment": "File URLs and (back)slashes",
|
|
|
|
|
+ "href": "file:///unicorn",
|
|
|
|
|
+ "new_value": "//\\/",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "file:///",
|
|
|
|
|
+ "pathname": "/"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "comment": "File URLs and (back)slashes",
|
|
|
|
|
+ "href": "file:///unicorn",
|
|
|
|
|
+ "new_value": "//monkey/..//",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "file:///",
|
|
|
|
|
+ "pathname": "/"
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
],
|
|
],
|
|
|
"search": [
|
|
"search": [
|
|
@@ -1444,12 +1729,12 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- "comment": "UTF-8 percent encoding with the query encode set. Tabs and newlines are removed. Leading or training C0 controls and space are removed.",
|
|
|
|
|
|
|
+ "comment": "UTF-8 percent encoding with the query encode set. Tabs and newlines are removed.",
|
|
|
"href": "a:/",
|
|
"href": "a:/",
|
|
|
- "new_value": "\u0000\u0001\t\n\r\u001f !\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
|
|
|
|
|
|
|
+ "new_value": "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
|
|
|
"expected": {
|
|
"expected": {
|
|
|
- "href": "a:/?!%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_`az{|}~%7F%C2%80%C2%81%C3%89%C3%A9",
|
|
|
|
|
- "search": "?!%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_`az{|}~%7F%C2%80%C2%81%C3%89%C3%A9"
|
|
|
|
|
|
|
+ "href": "a:/?%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_`az{|}~%7F%C2%80%C2%81%C3%89%C3%A9",
|
|
|
|
|
+ "search": "?%00%01%1F%20!%22%23$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_`az{|}~%7F%C2%80%C2%81%C3%89%C3%A9"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -1511,13 +1796,53 @@
|
|
|
"hash": ""
|
|
"hash": ""
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "http://example.net",
|
|
|
|
|
+ "new_value": "#foo bar",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "http://example.net/#foo%20bar",
|
|
|
|
|
+ "hash": "#foo%20bar"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "http://example.net",
|
|
|
|
|
+ "new_value": "#foo\"bar",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "http://example.net/#foo%22bar",
|
|
|
|
|
+ "hash": "#foo%22bar"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "http://example.net",
|
|
|
|
|
+ "new_value": "#foo<bar",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "http://example.net/#foo%3Cbar",
|
|
|
|
|
+ "hash": "#foo%3Cbar"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "http://example.net",
|
|
|
|
|
+ "new_value": "#foo>bar",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "http://example.net/#foo%3Ebar",
|
|
|
|
|
+ "hash": "#foo%3Ebar"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "http://example.net",
|
|
|
|
|
+ "new_value": "#foo`bar",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "http://example.net/#foo%60bar",
|
|
|
|
|
+ "hash": "#foo%60bar"
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
"comment": "Simple percent-encoding; nuls, tabs, and newlines are removed",
|
|
"comment": "Simple percent-encoding; nuls, tabs, and newlines are removed",
|
|
|
"href": "a:/",
|
|
"href": "a:/",
|
|
|
- "new_value": "\u0000\u0001\t\n\r\u001f !\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
|
|
|
|
|
|
|
+ "new_value": "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
|
|
|
"expected": {
|
|
"expected": {
|
|
|
- "href": "a:/#!%01%1F !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~%7F%C2%80%C2%81%C3%89%C3%A9",
|
|
|
|
|
- "hash": "#!%01%1F !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~%7F%C2%80%C2%81%C3%89%C3%A9"
|
|
|
|
|
|
|
+ "href": "a:/#%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9",
|
|
|
|
|
+ "hash": "#%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9"
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -1528,6 +1853,14 @@
|
|
|
"href": "http://example.net/#%c3%89t%C3%A9",
|
|
"href": "http://example.net/#%c3%89t%C3%A9",
|
|
|
"hash": "#%c3%89t%C3%A9"
|
|
"hash": "#%c3%89t%C3%A9"
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ "href": "javascript:alert(1)",
|
|
|
|
|
+ "new_value": "castle",
|
|
|
|
|
+ "expected": {
|
|
|
|
|
+ "href": "javascript:alert(1)#castle",
|
|
|
|
|
+ "hash": "#castle"
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
]
|
|
]
|
|
|
}
|
|
}
|