Bug 623291 - Firefox 4: change/blur event are not dispatched to input upon button click, r=enn, a=blocking

--HG--
extra : rebase_source : 3866a4ba1cfd9721a43c1c1fedeba2f6ed3c80d6
This commit is contained in:
Olli Pettay 2011-01-14 15:03:39 +02:00
Родитель ff05433231
Коммит 51505e96da
3 изменённых файлов: 49 добавлений и 1 удалений

Просмотреть файл

@ -447,7 +447,7 @@ nsHTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
if (fm)
fm->SetFocus(this, nsIFocusManager::FLAG_BYMOUSE |
nsIFocusManager::FLAG_NOSCROLL);
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
aVisitor.mEvent->flags |= NS_EVENT_FLAG_PREVENT_ANCHOR_ACTIONS;
} else if (static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
nsMouseEvent::eMiddleButton ||
static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==

Просмотреть файл

@ -250,6 +250,7 @@ _TEST_FILES = \
test_bug601030.html \
test_bug610687.html \
test_bug618948.html \
test_bug623291.html \
$(NULL)
libs:: $(_TEST_FILES)

Просмотреть файл

@ -0,0 +1,47 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=623291
-->
<head>
<title>Test for Bug 623291</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=623291">Mozilla Bug 623291</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<input id="textField" onfocus="next()" onblur="done();">
<button id="b">a button</button>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 623291 **/
function runTest() {
document.getElementById("textField").focus();
}
function next() {
synthesizeMouseAtCenter(document.getElementById('b'), {}, window);
}
function done() {
isnot(document.activeElement, document.getElementById("textField"),
"TextField should not be active anymore!");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(runTest);
</script>
</pre>
</body>
</html>