2017-06-22 13:51:42 +03:00
|
|
|
add_task(async function() {
|
|
|
|
await new Promise(resolve => waitForFocus(resolve, window));
|
2016-03-15 04:24:40 +03:00
|
|
|
|
|
|
|
const kPageURL =
|
|
|
|
"http://example.org/browser/editor/libeditor/tests/bug527935.html";
|
2017-06-22 13:51:42 +03:00
|
|
|
await BrowserTestUtils.withNewTab(
|
|
|
|
{
|
2016-03-15 04:24:40 +03:00
|
|
|
gBrowser,
|
2018-09-13 10:58:19 +03:00
|
|
|
url: kPageURL,
|
2017-06-22 13:51:42 +03:00
|
|
|
},
|
|
|
|
async function(aBrowser) {
|
2016-03-15 04:24:40 +03:00
|
|
|
var popupShown = false;
|
|
|
|
function listener() {
|
|
|
|
popupShown = true;
|
|
|
|
}
|
|
|
|
SpecialPowers.addAutoCompletePopupEventListener(
|
|
|
|
window,
|
|
|
|
"popupshowing",
|
|
|
|
listener
|
|
|
|
);
|
|
|
|
|
2017-06-22 13:51:42 +03:00
|
|
|
await ContentTask.spawn(aBrowser, {}, async function() {
|
2016-03-15 04:24:40 +03:00
|
|
|
var window = content.window.wrappedJSObject;
|
|
|
|
var document = window.document;
|
|
|
|
var formTarget = document.getElementById("formTarget");
|
|
|
|
var initValue = document.getElementById("initValue");
|
|
|
|
|
|
|
|
window.loadPromise = new Promise(resolve => {
|
|
|
|
formTarget.onload = resolve;
|
|
|
|
});
|
|
|
|
|
|
|
|
initValue.focus();
|
|
|
|
initValue.value = "foo";
|
|
|
|
});
|
|
|
|
|
2018-02-14 22:15:39 +03:00
|
|
|
EventUtils.synthesizeKey("KEY_Enter");
|
2016-03-15 04:24:40 +03:00
|
|
|
|
2017-06-22 13:51:42 +03:00
|
|
|
await ContentTask.spawn(aBrowser, {}, async function() {
|
2016-03-15 04:24:40 +03:00
|
|
|
var window = content.window.wrappedJSObject;
|
|
|
|
var document = window.document;
|
|
|
|
|
2017-06-22 13:51:42 +03:00
|
|
|
await window.loadPromise;
|
2016-03-15 04:24:40 +03:00
|
|
|
|
|
|
|
var newInput = document.createElement("input");
|
|
|
|
newInput.setAttribute("name", "test");
|
|
|
|
document.body.appendChild(newInput);
|
|
|
|
|
|
|
|
var event = document.createEvent("KeyboardEvent");
|
|
|
|
|
|
|
|
event.initKeyEvent(
|
|
|
|
"keypress",
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
null,
|
|
|
|
false,
|
|
|
|
false,
|
2019-07-05 11:45:46 +03:00
|
|
|
false,
|
|
|
|
false,
|
2016-03-15 04:24:40 +03:00
|
|
|
0,
|
|
|
|
"f".charCodeAt(0)
|
|
|
|
);
|
|
|
|
newInput.value = "";
|
|
|
|
newInput.focus();
|
|
|
|
newInput.dispatchEvent(event);
|
|
|
|
});
|
|
|
|
|
2017-06-22 13:51:42 +03:00
|
|
|
await new Promise(resolve => hitEventLoop(resolve, 100));
|
2016-03-15 04:24:40 +03:00
|
|
|
|
|
|
|
ok(!popupShown, "Popup must not be opened");
|
|
|
|
SpecialPowers.removeAutoCompletePopupEventListener(
|
|
|
|
window,
|
|
|
|
"popupshowing",
|
|
|
|
listener
|
|
|
|
);
|
|
|
|
}
|
2019-07-05 11:45:46 +03:00
|
|
|
);
|
2016-03-15 04:24:40 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
function hitEventLoop(func, times) {
|
|
|
|
if (times > 0) {
|
|
|
|
setTimeout(hitEventLoop, 0, func, times - 1);
|
|
|
|
} else {
|
|
|
|
setTimeout(func, 0);
|
|
|
|
}
|
|
|
|
}
|