error when adding first account: 0x80004005 (NS_ERROR_FAILURE) [nsIMsgAccountManager.defaultAccount]" mailInstrumentation.js in minst_postStateObject line 101

RESOLVED FIXED in Thunderbird 36.0

Status

RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: aryx, Assigned: aryx)

Tracking

Trunk
Thunderbird 36.0

Thunderbird Tracking Flags

(thunderbird36 fixed)

Details

Attachments

(1 attachment, 1 obsolete attachment)

Thunderbird 34.0a1 20140723 and 31.0 on Windows 8.1

When creating a new (existing account) to Thunderbird, remote debugging shows the following error twice (twice, because it gets logged as error + dumped):

[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIMsgAccountManager.defaultAccount]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: resource://gre/modules/mailInstrumentation.js :: minst_postStateObject :: line 101"  data: no] errUtils.js:96

Reason: _postStateObject doesn't handle MailServices.accounts.accounts.length == 0 which is true when the SMTP server gets created (which has to run before the creation of the incoming account.)
Comment on attachment 8471593 [details] [diff] [review]
patch, v1

Review of attachment 8471593 [details] [diff] [review]:
-----------------------------------------------------------------

::: mail/base/modules/mailInstrumentation.js
@@ +99,5 @@
> +    // Getting defaultAccount will throw an exception if no account is set up.
> +    // This method runs for the smtp server before the account has been set up.
> +    if (MailServices.accounts.accounts.length == 0) {
> +      return;
> +    }

no need for the braces, and you can move this up to be first in the function
Attachment #8471593 - Flags: review?(mkmelin+mozilla) → review+
https://hg.mozilla.org/comm-central/rev/5e5314dec210
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 36.0
status-thunderbird36: --- → fixed
You need to log in before you can comment on or make changes to this bug.