diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp
index d30284a265..08e8932c69 100644
--- a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp
+++ b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp
@@ -231,13 +231,13 @@ void EventLoop::process()
// FIXME: This is here to paper over an issue in the HTML parser where it'll create new interpreters (and thus ESOs) on temporary documents created for innerHTML if it uses Document::realm() to get the global object.
// Use queue_global_task instead.
-void old_queue_global_task_with_document(HTML::Task::Source source, DOM::Document& document, Function steps)
+void old_queue_global_task_with_document(HTML::Task::Source source, DOM::Document& document, JS::SafeFunction steps)
{
main_thread_event_loop().task_queue().add(HTML::Task::create(source, &document, move(steps)));
}
// https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task
-void queue_global_task(HTML::Task::Source source, JS::Object& global_object, Function steps)
+void queue_global_task(HTML::Task::Source source, JS::Object& global_object, JS::SafeFunction steps)
{
// 1. Let event loop be global's relevant agent's event loop.
auto& global_custom_data = verify_cast(*global_object.vm().custom_data());
@@ -255,7 +255,7 @@ void queue_global_task(HTML::Task::Source source, JS::Object& global_object, Fun
}
// https://html.spec.whatwg.org/#queue-a-microtask
-void queue_a_microtask(DOM::Document* document, Function steps)
+void queue_a_microtask(DOM::Document* document, JS::SafeFunction steps)
{
// 1. If event loop was not given, set event loop to the implied event loop.
auto& event_loop = HTML::main_thread_event_loop();
diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h
index ba360ad4b3..fd30663724 100644
--- a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h
+++ b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h
@@ -10,6 +10,7 @@
#include
#include
#include
+#include
#include
namespace Web::HTML {
@@ -107,9 +108,9 @@ private:
};
EventLoop& main_thread_event_loop();
-void old_queue_global_task_with_document(HTML::Task::Source, DOM::Document&, Function steps);
-void queue_global_task(HTML::Task::Source, JS::Object&, Function steps);
-void queue_a_microtask(DOM::Document*, Function steps);
+void old_queue_global_task_with_document(HTML::Task::Source, DOM::Document&, JS::SafeFunction steps);
+void queue_global_task(HTML::Task::Source, JS::Object&, JS::SafeFunction steps);
+void queue_a_microtask(DOM::Document*, JS::SafeFunction steps);
void perform_a_microtask_checkpoint();
}
diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/Task.cpp b/Userland/Libraries/LibWeb/HTML/EventLoop/Task.cpp
index 600b76fe6a..475383efc4 100644
--- a/Userland/Libraries/LibWeb/HTML/EventLoop/Task.cpp
+++ b/Userland/Libraries/LibWeb/HTML/EventLoop/Task.cpp
@@ -9,7 +9,7 @@
namespace Web::HTML {
-Task::Task(Source source, DOM::Document* document, Function steps)
+Task::Task(Source source, DOM::Document* document, JS::SafeFunction steps)
: m_source(source)
, m_steps(move(steps))
, m_document(JS::make_handle(document))
diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/Task.h b/Userland/Libraries/LibWeb/HTML/EventLoop/Task.h
index 46de995069..4b84809630 100644
--- a/Userland/Libraries/LibWeb/HTML/EventLoop/Task.h
+++ b/Userland/Libraries/LibWeb/HTML/EventLoop/Task.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Andreas Kling
+ * Copyright (c) 2021-2022, Andreas Kling
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -10,6 +10,7 @@
#include
#include
#include
+#include
#include
namespace Web::HTML {
@@ -30,7 +31,7 @@ public:
JavaScriptEngine,
};
- static NonnullOwnPtr create(Source source, DOM::Document* document, Function steps)
+ static NonnullOwnPtr create(Source source, DOM::Document* document, JS::SafeFunction steps)
{
return adopt_own(*new Task(source, document, move(steps)));
}
@@ -45,10 +46,10 @@ public:
bool is_runnable() const;
private:
- Task(Source, DOM::Document*, Function steps);
+ Task(Source, DOM::Document*, JS::SafeFunction steps);
Source m_source { Source::Unspecified };
- Function m_steps;
+ JS::SafeFunction m_steps;
JS::Handle m_document;
};