| Index: third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp b/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp
|
| index 7193eabcf7ffd00fcf4f893aafcb9ea9db6b3dae..7fae6acafea27153ed949c3dc367d263e377280b 100644
|
| --- a/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp
|
| +++ b/third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp
|
| @@ -786,167 +786,150 @@ void iteratorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| TestInterface5ImplementationV8Internal::iteratorMethod(info);
|
| }
|
|
|
| -static void namedPropertyGetter(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| -{
|
| - TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
|
| - String result = impl->anonymousNamedGetter(name);
|
| - if (result.isNull())
|
| - return;
|
| - v8SetReturnValueString(info, result, info.GetIsolate());
|
| +static void namedPropertyGetter(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
|
| + String result = impl->anonymousNamedGetter(name);
|
| + if (result.isNull())
|
| + return;
|
| + v8SetReturnValueString(info, result, info.GetIsolate());
|
| }
|
|
|
| -void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| -{
|
| - if (!name->IsString())
|
| - return;
|
| - const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
| +void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + if (!name->IsString())
|
| + return;
|
| + const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
|
|
| - TestInterface5ImplementationV8Internal::namedPropertyGetter(propertyName, info);
|
| + TestInterface5ImplementationV8Internal::namedPropertyGetter(propertyName, info);
|
| }
|
|
|
| -static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| -{
|
| - TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
|
| - V8StringResource<> propertyValue = v8Value;
|
| - if (!propertyValue.prepare())
|
| - return;
|
| +static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
|
| + V8StringResource<> propertyValue = v8Value;
|
| + if (!propertyValue.prepare())
|
| + return;
|
|
|
| - bool result = impl->anonymousNamedSetter(name, propertyValue);
|
| - if (!result)
|
| - return;
|
| - v8SetReturnValue(info, v8Value);
|
| + bool result = impl->anonymousNamedSetter(name, propertyValue);
|
| + if (!result)
|
| + return;
|
| + v8SetReturnValue(info, v8Value);
|
| }
|
|
|
| -void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| -{
|
| - if (!name->IsString())
|
| - return;
|
| - const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
| +void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + if (!name->IsString())
|
| + return;
|
| + const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
|
|
| - TestInterface5ImplementationV8Internal::namedPropertySetter(propertyName, v8Value, info);
|
| + TestInterface5ImplementationV8Internal::namedPropertySetter(propertyName, v8Value, info);
|
| }
|
|
|
| -static void namedPropertyDeleter(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
|
| -{
|
| - TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
|
| +static void namedPropertyDeleter(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
|
| + TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
|
|
|
| - DeleteResult result = impl->anonymousNamedDeleter(name);
|
| - if (result == DeleteUnknownProperty)
|
| - return;
|
| - v8SetReturnValue(info, result == DeleteSuccess);
|
| + DeleteResult result = impl->anonymousNamedDeleter(name);
|
| + if (result == DeleteUnknownProperty)
|
| + return;
|
| + v8SetReturnValue(info, result == DeleteSuccess);
|
| }
|
|
|
| -void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
|
| -{
|
| - if (!name->IsString())
|
| - return;
|
| - const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
| +void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
|
| + if (!name->IsString())
|
| + return;
|
| + const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
|
|
| - TestInterface5ImplementationV8Internal::namedPropertyDeleter(propertyName, info);
|
| + TestInterface5ImplementationV8Internal::namedPropertyDeleter(propertyName, info);
|
| }
|
|
|
| -static void namedPropertyQuery(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Integer>& info)
|
| -{
|
| - const CString& nameInUtf8 = name.utf8();
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext, "TestInterface5", nameInUtf8.data());
|
| +static void namedPropertyQuery(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Integer>& info) {
|
| + const CString& nameInUtf8 = name.utf8();
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext, "TestInterface5", nameInUtf8.data());
|
|
|
| - TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
|
| + TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
|
|
|
| - bool result = impl->namedPropertyQuery(name, exceptionState);
|
| - if (!result)
|
| - return;
|
| - v8SetReturnValueInt(info, v8::None);
|
| + bool result = impl->namedPropertyQuery(name, exceptionState);
|
| + if (!result)
|
| + return;
|
| + v8SetReturnValueInt(info, v8::None);
|
| }
|
|
|
| -void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
|
| -{
|
| - if (!name->IsString())
|
| - return;
|
| - const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
| +void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info) {
|
| + if (!name->IsString())
|
| + return;
|
| + const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
|
|
| - TestInterface5ImplementationV8Internal::namedPropertyQuery(propertyName, info);
|
| + TestInterface5ImplementationV8Internal::namedPropertyQuery(propertyName, info);
|
| }
|
|
|
| -static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info)
|
| -{
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::EnumerationContext, "TestInterface5");
|
| +static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) {
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::EnumerationContext, "TestInterface5");
|
|
|
| - TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
|
| + TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
|
|
|
| - Vector<String> names;
|
| - impl->namedPropertyEnumerator(names, exceptionState);
|
| - if (exceptionState.hadException())
|
| - return;
|
| - v8SetReturnValue(info, toV8(names, info.Holder(), info.GetIsolate()).As<v8::Array>());
|
| + Vector<String> names;
|
| + impl->namedPropertyEnumerator(names, exceptionState);
|
| + if (exceptionState.hadException())
|
| + return;
|
| + v8SetReturnValue(info, toV8(names, info.Holder(), info.GetIsolate()).As<v8::Array>());
|
| }
|
|
|
| -void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info)
|
| -{
|
| - TestInterface5ImplementationV8Internal::namedPropertyEnumerator(info);
|
| +void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info) {
|
| + TestInterface5ImplementationV8Internal::namedPropertyEnumerator(info);
|
| }
|
|
|
| -static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| -{
|
| - TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
|
| +static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
|
|
|
| - // We assume that all the implementations support length() method, although
|
| - // the spec doesn't require that length() must exist. It's okay that
|
| - // the interface does not have length attribute as long as the
|
| - // implementation supports length() member function.
|
| - if (index >= impl->length())
|
| - return; // Returns undefined due to out-of-range.
|
| + // We assume that all the implementations support length() method, although
|
| + // the spec doesn't require that length() must exist. It's okay that
|
| + // the interface does not have length attribute as long as the
|
| + // implementation supports length() member function.
|
| + if (index >= impl->length())
|
| + return; // Returns undefined due to out-of-range.
|
|
|
| - String result = impl->anonymousIndexedGetter(index);
|
| - v8SetReturnValueString(info, result, info.GetIsolate());
|
| + String result = impl->anonymousIndexedGetter(index);
|
| + v8SetReturnValueString(info, result, info.GetIsolate());
|
| }
|
|
|
| -void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| -{
|
| - TestInterface5ImplementationV8Internal::indexedPropertyGetter(index, info);
|
| +void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + TestInterface5ImplementationV8Internal::indexedPropertyGetter(index, info);
|
| }
|
|
|
| -static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| -{
|
| - TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
|
| - V8StringResource<> propertyValue = v8Value;
|
| - if (!propertyValue.prepare())
|
| - return;
|
| +static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
|
| + V8StringResource<> propertyValue = v8Value;
|
| + if (!propertyValue.prepare())
|
| + return;
|
|
|
| - bool result = impl->anonymousIndexedSetter(index, propertyValue);
|
| - if (!result)
|
| - return;
|
| - v8SetReturnValue(info, v8Value);
|
| + bool result = impl->anonymousIndexedSetter(index, propertyValue);
|
| + if (!result)
|
| + return;
|
| + v8SetReturnValue(info, v8Value);
|
| }
|
|
|
| -void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| -{
|
| - TestInterface5ImplementationV8Internal::indexedPropertySetter(index, v8Value, info);
|
| +void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + TestInterface5ImplementationV8Internal::indexedPropertySetter(index, v8Value, info);
|
| }
|
|
|
| -static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
|
| -{
|
| - TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
|
| +static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
|
| + TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder());
|
|
|
| - DeleteResult result = impl->anonymousIndexedDeleter(index);
|
| - if (result == DeleteUnknownProperty)
|
| - return;
|
| - v8SetReturnValue(info, result == DeleteSuccess);
|
| + DeleteResult result = impl->anonymousIndexedDeleter(index);
|
| + if (result == DeleteUnknownProperty)
|
| + return;
|
| + v8SetReturnValue(info, result == DeleteSuccess);
|
| }
|
|
|
| -void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info)
|
| -{
|
| - TestInterface5ImplementationV8Internal::indexedPropertyDeleter(index, info);
|
| +void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
|
| + TestInterface5ImplementationV8Internal::indexedPropertyDeleter(index, info);
|
| }
|
|
|
| } // namespace TestInterface5ImplementationV8Internal
|
|
|
| -void V8TestInterface5::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappable* scriptWrappable, const v8::Persistent<v8::Object>& wrapper)
|
| -{
|
| - TestInterface5Implementation* impl = scriptWrappable->toImpl<TestInterface5Implementation>();
|
| - TestInterface5Implementation* referencedName = impl->referencedName();
|
| - if (referencedName) {
|
| - DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, referencedName, isolate);
|
| - }
|
| +void V8TestInterface5::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappable* scriptWrappable, const v8::Persistent<v8::Object>& wrapper) {
|
| + TestInterface5Implementation* impl = scriptWrappable->toImpl<TestInterface5Implementation>();
|
| + TestInterface5Implementation* referencedName = impl->referencedName();
|
| + if (referencedName) {
|
| + DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, referencedName, isolate);
|
| + }
|
| }
|
|
|
| // Suppress warning: global constructors, because AttributeConfiguration is trivial
|
| @@ -990,98 +973,92 @@ const V8DOMConfiguration::MethodConfiguration V8TestInterface5Methods[] = {
|
| {"toString", TestInterface5ImplementationV8Internal::toStringMethodCallback, 0, 0, static_cast<v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype},
|
| };
|
|
|
| -static void installV8TestInterface5Template(v8::Isolate* isolate, const DOMWrapperWorld& world, v8::Local<v8::FunctionTemplate> interfaceTemplate)
|
| -{
|
| - // Initialize the interface object's template.
|
| - V8DOMConfiguration::initializeDOMInterfaceTemplate(isolate, interfaceTemplate, V8TestInterface5::wrapperTypeInfo.interfaceName, V8TestInterfaceEmpty::domTemplate(isolate, world), V8TestInterface5::internalFieldCount);
|
| - v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate);
|
| - ALLOW_UNUSED_LOCAL(signature);
|
| - v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->InstanceTemplate();
|
| - ALLOW_UNUSED_LOCAL(instanceTemplate);
|
| - v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->PrototypeTemplate();
|
| - ALLOW_UNUSED_LOCAL(prototypeTemplate);
|
| - // Register DOM constants, attributes and operations.
|
| - if (RuntimeEnabledFeatures::featureNameEnabled()) {
|
| - const V8DOMConfiguration::ConstantConfiguration V8TestInterface5Constants[] = {
|
| - {"UNSIGNED_LONG", 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong},
|
| - {"CONST_JAVASCRIPT", 1, 0, V8DOMConfiguration::ConstantTypeShort},
|
| - };
|
| - V8DOMConfiguration::installConstants(isolate, interfaceTemplate, prototypeTemplate, V8TestInterface5Constants, WTF_ARRAY_LENGTH(V8TestInterface5Constants));
|
| - V8DOMConfiguration::installAttributes(isolate, world, instanceTemplate, prototypeTemplate, V8TestInterface5Attributes, WTF_ARRAY_LENGTH(V8TestInterface5Attributes));
|
| - V8DOMConfiguration::installAccessors(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, V8TestInterface5Accessors, WTF_ARRAY_LENGTH(V8TestInterface5Accessors));
|
| - V8DOMConfiguration::installMethods(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, V8TestInterface5Methods, WTF_ARRAY_LENGTH(V8TestInterface5Methods));
|
| - }
|
| -
|
| - // Indexed properties
|
| - v8::IndexedPropertyHandlerConfiguration indexedPropertyHandlerConfig(TestInterface5ImplementationV8Internal::indexedPropertyGetterCallback, TestInterface5ImplementationV8Internal::indexedPropertySetterCallback, 0, TestInterface5ImplementationV8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestInterface5Implementation>, v8::Local<v8::Value>(), v8::PropertyHandlerFlags::kNone);
|
| - instanceTemplate->SetHandler(indexedPropertyHandlerConfig);
|
| - // Named properties
|
| - v8::NamedPropertyHandlerConfiguration namedPropertyHandlerConfig(TestInterface5ImplementationV8Internal::namedPropertyGetterCallback, TestInterface5ImplementationV8Internal::namedPropertySetterCallback, TestInterface5ImplementationV8Internal::namedPropertyQueryCallback, TestInterface5ImplementationV8Internal::namedPropertyDeleterCallback, TestInterface5ImplementationV8Internal::namedPropertyEnumeratorCallback, v8::Local<v8::Value>(), static_cast<v8::PropertyHandlerFlags>(int(v8::PropertyHandlerFlags::kOnlyInterceptStrings) | int(v8::PropertyHandlerFlags::kNonMasking)));
|
| - instanceTemplate->SetHandler(namedPropertyHandlerConfig);
|
| -
|
| - // Iterator (@@iterator)
|
| - const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorConfiguration = { v8::Symbol::GetIterator, TestInterface5ImplementationV8Internal::iteratorMethodCallback, 0, v8::DontEnum, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype };
|
| - V8DOMConfiguration::installMethod(isolate, world, prototypeTemplate, signature, symbolKeyedIteratorConfiguration);
|
| -
|
| - instanceTemplate->SetCallAsFunctionHandler(V8TestInterface5::legacyCallCustom);
|
| -}
|
| -
|
| -v8::Local<v8::FunctionTemplate> V8TestInterface5::domTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world)
|
| -{
|
| - return V8DOMConfiguration::domClassTemplate(isolate, world, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestInterface5Template);
|
| -}
|
| -
|
| -bool V8TestInterface5::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
|
| -{
|
| - return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
|
| -}
|
| -
|
| -v8::Local<v8::Object> V8TestInterface5::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate)
|
| -{
|
| - return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
|
| -}
|
| -
|
| -TestInterface5Implementation* V8TestInterface5::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value)
|
| -{
|
| - return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : nullptr;
|
| -}
|
| -
|
| -void V8TestInterface5::preparePrototypeAndInterfaceObject(v8::Local<v8::Context> context, const DOMWrapperWorld& world, v8::Local<v8::Object> prototypeObject, v8::Local<v8::Function> interfaceObject, v8::Local<v8::FunctionTemplate> interfaceTemplate)
|
| -{
|
| - v8::Isolate* isolate = context->GetIsolate();
|
| - ExecutionContext* executionContext = toExecutionContext(context);
|
| - v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate);
|
| - if (executionContext && (executionContext->isWorkerGlobalScope())) {
|
| - const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {"workerExposedAttribute", TestInterface5ImplementationV8Internal::workerExposedAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::workerExposedAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder};
|
| - V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, accessorConfiguration);
|
| - }
|
| - if (executionContext && (executionContext->isDocument())) {
|
| - const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {"windowExposedAttribute", TestInterface5ImplementationV8Internal::windowExposedAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::windowExposedAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder};
|
| - V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, accessorConfiguration);
|
| - }
|
| - v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate);
|
| - ExecutionContext* executionContext = toExecutionContext(prototypeObject->CreationContext());
|
| - ASSERT(executionContext);
|
| - if (executionContext && (executionContext->isWorkerGlobalScope())) {
|
| - const V8DOMConfiguration::MethodConfiguration workerExposedMethodMethodConfiguration = {"workerExposedMethod", TestInterface5ImplementationV8Internal::workerExposedMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
|
| - V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, workerExposedMethodMethodConfiguration);
|
| - }
|
| - if (executionContext && (executionContext->isDocument())) {
|
| - const V8DOMConfiguration::MethodConfiguration windowExposedMethodMethodConfiguration = {"windowExposedMethod", TestInterface5ImplementationV8Internal::windowExposedMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
|
| - V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, windowExposedMethodMethodConfiguration);
|
| - }
|
| - if (executionContext && (executionContext->isWorkerGlobalScope())) {
|
| - const V8DOMConfiguration::MethodConfiguration workerExposedStaticMethodMethodConfiguration = {"workerExposedStaticMethod", TestInterface5ImplementationV8Internal::workerExposedStaticMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface};
|
| - V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, workerExposedStaticMethodMethodConfiguration);
|
| - }
|
| - if (executionContext && (executionContext->isDocument())) {
|
| - const V8DOMConfiguration::MethodConfiguration windowExposedStaticMethodMethodConfiguration = {"windowExposedStaticMethod", TestInterface5ImplementationV8Internal::windowExposedStaticMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface};
|
| - V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, windowExposedStaticMethodMethodConfiguration);
|
| - }
|
| - if (executionContext && (executionContext->isDocument() || executionContext->isServiceWorkerGlobalScope())) {
|
| - const V8DOMConfiguration::MethodConfiguration windowAndServiceWorkerExposedMethodMethodConfiguration = {"windowAndServiceWorkerExposedMethod", TestInterface5ImplementationV8Internal::windowAndServiceWorkerExposedMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
|
| - V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, windowAndServiceWorkerExposedMethodMethodConfiguration);
|
| - }
|
| -}
|
| -
|
| -} // namespace blink
|
| +static void installV8TestInterface5Template(v8::Isolate* isolate, const DOMWrapperWorld& world, v8::Local<v8::FunctionTemplate> interfaceTemplate) {
|
| + // Initialize the interface object's template.
|
| + V8DOMConfiguration::initializeDOMInterfaceTemplate(isolate, interfaceTemplate, V8TestInterface5::wrapperTypeInfo.interfaceName, V8TestInterfaceEmpty::domTemplate(isolate, world), V8TestInterface5::internalFieldCount);
|
| + v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate);
|
| + ALLOW_UNUSED_LOCAL(signature);
|
| + v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->InstanceTemplate();
|
| + ALLOW_UNUSED_LOCAL(instanceTemplate);
|
| + v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->PrototypeTemplate();
|
| + ALLOW_UNUSED_LOCAL(prototypeTemplate);
|
| + // Register DOM constants, attributes and operations.
|
| + if (RuntimeEnabledFeatures::featureNameEnabled()) {
|
| + const V8DOMConfiguration::ConstantConfiguration V8TestInterface5Constants[] = {
|
| + {"UNSIGNED_LONG", 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong},
|
| + {"CONST_JAVASCRIPT", 1, 0, V8DOMConfiguration::ConstantTypeShort},
|
| + };
|
| + V8DOMConfiguration::installConstants(isolate, interfaceTemplate, prototypeTemplate, V8TestInterface5Constants, WTF_ARRAY_LENGTH(V8TestInterface5Constants));
|
| + V8DOMConfiguration::installAttributes(isolate, world, instanceTemplate, prototypeTemplate, V8TestInterface5Attributes, WTF_ARRAY_LENGTH(V8TestInterface5Attributes));
|
| + V8DOMConfiguration::installAccessors(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, V8TestInterface5Accessors, WTF_ARRAY_LENGTH(V8TestInterface5Accessors));
|
| + V8DOMConfiguration::installMethods(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, V8TestInterface5Methods, WTF_ARRAY_LENGTH(V8TestInterface5Methods));
|
| + }
|
| +
|
| + // Indexed properties
|
| + v8::IndexedPropertyHandlerConfiguration indexedPropertyHandlerConfig(TestInterface5ImplementationV8Internal::indexedPropertyGetterCallback, TestInterface5ImplementationV8Internal::indexedPropertySetterCallback, 0, TestInterface5ImplementationV8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestInterface5Implementation>, v8::Local<v8::Value>(), v8::PropertyHandlerFlags::kNone);
|
| + instanceTemplate->SetHandler(indexedPropertyHandlerConfig);
|
| + // Named properties
|
| + v8::NamedPropertyHandlerConfiguration namedPropertyHandlerConfig(TestInterface5ImplementationV8Internal::namedPropertyGetterCallback, TestInterface5ImplementationV8Internal::namedPropertySetterCallback, TestInterface5ImplementationV8Internal::namedPropertyQueryCallback, TestInterface5ImplementationV8Internal::namedPropertyDeleterCallback, TestInterface5ImplementationV8Internal::namedPropertyEnumeratorCallback, v8::Local<v8::Value>(), static_cast<v8::PropertyHandlerFlags>(int(v8::PropertyHandlerFlags::kOnlyInterceptStrings) | int(v8::PropertyHandlerFlags::kNonMasking)));
|
| + instanceTemplate->SetHandler(namedPropertyHandlerConfig);
|
| +
|
| + // Iterator (@@iterator)
|
| + const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorConfiguration = { v8::Symbol::GetIterator, TestInterface5ImplementationV8Internal::iteratorMethodCallback, 0, v8::DontEnum, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype };
|
| + V8DOMConfiguration::installMethod(isolate, world, prototypeTemplate, signature, symbolKeyedIteratorConfiguration);
|
| +
|
| + instanceTemplate->SetCallAsFunctionHandler(V8TestInterface5::legacyCallCustom);
|
| +}
|
| +
|
| +v8::Local<v8::FunctionTemplate> V8TestInterface5::domTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world) {
|
| + return V8DOMConfiguration::domClassTemplate(isolate, world, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestInterface5Template);
|
| +}
|
| +
|
| +bool V8TestInterface5::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) {
|
| + return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
|
| +}
|
| +
|
| +v8::Local<v8::Object> V8TestInterface5::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) {
|
| + return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
|
| +}
|
| +
|
| +TestInterface5Implementation* V8TestInterface5::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local<v8::Value> value) {
|
| + return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)) : nullptr;
|
| +}
|
| +
|
| +void V8TestInterface5::preparePrototypeAndInterfaceObject(v8::Local<v8::Context> context, const DOMWrapperWorld& world, v8::Local<v8::Object> prototypeObject, v8::Local<v8::Function> interfaceObject, v8::Local<v8::FunctionTemplate> interfaceTemplate) {
|
| + v8::Isolate* isolate = context->GetIsolate();
|
| + ExecutionContext* executionContext = toExecutionContext(context);
|
| + v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate);
|
| + if (executionContext && (executionContext->isWorkerGlobalScope())) {
|
| + const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {"workerExposedAttribute", TestInterface5ImplementationV8Internal::workerExposedAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::workerExposedAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder};
|
| + V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, accessorConfiguration);
|
| + }
|
| + if (executionContext && (executionContext->isDocument())) {
|
| + const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {"windowExposedAttribute", TestInterface5ImplementationV8Internal::windowExposedAttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::windowExposedAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder};
|
| + V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, accessorConfiguration);
|
| + }
|
| + v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate);
|
| + ExecutionContext* executionContext = toExecutionContext(prototypeObject->CreationContext());
|
| + ASSERT(executionContext);
|
| + if (executionContext && (executionContext->isWorkerGlobalScope())) {
|
| + const V8DOMConfiguration::MethodConfiguration workerExposedMethodMethodConfiguration = {"workerExposedMethod", TestInterface5ImplementationV8Internal::workerExposedMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
|
| + V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, workerExposedMethodMethodConfiguration);
|
| + }
|
| + if (executionContext && (executionContext->isDocument())) {
|
| + const V8DOMConfiguration::MethodConfiguration windowExposedMethodMethodConfiguration = {"windowExposedMethod", TestInterface5ImplementationV8Internal::windowExposedMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
|
| + V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, windowExposedMethodMethodConfiguration);
|
| + }
|
| + if (executionContext && (executionContext->isWorkerGlobalScope())) {
|
| + const V8DOMConfiguration::MethodConfiguration workerExposedStaticMethodMethodConfiguration = {"workerExposedStaticMethod", TestInterface5ImplementationV8Internal::workerExposedStaticMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface};
|
| + V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, workerExposedStaticMethodMethodConfiguration);
|
| + }
|
| + if (executionContext && (executionContext->isDocument())) {
|
| + const V8DOMConfiguration::MethodConfiguration windowExposedStaticMethodMethodConfiguration = {"windowExposedStaticMethod", TestInterface5ImplementationV8Internal::windowExposedStaticMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInterface};
|
| + V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, windowExposedStaticMethodMethodConfiguration);
|
| + }
|
| + if (executionContext && (executionContext->isDocument() || executionContext->isServiceWorkerGlobalScope())) {
|
| + const V8DOMConfiguration::MethodConfiguration windowAndServiceWorkerExposedMethodMethodConfiguration = {"windowAndServiceWorkerExposedMethod", TestInterface5ImplementationV8Internal::windowAndServiceWorkerExposedMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype};
|
| + V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, windowAndServiceWorkerExposedMethodMethodConfiguration);
|
| + }
|
| +}
|
| +
|
| +} // namespace blink
|
|
|