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