dom/tests/mochitest/sessionstorage/file_http.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <html>
     2 <head>
     3 <script>
     5 window.addEventListener("message", onMessageReceived, false);
     7 function postMsg(msg)
     8 {
     9   parent.postMessage(msg, "http://mochi.test:8888");
    10 }
    12 function onMessageReceived(event)
    13 {
    14   if (event.data == "check") {
    15     postMsg(sessionStorage.getItem("foo"));
    17     var gotValue = "threw";
    18     try {
    19       gotValue = sessionStorage.getItem("foo-https");
    20     } catch (e) {
    21     }
    23     postMsg(gotValue);
    25     postMsg("the end");
    26   }
    27 }
    29 function start()
    30 {
    31   sessionStorage.setItem("foo", "insecure");
    32   postMsg(sessionStorage.getItem("foo"));
    33 }
    35 </script>
    36 </head>
    37 <body onload="start();">
    38 insecure
    39 </body>
    40 </html>

mercurial