<!DOCTYPE html>
<body>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<h1>The length of an <input> element's string is NOT implicitly limited to 524288 characters. http://bugs.webkit.org/show_bug.cgi?id=14388 and crbug.com/450544</h1>
<div id="log"></div>
<input id="input">
<script>
var input = document.getElementById("input");
function attempt(length, expected)
{
var buffer = new Uint8Array(new ArrayBuffer(length));
for (var i = 0; i < buffer.length; ++i)
buffer[i] = 0x30 + (i % 10);
var testString = (new TextDecoder("utf-8")).decode(buffer);
input.value = testString;
assert_equals(input.value.length, expected);
}
test(function() {
attempt(0, 0);
}, "Insert 0 characters, the value length should be 0.");
test(function() {
attempt(5, 5);
}, "Insert 5 characters, the value length should be 5.");
test(function() {
attempt(1025, 1025);
}, "Insert 1025 characters, the value length should be 1025.");
test(function() {
attempt(524287, 524287);
}, "Insert 524287 characters, the value length should be 524287.");
test(function() {
attempt(524288, 524288);
}, "Insert 524288 characters, the value length should be 524288.");
test(function() {
attempt(524289, 524289);
}, "Insert 524289 characters, the value length should be 524289.");
test(function() {
attempt(530000, 530000);
}, "Insert 530000 characters, the value length should be 530000.");
test(function() {
attempt(1000000, 1000000);
}, "Insert 1000000 characters, the value length should be 1000000.");
</script>
</body>