| 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 0a46fdaba5a704908650023e44b801beb369c7ce..6a3ea30ec63f8da071225e153131c9841885aaa3 100644
|
| --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp
|
| +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp
|
| @@ -17,6 +17,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"
|
| @@ -359,12 +360,50 @@ v8::Local<v8::FunctionTemplate> V8TestInterfaceConstructorConstructor::domTempla
|
| result = v8::FunctionTemplate::New(isolate, V8TestInterfaceConstructorConstructorCallback);
|
| v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate();
|
| instanceTemplate->SetInternalFieldCount(V8TestInterfaceConstructor::internalFieldCount);
|
| - result->SetClassName(v8AtomicString(isolate, "TestInterfaceConstructor"));
|
| + result->SetClassName(v8AtomicString(isolate, "Audio"));
|
| result->Inherit(V8TestInterfaceConstructor::domTemplate(isolate, world));
|
| data->setInterfaceTemplate(world, &domTemplateKey, result);
|
| return result;
|
| }
|
|
|
| +void V8TestInterfaceConstructorConstructor::NamedConstructorAttributeGetter(
|
| + v8::Local<v8::Name> propertyName,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + v8::Local<v8::Value> data = info.Data();
|
| + DCHECK(data->IsExternal());
|
| + V8PerContextData* perContextData =
|
| + V8PerContextData::from(info.Holder()->CreationContext());
|
| + if (!perContextData)
|
| + return;
|
| +
|
| + v8::Local<v8::Function> namedConstructor = perContextData->constructorForType(&V8TestInterfaceConstructorConstructor::wrapperTypeInfo);
|
| + v8::Local<v8::Function> interface = perContextData->constructorForType(&V8TestInterfaceConstructor::wrapperTypeInfo);
|
| +
|
| + // Set the prototype of named constructors to the regular constructor.
|
| + v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
|
| + auto privateProperty = V8PrivateProperty::getNamedConstructorInitialized(info.GetIsolate());
|
| + v8::Local<v8::Value> privateValue = privateProperty.get(context, namedConstructor);
|
| + if (privateValue.IsEmpty()) {
|
| + // Only Window exposes named constructors, so that will always be the interface name.
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext, "Window", "Audio");
|
| + v8::MaybeLocal<v8::Value> interfacePrototype = interface->Get(context, v8AtomicString(info.GetIsolate(), "prototype"));
|
| + if (interfacePrototype.IsEmpty()) {
|
| + exceptionState.throwTypeError("Could not get prototype for V8TestInterfaceConstructor.");
|
| + return;
|
| + }
|
| +
|
| + v8::Maybe<bool> setResult = namedConstructor->Set(context, v8AtomicString(info.GetIsolate(), "prototype"), interfacePrototype.ToLocalChecked());
|
| + if (setResult.IsNothing() || setResult.ToChecked() != true) {
|
| + exceptionState.throwTypeError("Could not set prototype for Audio.");
|
| + return;
|
| + }
|
| +
|
| + privateProperty.set(context, 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()) {
|
|
|