2010-12-06 22:30:05 -08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=527935
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 527935</title>
|
|
|
|
<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=527935">Mozilla Bug 527935</a>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content">
|
|
|
|
<iframe id="formTarget" name="formTarget"></iframe>
|
|
|
|
<form action="data:text/html," target="formTarget">
|
|
|
|
<input name="test" id="initValue"><input type="submit">
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
/** Test for Bug 527935 **/
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
SimpleTest.waitForFocus(function() {
|
|
|
|
var formTarget = document.getElementById("formTarget");
|
|
|
|
var initValue = document.getElementById("initValue");
|
|
|
|
|
|
|
|
formTarget.addEventListener("load", function() {
|
|
|
|
var newInput = document.createElement("input");
|
|
|
|
newInput.setAttribute("name", "test");
|
|
|
|
document.body.appendChild(newInput);
|
|
|
|
|
|
|
|
setTimeout(function() {
|
|
|
|
var popupShown = false;
|
|
|
|
function listener() {
|
|
|
|
popupShown = true;
|
|
|
|
}
|
2011-01-29 18:47:17 -08:00
|
|
|
SpecialPowers.addAutoCompletePopupEventListener(window, listener);
|
2010-12-06 22:30:05 -08:00
|
|
|
|
|
|
|
var event = document.createEvent("KeyboardEvent");
|
|
|
|
|
|
|
|
event.initKeyEvent("keypress", true, true, null, false, false,
|
|
|
|
false, false, 0, "f".charCodeAt(0));
|
|
|
|
newInput.value = "";
|
|
|
|
newInput.focus();
|
|
|
|
newInput.dispatchEvent(event);
|
|
|
|
|
2011-04-16 16:39:34 -07:00
|
|
|
hitEventLoop(function() {
|
2010-12-06 22:30:05 -08:00
|
|
|
ok(!popupShown, "Popup must not be opened");
|
2011-01-29 18:47:17 -08:00
|
|
|
SpecialPowers.removeAutoCompletePopupEventListener(window, listener);
|
2010-12-06 22:30:05 -08:00
|
|
|
SimpleTest.finish();
|
2011-04-16 16:39:34 -07:00
|
|
|
}, 100);
|
2010-12-06 22:30:05 -08:00
|
|
|
}, 0);
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
initValue.focus();
|
|
|
|
initValue.value = "foo";
|
|
|
|
synthesizeKey("VK_ENTER", {});
|
|
|
|
});
|
|
|
|
|
2011-04-16 16:39:34 -07:00
|
|
|
function hitEventLoop(func, times) {
|
|
|
|
if (times > 0) {
|
|
|
|
setTimeout(hitEventLoop, 0, func, times - 1);
|
|
|
|
} else {
|
|
|
|
setTimeout(func, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-06 22:30:05 -08:00
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|