-
Notifications
You must be signed in to change notification settings - Fork 3k
JavaScript ShadowRealm proposal integration #9893
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes to the module loading algorithms look ok.
For the record, we (people working on modules in TC39) have some ideas for splitting the stateless and stateful parts of Module Records in ECMA-262. If/once that will happen, it would be great to share a module map for the stateless parts across principal realms and shadow realms, so that basically in this case:
import "/foo";
new ShadowRealm().importValue("/foo", "bar");
we only call into fetch once (to get the stateless part) and then we create the stateful part twice in both realms.
I think this could benefit from review at this point |
ShadowRealms reached 2.7 in TC39. Acceptance of this PR by WHATWG editors is a blocking requirement for Stage 3, though it probably shouldn't be landed until the Web API set is finalized. |
4fd9960
to
9d8d9ec
Compare
data-x="synthetic-realm-settings-object-principal-realm">principal realm</span> to <var>O</var>'s | ||
<span>associated realm</span>.</p></li> | ||
<span>associated realm</span>'s | ||
<span data-x="concept-principal-realm-of-realm">principal realm</span>.</p></li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we still run into an issue here if there is a third layer of shadow realm nesting?
My thinking is that this should effectively be a while loop which will go up until it sees that the host defined is not a synthetic settings object. Then, principal-realm-of-realm does not need to worry about how many layers of nesting of shadow realms there are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suppose a principal realm X → ShadowRealm A → ShadowRealm B → ShadowRealm C.
- Creating A: O's associated realm is X, so we set A.[[HostDefined]]'s synthetic-realm-settings-object-principal-realm to X's concept-principal-realm-of-realm which is also X
- Creating B: O's associated realm is A, and A's concept-principal-realm-of-realm is A.[[HostDefined]]'s synthetic-realm-settings-object-principal-realm, which is X, and we set B.[[HostDefined]]'s synthetic-realm-settings-object-principal-realm to X.
- Creating C: O's associated realm is B, and B's concept-principal-realm-of-realm is B.[[HostDefined]]'s synthetic-realm-settings-object-principal-realm, which is X, etc.
To replace #5339.
ShadowRealm
constructor denoland/deno#16211(See WHATWG Working Mode: Changes for more details.)
TODO:
/browsing-the-web.html ( diff )
/dom.html ( diff )
/embedded-content.html ( diff )
/form-elements.html ( diff )
/index.html ( diff )
/infrastructure.html ( diff )
/media.html ( diff )
/nav-history-apis.html ( diff )
/references.html ( diff )
/scripting.html ( diff )
/structured-data.html ( diff )
/timers-and-user-prompts.html ( diff )
/webappapis.html ( diff )
/workers.html ( diff )