LibWeb: ShadowRealms part 4 - enough for it to not crash#1993
LibWeb: ShadowRealms part 4 - enough for it to not crash#1993ADKaster merged 5 commits intoLadybirdBrowser:masterfrom
Conversation
c4c6fba to
434e213
Compare
a16bd7c to
2b099fa
Compare
With the introduction of shadow realms, there will be two different possible host defined objects. For clarity, rename the existing host defined object to PrincipalHostDefined.
This class is the host defined field of a synthetic realm created as part of a shadow realm.
This object represents the global object for a shadow realm. The IDL generator will need to be adjusted to the '[Global]' extended attribute and no '[Exposed]' field (the change in the test is not correct, as I understand it), but this should be enough to get us started on shadow realms.
2b099fa to
5cda02c
Compare
This is enough for a basic shadow realm to work :^) There is more that we still need to implement here such as module loading and fixing up the global object, but this is enough to get some basic usage working.
5cda02c to
69aa1f4
Compare
|
|
||
| // 11. Perform ? SetDefaultGlobalBindings(realm). | ||
| set_default_global_bindings(realm); | ||
|
|
There was a problem hiding this comment.
we should call ShadowRealmGlobalScopeGlobalMixin::initialize(realm, *this); here, as well as add_shadow_realm_exposed_interfaces(*this) (in a helper on the global scope/global object variable)
There was a problem hiding this comment.
speaking of which, did the spec folks decide what things should be exposed to shadow realms? We'll need to go around sprinkling annotations all over our idl files for the idl generator to pick them up
There was a problem hiding this comment.
Yes, spec folks have done so - those are all of the crashing IDL tests that we have currently. Here's a meta issue that shows what has been done: tc39/proposal-shadowrealm#393
There was a problem hiding this comment.
Well, not crashing after these changes, but still doesn't work :D
There was a problem hiding this comment.
ah perfect, then it should be straightforward to add ShadowRealm as an option in GenerateWindowOrWorkerInterfaces ... which I guess should be renamed to GenerateGlobalExposedInterfaces or some such.
There was a problem hiding this comment.
ah! they added this new thing too. hm. https://whatpr.org/html/9893/webappapis.html#universalglobalscope
There was a problem hiding this comment.
Right, yeah that's why I've left those other FIXME's you mentioned in the initialize steps. I need to implement that universal global scope and reshuffling some implementations from windoworworkerglobal scope mixin to a new universalglobalscope mixin
There was a problem hiding this comment.
gotcha. well, given that, I think we're good to go on this part once CI is happy. Feel free to add more fixmes if you want though.
Sitting ontop of #2134
This implements enough for the test case:
To work.
Unfortunately, WPT test cases are not passing as there is something going wrong with importing scripts (meaning that the test harness is not set up correctly), but this is still progress forwards!
http://wpt.live/url/idlharness-shadowrealm.window.html s