Bug 738234 - Make Account Provisioner dialog non-modal in the success state. r+ui-r=bwinton, a=bienvenu. GECKO130_2012052216_RELBRANCH
authorMike Conley <mconley@mozilla.com>
Thu, 24 May 2012 14:37:45 -0400
branchGECKO130_2012052216_RELBRANCH
changeset 11339 5fa5eaf77d48af3d2100b690a100475b4a8957cd
parent 11338 ed4dbed4f6093b0f2458584af0fef805dfd48b66
push idunknown
push userunknown
push dateunknown
reviewersbienvenu
bugs738234
Bug 738234 - Make Account Provisioner dialog non-modal in the success state. r+ui-r=bwinton, a=bienvenu.
mail/test/mozmill/newmailaccount/test-newmailaccount.js
mailnews/base/prefs/content/accountUtils.js
--- a/mail/test/mozmill/newmailaccount/test-newmailaccount.js
+++ b/mail/test/mozmill/newmailaccount/test-newmailaccount.js
@@ -154,25 +154,31 @@ function test_get_an_account() {
     return aURL.host == "localhost";
   });
 
   let tab = mc.tabmail.currentTabInfo;
 
   // Record how many accounts we start with.
   gNumAccounts = nAccounts();
 
-  // Plan for the account provisioner window to re-open, and then let
-  // subtest_get_an_account_part_2 run.
-  plan_for_modal_dialog("AccountCreation", subtest_get_an_account_part_2);
+  // Plan for the account provisioner window to re-open, and then run the
+  // controller through subtest_get_an_account_part_2. Since the Account
+  // Provisioner dialog is non-modal in the event of success, we use our
+  // normal window handlers.
+  plan_for_new_window("AccountCreation");
 
   // Click the OK button to order the account.
   let btn = tab.browser.contentWindow.document.querySelector("input[value=Send]");
   mc.click(new elib.Elem(btn));
 
-  wait_for_modal_dialog("AccountCreation");
+  let ac = wait_for_new_window("AccountCreation");
+
+  plan_for_window_close(ac);
+  subtest_get_an_account_part_2(ac);
+  wait_for_window_close();
 
   // Make sure we set the default search engine
   let engine = Services.search.getEngineByName("bar");
   assert_equals(engine, Services.search.currentEngine);
 }
 
 /**
  * This is a subtest for test_get_an_account, and runs the first time the
--- a/mailnews/base/prefs/content/accountUtils.js
+++ b/mailnews/base/prefs/content/accountUtils.js
@@ -379,27 +379,33 @@ function NewMailAccountProvisioner(aMsgW
     args.NewComposeMessage = mail3Pane.ComposeMessage;
 
   if (!args.openAddonsMgr)
     args.openAddonsMgr = mail3Pane.openAddonsMgr;
 
   if (!args.okCallback)
     args.okCallback = null;
 
-  if (!args.success)
+  let windowParams = "chrome,titlebar,centerscreen,width=640,height=480";
+
+  if (!args.success) {
     args.success = false;
+    // If we're not opening up the success dialog, then our window should be
+    // modal.
+    windowParams = "modal," + windowParams;
+  }
 
   // NOTE: If you're a developer, and you notice that the jQuery code in
   // accountProvisioner.xhtml isn't throwing errors or warnings, that's due
   // to bug 688273.  Just make the window non-modal to get those errors and
   // warnings back, and then clear this comment when bug 688273 is closed.
   window.openDialog(
     "chrome://messenger/content/newmailaccount/accountProvisioner.xhtml",
     "AccountCreation",
-    "modal,chrome,titlebar,centerscreen,width=640,height=480",
+    windowParams,
     args);
 }
 
 /**
  * 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