Bug 1500818 - wait for focus and activate of new windows in BTU.waitForNewWindow, r=dao

Differential Revision: https://phabricator.services.mozilla.com/D9364

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gijs Kruitbosch 2018-10-22 13:10:35 +00:00
parent a8cf5d4304
commit 73fbe18957
2 changed files with 5 additions and 0 deletions

View File

@ -7,6 +7,7 @@ const TEST_LINK = "https://example.com/";
const RESOURCE_LINK = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://example.com") + "test_contextmenu_links.html";
async function activateContextAndWaitFor(selector, where) {
info("Starting test for " + where);
let contextMenuItem = "openlink";
let openPromise;
let closeMethod;
@ -54,7 +55,9 @@ async function activateContextAndWaitFor(selector, where) {
contextMenu.hidePopup();
await awaitPopupHidden;
info("Waiting for the link to open");
let openedThing = await openPromise;
info("Waiting for the opened window/tab to close");
await closeMethod(openedThing);
}

View File

@ -589,6 +589,8 @@ var BrowserTestUtils = {
let promises = [
TestUtils.topicObserved("browser-delayed-startup-finished",
subject => subject == win),
this.waitForEvent(win, "focus"),
this.waitForEvent(win, "activate"),
];
if (url) {