dom/base/test/test_url_empty_port.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/base/test/test_url_empty_port.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,53 @@
     1.4 +
     1.5 +<!DOCTYPE HTML>
     1.6 +<html>
     1.7 +<!--
     1.8 +https://bugzilla.mozilla.org/show_bug.cgi?id=930450
     1.9 +-->
    1.10 +<head>
    1.11 +  <meta charset="utf-8">
    1.12 +  <title>Test for Bug 930450</title>
    1.13 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.14 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.15 +</head>
    1.16 +<body>
    1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=930450">Mozilla Bug 930450</a>
    1.18 +<p id="display"></p>
    1.19 +<div id="content" style="display: none">
    1.20 +  <iframe name="x" id="x"></iframe>
    1.21 +  <iframe name="y" id="y"></iframe>
    1.22 +</div>
    1.23 +<pre id="test">
    1.24 +</pre>
    1.25 +  <a id="link" href="http://www.example.com:8080">foobar</a>
    1.26 +  <area id="area" href="http://www.example.com:8080" />
    1.27 +  <script type="application/javascript">
    1.28 +
    1.29 +  var url = new URL('http://www.example.com:8080');
    1.30 +  is(url.port, 8080, 'URL.port is 8080');
    1.31 +  url.port = '';
    1.32 +  ise(url.port, '', 'URL.port is \'\'');
    1.33 +  url.port = 0;
    1.34 +  ise(url.port, '0', 'URL.port is 0');
    1.35 +
    1.36 +  var link = document.getElementById("link");
    1.37 +  is(link.port, 8080, 'URL.port is 8080');
    1.38 +  link.port = '';
    1.39 +  is(link.href, 'http://www.example.com/', "link.href matches");
    1.40 +  ise(link.port, '', 'URL.port is \'\'');
    1.41 +  link.port = 0;
    1.42 +  is(link.href, 'http://www.example.com:0/', "link.href matches");
    1.43 +  ise(link.port, '0', 'URL.port is 0');
    1.44 +
    1.45 +  var area = document.getElementById("area");
    1.46 +  is(area.port, 8080, 'URL.port is 8080');
    1.47 +  area.port = '';
    1.48 +  is(area.href, 'http://www.example.com/', "area.href matches");
    1.49 +  ise(area.port, '', 'URL.port is \'\'');
    1.50 +  area.port = 0;
    1.51 +  is(area.href, 'http://www.example.com:0/', "area.href matches");
    1.52 +  ise(area.port, '0', 'URL.port is 0');
    1.53 +
    1.54 +  </script>
    1.55 +</body>
    1.56 +</html>

mercurial