Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(730)

Unified Diff: Source/core/dom/Document.cpp

Issue 112353004: Add ExceptionState checks in Document::createElement*() methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698