Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index 520a1547d5abf3e66f7469cfed58e0816a0c26c1..e63072c337f7a0fb773a7379778dd5ae39575035 100644 |
--- a/Source/core/dom/Document.cpp |
+++ b/Source/core/dom/Document.cpp |
@@ -705,10 +705,13 @@ PassRefPtr<Element> Document::createElement(const AtomicString& localName, const |
RefPtr<Element> element; |
- if (RuntimeEnabledFeatures::customElementsEnabled() && CustomElement::isValidName(localName) && registrationContext()) |
+ if (RuntimeEnabledFeatures::customElementsEnabled() && CustomElement::isValidName(localName) && registrationContext()) { |
element = registrationContext()->createCustomTagElement(*this, QualifiedName(nullAtom, localName, xhtmlNamespaceURI)); |
- else |
+ } else { |
element = createElement(localName, exceptionState); |
+ if (exceptionState.hadException()) |
+ return 0; |
+ } |
if (RuntimeEnabledFeatures::customElementsEnabled() && !typeExtension.isNull() && !typeExtension.isEmpty()) |
CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element.get(), typeExtension); |
@@ -729,10 +732,13 @@ PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI, |
} |
RefPtr<Element> element; |
- if (CustomElement::isValidName(qName.localName()) && registrationContext()) |
+ if (CustomElement::isValidName(qName.localName()) && registrationContext()) { |
element = registrationContext()->createCustomTagElement(*this, qName); |
- else |
+ } else { |
element = createElementNS(namespaceURI, qualifiedName, exceptionState); |
+ if (exceptionState.hadException()) |
+ return 0; |
+ } |
if (!typeExtension.isNull() && !typeExtension.isEmpty()) |
CustomElementRegistrationContext::setIsAttributeAndTypeExtension(element.get(), typeExtension); |