Closed Bug 1504199 Opened 6 years ago Closed 6 years ago

JavaScript error: chrome://global/content/customElements.js, line 78: TypeError: child is null; can't access its "removeAttribute" property

Categories

(Thunderbird :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: jorgk-bmo, Unassigned)

Details

+++ This bug was initially created as a clone of Bug #1504076 +++ See bug 1504076 comment #8. JavaScript error: chrome://global/content/customElements.js, line 78: TypeError: child is null; can't access its "removeAttribute" property Seems like this is coming from lightning. (No errors with --safe-mode). Specifically the unifinder-search-results-tree-col-title, and so I think from bug 1499423. xxxmagnus-- this.id=unifinder-search-results-tree-col-title inheritAttribute child=null, attr=sortdirection JavaScript error: chrome://global/content/customElements.js, line 79: TypeError: child is null; can't access its "removeAttribute" property If I modify toolkit/content/widgets/tree.js to check the image is in the DOM, we don't get this error anymore. (I don't notice any problems either.) The this.isConnectedAndReady check alone seems insufficient. attributeChangedCallback() { - if (this.isConnectedAndReady) { + if (this.isConnectedAndReady && this.querySelector(".treecol-sortdirection")) { this._updateAttributes(); } } Brian, anything obvious to check?
Flags: needinfo?(bgrinstead)
Hm, I was thinking isConnectedAndReady would be enough to guard against running code before the initial connectedCallback, but I'm looking at it now and I guess there is a world where that's true but we haven't yet run the connectedCallback (if the code is triggered by another element's connectedCallback running through this loop: https://searchfox.org/mozilla-central/rev/39cb1e96cf97713c444c5a0404d4f84627aee85d/toolkit/content/customElements.js#33-39. Can you try this and see if it fixes the problem? 1) gElementsPendingConnection.delete(element) before the try/catch here: https://searchfox.org/mozilla-central/rev/39cb1e96cf97713c444c5a0404d4f84627aee85d/toolkit/content/customElements.js#34 2) Change isConnectedAndReady to `return gIsDOMContentLoaded && this.isConnected && !gElementsPendingConnection.has(this)` https://searchfox.org/mozilla-central/rev/39cb1e96cf97713c444c5a0404d4f84627aee85d/toolkit/content/customElements.js#102
Flags: needinfo?(bgrinstead) → needinfo?(mkmelin+mozilla)
Thanks, but unfortunately that doesn't fix the problem. The problem seems to be triggered by the custom overlaying lightning uses. The stack is inheritAttribute chrome://global/content/customElements.js:79:7 _updateAttributes chrome://global/content/elements/tree.js:99:7 attributeChangedCallback chrome://global/content/elements/tree.js:91:9 _insertElement resource:///modules/Overlays.jsm:357:11 _mergeElement resource:///modules/Overlays.jsm:410:9 _resolveForwardReference resource:///modules/Overlays.jsm:322:7 load resource:///modules/Overlays.jsm:160:14 load resource:///modules/Overlays.jsm:42:5 observe chrome://messenger/content/parent/ext-legacy.js:138:11 So we have nodes from a parsed XUL document, that we are then inserting in the "real" XUL document.
Flags: needinfo?(mkmelin+mozilla)
Interesting, so is the error happening in the parsed XUL doc or the real XUL doc? Also, does the connectedCallback never fire in the real doc, or does it just fire after attributeChangedCallback? I wonder if adoptedCallback would fire instead for your case.
The "fake" xul is just an xml DOM so it doesn't have any behaviour attached. The error occurs when we take the parsed node, and try to insert that inside/next to a node in the real XUL document. calendar-view-box (one root of problems) which we overlay, contains a <tree>, but if I add adoptedCallback on MozTreecol in tree.js it is never called, for any of the places with errors.

This error went away sometime during the last weeks.

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