<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description('There was a bug that users could input text longer than maxlength via IME.  This test confirms it was fixed.');

var input = document.createElement('input');
input.maxLength = 2;
document.body.appendChild(input);
input.focus();
textInputController.setMarkedText('abcd', 0, 4);
textInputController.insertText('abcd');  // Debug WebKit crashed by this without the change of bug#25253.
// Check the current value without input.value.
// In Release WebKit, input.value was 'ab' though the user-visible value was 'abcd'.
document.execCommand('SelectAll');
shouldBeEqualToString('input.value.substring(input.selectionStart, input.selectionEnd)', 'ab');
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
