1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 19:25:10 +00:00

LibJS: Add a helper for calling JS::Function's with arguments

The fact that a `MarkedValueList` had to be created was just annoying,
so here's an alternative.
This patchset also removes some (now) unneeded MarkedValueList.h includes.
This commit is contained in:
AnotherTest 2020-08-25 22:18:32 +04:30 committed by Andreas Kling
parent 521e730df1
commit 394e4c04cd
15 changed files with 72 additions and 113 deletions

View file

@ -96,10 +96,8 @@ void XMLHttpRequest::dispatch_event(NonnullRefPtr<DOM::Event> event)
auto& function = const_cast<DOM::EventListener&>(*listener.listener).function();
auto& global_object = function.global_object();
auto* this_value = wrap(global_object, *this);
JS::MarkedValueList arguments(global_object.heap());
arguments.append(wrap(global_object, *event));
auto& interpreter = function.interpreter();
(void)interpreter.call(function, this_value, move(arguments));
(void)interpreter.call(function, this_value, wrap(global_object, *this));
if (interpreter.exception())
interpreter.clear_exception();
}