frameLocalStorageCookieSettings.html (592B)
1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <head> 3 <title>localStorage cookies settings test</title> 4 5 </head> 6 <body> 7 <script type="text/javascript"> 8 function ok(what, msg) { 9 parent.postMessage({ type: "ok", what: !!what, msg }, "*"); 10 } 11 12 function is(a, b, msg) { 13 ok(a === b, msg); 14 } 15 16 try { 17 localStorage.setItem("contentkey", "test-value"); 18 ok(false, "Setting localStorageItem should throw a security exception"); 19 } catch(ex) { 20 is(ex.name, "SecurityError", "Got security exception"); 21 } 22 23 parent.postMessage({ type: "finish" }, "*"); 24 </script> 25 </body> 26 </html>