mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-23 19:09:49 +00:00
Bug 603556 - pasting into text that is longer than maxlength of text control fails; r=roc a=blocking-final+
This commit is contained in:
parent
1e1451b22d
commit
b15b1bb4b3
@ -662,7 +662,7 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
|
||||
nsresult res = TruncateInsertionIfNeeded(aSelection, inString, outString,
|
||||
aMaxLength, &truncated);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
if (truncated) {
|
||||
if (truncated && outString->IsEmpty()) {
|
||||
*aCancel = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ _TEST_FILES = \
|
||||
test_bug596506.html \
|
||||
test_bug597331.html \
|
||||
test_bug600570.html \
|
||||
test_bug603556.html \
|
||||
$(NULL)
|
||||
|
||||
# disables the key handling test on gtk2 because gtk2 overrides some key events
|
||||
|
49
editor/libeditor/text/tests/test_bug603556.html
Normal file
49
editor/libeditor/text/tests/test_bug603556.html
Normal file
@ -0,0 +1,49 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=603556
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 603556</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=603556">Mozilla Bug 603556</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<div id="src">testing</div>
|
||||
<input maxlength="4">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 603556 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(function() {
|
||||
var i = document.querySelector("input");
|
||||
var src = document.getElementById("src");
|
||||
SimpleTest.waitForClipboard(src.textContent,
|
||||
function() {
|
||||
getSelection().selectAllChildren(src);
|
||||
synthesizeKey("C", {accelKey: true});
|
||||
},
|
||||
function() {
|
||||
i.focus();
|
||||
synthesizeKey("V", {accelKey: true});
|
||||
is(i.value, src.textContent.substr(0, i.maxLength),
|
||||
"Pasting should paste maxlength chars worth of the clipboard contents");
|
||||
SimpleTest.finish();
|
||||
},
|
||||
function() {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user