1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/localstorage/frameKeySync.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,51 @@ 1.4 +<html xmlns="http://www.w3.org/1999/xhtml"> 1.5 +<head> 1.6 +<title>frame for localStorage test</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 = parseInt(location.search.substring(1)); 1.12 + 1.13 +function doStep() 1.14 +{ 1.15 + switch (currentStep) 1.16 + { 1.17 + case 1: 1.18 + localStorage.clear(); 1.19 + break; 1.20 + 1.21 + case 2: 1.22 + localStorage.setItem("a", "1"); 1.23 + is(localStorage["a"], "1", "Value a=1 set"); 1.24 + break; 1.25 + 1.26 + case 3: 1.27 + try { 1.28 + is(localStorage.key(0), "a", "Key 'a' present in 'key' array") 1.29 + } 1.30 + catch (exc) { 1.31 + ok(false, "Shouldn't throw when accessing key(0) " + exc); 1.32 + } 1.33 + is(localStorage["a"], "1", "Value a=1 set"); 1.34 + break; 1.35 + 1.36 + default: 1.37 + return finishTest(); 1.38 + } 1.39 + 1.40 + // Increase by two to as odd number are executed in a window separate from 1.41 + // where even step are. 1.42 + ++currentStep; 1.43 + ++currentStep; 1.44 + 1.45 + return true; 1.46 +} 1.47 + 1.48 +</script> 1.49 + 1.50 +</head> 1.51 + 1.52 +<body onload="postMsg('frame loaded');"> 1.53 +</body> 1.54 +</html>