Bug 1073311 - Wait for the window to be focused after opening it, and wait for the main window to be focused after closing the newly opened window
authorEhsan Akhgari <ehsan@mozilla.com>
Sun, 13 Sep 2015 13:15:19 -0400
changeset 294851 eb3784e3b5847ee99d443d474906f57242bb603b
parent 294850 ab62ceb75234f4ec571cbc3ff6128799d8bf9a79
child 294852 e617c037515ba7c98b1d549832a3fc8decb52663
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1073311
milestone43.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 1073311 - Wait for the window to be focused after opening it, and wait for the main window to be focused after closing the newly opened window
browser/components/customizableui/test/browser_880164_customization_context_menus.js
--- a/browser/components/customizableui/test/browser_880164_customization_context_menus.js
+++ b/browser/components/customizableui/test/browser_880164_customization_context_menus.js
@@ -271,16 +271,18 @@ add_task(function() {
   yield endCustomizing();
 });
 
 // Test the toolbarbutton panel context menu in customization mode
 // without opening the panel before customization mode
 add_task(function() {
   this.otherWin = yield openAndLoadWindow(null, true);
 
+  yield new Promise(resolve => waitForFocus(resolve, this.otherWin));
+
   yield startCustomizing(this.otherWin);
 
   let contextMenu = this.otherWin.document.getElementById("customizationPanelItemContextMenu");
   let shownPromise = popupShown(contextMenu);
   let newWindowButton = this.otherWin.document.getElementById("wrapper-new-window-button");
   EventUtils.synthesizeMouse(newWindowButton, 2, 2, {type: "contextmenu", button: 2}, this.otherWin);
   yield shownPromise;
 
@@ -293,16 +295,18 @@ add_task(function() {
   checkContextMenu(contextMenu, expectedEntries, this.otherWin);
 
   let hiddenContextPromise = popupHidden(contextMenu);
   contextMenu.hidePopup();
   yield hiddenContextPromise;
   yield endCustomizing(this.otherWin);
   yield promiseWindowClosed(this.otherWin);
   this.otherWin = null;
+
+  yield new Promise(resolve => waitForFocus(resolve, window));
 });
 
 // Bug 945191 - Combined buttons show wrong context menu options
 // when they are in the toolbar.
 add_task(function() {
   yield startCustomizing();
   let contextMenu = document.getElementById("customizationPanelItemContextMenu");
   let shownPromise = popupShown(contextMenu);