dom/tests/mochitest/localstorage/frameSlaveNotEqual.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 = 2;
    10 function doStep()
    11 {
    12   switch (currentStep)
    13   {
    14     case 2:
    15       is(localStorage.getItem("X"), null, "X not set in the slave");
    16       localStorage.setItem("X", "2");
    17       is(localStorage.getItem("X"), "2", "X set to 2 in the slave");
    18       break;
    20     case 4:
    21       is(localStorage.getItem("X"), "2", "X still set to 2 in the slave");
    22       localStorage.setItem("Y", "3");
    23       is(localStorage.getItem("Y"), "3", "Y set to 4 (MUST FAIL!) in the slave");
    24       break;
    26     case 6:
    27       return finishTest();
    28   }
    30   // Increase by two to distinguish each test step order
    31   // in both master doStep and slave doStep functions.
    32   ++currentStep;
    33   ++currentStep;
    35   return true;
    36 }
    38 </script>
    40 </head>
    42 <body onload="postMsg('frame loaded');">
    43 </body>
    44 </html>

mercurial