diff options
Diffstat (limited to 'dom/url/tests/test_url_malformedHost.html')
-rw-r--r-- | dom/url/tests/test_url_malformedHost.html | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/dom/url/tests/test_url_malformedHost.html b/dom/url/tests/test_url_malformedHost.html new file mode 100644 index 0000000000..7cc23d7e32 --- /dev/null +++ b/dom/url/tests/test_url_malformedHost.html @@ -0,0 +1,48 @@ + +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=1020041 +--> +<head> + <meta charset="utf-8"> + <title>Test for Bug 1020041</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1020041">Mozilla Bug 1020041</a> +<p id="display"></p> +<div id="content" style="display: none"> + <iframe name="x" id="x"></iframe> + <iframe name="y" id="y"></iframe> +</div> +<pre id="test"> +</pre> + <a id="link" href="http://www.example.com:8080">foobar</a> + <area id="area" href="http://www.example.com:8080" /> + <script type="application/javascript"> + + var tests = [ + { host: "?", expected: "www.example.com" }, + { host: "what?", expected: "what" }, + { host: "so what", expected: "www.example.com" }, + { host: "aa#bb", expected: "aa" }, + { host: "a/b", expected: "a" }, + { host: "a\\b", expected: "a" }, + { host: "[2001::1]#bla:10", expected: "[2001::1]"}, + ]; + + for (var i = 0; i < tests.length; ++i) { + var url = new URL("http://www.example.com"); + url.host = tests[i].host; + is(url.host, tests[i].expected, "URL.host is: " + url.host); + + url = new URL("http://www.example.com"); + url.hostname = tests[i].host; + is(url.hostname, tests[i].expected, "URL.hostname is: " + url.host); + } + + </script> +</body> +</html> |