dom/tests/mochitest/storageevent/frameLocalStorageSlaveEqual.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

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 is(event.key, expectedKey, "key name check");
michael@0 23 is(event.oldValue, expectedOldValue, "old value check");
michael@0 24 is(event.newValue, expectedNewValue, "new value check");
michael@0 25 is(event.url, "http://example.com/tests/dom/tests/mochitest/storageevent/frameLocalStorageMaster.html");
michael@0 26 ok(event.storageArea);
michael@0 27 }
michael@0 28
michael@0 29 switch (currentStep)
michael@0 30 {
michael@0 31 case 10:
michael@0 32 is(events.length, 5, "Expected 5 events");
michael@0 33 checkEvent("X", null, "1");
michael@0 34 checkEvent("X", "1", "2");
michael@0 35 checkEvent("X", "2", null);
michael@0 36 checkEvent("X", null, "2");
michael@0 37 checkEvent(null, null, null);
michael@0 38 break;
michael@0 39 }
michael@0 40
michael@0 41 // Increase by two to distinguish each test step order
michael@0 42 // in both master doStep and slave doStep functions.
michael@0 43 ++currentStep;
michael@0 44 ++currentStep;
michael@0 45
michael@0 46 return true;
michael@0 47 }
michael@0 48
michael@0 49 </script>
michael@0 50
michael@0 51 </head>
michael@0 52
michael@0 53 <body onload="postMsg('frame loaded');">
michael@0 54 </body>
michael@0 55 </html>

mercurial