Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freezing ModuleSource #4

Open
guybedford opened this issue Mar 27, 2024 · 1 comment
Open

Freezing ModuleSource #4

guybedford opened this issue Mar 27, 2024 · 1 comment

Comments

@guybedford
Copy link
Collaborator

In presenting the updated proposal at TG3 today, @ljharb brought up the question of whether we should be freezing the ModuleSource object, to avoid mutations from applying to all source phase importers of the same source.

There seem to be three options here:

  1. Freeze the entire object
  2. Freeze the ModuleSource instance, while leaving its prototype unfrozen, this would allow hardened environments to then freeze the prototype object to create the secure context.
  3. The default path - not freezing, and then to separately ensure instrumentation is always possible.

In the case where not freezing is followed, we discussed a source phase hook in the instancing / loader model to ensure that it would be possible to provide this, with the caveat that only a real source phase (with the source phase internal slot) would be able to be provided.

This also relates somewhat to the concept of resolution metadata, where every source object would be associated with host-loader-local resolution information. So that all sources provided to users should be explicitly hooked somehow to ensure existence in this local set as soon as they are available.

@ljharb
Copy link
Member

ljharb commented Mar 27, 2024

Option 1 we basically don't ever do unless it's a null object; option 2 would be reasonable. However, from discussion in today's TG3 meeting, it doesn't seem critical, and option 3 would also be acceptable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants