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 allocation of new JS objects in StructuredSerialize more rigorous #2554

Open
domenic opened this issue Apr 18, 2017 · 2 comments
Open
Labels

Comments

@domenic
Copy link
Member

domenic commented Apr 18, 2017

This spins off from tc39/ecma262#418.

Currently we say "a new X object in targetRealm". To rigorize this, I suggest defining either the prose phrase a default-constructed JS X object in targetRealm or an abstract operation ConstructJSIntrinsic("name", targetRealm) which does the following steps:

  1. Let constructor be targetRealm.[[Intrinsics]].[[%X%]].
  2. Return ? Construct(constructor, « »).

This could be located in our https://html.spec.whatwg.org/#dependencies JavaScript section, or in the structured serialization section. It should not be exported for other specs.

Alternately it should perhaps be located in Web IDL?

Then we can use this to replace all our "a new X object in targetRealm", linking to its definition.

@annevk
Copy link
Member

annevk commented Apr 18, 2017

Does IDL allocate JavaScript objects other than Array currently? Also, shouldn't JavaScript host this definition itself? Won't they need it with the Realms API if that makes it through?

@domenic
Copy link
Member Author

domenic commented Apr 18, 2017

Does IDL allocate JavaScript objects other than Array currently?

Well, it does ObjectCreate(%ObjectPrototype%) a lot, but that's easy. I guess it also uses backing Map objects, currently via the imprecise wording "... must have a [[BackingMap]] internal slot, which is initially set to a newly created Map object." So it would probably benefit.

Also, shouldn't JavaScript host this definition itself? Won't they need it with the Realms API if that makes it through?

I can't see why the realms API would need this. This is only necessary if specs need to default-construct objects themselves, which seems useful for the platform but rare for the JS spec.

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

No branches or pull requests

2 participants