Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / url / tests / test_url_malformedHost.html
blob7cc23d7e32ddaf30136f41bb962899a8dafacbaf
2 <!DOCTYPE HTML>
3 <html>
4 <!--
5 https://bugzilla.mozilla.org/show_bug.cgi?id=1020041
6 -->
7 <head>
8 <meta charset="utf-8">
9 <title>Test for Bug 1020041</title>
10 <script src="/tests/SimpleTest/SimpleTest.js"></script>
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
12 </head>
13 <body>
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1020041">Mozilla Bug 1020041</a>
15 <p id="display"></p>
16 <div id="content" style="display: none">
17 <iframe name="x" id="x"></iframe>
18 <iframe name="y" id="y"></iframe>
19 </div>
20 <pre id="test">
21 </pre>
22 <a id="link" href="http://www.example.com:8080">foobar</a>
23 <area id="area" href="http://www.example.com:8080" />
24 <script type="application/javascript">
26 var tests = [
27 { host: "?", expected: "www.example.com" },
28 { host: "what?", expected: "what" },
29 { host: "so what", expected: "www.example.com" },
30 { host: "aa#bb", expected: "aa" },
31 { host: "a/b", expected: "a" },
32 { host: "a\\b", expected: "a" },
33 { host: "[2001::1]#bla:10", expected: "[2001::1]"},
36 for (var i = 0; i < tests.length; ++i) {
37 var url = new URL("http://www.example.com");
38 url.host = tests[i].host;
39 is(url.host, tests[i].expected, "URL.host is: " + url.host);
41 url = new URL("http://www.example.com");
42 url.hostname = tests[i].host;
43 is(url.hostname, tests[i].expected, "URL.hostname is: " + url.host);
46 </script>
47 </body>
48 </html>