• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<body>
3    <p>In this test we need to find out if the browser can save the localStorage item correctly without truncated by the \x00 in the middle of the string.</p>
4<script type="text/javascript">
5    var key = 'TruncVal';
6    var value = '123\x00567';
7
8    var x = localStorage.getItem(key);
9    if (!x) {
10        localStorage.setItem(key, value);
11        document.write("<p>It hasn't got the '" + key + "' in the localStorage database, will create it using:<br>");
12        document.write("<code>localStorage.setItem('" + key + "', '" + value + "');</code><br>");
13        document.write("Now close your browser and start it again to see the results.</p>");
14    }
15    else {
16        document.write("<p>The value of " + key + " is: '" + x + "', the length is: " + x.length + "<br>");
17
18        if (x == value) {
19            document.write("PASS.");
20        }
21        else {
22            document.write("FAIL: The expected value is: '" + value + "', the expected length is: " + value.length);
23        }
24        document.write("</p><a href=\"javascript:localStorage.removeItem('" + key + "');\">remove '" + key + "' from localStorage</a>");
25    }
26</script>
27
28<p>This is for <a href="https://bugs.webkit.org/show_bug.cgi?id=58762">https://bugs.webkit.org/show_bug.cgi?id=58762</a>
29</p>
30</body>
31</html>
32