mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 02:13:56 +09:00
LibWeb: Make EventListener::function() return a reference
This commit is contained in:
parent
a38658dc88
commit
97382677bd
Notes:
sideshowbarker
2024-07-19 07:11:41 +09:00
Author: https://github.com/awesomekling
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