dom/tests/mochitest/bugs/test_bug622361.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 <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
     5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     7 <script>
     8 var w;
     9 var counter = 0;
    11 function doNext()
    12 {
    13   counter++;
    14   postMessage("ohai", "*");
    15 }
    17 function boom(event)
    18 {
    19   switch (counter)
    20   {
    21   case 1:
    22     w = window.open("data:text/html,1");
    23     doNext();
    24     return;
    25   case 2:
    26     w.location = "data:text/html,2";
    27     function next()
    28     {
    29       w.history.back();
    30       doNext();
    31     }
    32     setTimeout(next, 5000);
    33     return;
    34   case 3:
    35     localStorage.setItem("key", "value");
    36     w.history.forward();
    37     doNext();
    38     return;
    39   case 4:
    40     w.close();
    41     ok(true, "Test complete");
    42     SimpleTest.finish();
    43   }
    44 }
    46 window.addEventListener("message", boom, false);
    47 SimpleTest.waitForExplicitFinish();
    49 </script>
    50 </head>
    51 <body onload="doNext();"></body>
    52 </html>

mercurial