Open Bug 1776175 Opened 2 years ago Updated 2 years ago

Stop exposing module global variables via Cu.import

Categories

(Core :: XPConnect, task)

task

Tracking

()

People

(Reporter: arai, Unassigned)

References

(Blocks 1 open bug)

Details

Cu.import returns a proxy for the module's global object, that exposed global non-lexical and lexical variables.
for ESM, this causes de-optimization on the global variable not to use local slot.

https://searchfox.org/mozilla-central/rev/6d0ba065e3d41822337c708c8c0aca334ddd9218/js/public/CompileOptions.h#224-232

// De-optimize ES module's top-level `var`s, in order to define all of them
// on the ModuleEnvironmentObject, instead of local slot.
//
// This is used for providing all global variables in Cu.import return value
// (see bug 1766761 for more details), and this is temporary solution until
// ESM-ification finishes.
//
// WARNING: This option will eventually be removed.
bool deoptimizeModuleGlobalVars = false;

Once all dependencies to Cu.import return value goes away, we should remove this behavior.
In order to achieve this, yet another out-of-tree migration is necessary to migrate Cu.import with shim to ChromeUtils.importESModule

You need to log in before you can comment on or make changes to this bug.