Open Bug 1831834 Opened 2 years ago Updated 2 years ago

Move `ensureSideEffectFreeNatives` operation into lazy getter

Categories

(DevTools :: Console, task)

task

Tracking

(Not tracked)

People

(Reporter: arai, Unassigned)

References

(Depends on 1 open bug)

Details

ensureSideEffectFreeNatives is an operation to convert eager-function-allowlist.js into a map gSideEffectFreeNatives.

currently ensureSideEffectFreeNatives is performed before accessing gSideEffectFreeNatives.
and ensureSideEffectFreeNatives accesses eager-function-allowlist.js which is loaded by lazy getter.

we can move the ensureSideEffectFreeNatives operation into lazy getter, so that the consumer becomes simpler.

This depends on bug 1831821, because of the following comment:

https://searchfox.org/mozilla-central/rev/815764d6f304cd69b60075e83b06320464a66223/devtools/server/actors/webconsole/eval-with-debugger.js#361-368

// We ensure that the metadata for native functions is loaded before we
// initialize sideeffect-prevention because the data is lazy-loaded, and this
// logic can run inside of debuggee compartments because the
// "addAllGlobalsAsDebuggees" considers the vast majority of realms
// valid debuggees. Without this, eager-eval runs the risk of failing
// because building the list of valid native functions is itself a
// side-effectful operation because it needs to populate a
// module cache, among any number of other things.
Depends on: 1831821
See Also: → 1832769
You need to log in before you can comment on or make changes to this bug.