1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:27:45 +00:00

Everywhere: Convert VM::call() to JS::call()

This commit is contained in:
mjz19910 2022-01-23 02:12:26 -07:00 committed by Linus Groh
parent d436746c95
commit 1ef633472b
37 changed files with 160 additions and 157 deletions

View file

@ -6,6 +6,7 @@
#include <AK/Assertions.h>
#include <AK/TypeCasts.h>
#include <LibJS/Runtime/AbstractOperations.h>
#include <LibJS/Runtime/FunctionObject.h>
#include <LibWeb/Bindings/EventTargetWrapper.h>
#include <LibWeb/Bindings/EventTargetWrapperFactory.h>
@ -89,7 +90,7 @@ bool EventDispatcher::inner_invoke(Event& event, Vector<EventTarget::EventListen
auto* this_value = Bindings::wrap(global, *event.current_target());
auto* wrapped_event = Bindings::wrap(global, event);
auto& vm = global.vm();
[[maybe_unused]] auto rc = vm.call(listener.listener->function(), this_value, wrapped_event);
[[maybe_unused]] auto rc = JS::call(global, function, this_value, wrapped_event);
if (vm.exception()) {
vm.clear_exception();
// FIXME: Set legacyOutputDidListenersThrowFlag if given. (Only used by IndexedDB currently)

View file

@ -6,6 +6,7 @@
*/
#include <LibGUI/DisplayLink.h>
#include <LibJS/Runtime/AbstractOperations.h>
#include <LibJS/Runtime/FunctionObject.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/ResolvedCSSStyleDeclaration.h>
@ -171,7 +172,7 @@ void Window::timer_did_fire(Badge<Timer>, Timer& timer)
VERIFY(wrapper());
auto& vm = wrapper()->vm();
[[maybe_unused]] auto rc = vm.call(strong_timer->callback(), wrapper());
[[maybe_unused]] auto rc = JS::call(wrapper()->global_object(), strong_timer->callback(), wrapper());
if (vm.exception())
vm.clear_exception();
});
@ -202,7 +203,7 @@ i32 Window::request_animation_frame(JS::FunctionObject& js_callback)
auto callback = request_animation_frame_driver().add([this, handle = JS::make_handle(&js_callback)](i32 id) mutable {
auto& function = *handle.cell();
auto& vm = function.vm();
(void)vm.call(function, JS::js_undefined(), JS::Value(performance().now()));
(void)JS::call(function.global_object(), function, JS::js_undefined(), JS::Value(performance().now()));
if (vm.exception())
vm.clear_exception();
m_request_animation_frame_callbacks.remove(id);
@ -393,7 +394,7 @@ void Window::queue_microtask(JS::FunctionObject& callback)
// The queueMicrotask(callback) method must queue a microtask to invoke callback,
HTML::queue_a_microtask(associated_document(), [&callback, handle = JS::make_handle(&callback)]() {
auto& vm = callback.vm();
[[maybe_unused]] auto rc = vm.call(callback, JS::js_null());
[[maybe_unused]] auto rc = JS::call(callback.global_object(), callback, JS::js_null());
// FIXME: ...and if callback throws an exception, report the exception.
if (vm.exception())
vm.clear_exception();

View file

@ -215,7 +215,7 @@ JS::ThrowCompletionOr<size_t> WebAssemblyObject::instantiate_module(Wasm::Module
for (auto& entry : arguments)
argument_values.append(to_js_value(global_object, entry));
auto result_or_error = vm.call(function, JS::js_undefined(), move(argument_values));
auto result_or_error = JS::call(global_object, function, JS::js_undefined(), move(argument_values));
if (result_or_error.is_error()) {
vm.clear_exception();
return Wasm::Trap();