-
Notifications
You must be signed in to change notification settings - Fork 67
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
[Stage 3] behavior of global object #411
Comments
I discussed with igalia in details... here is where we are:
Now the problem: When The other issue is that there is no provision about what The other question is whether or not the global object should be ordinary or exotic. We pushed for it being an ordinary object, since there is nothing special about it, and so far we haven't get any push back from implementers. As far as I can tell, they just need to associate that object to the other internal mechanism (settings object, etc.). I believe we can do something similar to what we do in |
I think we're all in agreement about this goal — it's just a question of how to specify it conveniently and without creating a lot of duplication. Ms2ger and I talked today and we think it could be sufficient to add an assertion in the ShadowRealm constructor along the lines of:
or possibly, if it turns out to be necessary from the host's side:
This seems like it'd place the necessary restrictions on what hosts can do inside InitializeHostDefinedRealm. Also, just want to reiterate that nobody is trying to sneak any exotic behaviour in here! Unfortunately the ECMA-262 refactoring in tc39/ecma262#3139 seems to have opened this possibility, so now we need to add language like what I suggested above, to prevent it. But it's never been a goal of either #392 or #409 to enable exotic behaviour of ShadowRealm global objects. |
Is WindowProxy exotic? |
We're not putting WindowProxys in ShadowRealms, so I'm not sure why you ask |
Originally this proposal created a regular object for the global and provided a host hook to add configurable properties and change the prototype according to the APIs the host needed to expose.
#392 attempted to change that, to which I objected. The spirit of the changes in that PR were subsequently absorbed in other PRs and #392 was closed.
To satisfy virtualization use cases, the global object in a ShadowRealm must remain effectively fully configurable and with a behavior observably similar to a regular object. There is no way to specify such constraints on a host besides having the 262 spec create the global object. That means in
InitializeHostDefinedRealm
, step 12.a must be prevented for the ShadowRealm global, and the Else path in 12.b must be used.To clarify, while the host must not be allowed to observably use an exotic object, that requirement does not prevent an implementation to actually use an exotic object as global object, as long as the exotic behavior is observably indistinguishable from a regular object behavior.
The text was updated successfully, but these errors were encountered: