Closed Bug 1991298 Opened 7 months ago Closed 6 months ago

Bug 1956258 broke default accounts added via JsAccount

Categories

(MailNews Core :: Account Manager, defect)

Thunderbird 140
defect

Tracking

(thunderbird_esr140 affected, thunderbird143 wontfix, thunderbird144 affected, thunderbird145 affected)

RESOLVED FIXED
146 Branch
Tracking Status
thunderbird_esr140 --- affected
thunderbird143 --- wontfix
thunderbird144 --- affected
thunderbird145 --- affected

People

(Reporter: betterbird.project+18, Assigned: welpy-cw, NeedInfo)

References

(Regression, )

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 Edg/140.0.0.0

Steps to reproduce:

When OWL is used and the OWL account is set as default account, this is lost after restart.

Regressed by:
https://searchfox.org/comm-central/rev/04808e85d3457b3833f6187ccd5f31d476065b3f/mailnews/base/src/nsMsgAccountManager.cpp#842-851
since the add-on provided account isn't active yet during restart.

The correct solution is this minimal-invasive solution:
https://phabricator.services.mozilla.com/D257098?id=1082030

Keywords: regression
Regressed by: 1956258

Uh, the minimal-invasive solution is already landed (and uplifted to 140) so I don't know what you propose.

You landed a very invasive solution modifying the getter instead of only getting the default account when really required.
The suggestion is to back that out and land https://phabricator.services.mozilla.com/D257098?id=1082030 instead. Please scroll down to the end to see the code changes, essentially only:

--- a/mailnews/compose/src/nsMsgComposeService.cpp
+++ b/mailnews/compose/src/nsMsgComposeService.cpp
@@ -563,8 +563,11 @@ nsMsgComposeService::GetDefaultIdentity(
   nsCOMPtr<nsIMsgAccount> defaultAccount;
   rv = accountManager->GetDefaultAccount(getter_AddRefs(defaultAccount));
   NS_ENSURE_SUCCESS(rv, rv);
 
+  if (!defaultAccount) {
+    accountManager->AutosetDefaultAccount();
+  }
   return defaultAccount ? defaultAccount->GetDefaultIdentity(_retval) : NS_OK;
 }
See Also: → 1993449
Flags: needinfo?(h.w.forms)
Duplicate of this bug: 1993449
See Also: 1993449

Ben, is this something you can workaround in your add-on without much hassle? Otherwise I'd suggest to fix this regression, also there may be more add-ons relying on JsAccount.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(h.w.forms) → needinfo?(ben.bucksch)
Summary: Bug 1956258 broke default accounts added via JS Account → Bug 1956258 broke default accounts added via JsAccount

Not easy for us to work around, no, because by the time that Owl starts, Thunderbird has already removed the default account, and we have no way to know that we were the default account. The only way for us to work around that would be monitor the default account changes at all times, to make a separate pref where we remember that we were the default account, basically a duplicate of the Thunderbird pref, and restore the default account on every startup. There is obviously quite some potential for things to go wrong, so it's definitely not easy.

The bug is that Thunderbird takes away the default account prematurely, too early. Much easier to fix that at the core.

Thank you for considering this.

Since Bug 1956258, nsMsgAccountManager::GetDefaultAccount always tries to
auto-set it if none could be found. When this function is first called during
startup, JsAccounts may not have been initialized yet, so the getter should
simply return nullptr in this case.

Assignee: nobody → h.w.forms
Status: NEW → ASSIGNED
Target Milestone: --- → 146 Branch
Attachment #9519830 - Attachment description: Bug 1991298 - Do not reassign default status of uninitialized accounts. r=BenB,#thunderbird-back-end-reviewers → Bug 1991298 - Do not reassign default status of uninitialized accounts. r=mkmelin

Pushed by kaie@kuix.de:
https://hg.mozilla.org/comm-central/rev/4e33048c9e0f
Do not reassign default status of uninitialized accounts. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: