mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +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:
parent
521e730df1
commit
394e4c04cd
15 changed files with 72 additions and 113 deletions
|
@ -28,7 +28,6 @@
|
|||
#include <LibJS/AST.h>
|
||||
#include <LibJS/Interpreter.h>
|
||||
#include <LibJS/Runtime/Function.h>
|
||||
#include <LibJS/Runtime/MarkedValueList.h>
|
||||
#include <LibJS/Runtime/ScriptFunction.h>
|
||||
#include <LibWeb/Bindings/EventWrapper.h>
|
||||
#include <LibWeb/Bindings/EventWrapperFactory.h>
|
||||
|
@ -38,8 +37,8 @@
|
|||
#include <LibWeb/DOM/Element.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/DOM/EventListener.h>
|
||||
#include <LibWeb/HTML/HTMLAnchorElement.h>
|
||||
#include <LibWeb/DOM/Node.h>
|
||||
#include <LibWeb/HTML/HTMLAnchorElement.h>
|
||||
#include <LibWeb/Layout/LayoutBlock.h>
|
||||
#include <LibWeb/Layout/LayoutDocument.h>
|
||||
#include <LibWeb/Layout/LayoutInline.h>
|
||||
|
@ -132,10 +131,8 @@ void Node::dispatch_event(NonnullRefPtr<Event> event)
|
|||
dbg() << "calling event listener with this=" << this_value;
|
||||
#endif
|
||||
auto* event_wrapper = wrap(global_object, *event);
|
||||
JS::MarkedValueList arguments(global_object.heap());
|
||||
arguments.append(event_wrapper);
|
||||
auto& interpreter = document().interpreter();
|
||||
(void)interpreter.call(function, this_value, move(arguments));
|
||||
(void)interpreter.call(function, this_value, event_wrapper);
|
||||
if (interpreter.exception())
|
||||
interpreter.clear_exception();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue