summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/Runtime/VM.h2
-rw-r--r--Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Bindings/MainThreadVM.h2
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.cpp6
-rw-r--r--Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h2
-rw-r--r--Userland/Libraries/LibWeb/Platform/EventLoopPlugin.h5
-rw-r--r--Userland/Libraries/LibWeb/Platform/EventLoopPluginSerenity.cpp5
-rw-r--r--Userland/Libraries/LibWeb/Platform/EventLoopPluginSerenity.h4
9 files changed, 15 insertions, 15 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/VM.h b/Userland/Libraries/LibJS/Runtime/VM.h
index eb1dca8ff8..6880ab4f2a 100644
--- a/Userland/Libraries/LibJS/Runtime/VM.h
+++ b/Userland/Libraries/LibJS/Runtime/VM.h
@@ -35,7 +35,7 @@ public:
struct CustomData {
virtual ~CustomData() = default;
- virtual void spin_event_loop_until(Function<bool()> goal_condition) = 0;
+ virtual void spin_event_loop_until(JS::SafeFunction<bool()> goal_condition) = 0;
};
static ErrorOr<NonnullRefPtr<VM>> create(OwnPtr<CustomData> = {});
diff --git a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp
index 25c7394b34..32022c560d 100644
--- a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp
@@ -499,7 +499,7 @@ NonnullOwnPtr<JS::ExecutionContext> create_a_new_javascript_realm(JS::VM& vm, Fu
return realm_execution_context;
}
-void WebEngineCustomData::spin_event_loop_until(Function<bool()> goal_condition)
+void WebEngineCustomData::spin_event_loop_until(JS::SafeFunction<bool()> goal_condition)
{
Platform::EventLoopPlugin::the().spin_until(move(goal_condition));
}
diff --git a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.h b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.h
index 149211f556..e3605f8f90 100644
--- a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.h
+++ b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.h
@@ -38,7 +38,7 @@ struct CustomElementReactionsStack {
struct WebEngineCustomData final : public JS::VM::CustomData {
virtual ~WebEngineCustomData() override = default;
- virtual void spin_event_loop_until(Function<bool()> goal_condition) override;
+ virtual void spin_event_loop_until(JS::SafeFunction<bool()> goal_condition) override;
HTML::EventLoop event_loop;
diff --git a/Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.cpp b/Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.cpp
index 97eb40bc23..b3305128f0 100644
--- a/Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/Fetching/PendingResponse.cpp
@@ -56,9 +56,9 @@ void PendingResponse::run_callback()
{
VERIFY(m_callback);
VERIFY(m_response);
- Platform::EventLoopPlugin::the().deferred_invoke([strong_this = JS::make_handle(*this)] {
- strong_this->m_callback(*strong_this->m_response);
- strong_this->m_request->remove_pending_response({}, *strong_this.ptr());
+ Platform::EventLoopPlugin::the().deferred_invoke([this] {
+ m_callback(*m_response);
+ m_request->remove_pending_response({}, *this);
});
}
diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp
index 6cddeab5f8..35f41979d1 100644
--- a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp
+++ b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp
@@ -51,7 +51,7 @@ EventLoop& main_thread_event_loop()
}
// https://html.spec.whatwg.org/multipage/webappapis.html#spin-the-event-loop
-void EventLoop::spin_until(Function<bool()> goal_condition)
+void EventLoop::spin_until(JS::SafeFunction<bool()> goal_condition)
{
// FIXME: 1. Let task be the event loop's currently running task.
diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h
index 34cdecfb7c..63eb03224b 100644
--- a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h
+++ b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h
@@ -37,7 +37,7 @@ public:
TaskQueue& microtask_queue() { return m_microtask_queue; }
TaskQueue const& microtask_queue() const { return m_microtask_queue; }
- void spin_until(Function<bool()> goal_condition);
+ void spin_until(JS::SafeFunction<bool()> goal_condition);
void process();
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#termination-nesting-level
diff --git a/Userland/Libraries/LibWeb/Platform/EventLoopPlugin.h b/Userland/Libraries/LibWeb/Platform/EventLoopPlugin.h
index 9824fed4aa..6101a1728f 100644
--- a/Userland/Libraries/LibWeb/Platform/EventLoopPlugin.h
+++ b/Userland/Libraries/LibWeb/Platform/EventLoopPlugin.h
@@ -7,6 +7,7 @@
#pragma once
#include <AK/Forward.h>
+#include <LibJS/SafeFunction.h>
#include <LibWeb/Forward.h>
namespace Web::Platform {
@@ -18,8 +19,8 @@ public:
virtual ~EventLoopPlugin();
- virtual void spin_until(Function<bool()> goal_condition) = 0;
- virtual void deferred_invoke(Function<void()>) = 0;
+ virtual void spin_until(JS::SafeFunction<bool()> goal_condition) = 0;
+ virtual void deferred_invoke(JS::SafeFunction<void()>) = 0;
virtual NonnullRefPtr<Timer> create_timer() = 0;
virtual void quit() = 0;
};
diff --git a/Userland/Libraries/LibWeb/Platform/EventLoopPluginSerenity.cpp b/Userland/Libraries/LibWeb/Platform/EventLoopPluginSerenity.cpp
index 7a2246a30c..f087f50b54 100644
--- a/Userland/Libraries/LibWeb/Platform/EventLoopPluginSerenity.cpp
+++ b/Userland/Libraries/LibWeb/Platform/EventLoopPluginSerenity.cpp
@@ -5,7 +5,6 @@
*/
#include "EventLoopPluginSerenity.h"
-#include <AK/Function.h>
#include <AK/NonnullRefPtr.h>
#include <LibCore/EventLoop.h>
#include <LibWeb/Platform/TimerSerenity.h>
@@ -15,12 +14,12 @@ namespace Web::Platform {
EventLoopPluginSerenity::EventLoopPluginSerenity() = default;
EventLoopPluginSerenity::~EventLoopPluginSerenity() = default;
-void EventLoopPluginSerenity::spin_until(Function<bool()> goal_condition)
+void EventLoopPluginSerenity::spin_until(JS::SafeFunction<bool()> goal_condition)
{
Core::EventLoop::current().spin_until(move(goal_condition));
}
-void EventLoopPluginSerenity::deferred_invoke(Function<void()> function)
+void EventLoopPluginSerenity::deferred_invoke(JS::SafeFunction<void()> function)
{
VERIFY(function);
Core::deferred_invoke(move(function));
diff --git a/Userland/Libraries/LibWeb/Platform/EventLoopPluginSerenity.h b/Userland/Libraries/LibWeb/Platform/EventLoopPluginSerenity.h
index 0479b91e5a..c79e72a074 100644
--- a/Userland/Libraries/LibWeb/Platform/EventLoopPluginSerenity.h
+++ b/Userland/Libraries/LibWeb/Platform/EventLoopPluginSerenity.h
@@ -15,8 +15,8 @@ public:
EventLoopPluginSerenity();
virtual ~EventLoopPluginSerenity() override;
- virtual void spin_until(Function<bool()> goal_condition) override;
- virtual void deferred_invoke(Function<void()>) override;
+ virtual void spin_until(JS::SafeFunction<bool()> goal_condition) override;
+ virtual void deferred_invoke(JS::SafeFunction<void()>) override;
virtual NonnullRefPtr<Timer> create_timer() override;
virtual void quit() override;
};