tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

frameLocalStorageSlaveEqual.html (1309B)


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