1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/storageevent/frameSessionStorageSlaveEqual.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 1.4 +<html xmlns="http://www.w3.org/1999/xhtml"> 1.5 +<head> 1.6 +<title>slave for storage event propagation</title> 1.7 + 1.8 +<script type="text/javascript" src="interOriginFrame.js"></script> 1.9 +<script type="text/javascript"> 1.10 + 1.11 +var currentStep = 2; 1.12 + 1.13 +var events = []; 1.14 + 1.15 +window.addEventListener("storage", function(event) 1.16 +{ 1.17 + events.push(event); 1.18 +}, false); 1.19 + 1.20 +function doStep() 1.21 +{ 1.22 + function checkEvent(expectedKey, expectedOldValue, expectedNewValue) 1.23 + { 1.24 + var event = events.shift(); 1.25 + ok(event, "Event is present"); 1.26 + if (!event) 1.27 + return; 1.28 + 1.29 + is(event.key, expectedKey, "key name check"); 1.30 + is(event.oldValue, expectedOldValue, "old value check"); 1.31 + is(event.newValue, expectedNewValue, "new value check"); 1.32 + is(event.url, "http://example.com/tests/dom/tests/mochitest/storageevent/frameSessionStorageMasterEqual.html"); 1.33 + ok(event.storageArea); 1.34 + } 1.35 + 1.36 + switch (currentStep) 1.37 + { 1.38 + case 10: 1.39 + is(events.length, 5, "Expected 5 events"); 1.40 + checkEvent("X", null, "1"); 1.41 + checkEvent("X", "1", "2"); 1.42 + checkEvent("X", "2", null); 1.43 + checkEvent("X", null, "2"); 1.44 + checkEvent(null, null, null); 1.45 + break; 1.46 + } 1.47 + 1.48 + // Increase by two to distinguish each test step order 1.49 + // in both master doStep and slave doStep functions. 1.50 + ++currentStep; 1.51 + ++currentStep; 1.52 + 1.53 + return true; 1.54 +} 1.55 + 1.56 +</script> 1.57 + 1.58 +</head> 1.59 + 1.60 +<body onload="postMsg('frame loaded');"> 1.61 +</body> 1.62 +</html>