Index: third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp |
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp |
index 0e703cad458ebf76c73dec97eca5604fcd7284f7..302a11a4a1cf1a168a75dc6eb65c457f6f4ae0e6 100644 |
--- a/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp |
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElementRegistry.cpp |
@@ -8,6 +8,7 @@ |
#include "bindings/core/v8/ScriptCustomElementDefinitionBuilder.h" |
#include "bindings/core/v8/ScriptPromise.h" |
#include "bindings/core/v8/ScriptPromiseResolver.h" |
+#include "core/HTMLElementTypeHelpers.h" |
#include "core/dom/Document.h" |
#include "core/dom/Element.h" |
#include "core/dom/ElementDefinitionOptions.h" |
@@ -119,15 +120,24 @@ void CustomElementRegistry::define(const AtomicString& name, |
if (!builder.checkConstructorNotRegistered()) |
return; |
+ AtomicString localName = name; |
+ |
// Step 7. customized built-in elements definition |
// element interface extends option checks |
if (RuntimeEnabledFeatures::customElementsBuiltinEnabled() && |
options.hasExtends()) { |
- // If element interface is valid custom element name, throw exception |
+ // 7.1. If element interface is valid custom element name, throw exception |
+ const AtomicString& extends = AtomicString(options.extends()); |
if (throwIfValidName(AtomicString(options.extends()), exceptionState)) |
return; |
- // If element interface is undefined element, throw exception |
- // Set localname to extends |
+ // 7.2. If element interface is undefined element, throw exception |
+ if (htmlElementTypeForTag(extends) == HTMLElementType::HTMLUnknownElement) { |
+ exceptionState.throwDOMException( |
+ NotSupportedError, "\"" + extends + "\" is an HTMLUnknownElement"); |
+ return; |
+ } |
+ // 7.3. Set localName to extends |
+ localName = extends; |
} |
// TODO(dominicc): Add a test where the prototype getter destroys |
@@ -160,9 +170,10 @@ void CustomElementRegistry::define(const AtomicString& name, |
// CustomElementRegistry's element definition is running |
// flag." |
// (ElementDefinitionIsRunning destructor does this.) |
+ // ElementDefinitionIsRunning destructor(m_elementDefinitionIsRunning); |
dominicc (has gone to gerrit)
2016/10/21 02:30:07
I assume we still need this code?
|
} |
- CustomElementDescriptor descriptor(name, name); |
+ CustomElementDescriptor descriptor(name, localName); |
CustomElementDefinition* definition = builder.build(descriptor); |
CHECK(!exceptionState.hadException()); |
CHECK(definition->descriptor() == descriptor); |