Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / input-implicit-length-limit.html
blob056bb4feb80574a688c73d0009a79ef9bc3ba162
1 <p>This page tests that the length of an <tt>&lt;input&gt;</tt> element's string is implicitly limited to 524288 characters. <a href="http://bugs.webkit.org/show_bug.cgi?id=14388">http://bugs.webkit.org/show_bug.cgi?id=14388</a></p>
2 <input id="input">
3 <pre id="log"></pre>
4 <script>
5 function log(msg)
7 document.getElementById("log").appendChild(document.createTextNode(msg + "\n"));
10 if (window.testRunner)
11 testRunner.dumpAsText();
13 var testString = "";
15 function attempt(length, expected)
17 log("Attempting to insert " + length + " characters.");
19 if (testString.length > length)
20 testString = "";
22 for (var i = testString.length; i < length; ++i)
23 testString += i % 10;
25 var input = document.getElementById("input");
26 input.value = testString;
28 if (input.value.length == expected)
29 log("PASS");
30 else
31 log("FAIL: Expected " + expected + " characters to be inserted, but " + input.value.length + " characters were actually inserted.");
34 attempt(0, 0);
35 attempt(5, 5);
36 attempt(1025, 1025);
37 attempt(524287, 524287);
38 attempt(524288, 524288);
39 attempt(524289, 524288);
40 attempt(530000, 524288);
41 </script>