From 37ea6de7720ebb1bfa5591ebd602b72c4137c0fa Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 24 Sep 2022 12:16:54 +0200 Subject: [PATCH] LibWeb: Remove now-unnecessary JS::Handles in microtask capture lists --- Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp | 2 +- Userland/Libraries/LibWeb/HTML/Window.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp index 85f9cd88bd..6a0f074bb5 100644 --- a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp +++ b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp @@ -220,7 +220,7 @@ JS::VM& main_thread_vm() auto* script = active_script(); // NOTE: This keeps job_settings alive by keeping realm alive, which is holding onto job_settings. - HTML::queue_a_microtask(script ? script->settings_object().responsible_document().ptr() : nullptr, [job_settings, job = move(job), realm = realm ? JS::make_handle(realm) : JS::Handle {}, script_or_module = move(script_or_module)]() mutable { + HTML::queue_a_microtask(script ? script->settings_object().responsible_document().ptr() : nullptr, [job_settings, job = move(job), realm, script_or_module = move(script_or_module)]() mutable { // The dummy execution context has to be kept up here to keep it alive for the duration of the function. Optional dummy_execution_context; diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index 8eb5070b98..7f5bb6396c 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -509,8 +509,8 @@ void Window::fire_a_page_transition_event(FlyString const& event_name, bool pers void Window::queue_microtask_impl(Bindings::CallbackType& callback) { // The queueMicrotask(callback) method must queue a microtask to invoke callback, - HTML::queue_a_microtask(&associated_document(), [callback = JS::make_handle(callback)]() mutable { - auto result = Bindings::IDL::invoke_callback(*callback, {}); + HTML::queue_a_microtask(&associated_document(), [&callback]() mutable { + auto result = Bindings::IDL::invoke_callback(callback, {}); // and if callback throws an exception, report the exception. if (result.is_error()) HTML::report_exception(result);