summaryrefslogtreecommitdiffstats
path: root/mailnews/base/prefs/content/AccountWizard.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2019-11-10 22:51:10 -0500
committerMatt A. Tobin <email@mattatobin.com>2019-11-10 22:51:10 -0500
commit5d21f962db500a22697221d985709d5f24fa27f5 (patch)
tree76abad17d6a77770009f6b19ea3cc2b3cb9e88aa /mailnews/base/prefs/content/AccountWizard.js
parent2fda56a84eca7a08f626704e81b5c4c571623e44 (diff)
downloadUXP-5d21f962db500a22697221d985709d5f24fa27f5.tar
UXP-5d21f962db500a22697221d985709d5f24fa27f5.tar.gz
UXP-5d21f962db500a22697221d985709d5f24fa27f5.tar.lz
UXP-5d21f962db500a22697221d985709d5f24fa27f5.tar.xz
UXP-5d21f962db500a22697221d985709d5f24fa27f5.zip
Bug 342632 - Allow defaultAccount to return success with nullptr result when there is no usable account.
Tag #1273
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;
}
}