| <p>This page tests that the length of an <tt><input></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> | |
| <input id="input"> | |
| <pre id="log"></pre> | |
| <script> | |
| function log(msg) | |
| { | |
| document.getElementById("log").appendChild(document.createTextNode(msg + "\n")); | |
| } | |
| if (window.testRunner) | |
| testRunner.dumpAsText(); | |
| var testString = ""; | |
| function attempt(length, expected) | |
| { | |
| log("Attempting to insert " + length + " characters."); | |
| if (testString.length > length) | |
| testString = ""; | |
| for (var i = testString.length; i < length; ++i) | |
| testString += i % 10; | |
| var input = document.getElementById("input"); | |
| input.value = testString; | |
| if (input.value.length == expected) | |
| log("PASS"); | |
| else | |
| log("FAIL: Expected " + expected + " characters to be inserted, but " + input.value.length + " characters were actually inserted."); | |
| } | |
| attempt(0, 0); | |
| attempt(5, 5); | |
| attempt(1025, 1025); | |
| attempt(524287, 524287); | |
| attempt(524288, 524288); | |
| attempt(524289, 524288); | |
| attempt(530000, 524288); | |
| </script> |