diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp index 4381d8b34d05..16c0be5e4c53 100644 --- a/dom/base/CustomElementRegistry.cpp +++ b/dom/base/CustomElementRegistry.cpp @@ -423,6 +423,11 @@ CustomElementRegistry::EnqueueLifecycleCallback(nsIDocument::ElementCallbackType definition->mLocalName != aCustomElement->NodeInfo()->NameAtom()) { return; } + + if (!definition->mCallbacks) { + // definition has been unlinked. Don't try to mess with it. + return; + } } auto callback =