summaryrefslogtreecommitdiffstats
path: root/dom/base/CustomElementRegistry.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/base/CustomElementRegistry.cpp')
-rw-r--r--dom/base/CustomElementRegistry.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp
index fe2837f2a..59e107b14 100644
--- a/dom/base/CustomElementRegistry.cpp
+++ b/dom/base/CustomElementRegistry.cpp
@@ -333,6 +333,24 @@ CustomElementRegistry::RegisterUnresolvedElement(Element* aElement, nsIAtom* aTy
return;
}
+void
+CustomElementRegistry::UnregisterUnresolvedElement(Element* aElement,
+ nsIAtom* aTypeName)
+{
+ nsTArray<nsWeakPtr>* candidates;
+ if (mCandidatesMap.Get(aTypeName, &candidates)) {
+ MOZ_ASSERT(candidates);
+ // We don't need to iterate the candidates array and remove the element from
+ // the array for performance reason. It'll be handled by bug 1396620.
+ for (size_t i = 0; i < candidates->Length(); ++i) {
+ nsCOMPtr<Element> elem = do_QueryReferent(candidates->ElementAt(i));
+ if (elem && elem.get() == aElement) {
+ candidates->RemoveElementAt(i);
+ }
+ }
+ }
+}
+
/* static */ UniquePtr<CustomElementCallback>
CustomElementRegistry::CreateCustomElementCallback(
nsIDocument::ElementCallbackType aType, Element* aCustomElement,