diff --git a/Libraries/LibWeb/DOM/EventDispatcher.cpp b/Libraries/LibWeb/DOM/EventDispatcher.cpp index eb3e212db9..173fef805f 100644 --- a/Libraries/LibWeb/DOM/EventDispatcher.cpp +++ b/Libraries/LibWeb/DOM/EventDispatcher.cpp @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include #include @@ -44,9 +46,10 @@ void EventDispatcher::dispatch(EventTarget& target, NonnullRefPtr event) auto& function = listener.listener->function(); auto& global_object = function.global_object(); auto* this_value = Bindings::wrap(global_object, target); + auto* wrapped_event = Bindings::wrap(global_object, *event); auto& vm = global_object.vm(); - (void)vm.call(function, this_value, Bindings::wrap(global_object, target)); + (void)vm.call(function, this_value, wrapped_event); if (vm.exception()) vm.clear_exception(); }