dom/tests/mochitest/localstorage/frameMasterEqual.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 <html xmlns="http://www.w3.org/1999/xhtml">
     2 <head>
     3 <title>frame for localStorage test</title>
     5 <script type="text/javascript" src="interOriginFrame.js"></script>
     6 <script type="text/javascript">
     8 var currentStep = 1;
    10 function doStep()
    11 {
    12   switch (currentStep)
    13   {
    14     case 1:
    15       localStorage.setItem("X", "1");
    16       is(localStorage.getItem("X"), "1", "X is 1 in the master");
    17       break;
    19     case 3:
    20       is(localStorage.getItem("X"), "2", "X set to 2 in the master");
    21       localStorage.removeItem("X");
    22       is(localStorage.getItem("X"), null, "X was removed from the master");
    23       break;
    25     case 5:
    26       is(localStorage.getItem("Y"), "3", "Y is 3 in the master");
    27       localStorage.setItem("Z", "4");
    28       is(localStorage.getItem("Z"), "4", "Z is 4 in the master");
    30       localStorage.clear();
    31       is(localStorage.length, 0, "Master is empty");
    32       break;
    34     case 7:
    35       is(localStorage.length, 0, "Master is empty");
    36       break;
    38     case 9:
    39       return finishTest();
    40   }
    42   // Increase by two to distinguish each test step order
    43   // in both master doStep and slave doStep functions.
    44   ++currentStep;
    45   ++currentStep;
    47   return true;
    48 }
    50 </script>
    52 </head>
    54 <body onload="postMsg('frame loaded');">
    55 </body>
    56 </html>

mercurial