summaryrefslogtreecommitdiffstats
path: root/mailnews/base/prefs/content/AccountWizard.js
diff options
context:
space:
mode:
Diffstat (limited to 'mailnews/base/prefs/content/AccountWizard.js')
-rw-r--r--mailnews/base/prefs/content/AccountWizard.js26
1 files changed, 11 insertions, 15 deletions
diff --git a/mailnews/base/prefs/content/AccountWizard.js b/mailnews/base/prefs/content/AccountWizard.js
index 1903cbc88..90d729418 100644
--- a/mailnews/base/prefs/content/AccountWizard.js
+++ b/mailnews/base/prefs/content/AccountWizard.js
@@ -53,7 +53,9 @@ var gPrefsBundle, gMessengerBundle;
// the current nsIMsgAccount
var gCurrentAccount;
-// default account
+// The default account before we create a new account.
+// We need to store this as just asking for the default account may switch
+// it to the newly created one if there was none before.
var gDefaultAccount;
// the current associative array that
@@ -85,14 +87,9 @@ function onAccountWizardLoad() {
checkForInvalidAccounts();
- try {
- gDefaultAccount = MailServices.accounts.defaultAccount;
- }
- catch (ex) {
- // no default account, this is expected the first time you launch mail
- // on a new profile
- gDefaultAccount = null;
- }
+ // It is fine if there is no default account, this is expected the first
+ // time you launch mail on a new profile.
+ gDefaultAccount = MailServices.accounts.defaultAccount;
// Set default value for global inbox checkbox
var checkGlobalInbox = document.getElementById("deferStorage");
@@ -799,8 +796,7 @@ function getPreConfigDataForAccount(account)
function AccountToAccountData(account, defaultAccountData)
{
- dump("AccountToAccountData(" + account + ", " +
- defaultAccountData + ")\n");
+ dump("AccountToAccountData(" + account + ", " + defaultAccountData + ")\n");
var accountData = defaultAccountData;
if (!accountData)
accountData = new Object;
@@ -966,10 +962,10 @@ function onFlush() {
*/
function EnableCheckMailAtStartUpIfNeeded(newAccount)
{
- // Check if default account exists and if that account is alllowed to be
- // a default account. If no such account, make this one as the default account
+ // Check if default account existed.
+ // If no such account, make this one the default account
// and turn on the new mail check at startup for the current account
- if (!(gDefaultAccount && gDefaultAccount.incomingServer.canBeDefaultServer)) {
+ if (!gDefaultAccount) {
MailServices.accounts.defaultAccount = newAccount;
newAccount.incomingServer.loginAtStartUp = true;
newAccount.incomingServer.downloadOnBiff = true;
@@ -981,7 +977,7 @@ function SetSmtpRequiresUsernameAttribute(accountData)
// If this is the default server, time to set the smtp user name
// Set the generic attribute for requiring user name for smtp to true.
// ISPs can override the pref via rdf files.
- if (!(gDefaultAccount && gDefaultAccount.incomingServer.canBeDefaultServer)) {
+ if (!gDefaultAccount) {
accountData.smtpRequiresUsername = true;
}
}