Closed Bug 1608269 Opened 6 years ago Closed 3 years ago

JSM modules should not modify their export list dynamically

Categories

(Firefox :: General, task, P5)

task

Tracking

()

RESOLVED WONTFIX

People

(Reporter: mossop, Unassigned)

References

Details

ES6 modules cannot do this so we need to stop JSMs from doing it.

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.

(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.

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.

(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

I don't think there's any preparation to be done. That will just be an ordinary part of converting those modules to ES6

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.

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