summaryrefslogtreecommitdiffstats
path: root/dom/base/test/head.js
diff options
context:
space:
mode:
Diffstat (limited to 'dom/base/test/head.js')
-rw-r--r--dom/base/test/head.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/dom/base/test/head.js b/dom/base/test/head.js
new file mode 100644
index 0000000000..2b39f7a7b1
--- /dev/null
+++ b/dom/base/test/head.js
@@ -0,0 +1,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;
+}