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

Reference realm global in realm creation instructions #9607

Closed
wants to merge 1 commit into from

Conversation

domfarolino
Copy link
Member

@domfarolino domfarolino commented Aug 14, 2023

This is an editorial change to reference https://html.spec.whatwg.org/#concept-realm-global in the instructions we provide to the realm creation algorithm. Right now we just have plain text, but I think we're trying to reference the global object that is stored in the [[GlobalObject]] internal slot.


/document-lifecycle.html ( diff )
/document-sequences.html ( diff )
/workers.html ( diff )
/worklets.html ( diff )

@domfarolino domfarolino added the editorial Changes that do not affect how the standard is understood label Aug 14, 2023
@domenic
Copy link
Member

domenic commented Aug 15, 2023

This doesn't seem quite right. What we're doing here is working around the fact that https://tc39.es/ecma262/#sec-initializehostdefinedrealm is a funky algorithm that doesn't take proper arguments, but instead uses the phrasing

  1. If the host requires use of an exotic object to serve as realm's global object, let global be such an object created in a host-defined manner. Otherwise, let global be undefined, indicating that an ordinary object should be created as the global object.

  2. If the host requires that the this binding in realm's global scope return an object other than the global object, let thisValue be such an object created in a host-defined manner. Otherwise, let thisValue be undefined, indicating that realm's global this binding should be the global object.

So we need to provide these "customizations" for step 7 and 8, which we do via "For the global object" and "For the this binding".

It's technically true that the provided customization will result in a global object that is the realm's relevant global. But that's not the concept we're trying to point at, here.

We could make this clearer, perhaps, by saying something like "The host-provided manner of creating the global object is to create a new Window object", instead of "For the global object, create a new Window object"?

@domfarolino
Copy link
Member Author

Hmm, yeah I think your proposed sentence might be an improvement, however I was hoping to specifically link to something, but given the funkiness of the ES algorithm, maybe that's not doable without some clean-up over there. Since it doesn't seem like we can link to [[GlobalObject]], I was hoping we could link to the realm's relevant global since they point to the same thing, but I understand that that's indeed not the right way of phrasing these instructions.

In that case, I think I'll just close this.

@domfarolino domfarolino deleted the reference-realm-global branch August 18, 2023 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial Changes that do not affect how the standard is understood
Development

Successfully merging this pull request may close these issues.

2 participants