mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:47:34 +00:00
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.
This commit is contained in:
parent
56b2ae5ac0
commit
40a70461a0
60 changed files with 261 additions and 235 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue