| Index: third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/CustomElementConstructorBuilder.cpp b/third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.cpp
|
| similarity index 79%
|
| rename from third_party/WebKit/Source/bindings/core/v8/CustomElementConstructorBuilder.cpp
|
| rename to third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.cpp
|
| index a02a26c59081f5fe46d96117a16c8ab494217af3..eb67fcb18bca58e5006653264f28a4a2a322ad84 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/CustomElementConstructorBuilder.cpp
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.cpp
|
| @@ -28,11 +28,11 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#include "bindings/core/v8/CustomElementConstructorBuilder.h"
|
| +#include "bindings/core/v8/V0CustomElementConstructorBuilder.h"
|
|
|
| -#include "bindings/core/v8/CustomElementBinding.h"
|
| #include "bindings/core/v8/DOMWrapperWorld.h"
|
| #include "bindings/core/v8/ExceptionState.h"
|
| +#include "bindings/core/v8/V0CustomElementBinding.h"
|
| #include "bindings/core/v8/V8Binding.h"
|
| #include "bindings/core/v8/V8Document.h"
|
| #include "bindings/core/v8/V8HTMLElement.h"
|
| @@ -43,29 +43,29 @@
|
| #include "core/SVGNames.h"
|
| #include "core/dom/Document.h"
|
| #include "core/dom/ElementRegistrationOptions.h"
|
| -#include "core/dom/custom/CustomElementDefinition.h"
|
| -#include "core/dom/custom/CustomElementDescriptor.h"
|
| -#include "core/dom/custom/CustomElementException.h"
|
| -#include "core/dom/custom/CustomElementProcessingStack.h"
|
| +#include "core/dom/custom/V0CustomElementDefinition.h"
|
| +#include "core/dom/custom/V0CustomElementDescriptor.h"
|
| +#include "core/dom/custom/V0CustomElementException.h"
|
| +#include "core/dom/custom/V0CustomElementProcessingStack.h"
|
| #include "wtf/Assertions.h"
|
|
|
| namespace blink {
|
|
|
| static void constructCustomElement(const v8::FunctionCallbackInfo<v8::Value>&);
|
|
|
| -CustomElementConstructorBuilder::CustomElementConstructorBuilder(ScriptState* scriptState, const ElementRegistrationOptions& options)
|
| +V0CustomElementConstructorBuilder::V0CustomElementConstructorBuilder(ScriptState* scriptState, const ElementRegistrationOptions& options)
|
| : m_scriptState(scriptState)
|
| , m_options(options)
|
| {
|
| ASSERT(m_scriptState->context() == m_scriptState->isolate()->GetCurrentContext());
|
| }
|
|
|
| -bool CustomElementConstructorBuilder::isFeatureAllowed() const
|
| +bool V0CustomElementConstructorBuilder::isFeatureAllowed() const
|
| {
|
| return m_scriptState->world().isMainWorld();
|
| }
|
|
|
| -bool CustomElementConstructorBuilder::validateOptions(const AtomicString& type, QualifiedName& tagName, ExceptionState& exceptionState)
|
| +bool V0CustomElementConstructorBuilder::validateOptions(const AtomicString& type, QualifiedName& tagName, ExceptionState& exceptionState)
|
| {
|
| ASSERT(m_prototype.IsEmpty());
|
|
|
| @@ -73,7 +73,7 @@ bool CustomElementConstructorBuilder::validateOptions(const AtomicString& type,
|
|
|
| if (!m_scriptState->perContextData()) {
|
| // FIXME: This should generate an InvalidContext exception at a later point.
|
| - CustomElementException::throwException(CustomElementException::ContextDestroyedCheckingPrototype, type, exceptionState);
|
| + V0CustomElementException::throwException(V0CustomElementException::ContextDestroyedCheckingPrototype, type, exceptionState);
|
| tryCatch.ReThrow();
|
| return false;
|
| }
|
| @@ -102,18 +102,18 @@ bool CustomElementConstructorBuilder::validateOptions(const AtomicString& type,
|
| localName = AtomicString(m_options.extends().lower());
|
|
|
| if (!Document::isValidName(localName)) {
|
| - CustomElementException::throwException(CustomElementException::ExtendsIsInvalidName, type, exceptionState);
|
| + V0CustomElementException::throwException(V0CustomElementException::ExtendsIsInvalidName, type, exceptionState);
|
| tryCatch.ReThrow();
|
| return false;
|
| }
|
| - if (CustomElement::isValidName(localName)) {
|
| - CustomElementException::throwException(CustomElementException::ExtendsIsCustomElementName, type, exceptionState);
|
| + if (V0CustomElement::isValidName(localName)) {
|
| + V0CustomElementException::throwException(V0CustomElementException::ExtendsIsCustomElementName, type, exceptionState);
|
| tryCatch.ReThrow();
|
| return false;
|
| }
|
| } else {
|
| if (namespaceURI == SVGNames::svgNamespaceURI) {
|
| - CustomElementException::throwException(CustomElementException::ExtendsIsInvalidName, type, exceptionState);
|
| + V0CustomElementException::throwException(V0CustomElementException::ExtendsIsInvalidName, type, exceptionState);
|
| tryCatch.ReThrow();
|
| return false;
|
| }
|
| @@ -125,7 +125,7 @@ bool CustomElementConstructorBuilder::validateOptions(const AtomicString& type,
|
| return true;
|
| }
|
|
|
| -CustomElementLifecycleCallbacks* CustomElementConstructorBuilder::createCallbacks()
|
| +V0CustomElementLifecycleCallbacks* V0CustomElementConstructorBuilder::createCallbacks()
|
| {
|
| ASSERT(!m_prototype.IsEmpty());
|
|
|
| @@ -137,11 +137,11 @@ CustomElementLifecycleCallbacks* CustomElementConstructorBuilder::createCallback
|
| v8::MaybeLocal<v8::Function> detached = retrieveCallback("detachedCallback");
|
| v8::MaybeLocal<v8::Function> attributeChanged = retrieveCallback("attributeChangedCallback");
|
|
|
| - m_callbacks = V8CustomElementLifecycleCallbacks::create(m_scriptState.get(), m_prototype, created, attached, detached, attributeChanged);
|
| + m_callbacks = V8V0CustomElementLifecycleCallbacks::create(m_scriptState.get(), m_prototype, created, attached, detached, attributeChanged);
|
| return m_callbacks.get();
|
| }
|
|
|
| -v8::MaybeLocal<v8::Function> CustomElementConstructorBuilder::retrieveCallback(const char* name)
|
| +v8::MaybeLocal<v8::Function> V0CustomElementConstructorBuilder::retrieveCallback(const char* name)
|
| {
|
| v8::Local<v8::Value> value;
|
| if (!m_prototype->Get(m_scriptState->context(), v8String(m_scriptState->isolate(), name)).ToLocal(&value) || !value->IsFunction())
|
| @@ -149,7 +149,7 @@ v8::MaybeLocal<v8::Function> CustomElementConstructorBuilder::retrieveCallback(c
|
| return v8::MaybeLocal<v8::Function>(value.As<v8::Function>());
|
| }
|
|
|
| -bool CustomElementConstructorBuilder::createConstructor(Document* document, CustomElementDefinition* definition, ExceptionState& exceptionState)
|
| +bool V0CustomElementConstructorBuilder::createConstructor(Document* document, V0CustomElementDefinition* definition, ExceptionState& exceptionState)
|
| {
|
| ASSERT(!m_prototype.IsEmpty());
|
| ASSERT(m_constructor.IsEmpty());
|
| @@ -161,7 +161,7 @@ bool CustomElementConstructorBuilder::createConstructor(Document* document, Cust
|
| if (!prototypeIsValid(definition->descriptor().type(), exceptionState))
|
| return false;
|
|
|
| - const CustomElementDescriptor& descriptor = definition->descriptor();
|
| + const V0CustomElementDescriptor& descriptor = definition->descriptor();
|
|
|
| v8::Local<v8::String> v8TagName = v8String(isolate, descriptor.localName());
|
| v8::Local<v8::Value> v8Type;
|
| @@ -179,7 +179,7 @@ bool CustomElementConstructorBuilder::createConstructor(Document* document, Cust
|
| v8::Local<v8::FunctionTemplate> constructorTemplate = v8::FunctionTemplate::New(isolate);
|
| constructorTemplate->SetCallHandler(constructCustomElement, data);
|
| if (!constructorTemplate->GetFunction(context).ToLocal(&m_constructor)) {
|
| - CustomElementException::throwException(CustomElementException::ContextDestroyedRegisteringDefinition, definition->descriptor().type(), exceptionState);
|
| + V0CustomElementException::throwException(V0CustomElementException::ContextDestroyedRegisteringDefinition, definition->descriptor().type(), exceptionState);
|
| return false;
|
| }
|
|
|
| @@ -214,35 +214,35 @@ bool CustomElementConstructorBuilder::createConstructor(Document* document, Cust
|
| return true;
|
| }
|
|
|
| -bool CustomElementConstructorBuilder::prototypeIsValid(const AtomicString& type, ExceptionState& exceptionState) const
|
| +bool V0CustomElementConstructorBuilder::prototypeIsValid(const AtomicString& type, ExceptionState& exceptionState) const
|
| {
|
| if (m_prototype->InternalFieldCount() || !V8HiddenValue::getHiddenValue(m_scriptState.get(), m_prototype, V8HiddenValue::customElementIsInterfacePrototypeObject(m_scriptState->isolate())).IsEmpty()) {
|
| - CustomElementException::throwException(CustomElementException::PrototypeInUse, type, exceptionState);
|
| + V0CustomElementException::throwException(V0CustomElementException::PrototypeInUse, type, exceptionState);
|
| return false;
|
| }
|
|
|
| v8::PropertyAttribute propertyAttribute;
|
| if (!v8Call(m_prototype->GetPropertyAttributes(m_scriptState->context(), v8String(m_scriptState->isolate(), "constructor")), propertyAttribute) || (propertyAttribute & v8::DontDelete)) {
|
| - CustomElementException::throwException(CustomElementException::ConstructorPropertyNotConfigurable, type, exceptionState);
|
| + V0CustomElementException::throwException(V0CustomElementException::ConstructorPropertyNotConfigurable, type, exceptionState);
|
| return false;
|
| }
|
|
|
| return true;
|
| }
|
|
|
| -bool CustomElementConstructorBuilder::didRegisterDefinition() const
|
| +bool V0CustomElementConstructorBuilder::didRegisterDefinition() const
|
| {
|
| ASSERT(!m_constructor.IsEmpty());
|
|
|
| - return m_callbacks->setBinding(CustomElementBinding::create(m_scriptState->isolate(), m_prototype));
|
| + return m_callbacks->setBinding(V0CustomElementBinding::create(m_scriptState->isolate(), m_prototype));
|
| }
|
|
|
| -ScriptValue CustomElementConstructorBuilder::bindingsReturnValue() const
|
| +ScriptValue V0CustomElementConstructorBuilder::bindingsReturnValue() const
|
| {
|
| return ScriptValue(m_scriptState.get(), m_constructor);
|
| }
|
|
|
| -bool CustomElementConstructorBuilder::hasValidPrototypeChainFor(const WrapperTypeInfo* type) const
|
| +bool V0CustomElementConstructorBuilder::hasValidPrototypeChainFor(const WrapperTypeInfo* type) const
|
| {
|
| v8::Local<v8::Object> elementPrototype = m_scriptState->perContextData()->prototypeForType(type);
|
| if (elementPrototype.IsEmpty())
|
| @@ -281,7 +281,7 @@ static void constructCustomElement(const v8::FunctionCallbackInfo<v8::Value>& in
|
| TOSTRING_VOID(V8StringResource<>, type, maybeType);
|
|
|
| ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomElement", info.Holder(), info.GetIsolate());
|
| - CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
|
| + V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
|
| Element* element = document->createElementNS(namespaceURI, tagName, maybeType->IsNull() ? nullAtom : type, exceptionState);
|
| if (exceptionState.throwIfNeeded())
|
| return;
|
|
|