mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-27 02:47:31 +09:00
Bug 342632 - Allow defaultAccount to return success with nullptr result when there is no usable account.
Tag #1273
This commit is contained in:
parent
07b587d4ed
commit
af2693fe73
11 changed files with 121 additions and 101 deletions
|
|
@ -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;
|
||||
|
||||
|
|
@ -1378,18 +1378,6 @@ function getCurrentAccount()
|
|||
return currentAccount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue