| Index: third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp
|
| index 15e56f62142cc07fc41604e3ecb31674c533787a..f908bfd4cf34d71ed608cf89ca4f9dd3eb3ad23a 100644
|
| --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp
|
| +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp
|
| @@ -16,6 +16,7 @@
|
| #include "bindings/core/v8/LongOrTestDictionary.h"
|
| #include "bindings/core/v8/V8DOMConfiguration.h"
|
| #include "bindings/core/v8/V8ObjectConstructor.h"
|
| +#include "bindings/core/v8/V8PrivateProperty.h"
|
| #include "bindings/core/v8/V8TestDictionary.h"
|
| #include "bindings/core/v8/V8TestInterfaceEmpty.h"
|
| #include "core/dom/Document.h"
|
| @@ -364,6 +365,35 @@ v8::Local<v8::FunctionTemplate> V8TestInterfaceConstructorConstructor::domTempla
|
| return result;
|
| }
|
|
|
| +void V8TestInterfaceConstructorConstructor::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(&V8TestInterfaceConstructorConstructor::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(&V8TestInterfaceConstructor::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);
|
| +}
|
| +
|
| void V8TestInterfaceConstructor::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
|
| UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::TestFeature);
|
| if (!info.IsConstructCall()) {
|
|
|