dom/tests/mochitest/dom-level0/child_ip_address.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/dom-level0/child_ip_address.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,39 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Child window at 127.0.0.1</title>
     1.8 +  <script type="application/javascript">
     1.9 +function run()
    1.10 +{
    1.11 +  var target = document.getElementById("location");
    1.12 +  target.textContent = location.hostname + ":" + (location.port || 80);
    1.13 +
    1.14 +  var message = "child-response";
    1.15 +
    1.16 +  var domain = document.domain;
    1.17 +  if (domain !== "127.0.0.1")
    1.18 +    message += " wrong-initial-domain(" + domain + ")";
    1.19 +
    1.20 +  try
    1.21 +  {
    1.22 +    document.domain = "0.0.1";
    1.23 +    domain = document.domain;
    1.24 +    message += " ip-address-shortened-to(" + domain + ")";
    1.25 +  }
    1.26 +  catch (e)
    1.27 +  {
    1.28 +    domain = document.domain;
    1.29 +    if (domain !== "127.0.0.1")
    1.30 +      message += " ip-address-mutated-on-throw(" + domain + ")";
    1.31 +  }
    1.32 +
    1.33 +  window.parent.postMessage(message, "http://mochi.test:8888");
    1.34 +}
    1.35 +
    1.36 +window.addEventListener("load", run, false);
    1.37 +  </script>
    1.38 +</head>
    1.39 +<body>
    1.40 +<h1 id="location">Somewhere!</h1>
    1.41 +</body>
    1.42 +</html>

mercurial