dom/tests/mochitest/sessionstorage/interOriginSlave.js

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 function postMsg(message)
     2 {
     3   opener.postMessage(message, "http://mochi.test:8888");
     4 }
     6 window.addEventListener("message", onMessageReceived, false);
     8 function onMessageReceived(event)
     9 {
    10   //alert("slave got event: "+event.data);
    11   if (event.data == "step") {
    12     if (doStep())
    13       postMsg("perf");
    15     return;
    16   }
    18   postMsg("Invalid message");
    19 }
    21 function ok(a, message)
    22 {
    23   if (!a)
    24     postMsg("FAILURE: " + message);
    25   else
    26     postMsg(message);
    27 }
    29 function is(a, b, message)
    30 {
    31   if (a != b)
    32     postMsg("FAILURE: " + message + ", expected "+b+" got "+a);
    33   else
    34     postMsg(message + ", expected "+b+" got "+a);
    35 }
    37 function finishTest()
    38 {
    39   sessionStorage.clear();
    40   postMsg("done");
    41   return false;
    42 }

mercurial