Bug 2033055 Comment 3 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Hi :mbeir 
I took a brief look into this because I'm working on a refactoring in this area and I was curious about what may be going on,
using the STR Rob described in comment 0 and confirmed that Rob is right that by the time the `onUpdateModeChanged` is hit for the first time `this.toggleUpdatesEl.constructor` is an HTMLElement (instead of a PanelList).

I noticed though that the document.readyState is "interactive" at that time, and that the customElements.setElementCreationCallback registered from toolkit/content/customElements.js that is supposed to load the panel-list.mjs (from [here](https://searchfox.org/firefox-main/rev/0ae2fcae6a70566ab9e13e401480387b34911bad/toolkit/content/customElements.js#903)) is actually firing later on (after the `onUpdateModeChanged` linked in comment 0 has been already executed, and so the panel-item will not be checked as it should have been).

Looking to the changes in the two patches landed from Bug 2026900, I think that `panel-list` likely used to be loaded earlier before Bug 2025900 because the `customElements.setElementCreationCallback` registering the callback that loads the `.js` shared custom elements is registered right away, whereas the other `customElements.setElementCreationCallback`  callback that imports the `.mjs` shared custom elements is registered on DOMContentLoaded, that would explain why by the time onUpdateModeChanged is executed panel-list isn't loaded yet but it gets loaded as expected later on.
Hi :mbeir 
I took a brief look into this because I'm working on a refactoring in this area and I was curious about what may be going on,
using the STR Rob described in comment 0 and confirmed that Rob is right that by the time the `onUpdateModeChanged` is hit for the first time `this.toggleUpdatesEl.constructor` is `HTMLElement` (instead of a `PanelItem`).

I noticed though that the document.readyState is "interactive" at that time, and that the customElements.setElementCreationCallback registered from toolkit/content/customElements.js that is supposed to load the panel-list.mjs (from [here](https://searchfox.org/firefox-main/rev/0ae2fcae6a70566ab9e13e401480387b34911bad/toolkit/content/customElements.js#903)) is actually firing later on (after the `onUpdateModeChanged` linked in comment 0 has been already executed, and so the panel-item will not be checked as it should have been).

Looking to the changes in the two patches landed from Bug 2026900, I think that `panel-list` likely used to be loaded earlier before Bug 2025900 because the `customElements.setElementCreationCallback` registering the callback that loads the `.js` shared custom elements is registered right away, whereas the other `customElements.setElementCreationCallback`  callback that imports the `.mjs` shared custom elements is registered on DOMContentLoaded, that would explain why by the time onUpdateModeChanged is executed panel-list isn't loaded yet but it gets loaded as expected later on.

Back to Bug 2033055 Comment 3