dom/tests/mochitest/localstorage/test_embededNulls.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 xmlns="http://www.w3.org/1999/xhtml">
     2 <head>
     3 <title>embeded nulls test</title>
     5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     8 <script type="text/javascript">
    10 function startTest()
    11 {
    12   var k = "key with\x00null";
    13   var v = "value with\x00null";
    15   localStorage.setItem(k, v);
    17   is(localStorage.getItem("key with"), null,
    18     "not accessible by truncated key");
    20   is(localStorage.getItem(k), "value with\x00null",
    21     "value is identical to what has been stored");
    23   isnot(localStorage.getItem(k), "value with",
    24     "value is not truncated");
    26   localStorage.clear();
    28   SimpleTest.finish();
    29 }
    31 SimpleTest.waitForExplicitFinish();
    33 </script>
    35 </head>
    37 <body onload="startTest();">
    39 </body>
    40 </html>

mercurial