summaryrefslogtreecommitdiffstats
path: root/dom/base/test/head.js
blob: 2b39f7a7b1b3f76d6c13ea2b7e9886254a668388 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
async function newFocusedWindow(trigger) {
  let winPromise = BrowserTestUtils.domWindowOpenedAndLoaded();
  let delayedStartupPromise = BrowserTestUtils.waitForNewWindow();

  await trigger();

  let win = await winPromise;
  // New windows get focused after the first paint, see bug 1262946
  await BrowserTestUtils.waitForContentEvent(
    win.gBrowser.selectedBrowser,
    "MozAfterPaint"
  );
  await delayedStartupPromise;
  return win;
}