From 874e64d664ca5ee4de597b24026f2dae7a30701d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 24 Sep 2022 12:14:53 +0200 Subject: [PATCH] LibWeb: Make queue_an_element_task() use JS::SafeFunction --- Userland/Libraries/LibWeb/DOM/Element.cpp | 6 ++---- Userland/Libraries/LibWeb/DOM/Element.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index c950801065..5920b32ed8 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -552,11 +552,9 @@ void Element::make_html_uppercased_qualified_name() } // https://html.spec.whatwg.org/multipage/webappapis.html#queue-an-element-task -void Element::queue_an_element_task(HTML::Task::Source source, Function steps) +void Element::queue_an_element_task(HTML::Task::Source source, JS::SafeFunction steps) { - auto task = HTML::Task::create(source, &document(), [strong_this = JS::make_handle(*this), steps = move(steps)] { - steps(); - }); + auto task = HTML::Task::create(source, &document(), move(steps)); HTML::main_thread_event_loop().task_queue().add(move(task)); } diff --git a/Userland/Libraries/LibWeb/DOM/Element.h b/Userland/Libraries/LibWeb/DOM/Element.h index de9adf28a4..203f3fc50d 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.h +++ b/Userland/Libraries/LibWeb/DOM/Element.h @@ -122,7 +122,7 @@ public: void set_custom_properties(HashMap custom_properties) { m_custom_properties = move(custom_properties); } HashMap const& custom_properties() const { return m_custom_properties; } - void queue_an_element_task(HTML::Task::Source, Function); + void queue_an_element_task(HTML::Task::Source, JS::SafeFunction); bool is_void_element() const; bool serializes_as_void() const;