Bug 1266510: Try explicitly focusing new browser window before waiting for focus change event. r=me
authorKris Maglione <maglione.k@gmail.com>
Sun, 06 Nov 2016 19:03:03 -0800
changeset 351414 a4b855274882da6fb53e9ba618b403d6cfa11264
parent 351413 9438fd24fd96114d9513f49f88f48b4c694efa99
child 351415 4ffa6e380d58d41cf7ea567e9485a09c07d7ba87
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1266510
milestone52.0a1
Bug 1266510: Try explicitly focusing new browser window before waiting for focus change event. r=me MozReview-Commit-ID: B3mod2MtA8d
browser/components/extensions/test/browser/browser_ext_windows_events.js
--- a/browser/components/extensions/test/browser/browser_ext_windows_events.js
+++ b/browser/components/extensions/test/browser/browser_ext_windows_events.js
@@ -67,16 +67,20 @@ add_task(function* testWindowsEvents() {
   let currentWindowId = WindowManager.getId(currentWindow);
   info(`Current window ID: ${currentWindowId}`);
 
   info(`Create browser window 1`);
   let win1 = yield BrowserTestUtils.openNewBrowserWindow();
   let win1Id = yield extension.awaitMessage("window-created");
   info(`Window 1 ID: ${win1Id}`);
 
+  // This shouldn't be necessary, but tests intermittently fail, so let's give
+  // it a try.
+  win1.focus();
+
   let winId = yield extension.awaitMessage(`window-focus-changed`);
   is(winId, win1Id, "Got focus change event for the correct window ID.");
 
   info(`Create browser window 2`);
   let win2 = yield BrowserTestUtils.openNewBrowserWindow();
   let win2Id = yield extension.awaitMessage("window-created");
   info(`Window 2 ID: ${win2Id}`);