1 add_task(async function () {
2 await new Promise(resolve => waitForFocus(resolve, window));
5 "http://example.org/browser/editor/libeditor/tests/bug527935.html";
6 await BrowserTestUtils.withNewTab(
11 async function (aBrowser) {
12 var popupShown = false;
16 SpecialPowers.addAutoCompletePopupEventListener(
22 await SpecialPowers.spawn(aBrowser, [], async function () {
23 var window = content.window.wrappedJSObject;
24 var document = window.document;
25 var formTarget = document.getElementById("formTarget");
26 var initValue = document.getElementById("initValue");
28 window.loadPromise = new Promise(resolve => {
29 formTarget.onload = resolve;
33 initValue.value = "foo";
36 EventUtils.synthesizeKey("KEY_Enter");
38 await SpecialPowers.spawn(aBrowser, [], async function () {
39 var window = content.window.wrappedJSObject;
40 var document = window.document;
42 await window.loadPromise;
44 var newInput = document.createElement("input");
45 newInput.setAttribute("name", "test");
46 document.body.appendChild(newInput);
48 var event = new window.KeyboardEvent("keypress", {
53 charCode: "f".charCodeAt(0),
57 newInput.dispatchEvent(event);
60 await new Promise(resolve => hitEventLoop(resolve, 100));
62 ok(!popupShown, "Popup must not be opened");
63 SpecialPowers.removeAutoCompletePopupEventListener(
72 function hitEventLoop(func, times) {
74 setTimeout(hitEventLoop, 0, func, times - 1);