Bug 1406325 - Part 4: Use mType for LookupCustomElementDefinition and also removing parts of v0.

Tag UXP Issue #1344
This commit is contained in:
Gaming4JC 2020-01-19 22:59:16 -05:00 committed by Roy Tam
commit db3b6b5884
8 changed files with 34 additions and 112 deletions

View file

@ -267,6 +267,8 @@ NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&&
return NS_ERROR_OUT_OF_MEMORY;
nsIAtom *name = nodeInfo->NameAtom();
RefPtr<nsIAtom> tagAtom = nodeInfo->NameAtom();
RefPtr<nsIAtom> typeAtom = aIs ? NS_Atomize(*aIs) : tagAtom;
NS_ASSERTION(nodeInfo->NamespaceEquals(kNameSpaceID_XHTML),
"Trying to HTML elements that don't have the XHTML namespace");
@ -283,7 +285,7 @@ NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&&
nsContentUtils::LookupCustomElementDefinition(nodeInfo->GetDocument(),
nodeInfo->LocalName(),
nodeInfo->NamespaceID(),
aIs);
typeAtom);
}
// It might be a problem that parser synchronously calls constructor, so filed
@ -326,8 +328,6 @@ NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&&
// SetupCustomElement() should be called with an element that don't have
// CustomElementData setup, if not we will hit the assertion in
// SetCustomElementData().
nsCOMPtr<nsIAtom> tagAtom = nodeInfo->NameAtom();
nsCOMPtr<nsIAtom> typeAtom = aIs ? NS_Atomize(*aIs) : tagAtom;
// Built-in element
*aResult = CreateHTMLElement(tag, nodeInfo.forget(), aFromParser).take();
(*aResult)->SetCustomElementData(new CustomElementData(typeAtom));
@ -377,7 +377,7 @@ NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&&
if (CustomElementRegistry::IsCustomElementEnabled() &&
(isCustomElementName || aIs)) {
nsContentUtils::SetupCustomElement(*aResult, aIs);
(*aResult)->SetCustomElementData(new CustomElementData(typeAtom));
}
return NS_OK;