dom/tests/mochitest/localstorage/frameKeySync.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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 = parseInt(location.search.substring(1));
    10 function doStep()
    11 {
    12   switch (currentStep)
    13   {
    14     case 1:
    15       localStorage.clear();
    16       break;
    18     case 2:
    19       localStorage.setItem("a", "1");
    20       is(localStorage["a"], "1", "Value a=1 set");
    21       break;
    23     case 3:
    24       try {
    25         is(localStorage.key(0), "a", "Key 'a' present in 'key' array")
    26       }
    27       catch (exc) {
    28         ok(false, "Shouldn't throw when accessing key(0) " + exc);
    29       }
    30       is(localStorage["a"], "1", "Value a=1 set");
    31       break;
    33     default:
    34       return finishTest();
    35   }
    37   // Increase by two to as odd number are executed in a window separate from
    38   // where even step are.
    39   ++currentStep;
    40   ++currentStep;
    42   return true;
    43 }
    45 </script>
    47 </head>
    49 <body onload="postMsg('frame loaded');">
    50 </body>
    51 </html>

mercurial