The following comment looks concerning. My understanding was that you don't have to import moz-* modules in privileged globals because that's managed by [customElements.js](https://searchfox.org/firefox-main/rev/22d04b52b0eb8d9fa11bf8ede5ccc0243a07c5ba/toolkit/content/customElements.js), but the following comment says that's too late. https://searchfox.org/firefox-main/rev/22d04b52b0eb8d9fa11bf8ede5ccc0243a07c5ba/toolkit/components/satchel/megalist/content/MegalistAlpha.mjs#15-17 ```js // Directly import moz-button here, otherwise, moz-button will be loaded and upgraded on DOMContentLoaded, after MegalistAlpha is first updated. // eslint-disable-next-line import/no-unassigned-import import "chrome://global/content/elements/moz-button.mjs"; ``` and indeed [customElements.js](https://searchfox.org/firefox-main/rev/22d04b52b0eb8d9fa11bf8ede5ccc0243a07c5ba/toolkit/content/customElements.js#891-893,903) performs the import on `DOMContentLoaded`. https://searchfox.org/firefox-main/rev/22d04b52b0eb8d9fa11bf8ede5ccc0243a07c5ba/toolkit/content/customElements.js#891-893,903 ```js document.addEventListener( "DOMContentLoaded", () => { ... ChromeUtils.importESModule(script, { global: "current" }); ```
Bug 2020605 Comment 5 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
The following comment looks concerning. My understanding was that you don't have to import moz-* modules in privileged globals because that's managed by [customElements.js](https://searchfox.org/firefox-main/rev/22d04b52b0eb8d9fa11bf8ede5ccc0243a07c5ba/toolkit/content/customElements.js), but the following comment says that's too late. https://searchfox.org/firefox-main/rev/22d04b52b0eb8d9fa11bf8ede5ccc0243a07c5ba/toolkit/components/satchel/megalist/content/MegalistAlpha.mjs#15-17 ```js // Directly import moz-button here, otherwise, moz-button will be loaded and upgraded on DOMContentLoaded, after MegalistAlpha is first updated. // eslint-disable-next-line import/no-unassigned-import import "chrome://global/content/elements/moz-button.mjs"; ``` and indeed [customElements.js](https://searchfox.org/firefox-main/rev/22d04b52b0eb8d9fa11bf8ede5ccc0243a07c5ba/toolkit/content/customElements.js#891-893,903) performs the import after `DOMContentLoaded`. https://searchfox.org/firefox-main/rev/22d04b52b0eb8d9fa11bf8ede5ccc0243a07c5ba/toolkit/content/customElements.js#891-893,903 ```js document.addEventListener( "DOMContentLoaded", () => { ... ChromeUtils.importESModule(script, { global: "current" }); ```