summaryrefslogtreecommitdiffstats
path: root/dom/base/CustomElementRegistry.cpp
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2020-01-19 23:33:52 -0500
committerGaming4JC <g4jc@hyperbola.info>2020-01-26 15:50:46 -0500
commit93313b0ce3aada87f76948e6c65d455ee4998acf (patch)
treefd8285a120168d8c6adf004c5822b4379acd4b46 /dom/base/CustomElementRegistry.cpp
parentfb657f7a1e3ef326214e0c42a5a0dd6dc0109338 (diff)
downloadUXP-93313b0ce3aada87f76948e6c65d455ee4998acf.tar
UXP-93313b0ce3aada87f76948e6c65d455ee4998acf.tar.gz
UXP-93313b0ce3aada87f76948e6c65d455ee4998acf.tar.lz
UXP-93313b0ce3aada87f76948e6c65d455ee4998acf.tar.xz
UXP-93313b0ce3aada87f76948e6c65d455ee4998acf.zip
Bug 1406325 - Part 5: Implement try to upgrade.
Tag UXP Issue #1344
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,