dom/tests/mochitest/localstorage/test_embededNulls.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/localstorage/test_embededNulls.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,40 @@
     1.4 +<html xmlns="http://www.w3.org/1999/xhtml">
     1.5 +<head>
     1.6 +<title>embeded nulls test</title>
     1.7 +
     1.8 +<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     1.9 +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.10 +
    1.11 +<script type="text/javascript">
    1.12 +
    1.13 +function startTest()
    1.14 +{
    1.15 +  var k = "key with\x00null";
    1.16 +  var v = "value with\x00null";
    1.17 +
    1.18 +  localStorage.setItem(k, v);
    1.19 +
    1.20 +  is(localStorage.getItem("key with"), null,
    1.21 +    "not accessible by truncated key");
    1.22 +
    1.23 +  is(localStorage.getItem(k), "value with\x00null",
    1.24 +    "value is identical to what has been stored");
    1.25 +
    1.26 +  isnot(localStorage.getItem(k), "value with",
    1.27 +    "value is not truncated");
    1.28 +
    1.29 +  localStorage.clear();
    1.30 +
    1.31 +  SimpleTest.finish();
    1.32 +}
    1.33 +
    1.34 +SimpleTest.waitForExplicitFinish();
    1.35 +
    1.36 +</script>
    1.37 +
    1.38 +</head>
    1.39 +
    1.40 +<body onload="startTest();">
    1.41 +
    1.42 +</body>
    1.43 +</html>

mercurial