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

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <!DOCTYPE html>
     2 <html>
     3 <head>
     4   <title>Child window at 127.0.0.1</title>
     5   <script type="application/javascript">
     6 function run()
     7 {
     8   var target = document.getElementById("location");
     9   target.textContent = location.hostname + ":" + (location.port || 80);
    11   var message = "child-response";
    13   var domain = document.domain;
    14   if (domain !== "127.0.0.1")
    15     message += " wrong-initial-domain(" + domain + ")";
    17   try
    18   {
    19     document.domain = "0.0.1";
    20     domain = document.domain;
    21     message += " ip-address-shortened-to(" + domain + ")";
    22   }
    23   catch (e)
    24   {
    25     domain = document.domain;
    26     if (domain !== "127.0.0.1")
    27       message += " ip-address-mutated-on-throw(" + domain + ")";
    28   }
    30   window.parent.postMessage(message, "http://mochi.test:8888");
    31 }
    33 window.addEventListener("load", run, false);
    34   </script>
    35 </head>
    36 <body>
    37 <h1 id="location">Somewhere!</h1>
    38 </body>
    39 </html>

mercurial