Bug 1502982 - use a capturing focus listeners so we catch focus in windows that don't have a URL bar etc., r=bdahl
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 29 Oct 2018 22:16:05 +0000
changeset 443450 585c23a3f8c6
parent 443449 b50e31d758b1
child 443451 9de1bee6adc2
push id34957
push userdvarga@mozilla.com
push dateTue, 30 Oct 2018 09:39:58 +0000
treeherdermozilla-central@a7332ea46f0f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbdahl
bugs1502982
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1502982 - use a capturing focus listeners so we catch focus in windows that don't have a URL bar etc., r=bdahl Differential Revision: https://phabricator.services.mozilla.com/D10103
testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
--- a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
+++ b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
@@ -576,17 +576,17 @@ var BrowserTestUtils = {
 
         if (!anyWindow) {
           Services.ww.unregisterNotification(observe);
         }
 
         // Add these event listeners now since they may fire before the
         // DOMContentLoaded event down below.
         let promises = [
-          this.waitForEvent(win, "focus"),
+          this.waitForEvent(win, "focus", true),
           this.waitForEvent(win, "activate"),
         ];
 
         if (url) {
           await this.waitForEvent(win, "DOMContentLoaded");
 
           if (win.document.documentURI != AppConstants.BROWSER_CHROME_URL) {
             return;
@@ -718,17 +718,17 @@ var BrowserTestUtils = {
    */
   async openNewBrowserWindow(options = {}) {
     let currentWin = BrowserWindowTracker.getTopWindow({private: false});
     if (!currentWin) {
       throw new Error("Can't open a new browser window from this helper if no non-private window is open.");
     }
     let win = currentWin.OpenBrowserWindow(options);
 
-    let promises = [this.waitForEvent(win, "focus"), this.waitForEvent(win, "activate")];
+    let promises = [this.waitForEvent(win, "focus", true), this.waitForEvent(win, "activate")];
 
     // Wait for browser-delayed-startup-finished notification, it indicates
     // that the window has loaded completely and is ready to be used for
     // testing.
     promises.push(
       TestUtils.topicObserved("browser-delayed-startup-finished",
                               subject => subject == win).then(() => win)
     );