1 <html> 2 <head> 3 <script src="resources/clearSessionStorage.js"></script> 4 <script> 5 6 if (window.layoutTestController) 7 layoutTestController.dumpAsText(); 8 9 function log(a) 10 { 11 document.getElementById("logger").innerHTML += a + "<br>"; 12 } 13 14 function runTest() 15 { 16 if (!window.sessionStorage) { 17 log("window.sessionStorage DOES NOT exist"); 18 return; 19 } 20 21 log("Length is " + sessionStorage.length); 22 23 log("Testing implicit setters"); 24 sessionStorage.a = null; 25 log("Type/value for null is " + typeof sessionStorage.a + "/" + sessionStorage.a); 26 sessionStorage.b = 0; 27 log("Type/value for 0 is " + typeof sessionStorage.b + "/" + sessionStorage.b); 28 sessionStorage.c = function(){}; 29 log("Type/value for function(){} is " + typeof sessionStorage.c + "/" + sessionStorage.c); 30 31 log("Testing explicit setters"); 32 sessionStorage.setItem('d', null); 33 log("Type/value for null is " + typeof sessionStorage.d + "/" + sessionStorage.d); 34 sessionStorage.setItem('e', 0); 35 log("Type/value for 0 is " + typeof sessionStorage.e + "/" + sessionStorage.e); 36 sessionStorage.setItem('f', function(){}); 37 log("Type/value for function(){} is " + typeof sessionStorage.f + "/" + sessionStorage.f); 38 39 log("Testing index setters"); 40 sessionStorage['g'] = null; 41 log("Type/value for null is " + typeof sessionStorage.g + "/" + sessionStorage.g); 42 sessionStorage['h'] = 0; 43 log("Type/value for 0 is " + typeof sessionStorage.h + "/" + sessionStorage.h); 44 sessionStorage['i'] = function(){}; 45 log("Type/value for function(){} is " + typeof sessionStorage.i + "/" + sessionStorage.i); 46 } 47 48 </script> 49 </head> 50 <body onload="runTest();"> 51 This test case verifies that session storage only stores strings. 52 <div id="logger"></div> 53 </body> 54 </html> 55