mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 21:25:07 +00:00
LibWeb: Make EventListener::function() return a reference
This commit is contained in:
parent
a38658dc88
commit
97382677bd
4 changed files with 16 additions and 13 deletions
|
@ -92,11 +92,12 @@ void XMLHttpRequest::dispatch_event(NonnullRefPtr<Event> event)
|
|||
{
|
||||
for (auto& listener : listeners()) {
|
||||
if (listener.event_name == event->name()) {
|
||||
auto* function = const_cast<EventListener&>(*listener.listener).function();
|
||||
auto* this_value = wrap(function->heap(), *this);
|
||||
JS::MarkedValueList arguments(function->heap());
|
||||
arguments.append(wrap(function->heap(), *event));
|
||||
function->interpreter().call(function, this_value, move(arguments));
|
||||
auto& function = const_cast<EventListener&>(*listener.listener).function();
|
||||
auto& heap = function.heap();
|
||||
auto* this_value = wrap(heap, *this);
|
||||
JS::MarkedValueList arguments(heap);
|
||||
arguments.append(wrap(heap, *event));
|
||||
function.interpreter().call(&function, this_value, move(arguments));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue