dom/tests/mochitest/sessionstorage/test_sessionStorageHttpHttps.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <html xmlns="http://www.w3.org/1999/xhtml">
     2 <head>
     3 <title>sessionStorage replace test</title>
     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 -->
    10 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    13 <script type="text/javascript">
    15 window.addEventListener("message", onMessageReceived, false);
    17 var messages = [];
    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?");
    28     SimpleTest.finish();
    30     return;
    31   }
    33   messages.push(event.data);
    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   }
    39   if (event.data == "secure") {
    40     window.httpframe.postMessage("check", "http://test1.example.com");
    41   }
    42 }
    44 function startTest()
    45 {
    46   window.httpframe.location = "http://test1.example.com/tests/dom/tests/mochitest/sessionstorage/file_http.html";
    47 }
    49 SimpleTest.waitForExplicitFinish();
    51 </script>
    53 </head>
    55 <body onload="startTest();">
    56   <iframe src="" name="httpframe"></iframe>
    57   <iframe src="" name="httpsframe"></iframe>
    58 </body>
    59 </html>

mercurial