Skip to content

Commit

Permalink
Merge e9980e7 into 740d73c
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk authored Jan 20, 2017
2 parents 740d73c + e9980e7 commit 045b749
Show file tree
Hide file tree
Showing 2 changed files with 247 additions and 12 deletions.
180 changes: 172 additions & 8 deletions url/setters_tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,88 @@
}
],
"host": [
{
"comment": "Non-special scheme",
"href": "sc://x/",
"new_value": "\u0000",
"expected": {
"href": "sc://x/",
"host": "x",
"hostname": "x"
}
},
{
"href": "sc://x/",
"new_value": "\u0009",
"expected": {
"href": "sc:///",
"host": "",
"hostname": ""
}
},
{
"href": "sc://x/",
"new_value": "\u000A",
"expected": {
"href": "sc:///",
"host": "",
"hostname": ""
}
},
{
"href": "sc://x/",
"new_value": "\u000D",
"expected": {
"href": "sc:///",
"host": "",
"hostname": ""
}
},
{
"href": "sc://x/",
"new_value": " ",
"expected": {
"href": "sc://x/",
"host": "x",
"hostname": "x"
}
},
{
"href": "sc://x/",
"new_value": "#",
"expected": {
"href": "sc:///",
"host": "",
"hostname": ""
}
},
{
"href": "sc://x/",
"new_value": "/",
"expected": {
"href": "sc:///",
"host": "",
"hostname": ""
}
},
{
"href": "sc://x/",
"new_value": "?",
"expected": {
"href": "sc:///",
"host": "",
"hostname": ""
}
},
{
"href": "sc://x/",
"new_value": "@",
"expected": {
"href": "sc://x/",
"host": "x",
"hostname": "x"
}
},
{
"comment": "Cannot-be-a-base means no host",
"href": "mailto:me@example.net",
Expand Down Expand Up @@ -567,13 +649,13 @@
}
},
{
"comment": "\\ is not a delimiter for non-special schemes, and it’s invalid in a domain",
"comment": "\\ is not a delimiter for non-special schemes",
"href": "view-source+http://example.net/path",
"new_value": "example.com\\stuff",
"expected": {
"href": "view-source+http://example.net/path",
"host": "example.net",
"hostname": "example.net",
"href": "view-source+http://example.com\\stuff/path",
"host": "example.com\\stuff",
"hostname": "example.com\\stuff",
"port": ""
}
},
Expand Down Expand Up @@ -680,6 +762,88 @@
}
],
"hostname": [
{
"comment": "Non-special scheme",
"href": "sc://x/",
"new_value": "\u0000",
"expected": {
"href": "sc://x/",
"host": "x",
"hostname": "x"
}
},
{
"href": "sc://x/",
"new_value": "\u0009",
"expected": {
"href": "sc:///",
"host": "",
"hostname": ""
}
},
{
"href": "sc://x/",
"new_value": "\u000A",
"expected": {
"href": "sc:///",
"host": "",
"hostname": ""
}
},
{
"href": "sc://x/",
"new_value": "\u000D",
"expected": {
"href": "sc:///",
"host": "",
"hostname": ""
}
},
{
"href": "sc://x/",
"new_value": " ",
"expected": {
"href": "sc://x/",
"host": "x",
"hostname": "x"
}
},
{
"href": "sc://x/",
"new_value": "#",
"expected": {
"href": "sc:///",
"host": "",
"hostname": ""
}
},
{
"href": "sc://x/",
"new_value": "/",
"expected": {
"href": "sc:///",
"host": "",
"hostname": ""
}
},
{
"href": "sc://x/",
"new_value": "?",
"expected": {
"href": "sc:///",
"host": "",
"hostname": ""
}
},
{
"href": "sc://x/",
"new_value": "@",
"expected": {
"href": "sc://x/",
"host": "x",
"hostname": "x"
}
},
{
"comment": "Cannot-be-a-base means no host",
"href": "mailto:me@example.net",
Expand Down Expand Up @@ -824,13 +988,13 @@
}
},
{
"comment": "\\ is not a delimiter for non-special schemes, and it’s invalid in a domain",
"comment": "\\ is not a delimiter for non-special schemes",
"href": "view-source+http://example.net/path",
"new_value": "example.com\\stuff",
"expected": {
"href": "view-source+http://example.net/path",
"host": "example.net",
"hostname": "example.net",
"href": "view-source+http://example.com\\stuff/path",
"host": "example.com\\stuff",
"hostname": "example.com\\stuff",
"port": ""
}
},
Expand Down
79 changes: 75 additions & 4 deletions url/urltestdata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4256,22 +4256,82 @@
"search": "",
"hash": ""
},
"# unknown schemes and non-ASCII domains",
"# unknown schemes and their hosts",
{
"input": "sc://ñ.test/",
"base": "about:blank",
"href": "sc://xn--ida.test/",
"href": "sc://%C3%B1.test/",
"origin": "null",
"protocol": "sc:",
"username": "",
"password": "",
"host": "xn--ida.test",
"hostname": "xn--ida.test",
"host": "%C3%B1.test",
"hostname": "%C3%B1.test",
"port": "",
"pathname": "/",
"search": "",
"hash": ""
},
{
"input": "sc://\u001F!\"$%&'()*+,-.;<=>^_`{|}~/",
"base": "about:blank",
"href": "sc://%1F!\"$%&'()*+,-.;<=>^_`{|}~/",
"origin": "null",
"protocol": "sc:",
"username": "",
"password": "",
"host": "%1F!\"$%&'()*+,-.;<=>^_`{|}~",
"hostname": "%1F!\"$%&'()*+,-.;<=>^_`{|}~",
"port": "",
"pathname": "/",
"search": "",
"hash": ""
},
{
"input": "sc://\u0000/",
"base": "about:blank",
"failure": true
},
{
"input": "sc:// /",
"base": "about:blank",
"failure": true
},
{
"input": "sc://@/",
"base": "about:blank",
"failure": true
},
{
"input": "sc://te@s:t@/",
"base": "about:blank",
"failure": true
},
{
"input": "sc://:/",
"base": "about:blank",
"failure": true
},
{
"input": "sc://:12/",
"base": "about:blank",
"failure": true
},
{
"input": "x",
"base": "sc://ñ",
"href": "sc://%C3%B1/x",
"origin": "null",
"protocol": "sc:",
"username": "",
"password": "",
"host": "%C3%B1",
"hostname": "%C3%B1",
"port": "",
"pathname": "/x",
"search": "",
"hash": ""
},
"# unknown schemes and backslashes",
{
"input": "sc:\\../",
Expand Down Expand Up @@ -4754,5 +4814,16 @@
"pathname": "/",
"search": "",
"hash": ""
},
"# Empty host",
{
"input": "http://?",
"base": "about:blank",
"failure": "true"
},
{
"input": "http://#",
"base": "about:blank",
"failure": "true"
}
]

0 comments on commit 045b749

Please sign in to comment.