dom/tests/mochitest/storageevent/frameSessionStorageSlaveEqual.html

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

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

mercurial