diff options
author | Matt A. Tobin <email@mattatobin.com> | 2019-11-10 22:51:10 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2019-11-10 22:51:10 -0500 |
commit | 5d21f962db500a22697221d985709d5f24fa27f5 (patch) | |
tree | 76abad17d6a77770009f6b19ea3cc2b3cb9e88aa /mailnews/base/prefs/content/AccountManager.js | |
parent | 2fda56a84eca7a08f626704e81b5c4c571623e44 (diff) | |
download | UXP-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/AccountManager.js')
-rw-r--r-- | mailnews/base/prefs/content/AccountManager.js | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/mailnews/base/prefs/content/AccountManager.js b/mailnews/base/prefs/content/AccountManager.js index 83117f4ad..81fb115de 100644 --- a/mailnews/base/prefs/content/AccountManager.js +++ b/mailnews/base/prefs/content/AccountManager.js @@ -704,7 +704,7 @@ function onSetDefault(event) { if (event.target.getAttribute("disabled") == "true") return; - let previousDefault = getDefaultAccount(); + let previousDefault = MailServices.accounts.defaultAccount; MailServices.accounts.defaultAccount = currentAccount; markDefaultServer(currentAccount, previousDefault); @@ -771,7 +771,7 @@ function onRemoveAccount(event) { // Either the default account was deleted so there is a new one // or the default account was not changed. Either way, there is // no need to unmark the old one. - markDefaultServer(getDefaultAccount(), null); + markDefaultServer(MailServices.accounts.defaultAccount, null); } function saveAccount(accountValues, account) @@ -928,7 +928,7 @@ function updateItems(tree, account, addAccountItem, setDefaultItem, removeItem) // problem. Either way, we don't want the user to act on it. let server = account.incomingServer; - if (account != getDefaultAccount() && + if (account != MailServices.accounts.defaultAccount && server.canBeDefaultServer && account.identities.length > 0) canSetDefault = true; @@ -1379,18 +1379,6 @@ function getCurrentAccount() } /** - * Returns the default account without throwing exception if there is none. - * The account manager can be opened even if there are no account yet. - */ -function getDefaultAccount() { - try { - return MailServices.accounts.defaultAccount; - } catch (e) { - return null; // No default account yet. - } -} - -/** * Get the array of persisted form elements for the given page. */ function getPageFormElements() { @@ -1605,7 +1593,7 @@ var gAccountTree = { treeitem._account = account; } - markDefaultServer(getDefaultAccount(), null); + markDefaultServer(MailServices.accounts.defaultAccount, null); // Now add the outgoing server node. var treeitem = document.createElement("treeitem"); |