test_sessionStorageHttpHttps.html (1574B)
1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <head> 3 <title>sessionStorage replace test</title> 4 5 <!-- 6 This test checks that sessionStorage values set in an https page 7 are not readable from a non-https page from the same domain. 8 --> 9 10 <script src="/tests/SimpleTest/SimpleTest.js"></script> 11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 12 13 <script type="text/javascript"> 14 15 window.addEventListener("message", onMessageReceived); 16 17 var messages = []; 18 19 function onMessageReceived(event) 20 { 21 if (event.data == "the end") { 22 is(messages.length, 4, "Wrong number of messages."); 23 is(messages[0], "insecure", "Wrong message from insecure page"); 24 is(messages[1], "secure", "Wrong message from secure page"); 25 is(messages[2], "insecure", "Wrong second message from insecure page"); 26 is(messages[3], null, "Insecure page got secure message?"); 27 28 SimpleTest.finish(); 29 30 return; 31 } 32 33 messages.push(event.data); 34 35 if (event.data == "insecure" && messages.length == 1) { 36 window.httpsframe.location = "https://test1.example.com/tests/dom/tests/mochitest/sessionstorage/file_https.html"; 37 } 38 39 if (event.data == "secure") { 40 window.httpframe.postMessage("check", "http://test1.example.com"); 41 } 42 } 43 44 function startTest() 45 { 46 window.httpframe.location = "http://test1.example.com/tests/dom/tests/mochitest/sessionstorage/file_http.html"; 47 } 48 49 SimpleTest.waitForExplicitFinish(); 50 51 </script> 52 53 </head> 54 55 <body onload="startTest();"> 56 <iframe src="" name="httpframe"></iframe> 57 <iframe src="" name="httpsframe"></iframe> 58 </body> 59 </html>