summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2020-01-20 21:44:27 -0500
committerGaming4JC <g4jc@hyperbola.info>2020-01-26 15:50:49 -0500
commit14d115cfe32ab72b7193a4fb74e13c06c6d4cc8f (patch)
tree78b8e98ce1cf0a8066098038a4bfa0cfdbe99901
parent8db81508a1ffe1c3873503a1cb2082d664714776 (diff)
downloadUXP-14d115cfe32ab72b7193a4fb74e13c06c6d4cc8f.tar
UXP-14d115cfe32ab72b7193a4fb74e13c06c6d4cc8f.tar.gz
UXP-14d115cfe32ab72b7193a4fb74e13c06c6d4cc8f.tar.lz
UXP-14d115cfe32ab72b7193a4fb74e13c06c6d4cc8f.tar.xz
UXP-14d115cfe32ab72b7193a4fb74e13c06c6d4cc8f.zip
Bug 1419643 - Don't need to lookup custom element definition for a non-custom element
Tag UXP Issue #1344
-rw-r--r--dom/html/nsHTMLContentSink.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/dom/html/nsHTMLContentSink.cpp b/dom/html/nsHTMLContentSink.cpp
index 7d60fffb5..920ded728 100644
--- a/dom/html/nsHTMLContentSink.cpp
+++ b/dom/html/nsHTMLContentSink.cpp
@@ -275,12 +275,18 @@ NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&&
int32_t tag = parserService->HTMLCaseSensitiveAtomTagToId(name);
+ bool isCustomElementName = (tag == eHTMLTag_userdefined &&
+ nsContentUtils::IsCustomElementName(name));
+ bool isCustomElement = isCustomElementName || aIs;
+ MOZ_ASSERT_IF(aDefinition, isCustomElement);
+
// https://dom.spec.whatwg.org/#concept-create-element
// We only handle the "synchronous custom elements flag is set" now.
// For the unset case (e.g. cloning a node), see bug 1319342 for that.
// Step 4.
CustomElementDefinition* definition = aDefinition;
- if (!definition && CustomElementRegistry::IsCustomElementEnabled()) {
+ if (CustomElementRegistry::IsCustomElementEnabled() && isCustomElement &&
+ !definition) {
definition =
nsContentUtils::LookupCustomElementDefinition(nodeInfo->GetDocument(),
nodeInfo->LocalName(),
@@ -363,8 +369,6 @@ NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&&
// Per the Custom Element specification, unknown tags that are valid custom
// element names should be HTMLElement instead of HTMLUnknownElement.
- bool isCustomElementName = (tag == eHTMLTag_userdefined &&
- nsContentUtils::IsCustomElementName(name));
if (isCustomElementName) {
NS_IF_ADDREF(*aResult = NS_NewHTMLElement(nodeInfo.forget(), aFromParser));
} else {
@@ -375,8 +379,7 @@ NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&&
return NS_ERROR_OUT_OF_MEMORY;
}
- if (CustomElementRegistry::IsCustomElementEnabled() &&
- (isCustomElementName || aIs)) {
+ if (CustomElementRegistry::IsCustomElementEnabled() && isCustomElement) {
(*aResult)->SetCustomElementData(new CustomElementData(typeAtom));
}