frameKeySync.html (1005B)
1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <head> 3 <title>frame for localStorage test</title> 4 5 <script type="text/javascript" src="interOriginFrame.js"></script> 6 <script type="text/javascript"> 7 8 var currentStep = parseInt(location.search.substring(1)); 9 10 function doStep() 11 { 12 switch (currentStep) 13 { 14 case 1: 15 localStorage.clear(); 16 break; 17 18 case 2: 19 localStorage.setItem("a", "1"); 20 is(localStorage.a, "1", "Value a=1 set"); 21 break; 22 23 case 3: 24 try { 25 is(localStorage.key(0), "a", "Key 'a' present in 'key' array") 26 } 27 catch (exc) { 28 ok(false, "Shouldn't throw when accessing key(0) " + exc); 29 } 30 is(localStorage.a, "1", "Value a=1 set"); 31 break; 32 33 default: 34 return finishTest(); 35 } 36 37 // Increase by two to as odd number are executed in a window separate from 38 // where even step are. 39 ++currentStep; 40 ++currentStep; 41 42 return true; 43 } 44 45 </script> 46 47 </head> 48 49 <body onload="postMsg('frame loaded');"> 50 </body> 51 </html>