Bug 1902611 - Improve resiliency with corrupted chat buddy list. r=vineet

Differential Revision: https://phabricator.services.mozilla.com/D213764

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Martin Giger 2024-06-18 22:13:53 +00:00
Родитель 3974b3409d
Коммит 5ed5139c5f
2 изменённых файлов: 29 добавлений и 15 удалений

Просмотреть файл

@ -96,20 +96,32 @@ var AboutSupport = {
const accountDetails = [];
for (const account of MailServices.accounts.accounts) {
const server = account.incomingServer;
accountDetails.push({
key: account.key,
name: server.prettyName,
hostDetails:
"(" +
server.type +
") " +
server.hostName +
(server.port != -1 ? ":" + server.port : ""),
socketType: server.socketType,
authMethod: server.authMethod,
smtpServers: this._getSMTPDetails(account),
});
try {
const server = account.incomingServer;
accountDetails.push({
key: account.key,
name: server.prettyName,
hostDetails:
"(" +
server.type +
") " +
server.hostName +
(server.port != -1 ? ":" + server.port : ""),
socketType: server.socketType,
authMethod: server.authMethod,
smtpServers: this._getSMTPDetails(account),
});
} catch (error) {
// Populate placeholder data.
accountDetails.push({
key: account.key,
name: error.message,
hostDetails: "",
sokectType: "",
authMethod: "",
smtpServers: [],
});
}
}
function idCompare(accountA, accountB) {

Просмотреть файл

@ -1839,6 +1839,7 @@ var gAccountTree = {
let amChrome = "about:blank";
const panelsToKeep = [];
let server = null;
let validAccount = true;
// This "try {} catch {}" block is intentionally very long to catch
// unknown exceptions and confine them to this single account.
@ -1921,6 +1922,7 @@ var gAccountTree = {
console.error("Error accessing account " + accountID + ": " + e);
accountName = "Invalid account " + accountID;
panelsToKeep.length = 0;
validAccount = false;
}
// Create the top level tree-item.
@ -1940,7 +1942,7 @@ var gAccountTree = {
treeitem.classList.add("isSecure");
}
// For IM accounts, we can try to fetch a protocol specific icon.
if (server.type == "im") {
if (server.type == "im" && validAccount) {
treeitem.querySelector(".icon").style.backgroundImage =
"url(" +
ChatIcons.getProtocolIconURI(