summaryrefslogtreecommitdiffstats
path: root/netwerk/test/mochitests/test_uri_scheme.html
blob: b0c247f3365d48c7e3528bf3226b4afaf9b62b4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE HTML>
<html>
<!--
-->
<head>
  <title>Test for URI Manipulation</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />

<script type="text/javascript">
function dotest1()
{
  SimpleTest.waitForExplicitFinish();
  var o = new URL("http://localhost/");
  try { o.href = "foopy:bar:baz"; } catch(e) { }
  o.protocol = "http:";
  o.hostname;
  try { o.href = "http://localhost/"; } catch(e) { }
  ok(o.protocol, "http:");
  dotest2();
}

function dotest2()
{
  var o = new URL("http://www.mozilla.org/");
  try {
      o.href ="aaaaaaaaaaa:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
  } catch(e) { }
  o.hash = "#";
  o.pathname = "/";
  o.protocol = "http:";
  try { o.href = "http://localhost/"; } catch(e) { }
  ok(o.protocol, "http:");
  dotest3();
}

function dotest3()
{
  is(new URL("resource://123/").href, "resource://123/");
  SimpleTest.finish();
}
</script>
</head>
<body onload="dotest1();">
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
</body>
</html>