| 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 4599e4c503401dbbb7ca3c5893d269ca12cb3035..52d8938c51209f7b61f69219227443b205a5b1ba 100644
|
| --- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventTarget.cpp
|
| +++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventTarget.cpp
|
| @@ -15,6 +15,7 @@
|
| #include "bindings/core/v8/GeneratedCodeHelper.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"
|
| @@ -61,7 +62,7 @@ namespace TestInterfaceEventTargetV8Internal {
|
| #pragma clang diagnostic push
|
| #pragma clang diagnostic ignored "-Wglobal-constructors"
|
| #endif
|
| -const WrapperTypeInfo V8TestInterfaceEventTargetConstructor::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceEventTargetConstructor::domTemplate, V8TestInterfaceEventTarget::trace, V8TestInterfaceEventTarget::traceWrappers, 0, nullptr, "TestInterfaceEventTarget", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::NotInheritFromActiveScriptWrappable, WrapperTypeInfo::InheritFromEventTarget, WrapperTypeInfo::Independent };
|
| +const WrapperTypeInfo V8TestInterfaceEventTargetConstructor::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceEventTargetConstructor::domTemplate, V8TestInterfaceEventTarget::trace, V8TestInterfaceEventTarget::traceWrappers, 0, nullptr, "TestInterfaceEventTarget", &V8EventTarget::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::NotInheritFromActiveScriptWrappable, WrapperTypeInfo::InheritFromEventTarget, WrapperTypeInfo::Independent };
|
| #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
|
| #pragma clang diagnostic pop
|
| #endif
|
| @@ -94,12 +95,50 @@ 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::Value> data = info.Data();
|
| + DCHECK(data->IsExternal());
|
| + V8PerContextData* perContextData =
|
| + V8PerContextData::from(info.Holder()->CreationContext());
|
| + if (!perContextData)
|
| + return;
|
| +
|
| + v8::Local<v8::Function> namedConstructor = perContextData->constructorForType(&V8TestInterfaceEventTargetConstructor::wrapperTypeInfo);
|
| + v8::Local<v8::Function> interface = perContextData->constructorForType(&V8TestInterfaceEventTarget::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", "Name");
|
| + v8::MaybeLocal<v8::Value> interfacePrototype = interface->Get(context, v8AtomicString(info.GetIsolate(), "prototype"));
|
| + if (interfacePrototype.IsEmpty()) {
|
| + exceptionState.throwTypeError("Could not get prototype for V8TestInterfaceEventTarget.");
|
| + 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 Name.");
|
| + return;
|
| + }
|
| +
|
| + privateProperty.set(context, 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);
|
|
|