LibWeb: Add non const global object getter to EnvironmentSettingsObject

And sneak in a as_if tidyup too.
This commit is contained in:
Shannon Booth
2026-02-24 21:57:30 +01:00
committed by Shannon Booth
parent 9e7aa878bc
commit 8d099b9cec
Notes: github-actions[bot] 2026-02-26 06:24:02 +00:00
2 changed files with 3 additions and 3 deletions

View File

@@ -547,10 +547,9 @@ JS::Object& entry_global_object()
bool is_secure_context(Environment const& environment)
{
// 1. If environment is an environment settings object, then:
if (is<EnvironmentSettingsObject>(environment)) {
if (auto const* environment_settings_object = as_if<EnvironmentSettingsObject>(environment)) {
// 1. Let global be environment's global object.
// FIXME: Add a const global_object() getter to ESO
auto& global = static_cast<EnvironmentSettingsObject&>(const_cast<Environment&>(environment)).global_object();
auto const& global = environment_settings_object->global_object();
// 2. If global is a WorkerGlobalScope, then:
if (auto const* worker = as_if<WorkerGlobalScope>(global)) {