Bug 1406325 - Part 5: Implement try to upgrade.

Tag UXP Issue #1344
This commit is contained in:
Gaming4JC
2020-01-19 23:33:52 -05:00
parent fb657f7a1e
commit 93313b0ce3
5 changed files with 121 additions and 14 deletions
+18
View File
@@ -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,