Bug 1133581 - do not call selectServer() from Account manager if it is not open when skipping Account provisioner. r=mkmelin, r=iann, a=rkent
authoraceman <acelists@atlas.sk>
Fri, 06 Mar 2015 23:05:05 -0800
changeset 25781 1a31d788c7266b6403b80da11c562b3c788de272
parent 25780 487d106725e8f877cd44fbdb17d464f1be523a23
child 25782 545f15e719f2db34436660d1764961a3a5a77445
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)
reviewersmkmelin, iann, rkent
bugs1133581
Bug 1133581 - do not call selectServer() from Account manager if it is not open when skipping Account provisioner. r=mkmelin, r=iann, a=rkent
mailnews/base/prefs/content/accountUtils.js
--- a/mailnews/base/prefs/content/accountUtils.js
+++ b/mailnews/base/prefs/content/accountUtils.js
@@ -422,33 +422,41 @@ function NewMailAccountProvisioner(aMsgW
 /**
  * Open the New Mail Account Wizard, or focus it if it's already open.
  *
  * @param msgWindow a msgWindow for us to use to verify the accounts.
  * @param okCallback an optional callback for us to call back to if
  *                   everything's okay.
  * @param extraData an optional param that allows us to pass data in and
  *                  out.  Used in the upcoming AccountProvisioner add-on.
- * @see msgOpenAccountWizard below for the previous implementation.
+ * @see msgOpenAccountWizard above for the previous implementation.
  */
 function msgNewMailAccount(msgWindow, okCallback, extraData)
 {
   if (!msgWindow)
     throw new Error("msgNewMailAccount must be given a msgWindow.");
 
   let existingWindow = Services.wm.getMostRecentWindow("mail:autoconfig");
-  if (existingWindow)
+  if (existingWindow) {
     existingWindow.focus();
-  else
+  } else {
     // disabling modal for the time being, see 688273 REMOVEME
     window.openDialog("chrome://messenger/content/accountcreation/emailWizard.xul",
                       "AccountSetup", "chrome,titlebar,centerscreen",
                       {msgWindow:msgWindow,
                        okCallback:okCallback,
                        extraData:extraData});
+  }
+
+  // No sense to run the remaining code while the dialog is not modal.
+  return;
 
   // If we started with no servers at all and "smtp servers" list selected,
   // refresh display somehow. Bug 58506.
   // TODO Better fix: select newly created account (in all cases)
-  if (typeof(getCurrentAccount) == "function" && // in AccountManager, not menu
-      !getCurrentAccount())
+  let existingAccountManager =
+      Services.wm.getMostRecentWindow("mailnews:accountmanager");
+  // in AccountManager, not menu
+  if (existingAccountManager && typeof(getCurrentAccount) == "function" &&
+      !getCurrentAccount()) {
     selectServer(null, null);
+  }
 }