diff --git a/testing/marionette/browser.js b/testing/marionette/browser.js index dead62df27a2..924731ae73d9 100644 --- a/testing/marionette/browser.js +++ b/testing/marionette/browser.js @@ -353,7 +353,11 @@ browser.Context = class { subject => subject == win ); - win.focus(); + // Bug 1509380 - Missing focus/activate event when Firefox is not + // the top-most application. As such wait for the next tick, and + // manually focus the newly opened window. + win.setTimeout(() => win.focus(), 0); + await Promise.all([activated, focused, startup]); // The new window shouldn't get focused. As such set the diff --git a/testing/marionette/harness/marionette_harness/runner/mixins/window_manager.py b/testing/marionette/harness/marionette_harness/runner/mixins/window_manager.py index e98eddae91b1..79f702ebc258 100644 --- a/testing/marionette/harness/marionette_harness/runner/mixins/window_manager.py +++ b/testing/marionette/harness/marionette_harness/runner/mixins/window_manager.py @@ -163,7 +163,10 @@ class WindowManagerMixin(object): let win = window.openDialog(url, null, "chrome,centerscreen"); let focused = waitForFocus(win); - win.focus(); + // Bug 1509380 - Missing focus/activate event when Firefox is not + // the top-most application. As such wait for the next tick, and + // manually focus the newly opened window. + win.setTimeout(() => win.focus(), 0); await focused; // The new window shouldn't get focused. As such set the