No account selected when opening the account settings dialog while the inbox of the unified view is selected

RESOLVED FIXED in Thunderbird 14.0

Status

Thunderbird
Account Manager
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: florian, Assigned: florian)

Tracking

Trunk
Thunderbird 14.0

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

Created attachment 616952 [details] [diff] [review]
Patch

I see this in the error console when this happens:
JavaScript error: chrome://messenger/content/AccountManager.js, line 176: childrenNode.childNodes[i]._account is undefined


I was afraid this was caused by some of my changes for bug 742238 so I investigated. The problem is that when the 'Inbox' of the unified view is selected, the code opening the Account Settings… dialog wants to select a "Unified folders" account that isn't in the list, so the code looking for this account iterates through the whole list of accounts and fails on the "Outgoing Server (SMTP)" tree item that doesn't have an _account property.

The attached patch prevents the code from failing on tree items that don't have the _account property and to fall back to the first account when the requested account isn't in the list.
Attachment #616952 - Flags: review?(dbienvenu)

Comment 1

5 years ago
I can confirm the error. I like the patch.
But as you "document.getElementById("account-tree-children")" twice in the common path, wouldn't it be better to:
var childrenNode = document.getElementById("account-tree-children");
var accountNode = childrenNode.firstChild;

(I have seen cases where even "document.getElementById("account-tree-children") is null" (when playing with edge cases in bug 723277 comment 44), but this patch does not make that worse, I think. I'll look at that in other bug.)
Created attachment 616962 [details] [diff] [review]
Patch v2

Updated patch taking into account the suggestion from comment 1.

(In reply to :aceman from comment #1)

> (I have seen cases where even
> "document.getElementById("account-tree-children") is null" (when playing
> with edge cases in bug 723277 comment 44), but this patch does not make that
> worse, I think.

It seems you meant bug 713277 comment 44.
Attachment #616952 - Attachment is obsolete: true
Attachment #616952 - Flags: review?(dbienvenu)
Attachment #616962 - Flags: review?(dbienvenu)

Comment 3

5 years ago
(In reply to Florian Quèze from comment #2)
> It seems you meant bug 713277 comment 44.
Yes, sorry.

Comment 4

5 years ago
Comment on attachment 616962 [details] [diff] [review]
Patch v2

looks reasonable, though I'd prefer let for the local vars, thx!
Attachment #616962 - Flags: review?(dbienvenu) → review+
http://hg.mozilla.org/comm-central/rev/9bb214321f4c
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 14.0
You need to log in before you can comment on or make changes to this bug.