| Index: third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistry.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistry.cpp b/third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistry.cpp
|
| index 2ecc455436fc31c9a4b2539d45094f9b81ccd7f3..4d9f0911da77109f9be6ef95687043083d04515a 100644
|
| --- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistry.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistry.cpp
|
| @@ -30,15 +30,32 @@
|
|
|
| #include "core/dom/custom/V0CustomElementRegistry.h"
|
|
|
| +#include "bindings/core/v8/ScriptState.h"
|
| #include "bindings/core/v8/V0CustomElementConstructorBuilder.h"
|
| +#include "bindings/core/v8/V8Binding.h"
|
| #include "core/HTMLNames.h"
|
| #include "core/SVGNames.h"
|
| +#include "core/dom/Document.h"
|
| +#include "core/dom/custom/CustomElementsRegistry.h"
|
| #include "core/dom/custom/V0CustomElementException.h"
|
| #include "core/dom/custom/V0CustomElementRegistrationContext.h"
|
| +#include "core/frame/LocalDOMWindow.h"
|
|
|
| namespace blink {
|
|
|
| -V0CustomElementDefinition* V0CustomElementRegistry::registerElement(Document* document, V0CustomElementConstructorBuilder* constructorBuilder, const AtomicString& userSuppliedName, V0CustomElement::NameSet validNames, ExceptionState& exceptionState)
|
| +static bool v1CustomElementIsDefined(ScriptState* scriptState, const AtomicString& name)
|
| +{
|
| + CustomElementsRegistry* registry =
|
| + scriptState->domWindow()->customElements(scriptState);
|
| + return registry && registry->nameIsDefined(name);
|
| +}
|
| +
|
| +bool V0CustomElementRegistry::nameIsDefined(const AtomicString& name) const
|
| +{
|
| + return m_registeredTypeNames.contains(name);
|
| +}
|
| +
|
| +V0CustomElementDefinition* V0CustomElementRegistry::registerElement(ScriptState* scriptState, Document* document, V0CustomElementConstructorBuilder* constructorBuilder, const AtomicString& userSuppliedName, V0CustomElement::NameSet validNames, ExceptionState& exceptionState)
|
| {
|
| AtomicString type = userSuppliedName.lower();
|
|
|
| @@ -52,7 +69,7 @@ V0CustomElementDefinition* V0CustomElementRegistry::registerElement(Document* do
|
| return 0;
|
| }
|
|
|
| - if (m_registeredTypeNames.contains(type)) {
|
| + if (m_registeredTypeNames.contains(type) || v1CustomElementIsDefined(scriptState, type)) {
|
| V0CustomElementException::throwException(V0CustomElementException::TypeAlreadyRegistered, type, exceptionState);
|
| return 0;
|
| }
|
|
|