JSM modules should not modify their export list dynamically
Categories
(Firefox :: General, task, P5)
Tracking
()
People
(Reporter: mossop, Unassigned)
References
Details
ES6 modules cannot do this so we need to stop JSMs from doing it.
![]() |
||
Comment 1•6 years ago
|
||
This is already not supported for JSMs. At least, not after they've already been imported. The exports are captured when the module is loaded and the same set is returned after that.
Reporter | ||
Comment 2•6 years ago
|
||
(In reply to Kris Maglione [:kmag] from comment #1)
This is already not supported for JSMs. At least, not after they've already been imported. The exports are captured when the module is loaded and the same set is returned after that.
Yes, but some (very few thankfully) modify it before they've been imported. See https://searchfox.org/mozilla-central/source/services/sync/modules/constants.js#137 for example.
![]() |
||
Comment 3•6 years ago
|
||
That's true, but they don't do it in a way that's incompatible with ES6 modules. They can just be changed to use export
statements, which will have approximately the same effect.
Reporter | ||
Comment 4•6 years ago
|
||
(In reply to Kris Maglione [:kmag] from comment #3)
That's true, but they don't do it in a way that's incompatible with ES6 modules. They can just be changed to use
export
statements, which will have approximately the same effect.
Yes, we want to prepare for that.
Better example: https://searchfox.org/mozilla-central/source/browser/components/migration/ChromeProfileMigrator.jsm#615
![]() |
||
Comment 5•6 years ago
|
||
I don't think there's any preparation to be done. That will just be an ordinary part of converting those modules to ES6
Comment 6•3 years ago
|
||
I agree that this is not preparation step.
Each file that does this should be manually migrated, and this issue should be addressed at the same time.
Description
•