Closed Bug 1052464 Opened 7 years ago Closed 7 years ago

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

Categories

(Thunderbird :: General, defect)

defect
Not set
normal

Tracking

(thunderbird36 fixed)

RESOLVED FIXED
Thunderbird 36.0
Tracking Status
thunderbird36 --- fixed

People

(Reporter: aryx, Assigned: aryx)

Details

Attachments

(1 file, 1 obsolete file)

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.)
Attached patch patch, v1 (obsolete) — Splinter Review
Attachment #8471593 - Flags: review?(mkmelin+mozilla)
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
Closed: 7 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 36.0
You need to log in before you can comment on or make changes to this bug.