summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/localstorage/test_embededNulls.html
blob: b12a403b8562bdcc71e3350b8160ee9d24d816f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>embeded nulls test</title>

<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />

<script type="text/javascript">

function startTest()
{
  var k = "key with\x00null";
  var v = "value with\x00null";

  localStorage.setItem(k, v);

  is(localStorage.getItem("key with"), null,
    "not accessible by truncated key");

  is(localStorage.getItem(k), "value with\x00null",
    "value is identical to what has been stored");

  isnot(localStorage.getItem(k), "value with",
    "value is not truncated");

  localStorage.clear();

  SimpleTest.finish();
}

SimpleTest.waitForExplicitFinish();

</script>

</head>

<body onload="startTest();">

</body>
</html>