Closed Bug 1635019 Opened 5 months ago Closed 3 months ago

JavaScript Error: "TypeError: can't access property "firstChild", container is undefined" {file: "chrome://messenger/content/customizableui/panelUI.js" line: 1324}]

Categories

(Thunderbird :: Mail Window Front End, defect)

defect

Tracking

(thunderbird78 fixed)

RESOLVED FIXED
Thunderbird 79.0
Tracking Status
thunderbird78 --- fixed

People

(Reporter: ishikawa, Assigned: darktrojan)

Details

Attachments

(1 file)

Running mochitest of FULL DEBUG version of thunderbird
produces the following error.
120 at the beginning of line is the frequencey of occurences.

120 INFO Console message: [JavaScript Error: "TypeError: can't access property "firstChild", container is undefined" {file: "chrome://messenger/content/customizableui/panelUI.js" line: 1324}]

mozilla/comm/mail/components/customizableui/content/panelUI.js

updateAlerts() {
let tabmail = document.getElementById("tabmail");
let sideloaded = ExtensionsUI.sideloaded;
let updates = ExtensionsUI.updates;
let container = PanelUI.addonNotificationContainer;

while (container.firstChild) {    <=== here
  container.firstChild.remove();
}

I think the whole while-statement ought to be enclosed in a if
(conainer) check.

if (container) {
while (container.firstChild) {
container.firstChild.remove();
}
}

But I am not even sure if |PanelUI.addonNotificationContaier| can be
null when |updateAlerts()| is called. This may be an edge case.
Or this may be really a very bad bug.
And if it is null, we may have to do something special.
So I leave it to the people in the know to produce a patch.

BTW, this error is encountered AFTER the patch in
Bug 1634511 was applied.

Moral of the story. mochitest infrastructure/harness REALLY OUGHT TO FAIL a
test that produces JavaScript Error during its execution. PERIOD. (Or does it? I am new to mochitest. It is in place since last December.)

It's undefined because we're init'ing gExtensionsNotifications too early, before PanelUI. I've changed it so that it doesn't happen on load, instead, after PanelUI.init. Also tidied up the linter imports.

Assignee: nobody → geoff
Status: NEW → ASSIGNED
Attachment #9158071 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9158071 [details] [diff] [review]
1635019-container-is-undefined-1.diff

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

Great, r=mkmelin
Attachment #9158071 - Flags: review?(mkmelin+mozilla) → review+
Target Milestone: --- → Thunderbird 79.0

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/cdb11b6187f0
Fix "container is undefined" error in panelUI.js. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Comment on attachment 9158071 [details] [diff] [review]
1635019-container-is-undefined-1.diff

We should take this. One less source of useless error messages.
Attachment #9158071 - Flags: approval-comm-beta?
Comment on attachment 9158071 [details] [diff] [review]
1635019-container-is-undefined-1.diff

Approved for beta
Attachment #9158071 - Flags: approval-comm-beta? → approval-comm-beta+
You need to log in before you can comment on or make changes to this bug.