diff options
author | Linus Groh <mail@linusgroh.de> | 2022-08-22 19:00:49 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-08-23 13:58:30 +0100 |
commit | b345a0acca725d1b4e4d6df26fc602d69e97f073 (patch) | |
tree | c1a1b7936505373fc3be8cb7b6f0ced444d05d63 /Userland/Services | |
parent | e3895e6c808d4606f02b26b1eaad3a3a803bba12 (diff) | |
download | serenity-b345a0acca725d1b4e4d6df26fc602d69e97f073.zip |
LibJS+LibWeb: Reduce use of GlobalObject as an intermediary
- Prefer VM::current_realm() over GlobalObject::associated_realm()
- Prefer VM::heap() over GlobalObject::heap()
- Prefer Cell::vm() over Cell::global_object()
- Prefer Wrapper::vm() over Wrapper::global_object()
- Inline Realm::global_object() calls used to access intrinsics as they
will later perform a direct lookup without going through the global
object
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/WebContent/WebContentConsoleClient.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Services/WebContent/WebContentConsoleClient.cpp b/Userland/Services/WebContent/WebContentConsoleClient.cpp index 9e3922e97a..a94c1ff774 100644 --- a/Userland/Services/WebContent/WebContentConsoleClient.cpp +++ b/Userland/Services/WebContent/WebContentConsoleClient.cpp @@ -25,13 +25,13 @@ WebContentConsoleClient::WebContentConsoleClient(JS::Console& console, WeakPtr<J auto& vm = m_interpreter->vm(); auto& realm = m_interpreter->realm(); - auto& global_object = realm.global_object(); + auto& window = static_cast<Web::Bindings::WindowObject&>(realm.global_object()); - auto console_global_object = m_interpreter->heap().allocate_without_realm<ConsoleGlobalObject>(m_interpreter->realm(), static_cast<Web::Bindings::WindowObject&>(global_object)); + auto console_global_object = m_interpreter->heap().allocate_without_realm<ConsoleGlobalObject>(realm, window); // 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>(*m_interpreter->realm().host_defined()); + auto& eso = verify_cast<Web::HTML::EnvironmentSettingsObject>(*realm.host_defined()); vm.push_execution_context(eso.realm_execution_context()); console_global_object->set_associated_realm(realm); console_global_object->initialize_global_object(realm); |