test_bug1043106.html (1127B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1043106 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 1043106</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1043106">Mozilla Bug 1043106</a> 14 <iframe id="iframe"></iframe> 15 <script type="application/javascript"> 16 17 var storage; 18 19 window.addEventListener("storage", function (event) { 20 is(event.storageArea, storage, "The storageArea is correct"); 21 storage.removeItem("a"); 22 runTests(); 23 }); 24 25 var tests = [ { key: 'localStorage', storage: localStorage }, 26 { key: 'sessionStorage', storage: sessionStorage } ]; 27 function runTests() { 28 if (!tests.length) { 29 SimpleTest.finish(); 30 return; 31 } 32 33 var t = tests.shift(); 34 storage = t.storage; 35 36 var ifr = document.getElementById("iframe"); 37 ifr.srcdoc = "<script>"+ t.key + ".setItem(\"a\",\"b\");</"+"script>"; 38 } 39 40 SimpleTest.waitForExplicitFinish(); 41 runTests(); 42 </script> 43 </body> 44 </html>