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').appendChild(document.createTextNode(a)); 12 document.getElementById('logger').appendChild(document.createElement("br")); 13 } 14 15 function runTest() 16 { 17 if (!window.sessionStorage) { 18 log("window.sessionStorage DOES NOT exist"); 19 return; 20 } 21 22 log("foo (before anything) is: " + sessionStorage.foo); 23 sessionStorage.foo = "bar"; 24 log("foo (after a named property setter set) is: " + sessionStorage.foo); 25 delete sessionStorage.foo; 26 log("foo (after a delete) is: " + sessionStorage.foo); 27 sessionStorage["foo"] = "bar"; 28 log("foo (after an indexed setter set) is: " + sessionStorage.foo); 29 delete sessionStorage.FOO; 30 log("foo (after deleting FOO (not foo)) is : " + sessionStorage.foo); 31 delete sessionStorage.foo; 32 log("foo (after a delete) is: " + sessionStorage.foo); 33 sessionStorage.setItem("foo", "bar"); 34 log("foo (after calling setItem) is: " + sessionStorage.foo); 35 delete sessionStorage.foo; 36 log("foo (after a delete) is: " + sessionStorage.foo); 37 delete sessionStorage.foo; 38 log("foo (after a redundant delete) is: " + sessionStorage.foo); 39 sessionStorage.foo = "bar"; 40 log("foo (after a named property setter set) is: " + sessionStorage.foo); 41 delete sessionStorage["foo"]; 42 log("foo (after an indexed delete) is: " + sessionStorage.foo); 43 } 44 45 </script> 46 </head> 47 <body onload="runTest();"> 48 This test makes sure that using the syntax `delete sessionStorage.keyName` works as an alias to `sessionStorage.removeItem(keyName).`<br><hr> 49 <div id="logger"></div> 50 </body> 51 </html> 52