summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibJS/Heap/Cell.h12
-rw-r--r--Userland/Libraries/LibJS/Runtime/FinalizationRegistry.cpp2
2 files changed, 13 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Heap/Cell.h b/Userland/Libraries/LibJS/Heap/Cell.h
index fc266b4ccb..c870a998ee 100644
--- a/Userland/Libraries/LibJS/Heap/Cell.h
+++ b/Userland/Libraries/LibJS/Heap/Cell.h
@@ -11,6 +11,7 @@
#include <AK/Noncopyable.h>
#include <AK/StringView.h>
#include <LibJS/Forward.h>
+#include <LibJS/Heap/GCPtr.h>
namespace JS {
@@ -55,6 +56,17 @@ public:
{
visit_impl(cell);
}
+ template<typename T>
+ void visit(GCPtr<T> cell)
+ {
+ if (cell)
+ visit_impl(*cell.ptr());
+ }
+ template<typename T>
+ void visit(NonnullGCPtr<T> cell)
+ {
+ visit_impl(*cell.ptr());
+ }
void visit(Value);
protected:
diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.cpp b/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.cpp
index ee63d93006..a11ba51d45 100644
--- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.cpp
+++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistry.cpp
@@ -82,7 +82,7 @@ ThrowCompletionOr<void> FinalizationRegistry::cleanup(Optional<JobCallback> call
void FinalizationRegistry::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
- visitor.visit(m_realm.ptr());
+ visitor.visit(m_realm);
for (auto& record : m_records) {
visitor.visit(record.held_value);
visitor.visit(record.unregister_token);