dom/tests/mochitest/storageevent/frameSessionStorageSlaveEqual.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <html xmlns="http://www.w3.org/1999/xhtml">
     2 <head>
     3 <title>slave for storage event propagation</title>
     5 <script type="text/javascript" src="interOriginFrame.js"></script>
     6 <script type="text/javascript">
     8 var currentStep = 2;
    10 var events = [];
    12 window.addEventListener("storage", function(event)
    13 {
    14   events.push(event);
    15 }, false);
    17 function doStep()
    18 {
    19   function checkEvent(expectedKey, expectedOldValue, expectedNewValue)
    20   {
    21     var event = events.shift();
    22     ok(event, "Event is present");
    23     if (!event)
    24       return;
    26     is(event.key, expectedKey, "key name check");
    27     is(event.oldValue, expectedOldValue, "old value check");
    28     is(event.newValue, expectedNewValue, "new value check");
    29     is(event.url, "http://example.com/tests/dom/tests/mochitest/storageevent/frameSessionStorageMasterEqual.html");
    30     ok(event.storageArea);
    31   }
    33   switch (currentStep)
    34   {
    35     case 10:
    36       is(events.length, 5, "Expected 5 events");
    37       checkEvent("X", null, "1");
    38       checkEvent("X", "1", "2");
    39       checkEvent("X", "2", null);
    40       checkEvent("X", null, "2");
    41       checkEvent(null, null, null);
    42       break;
    43   }
    45   // Increase by two to distinguish each test step order
    46   // in both master doStep and slave doStep functions.
    47   ++currentStep;
    48   ++currentStep;
    50   return true;
    51 }
    53 </script>
    55 </head>
    57 <body onload="postMsg('frame loaded');">
    58 </body>
    59 </html>

mercurial