-
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
ScriptEvaluation semantics for ShadowRealm #379
Comments
Let's discuss this next week at SES meeting. @erights and @nicolo-ribaudo might have opinions here as well. |
Tomorrow's there is no SES meeting due to TG3. I've put it on the agenda for 2024-02-21. |
We discussed this during today's SES meeting -- we didn't come to a conclusion, but there were to points in favor of the two different options. To recap, the observable difference is that
In addition to this, @mhofman notes that |
Also, I realized that there is another difference we didn't explicitly talk about during the SES meeting (but maybe it's a consequence of the configurability of properties). The following code: realm.evaluate("var a = 1");
realm.evaluate("let a = 2"); will work under Test cases: <!-- ScriptEvaluation -->
<script>var a = 1;</script>
<script>let a = 2;</script> <!-- PerformEval -->
<script>
eval("var a = 1;");
eval("let a = 1;");
</script> |
I think more relevant is that <!-- ScriptEvaluation -->
<script>let a = 1;</script>
<script>let b = a + 1;</script> Does work as well, and that there is no way to do this with |
It looks like
PerformShadowRealmEval
is based offPerformEval
, which means there is no way to have theScriptEvaluation
semantics in ShadowRealms, namely the behavior ofGlobalDeclarationInstantiation
to create global object properties forvar
andfunction
declarations.I'm wondering if this option was ever discussed. While it'd be easy to add a new API later (e.g.
ShadowRealm.prototype.executeScript()
) with theScriptEvaluation
semantics, I also don't think there'd be harm in changing the semantics ofPerformShadowRealmEval
before shipping. It's always possible to go fromScriptEvaluation
toPerformEval
(const evaluate = shadowRealm.executeScript('eval')
), but not the other way around.The text was updated successfully, but these errors were encountered: