1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:18:13 +00:00

LibWeb: Move Web prototypes and constructors to new Intrinsics object

This Intrinsics object hangs off of a new HostDefined struct that takes
the place of EnvironmentSettingsObject as the true [[HostDefined]] slot
on JS::Realm objects created by LibWeb.

This gets the intrinsics off of the GlobalObject, Window, similar to the
previous refactor of LibJS to move the intrinsics into the Realm's
[[Intrinics]] internal slot.

A side effect of this change is that we cannot fully initialize a Window
object until the [[HostDefined]] slot has been installed into the realm,
which happens with the creation of the WindowEnvironmentSettingsObject.

As such, any Window usage that has not been funned through a WindowESO
will not have any cached Web prototyped or constructors, and will not
have Window APIs available to javascript code. Currently this seems
limited to usage of Window in the CSS parser, but a subsequent commit
will clean those up to take Realm as well. However, this commit compiles
so let's cut it off here :^).
This commit is contained in:
Andrew Kaster 2022-09-24 15:39:23 -06:00 committed by Linus Groh
parent 01c2cffcca
commit c61a4f35dc
22 changed files with 240 additions and 60 deletions

View file

@ -54,7 +54,9 @@ enum class RunScriptDecision {
// https://html.spec.whatwg.org/multipage/webappapis.html#environment-settings-object
struct EnvironmentSettingsObject
: public Environment
, public JS::Realm::HostDefined {
, public JS::Cell {
JS_CELL(EnvironmentSettingsObject, JS::Cell);
virtual ~EnvironmentSettingsObject() override;
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-target-browsing-context