Bug 1039714 - Wait for the modal dialog to be closed surely. r=standard8. a=test-only
authorHiroyuki Ikezoe <hiikezoe>
Wed, 10 Sep 2014 15:22:00 +0300
changeset 25583 5e7ec0714531f84402462ec033b9470d47bfd684
parent 25582 0ba98d79a13ac6b69a84f4a1f672a1de3ef26b0f
child 25584 3c6f24c7f150445fe58b385ed2f2fb33b334fc11
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstandard8, test-only
bugs1039714
Bug 1039714 - Wait for the modal dialog to be closed surely. r=standard8. a=test-only
mail/test/mozmill/shared-modules/test-window-helpers.js
--- a/mail/test/mozmill/shared-modules/test-window-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-window-helpers.js
@@ -307,28 +307,30 @@ var WindowWatcher = {
                                         .getInterface(Ci.nsIDOMWindow);
       let troller = new controller.MozMillController(domWindow);
       augment_controller(troller, this.waitingForOpen);
 
       this._timer.cancel();
 
       let self = this;
       function startTest() {
+        self.planForWindowClose(troller.window);
         try {
           let runner = new frame.Runner(collector);
           runner.wrapper(self.subTestFunc, troller);
         }
         finally {
           self.subTestFunc = null;
         }
 
         // if the test failed, make sure we force the window closed...
         // except I'm not sure how to easily figure that out...
         // so just close it no matter what.
         troller.window.close();
+        self.waitForWindowClose();
 
         self.waitingList.delete(self.waitingForOpen);
         // now we are waiting for it to close...
         self.waitingForClose = self.waitingForOpen;
         self.waitingForOpen = null;
       }
 
       let targetFocusedWindow = {};
@@ -950,17 +952,16 @@ var AugmentEverybodyWith = {
      * @param aKeepOpen  If set to true the popups are not closed after last click.
      *
      * @return  An array of popup elements that were left open. It will be
      *          an empty array if aKeepOpen was set to true.
      */
     click_menus_in_sequence: function _click_menus(aRootPopup, aActions, aKeepOpen) {
       if (aRootPopup.state == "closed")
         aRootPopup.openPopup(null, "", 0, 0, true, true);
-      aRootPopup.focus(); // This is a hack that can be removed once the focus issues on Linux are solved.
       if (aRootPopup.state != "open") { // handle "showing"
         utils.waitFor(function() { return aRootPopup.state == "open"; },
                       "Popup never opened! id=" + aRootPopup.id +
                       ", state=" + aRootPopup.state, 5000, 50);
       }
       // These popups sadly do not close themselves, so we need to keep track
       // of them so we can make sure they end up closed.
       let closeStack = [aRootPopup];
@@ -1004,17 +1005,16 @@ var AugmentEverybodyWith = {
             break;
         }
 
         if (!matchingNode)
           throw new Error("Did not find matching menu item for action index " +
                           iAction + ": " + JSON.stringify(actionObj));
 
         this.click(new elib.Elem(matchingNode));
-        matchingNode.focus(); // This is a hack that can be removed once the focus issues on Linux are solved.
         if ("menupopup" in matchingNode) {
           curPopup = matchingNode.menupopup;
           closeStack.push(curPopup);
           utils.waitFor(function() { return curPopup.state == "open"; },
                         "Popup never opened at action depth " + iAction +
                         "; id=" + curPopup.id + ", state=" + curPopup.state,
                         5000, 50);
         }