diff --git a/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.cpp b/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.cpp
index c8576f5954..329c55bbee 100644
--- a/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.cpp
+++ b/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.cpp
@@ -11,6 +11,7 @@ namespace Web::HTML {
void CustomElementDefinition::visit_edges(Visitor& visitor)
{
Base::visit_edges(visitor);
+ visitor.visit(m_constructor);
for (auto& callback : m_lifecycle_callbacks)
visitor.visit(callback.value);
}
diff --git a/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.h b/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.h
index a6a4f47688..25d1d11e90 100644
--- a/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.h
+++ b/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementDefinition.h
@@ -51,7 +51,7 @@ private:
CustomElementDefinition(String const& name, String const& local_name, WebIDL::CallbackType& constructor, Vector&& observed_attributes, LifecycleCallbacksStorage&& lifecycle_callbacks, bool form_associated, bool disable_internals, bool disable_shadow)
: m_name(name)
, m_local_name(local_name)
- , m_constructor(JS::make_handle(constructor))
+ , m_constructor(constructor)
, m_observed_attributes(move(observed_attributes))
, m_lifecycle_callbacks(move(lifecycle_callbacks))
, m_form_associated(form_associated)
@@ -74,7 +74,7 @@ private:
// https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-constructor
// A Web IDL CustomElementConstructor callback function type value wrapping the custom element constructor
- JS::Handle m_constructor;
+ JS::NonnullGCPtr m_constructor;
// https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-observed-attributes
// A list of observed attributes