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

Make sure JS objects are created in the right Realms #641

Open
jyasskin opened this issue Jun 20, 2023 · 0 comments
Open

Make sure JS objects are created in the right Realms #641

jyasskin opened this issue Jun 20, 2023 · 0 comments
Labels
spec Relates to the spec

Comments

@jyasskin
Copy link
Member

Any time we create a JS object, and more generally, any time we (indirectly) use a %WellKnownIntrinsicObject% from the TC39 spec, there needs to be a "current realm" available. For objects meant to be associated with the main document's realm, this means avoiding %Intrinsics% from 'in parallel' contexts.

Protected Audience also creates new realms in https://wicg.github.io/turtledove/#evaluate-a-script, but it creates some objects intended for those realms from algorithms like https://wicg.github.io/turtledove/#evaluate-a-bidding-script, before their realm exists or is made the running execution context.

There are a couple ways to fix this second problem. You could create the new realm earlier, before the spec creates any of the JS objects meant for it, or you could move the JS object creation down into 'evaluate a script'. To do the latter, I think you'd want to pass them as WebIDL objects to 'evaluate a script', convert |F| to the appropriate WebIDL callback function type, and use 'invoke' to call it. This might take some changes to WebIDL, which doesn't currently have a type representing an object parsed from a JSON string, and which assumes a non-empty [[HostDefined]] settings object.

@JensenPaul JensenPaul added the spec Relates to the spec label Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec Relates to the spec
Projects
None yet
Development

No branches or pull requests

2 participants