diff options
author | Linus Groh <mail@linusgroh.de> | 2022-08-22 18:31:08 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-08-23 13:58:30 +0100 |
commit | 40a70461a0f6b0224c51fe7fb1be28edd26bb4b3 (patch) | |
tree | 5d54bb00d2d82dac774137057bcec21cc9d5d56d /Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp | |
parent | 56b2ae5ac0a383c96163c4b7b07bddd79da23c7a (diff) | |
download | serenity-40a70461a0f6b0224c51fe7fb1be28edd26bb4b3.zip |
LibWeb: Replace GlobalObject with Realm in wrapper functions
Similar to create() in LibJS, wrap() et al. are on a low enough level to
warrant passing a Realm directly instead of relying on the current realm
from the VM, as a wrapper may need to be allocated while no JS is being
executed.
Diffstat (limited to 'Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp b/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp index 8ae3f2b254..b37bc4fde8 100644 --- a/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp +++ b/Userland/Libraries/LibWeb/DOM/EventDispatcher.cpp @@ -88,7 +88,8 @@ bool EventDispatcher::inner_invoke(Event& event, Vector<NonnullRefPtr<DOM::DOMEv // 6. Let global be listener callback’s associated Realm’s global object. auto& callback = listener->callback->callback(); - auto& global = callback.callback.cell()->global_object(); + auto& realm = callback.callback->shape().realm(); + auto& global = realm.global_object(); // 7. Let currentEvent be undefined. RefPtr<Event> current_event; @@ -112,8 +113,8 @@ bool EventDispatcher::inner_invoke(Event& event, Vector<NonnullRefPtr<DOM::DOMEv // 10. Call a user object’s operation with listener’s callback, "handleEvent", « event », and event’s currentTarget attribute value. If this throws an exception, then: // FIXME: These should be wrapped for us in call_user_object_operation, but it currently doesn't do that. - auto* this_value = Bindings::wrap(global, *event.current_target()); - auto* wrapped_event = Bindings::wrap(global, event); + auto* this_value = Bindings::wrap(realm, *event.current_target()); + auto* wrapped_event = Bindings::wrap(realm, event); auto result = Bindings::IDL::call_user_object_operation(callback, "handleEvent", this_value, wrapped_event); // If this throws an exception, then: |