dom/tests/mochitest/dom-level0/child_ip_address.html
author Nils Maier <maierman@web.de>
Wed, 28 Nov 2012 13:13:13 -0500
changeset 114378 0e5ca55005ae8ef9002ac12472740104fb79fd47
parent 39363 29810a1281ee680225c5b810ff1a4071ec03f5ae
child 491147 8459bff03c9544c8ad7dbe396fa66909635fec50
permissions -rw-r--r--
Bug 719180: Part 2 - Add jar channel unit tests; r=taras

<!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, false);
  </script>
</head>
<body>
<h1 id="location">Somewhere!</h1>
</body>
</html>