| Index: Source/bindings/tests/results/V8TestInterfaceConstructor2.cpp
|
| diff --git a/Source/bindings/tests/results/V8TestInterfaceConstructor.cpp b/Source/bindings/tests/results/V8TestInterfaceConstructor2.cpp
|
| similarity index 60%
|
| copy from Source/bindings/tests/results/V8TestInterfaceConstructor.cpp
|
| copy to Source/bindings/tests/results/V8TestInterfaceConstructor2.cpp
|
| index 0c0d6bcecf3a96c6089d0b2c7fdb7cb3944ddef6..9b7ebf674a6cd54bae0531b8677e7c05280d3671 100644
|
| --- a/Source/bindings/tests/results/V8TestInterfaceConstructor.cpp
|
| +++ b/Source/bindings/tests/results/V8TestInterfaceConstructor2.cpp
|
| @@ -31,7 +31,7 @@
|
| // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY!
|
|
|
| #include "config.h"
|
| -#include "V8TestInterfaceConstructor.h"
|
| +#include "V8TestInterfaceConstructor2.h"
|
|
|
| #include "RuntimeEnabledFeatures.h"
|
| #include "V8TestInterfaceEmpty.h"
|
| @@ -41,15 +41,14 @@
|
| #include "bindings/v8/V8ObjectConstructor.h"
|
| #include "core/dom/ContextFeatures.h"
|
| #include "core/dom/Document.h"
|
| -#include "core/frame/UseCounter.h"
|
| #include "platform/TraceEvent.h"
|
|
|
| namespace WebCore {
|
|
|
| -static void initializeScriptWrappableForInterface(TestInterfaceConstructor* object)
|
| +static void initializeScriptWrappableForInterface(TestInterfaceConstructor2* object)
|
| {
|
| if (ScriptWrappable::wrapperCanBeStoredInObject(object))
|
| - ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceConstructor::wrapperTypeInfo);
|
| + ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceConstructor2::wrapperTypeInfo);
|
| else
|
| ASSERT_NOT_REACHED();
|
| }
|
| @@ -60,66 +59,72 @@ static void initializeScriptWrappableForInterface(TestInterfaceConstructor* obje
|
| // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function
|
| // in the global namespace.
|
| // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/feedback/details/664619/the-namespace-of-local-function-declarations-in-c)
|
| -void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceConstructor* object)
|
| +void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceConstructor2* object)
|
| {
|
| WebCore::initializeScriptWrappableForInterface(object);
|
| }
|
|
|
| namespace WebCore {
|
| -const WrapperTypeInfo V8TestInterfaceConstructor::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceConstructor::domTemplate, V8TestInterfaceConstructor::derefObject, 0, 0, 0, V8TestInterfaceConstructor::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype };
|
| +const WrapperTypeInfo V8TestInterfaceConstructor2::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceConstructor2::domTemplate, V8TestInterfaceConstructor2::derefObject, 0, 0, 0, V8TestInterfaceConstructor2::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype };
|
|
|
| -namespace TestInterfaceConstructorV8Internal {
|
| +namespace TestInterfaceConstructor2V8Internal {
|
|
|
| template <typename T> void V8_USE(T) { }
|
|
|
| -static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| +static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| +{
|
| + V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]);
|
| + RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(stringArg);
|
| + v8::Handle<v8::Object> wrapper = info.Holder();
|
| +
|
| + V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor2>(impl.release(), &V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent);
|
| + v8SetReturnValue(info, wrapper);
|
| +}
|
| +
|
| +static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| - if (UNLIKELY(info.Length() < 5)) {
|
| - throwTypeError(ExceptionMessages::failedToExecute("Constructor", "TestInterfaceConstructor", ExceptionMessages::notEnoughArguments(5, info.Length())), info.GetIsolate());
|
| + V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceEmpty::hasInstance(info[0], info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestInterfaceEmpty::toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0);
|
| + V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, defaultUndefinedOptionalStringArg, info[1]);
|
| + V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, defaultNullStringOptionalStringArg, argumentOrNull(info, 2));
|
| + V8TRYCATCH_VOID(Dictionary, defaultUndefinedOptionalDictionaryArg, Dictionary(info[3], info.GetIsolate()));
|
| + if (!defaultUndefinedOptionalDictionaryArg.isUndefinedOrNull() && !defaultUndefinedOptionalDictionaryArg.isObject()) {
|
| + throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceConstructor2", "parameter 4 ('defaultUndefinedOptionalDictionaryArg') is not an object."), info.GetIsolate());
|
| return;
|
| }
|
| - ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceConstructor", info.Holder(), info.GetIsolate());
|
| - V8TRYCATCH_VOID(double, doubleArg, static_cast<double>(info[0]->NumberValue()));
|
| - V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[1]);
|
| - V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceEmpty::hasInstance(info[2], info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestInterfaceEmpty::toNative(v8::Handle<v8::Object>::Cast(info[2])) : 0);
|
| - V8TRYCATCH_VOID(Dictionary, dictionaryArg, Dictionary(info[3], info.GetIsolate()));
|
| - if (!dictionaryArg.isUndefinedOrNull() && !dictionaryArg.isObject()) {
|
| - throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceConstructor", "parameter 4 ('dictionaryArg') is not an object."), info.GetIsolate());
|
| + RefPtr<TestInterfaceConstructor2> impl = TestInterfaceConstructor2::create(testInterfaceEmptyArg, defaultUndefinedOptionalStringArg, defaultNullStringOptionalStringArg, defaultUndefinedOptionalDictionaryArg);
|
| + v8::Handle<v8::Object> wrapper = info.Holder();
|
| +
|
| + V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor2>(impl.release(), &V8TestInterfaceConstructor2::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent);
|
| + v8SetReturnValue(info, wrapper);
|
| +}
|
| +
|
| +static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| +{
|
| + if (((info.Length() == 1))) {
|
| + TestInterfaceConstructor2V8Internal::constructor1(info);
|
| return;
|
| }
|
| - V8TRYCATCH_VOID(Vector<String>, sequenceStringArg, toNativeArray<String>(info[4], 5, info.GetIsolate()));
|
| - V8TRYCATCH_VOID(Dictionary, optionalDictionaryArg, Dictionary(info[5], info.GetIsolate()));
|
| - if (!optionalDictionaryArg.isUndefinedOrNull() && !optionalDictionaryArg.isObject()) {
|
| - throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceConstructor", "parameter 6 ('optionalDictionaryArg') is not an object."), info.GetIsolate());
|
| + if (((info.Length() == 1) && (V8TestInterfaceEmpty::hasInstance(info[0], info.GetIsolate(), worldType(info.GetIsolate())))) || ((info.Length() == 2) && (V8TestInterfaceEmpty::hasInstance(info[0], info.GetIsolate(), worldType(info.GetIsolate())))) || ((info.Length() == 3) && (V8TestInterfaceEmpty::hasInstance(info[0], info.GetIsolate(), worldType(info.GetIsolate())))) || ((info.Length() == 4) && (V8TestInterfaceEmpty::hasInstance(info[0], info.GetIsolate(), worldType(info.GetIsolate()))))) {
|
| + TestInterfaceConstructor2V8Internal::constructor2(info);
|
| return;
|
| }
|
| - V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, defaultUndefinedOptionalStringArg, info[6]);
|
| - V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, defaultNullStringOptionalStringArg, argumentOrNull(info, 7));
|
| - V8TRYCATCH_VOID(TestInterfaceEmpty*, optionalTestInterfaceEmptyArg, V8TestInterfaceEmpty::hasInstance(info[8], info.GetIsolate(), worldType(info.GetIsolate())) ? V8TestInterfaceEmpty::toNative(v8::Handle<v8::Object>::Cast(info[8])) : 0);
|
| - V8TRYCATCH_VOID(Dictionary, defaultUndefinedOptionalDictionaryArg, Dictionary(info[9], info.GetIsolate()));
|
| - if (!defaultUndefinedOptionalDictionaryArg.isUndefinedOrNull() && !defaultUndefinedOptionalDictionaryArg.isObject()) {
|
| - throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceConstructor", "parameter 10 ('defaultUndefinedOptionalDictionaryArg') is not an object."), info.GetIsolate());
|
| + ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceConstructor2", info.Holder(), info.GetIsolate());
|
| + if (UNLIKELY(info.Length() < 1)) {
|
| + exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length()));
|
| + exceptionState.throwIfNeeded();
|
| return;
|
| }
|
| - ExecutionContext* context = getExecutionContext();
|
| - Document& document = *toDocument(getExecutionContext());
|
| - RefPtr<TestInterfaceConstructor> impl = TestInterfaceConstructor::create(context, document, doubleArg, stringArg, testInterfaceEmptyArg, dictionaryArg, sequenceStringArg, optionalDictionaryArg, defaultUndefinedOptionalStringArg, defaultNullStringOptionalStringArg, optionalTestInterfaceEmptyArg, defaultUndefinedOptionalDictionaryArg, exceptionState);
|
| - v8::Handle<v8::Object> wrapper = info.Holder();
|
| - if (exceptionState.throwIfNeeded())
|
| - return;
|
| -
|
| - V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl.release(), &V8TestInterfaceConstructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent);
|
| - v8SetReturnValue(info, wrapper);
|
| + exceptionState.throwTypeError("No matching constructor signature.");
|
| + exceptionState.throwIfNeeded();
|
| }
|
|
|
| -} // namespace TestInterfaceConstructorV8Internal
|
| +} // namespace TestInterfaceConstructor2V8Internal
|
|
|
| -void V8TestInterfaceConstructor::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| +void V8TestInterfaceConstructor2::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor");
|
| - UseCounter::count(activeDOMWindow(), UseCounter::TestFeature);
|
| if (!info.IsConstructCall()) {
|
| - throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceConstructor", "Please use the 'new' operator, this DOM object constructor cannot be called as a function."), info.GetIsolate());
|
| + throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceConstructor2", "Please use the 'new' operator, this DOM object constructor cannot be called as a function."), info.GetIsolate());
|
| return;
|
| }
|
|
|
| @@ -128,21 +133,21 @@ void V8TestInterfaceConstructor::constructorCallback(const v8::FunctionCallbackI
|
| return;
|
| }
|
|
|
| - TestInterfaceConstructorV8Internal::constructor(info);
|
| + TestInterfaceConstructor2V8Internal::constructor(info);
|
| }
|
|
|
| -static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceConstructorTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType)
|
| +static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceConstructor2Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType)
|
| {
|
| functionTemplate->ReadOnlyPrototype();
|
|
|
| v8::Local<v8::Signature> defaultSignature;
|
| - defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceConstructor", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceConstructor::internalFieldCount,
|
| + defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceConstructor2", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceConstructor2::internalFieldCount,
|
| 0, 0,
|
| 0, 0,
|
| 0, 0,
|
| isolate, currentWorldType);
|
| - functionTemplate->SetCallHandler(V8TestInterfaceConstructor::constructorCallback);
|
| - functionTemplate->SetLength(5);
|
| + functionTemplate->SetCallHandler(V8TestInterfaceConstructor2::constructorCallback);
|
| + functionTemplate->SetLength(1);
|
| v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTemplate->InstanceTemplate();
|
| v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTemplate->PrototypeTemplate();
|
|
|
| @@ -151,7 +156,7 @@ static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceConstructorTempl
|
| return functionTemplate;
|
| }
|
|
|
| -v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor::domTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType)
|
| +v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor2::domTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType)
|
| {
|
| V8PerIsolateData* data = V8PerIsolateData::from(isolate);
|
| V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWorldType).find(&wrapperTypeInfo);
|
| @@ -161,27 +166,27 @@ v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor::domTemplate(v8::Iso
|
| TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
|
| v8::EscapableHandleScope handleScope(isolate);
|
| v8::Local<v8::FunctionTemplate> templ =
|
| - ConfigureV8TestInterfaceConstructorTemplate(data->rawDOMTemplate(&wrapperTypeInfo, currentWorldType), isolate, currentWorldType);
|
| + ConfigureV8TestInterfaceConstructor2Template(data->rawDOMTemplate(&wrapperTypeInfo, currentWorldType), isolate, currentWorldType);
|
| data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTemplate>(isolate, templ));
|
| return handleScope.Escape(templ);
|
| }
|
|
|
| -bool V8TestInterfaceConstructor::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate, WrapperWorldType currentWorldType)
|
| +bool V8TestInterfaceConstructor2::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate, WrapperWorldType currentWorldType)
|
| {
|
| return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValue, currentWorldType);
|
| }
|
|
|
| -bool V8TestInterfaceConstructor::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate)
|
| +bool V8TestInterfaceConstructor2::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate)
|
| {
|
| return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValue, MainWorld)
|
| || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValue, IsolatedWorld)
|
| || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValue, WorkerWorld);
|
| }
|
|
|
| -v8::Handle<v8::Object> V8TestInterfaceConstructor::createWrapper(PassRefPtr<TestInterfaceConstructor> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| +v8::Handle<v8::Object> V8TestInterfaceConstructor2::createWrapper(PassRefPtr<TestInterfaceConstructor2> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| {
|
| ASSERT(impl);
|
| - ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceConstructor>(impl.get(), isolate));
|
| + ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceConstructor2>(impl.get(), isolate));
|
| if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
|
| const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl.get());
|
| // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have
|
| @@ -194,17 +199,17 @@ v8::Handle<v8::Object> V8TestInterfaceConstructor::createWrapper(PassRefPtr<Test
|
| return wrapper;
|
|
|
| installPerContextEnabledProperties(wrapper, impl.get(), isolate);
|
| - V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
|
| + V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor2>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
|
| return wrapper;
|
| }
|
|
|
| -void V8TestInterfaceConstructor::derefObject(void* object)
|
| +void V8TestInterfaceConstructor2::derefObject(void* object)
|
| {
|
| fromInternalPointer(object)->deref();
|
| }
|
|
|
| template<>
|
| -v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| +v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| {
|
| return toV8(impl, creationContext, isolate);
|
| }
|
|
|