summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/dom-level0/child_ip_address.html
blob: 24c1f0ba30648d6c53b301e345cf7e1fe594dff1 (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
<!DOCTYPE html>
<html>
<head>
  <title>Child window at 127.0.0.1</title>
  <script type="application/javascript">
function run()
{
  var target = document.getElementById("location");
  target.textContent = location.hostname + ":" + (location.port || 80);

  var message = "child-response";

  var domain = document.domain;
  if (domain !== "127.0.0.1")
    message += " wrong-initial-domain(" + domain + ")";

  try
  {
    document.domain = "0.0.1";
    domain = document.domain;
    message += " ip-address-shortened-to(" + domain + ")";
  }
  catch (e)
  {
    domain = document.domain;
    if (domain !== "127.0.0.1")
      message += " ip-address-mutated-on-throw(" + domain + ")";
  }

  window.parent.postMessage(message, "http://mochi.test:8888");
}

window.addEventListener("load", run);
  </script>
</head>
<body>
<h1 id="location">Somewhere!</h1>
</body>
</html>