LibWeb: Make HTML::Environment a GC-allocated type

The only subclass was already GC-allocated, so let's hoist the JS::Cell
inheritance up one level. This ends up simplifying a bit of rather
dubious looking code where we were previously slicing ESOs.
This commit is contained in:
Andreas Kling
2024-04-24 11:09:36 +02:00
parent 7fa45c5fdf
commit f60d82eb85
9 changed files with 29 additions and 26 deletions

View File

@@ -553,13 +553,10 @@ static CrossOriginOpenerPolicy obtain_a_cross_origin_opener_policy(JS::NonnullGC
CrossOriginOpenerPolicy policy = {};
// AD-HOC: We don't yet setup environments in all cases
if (reserved_client.has<Empty>())
if (!reserved_client)
return policy;
auto& reserved_environment = reserved_client.visit(
[](Empty const&) -> Environment& { VERIFY_NOT_REACHED(); },
[](Environment* env) -> Environment& { return *env; },
[](JS::GCPtr<EnvironmentSettingsObject> eso) -> Environment& { return *eso; });
auto& reserved_environment = *reserved_client;
// 2. If reservedEnvironment is a non-secure context, then return policy.
if (is_non_secure_context(reserved_environment))