Integrate with MakeRealm#12580
Conversation
|
I read through this PR and whatwg/webidl#1608 again and made a few tweaks, but overall I'm happy with the new shape. Perhaps it's a little odd that MakeRealm ends up returning an execution context rather than a realm as the name suggests, but that seems fine (and was already the case for HTML's create a new realm). |
| <var>customizations</var> taking a <span>JavaScript execution context</span> and returning a | ||
| tuple of an object (the global object) and an object or null (the global <b>this</b> binding):</p> |
There was a problem hiding this comment.
The EcmaScript spec doesn't have the concept of a tuple; it's expecting customizations to return a List of two elements. So we could make that change here.
Alternatively, maybe it would simplify things to say that, because customizations now explicitly has access to the realm being created, it can simply assign the two objects to the realm's [[GlobalObject]] and [[GlobalEnv]] fields, and not return anything. MakeRealm, after calling customizations, can detect whether those fields have been set, and if not, set them to their defaults. (First suggested here: tc39/ecma262#3728 (comment), in the first bullet.)
(Note that the HTML and Web IDL specs already refer to [[GlobalObject]] and [[GlobalEnv]], so it's not like this would be breaking some encapsulation.)
There was a problem hiding this comment.
I can make the change to set those fields instead. That seems nice.
There was a problem hiding this comment.
I tried this, but I think it's actually less nice as it would require HTML to also take a dependency on NewGlobalEnvironment to set [[GlobalEnv]] correctly. So for now I'll just update to return a list instead. Let me know if you disagree.
There was a problem hiding this comment.
it would require HTML to also take a dependency on
NewGlobalEnvironmentto set[[GlobalEnv]]correctly.
Hm, yeah. Oh well.
Initial attempt at integrating with tc39/ecma262#3728.
This should be editorial.
/browsers.html ( diff )
/document-lifecycle.html ( diff )
/document-sequences.html ( diff )
/imagebitmap-and-animations.html ( diff )
/infrastructure.html ( diff )
/nav-history-apis.html ( diff )
/webappapis.html ( diff )
/workers.html ( diff )
/worklets.html ( diff )