Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / dom / url / tests / test_url_empty_port.html
blob5001bdfae5241a75e14fed8b211bcc07678c89da
2 <!DOCTYPE HTML>
3 <html>
4 <!--
5 https://bugzilla.mozilla.org/show_bug.cgi?id=930450
6 -->
7 <head>
8 <meta charset="utf-8">
9 <title>Test for Bug 930450</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=930450">Mozilla Bug 930450</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 url = new URL("http://www.example.com:8080");
27 is(url.port, "8080", "URL.port is 8080");
28 url.port = "";
29 is(url.port, "", "URL.port is ''");
30 url.port = 0;
31 is(url.port, "0", "URL.port is 0");
33 var link = document.getElementById("link");
34 is(link.port, "8080", "URL.port is 8080");
35 link.port = "";
36 is(link.href, "http://www.example.com/", "link.href matches");
37 is(link.port, "", "URL.port is ''");
38 link.port = 0;
39 is(link.href, "http://www.example.com:0/", "link.href matches");
40 is(link.port, "0", "URL.port is 0");
42 var area = document.getElementById("area");
43 is(area.port, "8080", "URL.port is 8080");
44 area.port = "";
45 is(area.href, "http://www.example.com/", "area.href matches");
46 is(area.port, "", "URL.port is ''");
47 area.port = 0;
48 is(area.href, "http://www.example.com:0/", "area.href matches");
49 is(area.port, "0", "URL.port is 0");
51 </script>
52 </body>
53 </html>