| Index: Source/bindings/tests/results/core/V8TestObject.cpp
|
| diff --git a/Source/bindings/tests/results/core/V8TestObject.cpp b/Source/bindings/tests/results/core/V8TestObject.cpp
|
| index 3641c09328d531abc7965d67669f09b65cdcaf4c..a277081d8a46d2cf13efae9c8d987758d28440de 100644
|
| --- a/Source/bindings/tests/results/core/V8TestObject.cpp
|
| +++ b/Source/bindings/tests/results/core/V8TestObject.cpp
|
| @@ -73,7 +73,7 @@
|
|
|
| namespace blink {
|
|
|
| -const WrapperTypeInfo V8TestObject::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestObject::domTemplate, V8TestObject::refObject, V8TestObject::derefObject, V8TestObject::trace, 0, 0, V8TestObject::installConditionallyEnabledMethods, V8TestObject::installConditionallyEnabledProperties, "TestObject", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::NotInheritFromEventTarget, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject };
|
| +const WrapperTypeInfo V8TestObject::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestObject::domTemplate, V8TestObject::refObject, V8TestObject::derefObject, V8TestObject::trace, 0, 0, V8TestObject::preparePrototypeObject, V8TestObject::installConditionallyEnabledProperties, "TestObject", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::NotInheritFromEventTarget, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject };
|
|
|
| // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestObject.h.
|
| // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
|
| @@ -5236,6 +5236,38 @@ static void sameObjectAttributeAttributeSetterCallback(v8::Local<v8::Name>, v8::
|
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
|
| }
|
|
|
| +static void unscopeableLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
|
| +{
|
| + v8::Local<v8::Object> holder = info.Holder();
|
| + TestObject* impl = V8TestObject::toImpl(holder);
|
| + v8SetReturnValueInt(info, impl->unscopeableLongAttribute());
|
| +}
|
| +
|
| +static void unscopeableLongAttributeAttributeGetterCallback(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info)
|
| +{
|
| + TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
|
| + TestObjectV8Internal::unscopeableLongAttributeAttributeGetter(info);
|
| + TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
|
| +}
|
| +
|
| +static void unscopeableLongAttributeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
|
| +{
|
| + v8::Local<v8::Object> holder = info.Holder();
|
| + ExceptionState exceptionState(ExceptionState::SetterContext, "unscopeableLongAttribute", "TestObject", holder, info.GetIsolate());
|
| + TestObject* impl = V8TestObject::toImpl(holder);
|
| + int cppValue = toInt32(info.GetIsolate(), v8Value, NormalConversion, exceptionState);
|
| + if (exceptionState.throwIfNeeded())
|
| + return;
|
| + impl->setUnscopeableLongAttribute(cppValue);
|
| +}
|
| +
|
| +static void unscopeableLongAttributeAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
|
| +{
|
| + TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
|
| + TestObjectV8Internal::unscopeableLongAttributeAttributeSetter(v8Value, info);
|
| + TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
|
| +}
|
| +
|
| static void testInterfaceAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
|
| {
|
| v8::Local<v8::Object> holder = info.Holder();
|
| @@ -5591,6 +5623,19 @@ static void measureAsFeatureNameTestInterfaceEmptyConstructorAttributeConstructo
|
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
|
| }
|
|
|
| +static void unscopeableVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| +{
|
| + TestObject* impl = V8TestObject::toImpl(info.Holder());
|
| + impl->unscopeableVoidMethod();
|
| +}
|
| +
|
| +static void unscopeableVoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| +{
|
| + TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
|
| + TestObjectV8Internal::unscopeableVoidMethodMethod(info);
|
| + TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
|
| +}
|
| +
|
| static void voidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| TestObject* impl = V8TestObject::toImpl(info.Holder());
|
| @@ -12326,6 +12371,7 @@ static const V8DOMConfiguration::AttributeConfiguration V8TestObjectAttributes[]
|
| {"unforgeableLongAttribute", TestObjectV8Internal::unforgeableLongAttributeAttributeGetterCallback, TestObjectV8Internal::unforgeableLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::PROHIBITS_OVERWRITING), static_cast<v8::PropertyAttribute>(v8::DontDelete), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
|
| {"measuredLongAttribute", TestObjectV8Internal::measuredLongAttributeAttributeGetterCallback, TestObjectV8Internal::measuredLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
|
| {"sameObjectAttribute", TestObjectV8Internal::sameObjectAttributeAttributeGetterCallback, TestObjectV8Internal::sameObjectAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
|
| + {"unscopeableLongAttribute", TestObjectV8Internal::unscopeableLongAttributeAttributeGetterCallback, TestObjectV8Internal::unscopeableLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
|
| {"testInterfaceAttribute", TestObjectV8Internal::testInterfaceAttributeAttributeGetterCallback, TestObjectV8Internal::testInterfaceAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
|
| {"testInterfaceGarbageCollectedAttribute", TestObjectV8Internal::testInterfaceGarbageCollectedAttributeAttributeGetterCallback, TestObjectV8Internal::testInterfaceGarbageCollectedAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
|
| {"testInterfaceGarbageCollectedOrNullAttribute", TestObjectV8Internal::testInterfaceGarbageCollectedOrNullAttributeAttributeGetterCallback, TestObjectV8Internal::testInterfaceGarbageCollectedOrNullAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
|
| @@ -12345,6 +12391,7 @@ static const V8DOMConfiguration::AccessorConfiguration V8TestObjectAccessors[] =
|
| };
|
|
|
| static const V8DOMConfiguration::MethodConfiguration V8TestObjectMethods[] = {
|
| + {"unscopeableVoidMethod", TestObjectV8Internal::unscopeableVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
|
| {"voidMethod", TestObjectV8Internal::voidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
|
| {"dateMethod", TestObjectV8Internal::dateMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
|
| {"stringMethod", TestObjectV8Internal::stringMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
|
| @@ -12768,12 +12815,21 @@ void V8TestObject::installConditionallyEnabledProperties(v8::Local<v8::Object> i
|
| }
|
| }
|
|
|
| -void V8TestObject::installConditionallyEnabledMethods(v8::Local<v8::Object> prototypeObject, v8::Isolate* isolate)
|
| +void V8TestObject::preparePrototypeObject(v8::Isolate* isolate, v8::Local<v8::Object> prototypeObject)
|
| {
|
| + v8::Local<v8::Context> v8Context(prototypeObject->CreationContext());
|
| + v8::Local<v8::Name> unscopablesSymbol(v8::Symbol::GetUnscopables(isolate));
|
| + v8::Local<v8::Object> unscopeables;
|
| + if (v8CallBoolean(prototypeObject->HasOwnProperty(v8Context, unscopablesSymbol)))
|
| + unscopeables = prototypeObject->Get(v8Context, unscopablesSymbol).ToLocalChecked().As<v8::Object>();
|
| + else
|
| + unscopeables = v8::Object::New(isolate);
|
| + unscopeables->ForceSet(v8Context, v8AtomicString(isolate, "unscopeableLongAttribute"), v8::True(isolate)).FromJust();
|
| + unscopeables->ForceSet(v8Context, v8AtomicString(isolate, "unscopeableVoidMethod"), v8::True(isolate)).FromJust();
|
| + prototypeObject->ForceSet(v8Context, unscopablesSymbol, unscopeables).FromJust();
|
| v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domTemplate(isolate));
|
| ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext());
|
| ASSERT(context);
|
| -
|
| if (context && context->isDocument() && ContextFeatures::featureNameEnabled(toDocument(context))) {
|
| prototypeObject->Set(v8AtomicString(isolate, "perContextEnabledVoidMethod"), v8::FunctionTemplate::New(isolate, TestObjectV8Internal::perContextEnabledVoidMethodMethodCallback, v8Undefined(), defaultSignature, 0)->GetFunction(isolate->GetCurrentContext()).ToLocalChecked());
|
| }
|
|
|