From 1d5b03ce171df7a5a3aae3f4048ac3419e21fd74 Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Mon, 27 Jun 2022 19:49:13 +0100 Subject: [PATCH] LibWeb: Store PromiseRejectionEvent::m_reason in a JS::Handle --- Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h b/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h index 944c8f1b8d..ecf676f2de 100644 --- a/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h +++ b/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h @@ -34,19 +34,18 @@ public: // Needs to return a pointer for the generated JS bindings to work. JS::Promise const* promise() const { return m_promise.cell(); } - JS::Value reason() const { return m_reason; } + JS::Value reason() const { return m_reason.value(); } protected: PromiseRejectionEvent(FlyString const& event_name, PromiseRejectionEventInit const& event_init) : DOM::Event(event_name, event_init) , m_promise(event_init.promise) - , m_reason(event_init.reason) + , m_reason(JS::make_handle(event_init.reason)) { } JS::Handle m_promise; - // FIXME: Protect this from GC! Currently we have no handle for arbitrary JS::Value. - JS::Value m_reason; + JS::Handle m_reason; }; }