Ladybird/ConsoleClient: Get the current ESO from new HostDefined helper

This commit is contained in:
Andrew Kaster 2022-09-25 19:05:45 -06:00
parent 2ff37d7e13
commit b2ba91123b
Notes: sideshowbarker 2024-07-17 07:31:31 +09:00

View file

@ -32,7 +32,7 @@ ConsoleClient::ConsoleClient(JS::Console& console, JS::Realm& realm, SimpleWebVi
// NOTE: We need to push an execution context here for NativeFunction::create() to succeed during global object initialization.
// It gets removed immediately after creating the interpreter in Document::interpreter().
auto& eso = verify_cast<Web::HTML::EnvironmentSettingsObject>(*realm.host_defined());
auto& eso = Web::Bindings::host_defined_environment_settings_object(realm);
vm.push_execution_context(eso.realm_execution_context());
console_global_object->initialize(realm);
vm.pop_execution_context();
@ -45,7 +45,7 @@ void ConsoleClient::handle_input(String const& js_source)
if (!m_realm)
return;
auto& settings = verify_cast<Web::HTML::EnvironmentSettingsObject>(*m_realm->host_defined());
auto& settings = Web::Bindings::host_defined_environment_settings_object(*m_realm);
auto script = Web::HTML::ClassicScript::create("(console)", js_source, settings, settings.api_base_url());
// FIXME: Add parse error printouts back once ClassicScript can report parse errors.