зеркало из https://github.com/mozilla/pjs.git
Bug 620145 - Prompt for gmail message with no text has to be focused (clicked on) before ok-ing (or canceling). r=smaug, a=blocking
This commit is contained in:
Родитель
3df22ea1c5
Коммит
2886cf6ec4
|
@ -184,6 +184,7 @@
|
|||
#include "nsFocusManager.h"
|
||||
#include "nsIJSON.h"
|
||||
#include "nsIXULWindow.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsXULPopupManager.h"
|
||||
#include "nsIDOMXULControlElement.h"
|
||||
|
@ -6266,6 +6267,19 @@ nsGlobalWindow::EnterModalState()
|
|||
return;
|
||||
}
|
||||
|
||||
// If there is an active ESM in this window, clear it. Otherwise, this can
|
||||
// cause a problem if a modal state is entered during a mouseup event.
|
||||
nsEventStateManager* activeESM =
|
||||
static_cast<nsEventStateManager*>(nsEventStateManager::GetActiveEventStateManager());
|
||||
if (activeESM && activeESM->GetPresContext()) {
|
||||
nsIPresShell* activeShell = activeESM->GetPresContext()->GetPresShell();
|
||||
if (activeShell && (
|
||||
nsContentUtils::ContentIsCrossDocDescendantOf(activeShell->GetDocument(), mDoc) ||
|
||||
nsContentUtils::ContentIsCrossDocDescendantOf(mDoc, activeShell->GetDocument()))) {
|
||||
nsEventStateManager::ClearGlobalActiveContent(activeESM);
|
||||
}
|
||||
}
|
||||
|
||||
if (topWin->mModalStateDepth == 0) {
|
||||
NS_ASSERTION(!mSuspendedDoc, "Shouldn't have mSuspendedDoc here!");
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ MOCHI_TESTS = \
|
|||
test_modal_select.html \
|
||||
test_modal_prompts.html \
|
||||
test_bug619644.html \
|
||||
test_bug620145.html \
|
||||
$(NULL)
|
||||
|
||||
MOCHI_CONTENT = \
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Test for Bug 620145</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="prompt_common.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body onload="runtest()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=620145">Mozilla Bug 620145</a>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<button id="button" onmouseup="alert('message\n');">Button</button>
|
||||
|
||||
<script class="testbody" type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testNum = 0;
|
||||
|
||||
function runtest()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
isTabModal = true;
|
||||
startCallbackTimer();
|
||||
|
||||
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||
getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
|
||||
var e = document.createEvent("MouseEvent");
|
||||
e.initEvent("mousedown", false, false, window, 0, 1, 1, 1, 1,
|
||||
false, false, false, false, 0, null);
|
||||
utils.dispatchDOMEventViaPresShell($("button"), e, true);
|
||||
|
||||
e = document.createEvent("MouseEvent");
|
||||
e.initEvent("mouseup", false, false, window, 0, 1, 1, 1, 1,
|
||||
false, false, false, false, 0, null);
|
||||
utils.dispatchDOMEventViaPresShell($("button"), e, true);
|
||||
|
||||
ok(true, "dialog closed");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function handleDialog(ui, testNum)
|
||||
{
|
||||
synthesizeMouse(ui.button0, 5, 5, { }, ui.button0.ownerDocument.defaultView);
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче