mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
89 lines
2.9 KiB
HTML
89 lines
2.9 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=569988
|
|
-->
|
|
<head>
|
|
<title>Test for Bug 569988</title>
|
|
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="application/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=569988">Mozilla Bug 569988</a>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
<pre id="test">
|
|
<script type="application/javascript">
|
|
|
|
/** Test for Bug 569988 **/
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
SimpleTest.waitForFocus(runTest);
|
|
|
|
var gPromptInput = null;
|
|
|
|
function runTest()
|
|
{
|
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
|
|
var os = Components.classes["@mozilla.org/observer-service;1"].
|
|
getService(Components.interfaces.nsIObserverService);
|
|
|
|
os.addObserver(onPromptLoad, "common-dialog-loaded", false);
|
|
os.addObserver(onPromptLoad, "tabmodal-dialog-loaded", false);
|
|
|
|
ok(true, "opening prompt...");
|
|
prompt("summary", "text");
|
|
ok(true, "prompt is closed");
|
|
|
|
os.removeObserver(onPromptLoad, "tabmodal-dialog-loaded");
|
|
os.removeObserver(onPromptLoad, "common-dialog-loaded");
|
|
}
|
|
|
|
function onPromptLoad(subject, topic, data)
|
|
{
|
|
ok(true, "onPromptLoad is called");
|
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
gPromptInput = subject.Dialog.ui.loginTextbox;
|
|
gPromptInput.addEventListener("focus", onPromptFocus, false);
|
|
// shift focus to ensure it fires.
|
|
subject.Dialog.ui.button0.focus();
|
|
gPromptInput.focus();
|
|
}
|
|
|
|
function onPromptFocus() {
|
|
ok(true, "onPromptFocus is called");
|
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
gPromptInput.removeEventListener("focus", onPromptFocus, false);
|
|
|
|
var systemGroup =
|
|
Components.classes["@mozilla.org/eventlistenerservice;1"].
|
|
getService(Components.interfaces.nsIEventListenerService).
|
|
systemEventGroup;
|
|
gPromptInput.QueryInterface(Components.interfaces.nsIDOM3EventTarget);
|
|
var listener = {
|
|
handleEvent: function _hv(aEvent)
|
|
{
|
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
var isPrevented = aEvent.getPreventDefault();
|
|
ok(!isPrevented, "ESC key event is prevented by editor");
|
|
gPromptInput.removeGroupedEventListener("keypress", listener, false,
|
|
systemGroup);
|
|
SimpleTest.finish();
|
|
}
|
|
};
|
|
gPromptInput.addGroupedEventListener("keypress", listener, false,
|
|
systemGroup);
|
|
ok(true, "sending key");
|
|
synthesizeKey("VK_ESCAPE", { }, gPromptInput.ownerDocument.defaultView);
|
|
}
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|