| Index: third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventTarget.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventTarget.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventTarget.cpp
|
| index 6d998bb3fc78d09b337caa58022652229ca74d75..e720341c6f973145de6931189b6fcf7f05982e6f 100644
|
| --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventTarget.cpp
|
| +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventTarget.cpp
|
| @@ -14,6 +14,7 @@
|
| #include "bindings/core/v8/ExceptionState.h"
|
| #include "bindings/core/v8/V8DOMConfiguration.h"
|
| #include "bindings/core/v8/V8ObjectConstructor.h"
|
| +#include "bindings/core/v8/V8PrivateProperty.h"
|
| #include "core/dom/Document.h"
|
| #include "core/frame/LocalDOMWindow.h"
|
| #include "wtf/GetPtr.h"
|
| @@ -93,12 +94,41 @@ v8::Local<v8::FunctionTemplate> V8TestInterfaceEventTargetConstructor::domTempla
|
| result = v8::FunctionTemplate::New(isolate, V8TestInterfaceEventTargetConstructorCallback);
|
| v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate();
|
| instanceTemplate->SetInternalFieldCount(V8TestInterfaceEventTarget::internalFieldCount);
|
| - result->SetClassName(v8AtomicString(isolate, "TestInterfaceEventTarget"));
|
| + result->SetClassName(v8AtomicString(isolate, "Name"));
|
| result->Inherit(V8TestInterfaceEventTarget::domTemplate(isolate, world));
|
| data->setInterfaceTemplate(world, &domTemplateKey, result);
|
| return result;
|
| }
|
|
|
| +void V8TestInterfaceEventTargetConstructor::NamedConstructorAttributeGetter(
|
| + v8::Local<v8::Name> propertyName,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + v8::Local<v8::Context> creationContext = info.Holder()->CreationContext();
|
| + V8PerContextData* perContextData = V8PerContextData::from(creationContext);
|
| + if (!perContextData) {
|
| + // TODO(yukishiino): Return a valid named constructor even after the context is detached
|
| + return;
|
| + }
|
| +
|
| + v8::Local<v8::Function> namedConstructor = perContextData->constructorForType(&V8TestInterfaceEventTargetConstructor::wrapperTypeInfo);
|
| +
|
| + // Set the prototype of named constructors to the regular constructor.
|
| + auto privateProperty = V8PrivateProperty::getNamedConstructorInitialized(info.GetIsolate());
|
| + v8::Local<v8::Context> currentContext = info.GetIsolate()->GetCurrentContext();
|
| + v8::Local<v8::Value> privateValue = privateProperty.get(currentContext, namedConstructor);
|
| +
|
| + if (privateValue.IsEmpty()) {
|
| + v8::Local<v8::Function> interface = perContextData->constructorForType(&V8TestInterfaceEventTarget::wrapperTypeInfo);
|
| + v8::Local<v8::Value> interfacePrototype = interface->Get(currentContext, v8AtomicString(info.GetIsolate(), "prototype")).ToLocalChecked();
|
| + bool result = namedConstructor->Set(currentContext, v8AtomicString(info.GetIsolate(), "prototype"), interfacePrototype).ToChecked();
|
| + if (!result)
|
| + return;
|
| + privateProperty.set(currentContext, namedConstructor, v8::True(info.GetIsolate()));
|
| + }
|
| +
|
| + v8SetReturnValue(info, namedConstructor);
|
| +}
|
| +
|
| static void installV8TestInterfaceEventTargetTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world, v8::Local<v8::FunctionTemplate> interfaceTemplate) {
|
| // Initialize the interface object's template.
|
| V8DOMConfiguration::initializeDOMInterfaceTemplate(isolate, interfaceTemplate, V8TestInterfaceEventTarget::wrapperTypeInfo.interfaceName, V8EventTarget::domTemplate(isolate, world), V8TestInterfaceEventTarget::internalFieldCount);
|
|
|