| Index: Source/bindings/tests/results/V8TestObject.cpp
|
| diff --git a/Source/bindings/tests/results/V8TestObject.cpp b/Source/bindings/tests/results/V8TestObject.cpp
|
| index ba91c5a18a6bd2fbf160ef4ccfa8f39bb276c658..5a009a165c14204bb5f0a325f334a3128e7f2d8e 100644
|
| --- a/Source/bindings/tests/results/V8TestObject.cpp
|
| +++ b/Source/bindings/tests/results/V8TestObject.cpp
|
| @@ -10,6 +10,7 @@
|
| #include "bindings/core/v8/BindingSecurity.h"
|
| #include "bindings/core/v8/Dictionary.h"
|
| #include "bindings/core/v8/ExceptionState.h"
|
| +#include "bindings/core/v8/Optional.h"
|
| #include "bindings/core/v8/PrivateScriptRunner.h"
|
| #include "bindings/core/v8/ScriptCallStackFactory.h"
|
| #include "bindings/core/v8/ScriptPromise.h"
|
| @@ -6664,16 +6665,21 @@ static void voidMethodOptionalTestCallbackInterfaceArgMethod(const v8::FunctionC
|
| {
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| OwnPtr<TestCallbackInterface> optionalTestCallbackInterfaceArg;
|
| + bool optionalTestCallbackInterfaceArgMissing = false;
|
| {
|
| - if (info.Length() > 0 && !isUndefinedOrNull(info[0])) {
|
| - if (!info[0]->IsFunction()) {
|
| - V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute("voidMethodOptionalTestCallbackInterfaceArg", "TestObject", "The callback provided as parameter 1 is not a function."), info.GetIsolate());
|
| - return;
|
| + if (!info[0]->IsUndefined()) {
|
| + if (info.Length() > 0 && !isUndefinedOrNull(info[0])) {
|
| + if (!info[0]->IsFunction()) {
|
| + V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute("voidMethodOptionalTestCallbackInterfaceArg", "TestObject", "The callback provided as parameter 1 is not a function."), info.GetIsolate());
|
| + return;
|
| + }
|
| + optionalTestCallbackInterfaceArg = V8TestCallbackInterface::create(v8::Handle<v8::Function>::Cast(info[0]), ScriptState::current(info.GetIsolate()));
|
| }
|
| - optionalTestCallbackInterfaceArg = V8TestCallbackInterface::create(v8::Handle<v8::Function>::Cast(info[0]), ScriptState::current(info.GetIsolate()));
|
| + } else {
|
| + optionalTestCallbackInterfaceArgMissing = true;
|
| }
|
| }
|
| - impl->voidMethodOptionalTestCallbackInterfaceArg(optionalTestCallbackInterfaceArg.release());
|
| + impl->voidMethodOptionalTestCallbackInterfaceArg(Optional<OwnPtr<TestCallbackInterface> >(optionalTestCallbackInterfaceArg, optionalTestCallbackInterfaceArgMissing));
|
| }
|
|
|
| static void voidMethodOptionalTestCallbackInterfaceArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| @@ -7043,14 +7049,15 @@ static void voidMethodOptionalStringArgMethod(const v8::FunctionCallbackInfo<v8:
|
| {
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| V8StringResource<> optionalStringArg;
|
| + bool optionalStringArgMissing = false;
|
| {
|
| - if (UNLIKELY(info.Length() <= 0)) {
|
| - impl->voidMethodOptionalStringArg();
|
| - return;
|
| + if (!info[0]->IsUndefined()) {
|
| + TOSTRING_VOID_INTERNAL(optionalStringArg, info[0]);
|
| + } else {
|
| + optionalStringArgMissing = true;
|
| }
|
| - TOSTRING_VOID_INTERNAL(optionalStringArg, info[0]);
|
| }
|
| - impl->voidMethodOptionalStringArg(optionalStringArg);
|
| + impl->voidMethodOptionalStringArg(Optional<V8StringResource<> >(optionalStringArg, optionalStringArgMissing));
|
| }
|
|
|
| static void voidMethodOptionalStringArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| @@ -7063,17 +7070,18 @@ static void voidMethodOptionalStringArgMethodCallback(const v8::FunctionCallback
|
| static void voidMethodOptionalTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| - TestInterfaceEmpty* optionalTestInterfaceEmptyArg;
|
| + TestInterfaceEmpty* optionalTestInterfaceEmptyArg = nullptr;
|
| + bool optionalTestInterfaceEmptyArgMissing = false;
|
| {
|
| v8::TryCatch block;
|
| V8RethrowTryCatchScope rethrow(block);
|
| - if (UNLIKELY(info.Length() <= 0)) {
|
| - impl->voidMethodOptionalTestInterfaceEmptyArg();
|
| - return;
|
| + if (!info[0]->IsUndefined()) {
|
| + TONATIVE_VOID_INTERNAL(optionalTestInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
|
| + } else {
|
| + optionalTestInterfaceEmptyArgMissing = true;
|
| }
|
| - TONATIVE_VOID_INTERNAL(optionalTestInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
|
| }
|
| - impl->voidMethodOptionalTestInterfaceEmptyArg(optionalTestInterfaceEmptyArg);
|
| + impl->voidMethodOptionalTestInterfaceEmptyArg(Optional<RefPtr<TestInterfaceEmpty> >(optionalTestInterfaceEmptyArg, optionalTestInterfaceEmptyArgMissing));
|
| }
|
|
|
| static void voidMethodOptionalTestInterfaceEmptyArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| @@ -7087,17 +7095,18 @@ static void voidMethodOptionalLongArgMethod(const v8::FunctionCallbackInfo<v8::V
|
| {
|
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodOptionalLongArg", "TestObject", info.Holder(), info.GetIsolate());
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| - int optionalLongArg;
|
| + int optionalLongArg = 0;
|
| + bool optionalLongArgMissing = false;
|
| {
|
| v8::TryCatch block;
|
| V8RethrowTryCatchScope rethrow(block);
|
| - if (UNLIKELY(info.Length() <= 0)) {
|
| - impl->voidMethodOptionalLongArg();
|
| - return;
|
| + if (!info[0]->IsUndefined()) {
|
| + TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalLongArg, toInt32(info[0], exceptionState), exceptionState);
|
| + } else {
|
| + optionalLongArgMissing = true;
|
| }
|
| - TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalLongArg, toInt32(info[0], exceptionState), exceptionState);
|
| }
|
| - impl->voidMethodOptionalLongArg(optionalLongArg);
|
| + impl->voidMethodOptionalLongArg(Optional<int>(optionalLongArg, optionalLongArgMissing));
|
| }
|
|
|
| static void voidMethodOptionalLongArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| @@ -7111,17 +7120,18 @@ static void stringMethodOptionalLongArgMethod(const v8::FunctionCallbackInfo<v8:
|
| {
|
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringMethodOptionalLongArg", "TestObject", info.Holder(), info.GetIsolate());
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| - int optionalLongArg;
|
| + int optionalLongArg = 0;
|
| + bool optionalLongArgMissing = false;
|
| {
|
| v8::TryCatch block;
|
| V8RethrowTryCatchScope rethrow(block);
|
| - if (UNLIKELY(info.Length() <= 0)) {
|
| - v8SetReturnValueString(info, impl->stringMethodOptionalLongArg(), info.GetIsolate());
|
| - return;
|
| + if (!info[0]->IsUndefined()) {
|
| + TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalLongArg, toInt32(info[0], exceptionState), exceptionState);
|
| + } else {
|
| + optionalLongArgMissing = true;
|
| }
|
| - TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalLongArg, toInt32(info[0], exceptionState), exceptionState);
|
| }
|
| - v8SetReturnValueString(info, impl->stringMethodOptionalLongArg(optionalLongArg), info.GetIsolate());
|
| + v8SetReturnValueString(info, impl->stringMethodOptionalLongArg(Optional<int>(optionalLongArg, optionalLongArgMissing)), info.GetIsolate());
|
| }
|
|
|
| static void stringMethodOptionalLongArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| @@ -7135,17 +7145,18 @@ static void testInterfaceEmptyMethodOptionalLongArgMethod(const v8::FunctionCall
|
| {
|
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "testInterfaceEmptyMethodOptionalLongArg", "TestObject", info.Holder(), info.GetIsolate());
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| - int optionalLongArg;
|
| + int optionalLongArg = 0;
|
| + bool optionalLongArgMissing = false;
|
| {
|
| v8::TryCatch block;
|
| V8RethrowTryCatchScope rethrow(block);
|
| - if (UNLIKELY(info.Length() <= 0)) {
|
| - v8SetReturnValue(info, impl->testInterfaceEmptyMethodOptionalLongArg());
|
| - return;
|
| + if (!info[0]->IsUndefined()) {
|
| + TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalLongArg, toInt32(info[0], exceptionState), exceptionState);
|
| + } else {
|
| + optionalLongArgMissing = true;
|
| }
|
| - TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalLongArg, toInt32(info[0], exceptionState), exceptionState);
|
| }
|
| - v8SetReturnValue(info, impl->testInterfaceEmptyMethodOptionalLongArg(optionalLongArg));
|
| + v8SetReturnValue(info, impl->testInterfaceEmptyMethodOptionalLongArg(Optional<int>(optionalLongArg, optionalLongArgMissing)));
|
| }
|
|
|
| static void testInterfaceEmptyMethodOptionalLongArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| @@ -7159,17 +7170,18 @@ static void longMethodOptionalLongArgMethod(const v8::FunctionCallbackInfo<v8::V
|
| {
|
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "longMethodOptionalLongArg", "TestObject", info.Holder(), info.GetIsolate());
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| - int optionalLongArg;
|
| + int optionalLongArg = 0;
|
| + bool optionalLongArgMissing = false;
|
| {
|
| v8::TryCatch block;
|
| V8RethrowTryCatchScope rethrow(block);
|
| - if (UNLIKELY(info.Length() <= 0)) {
|
| - v8SetReturnValueInt(info, impl->longMethodOptionalLongArg());
|
| - return;
|
| + if (!info[0]->IsUndefined()) {
|
| + TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalLongArg, toInt32(info[0], exceptionState), exceptionState);
|
| + } else {
|
| + optionalLongArgMissing = true;
|
| }
|
| - TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalLongArg, toInt32(info[0], exceptionState), exceptionState);
|
| }
|
| - v8SetReturnValueInt(info, impl->longMethodOptionalLongArg(optionalLongArg));
|
| + v8SetReturnValueInt(info, impl->longMethodOptionalLongArg(Optional<int>(optionalLongArg, optionalLongArgMissing)));
|
| }
|
|
|
| static void longMethodOptionalLongArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| @@ -7189,18 +7201,19 @@ static void voidMethodLongArgOptionalLongArgMethod(const v8::FunctionCallbackInf
|
| }
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| int longArg;
|
| - int optionalLongArg;
|
| + int optionalLongArg = 0;
|
| + bool optionalLongArgMissing = false;
|
| {
|
| v8::TryCatch block;
|
| V8RethrowTryCatchScope rethrow(block);
|
| TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[0], exceptionState), exceptionState);
|
| - if (UNLIKELY(info.Length() <= 1)) {
|
| - impl->voidMethodLongArgOptionalLongArg(longArg);
|
| - return;
|
| + if (!info[1]->IsUndefined()) {
|
| + TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalLongArg, toInt32(info[1], exceptionState), exceptionState);
|
| + } else {
|
| + optionalLongArgMissing = true;
|
| }
|
| - TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalLongArg, toInt32(info[1], exceptionState), exceptionState);
|
| }
|
| - impl->voidMethodLongArgOptionalLongArg(longArg, optionalLongArg);
|
| + impl->voidMethodLongArgOptionalLongArg(longArg, Optional<int>(optionalLongArg, optionalLongArgMissing));
|
| }
|
|
|
| static void voidMethodLongArgOptionalLongArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| @@ -7220,24 +7233,26 @@ static void voidMethodLongArgOptionalLongArgOptionalLongArgMethod(const v8::Func
|
| }
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| int longArg;
|
| - int optionalLongArg1;
|
| - int optionalLongArg2;
|
| + int optionalLongArg1 = 0;
|
| + bool optionalLongArg1Missing = false;
|
| + int optionalLongArg2 = 0;
|
| + bool optionalLongArg2Missing = false;
|
| {
|
| v8::TryCatch block;
|
| V8RethrowTryCatchScope rethrow(block);
|
| TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[0], exceptionState), exceptionState);
|
| - if (UNLIKELY(info.Length() <= 1)) {
|
| - impl->voidMethodLongArgOptionalLongArgOptionalLongArg(longArg);
|
| - return;
|
| + if (!info[1]->IsUndefined()) {
|
| + TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalLongArg1, toInt32(info[1], exceptionState), exceptionState);
|
| + } else {
|
| + optionalLongArg1Missing = true;
|
| }
|
| - TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalLongArg1, toInt32(info[1], exceptionState), exceptionState);
|
| - if (UNLIKELY(info.Length() <= 2)) {
|
| - impl->voidMethodLongArgOptionalLongArgOptionalLongArg(longArg, optionalLongArg1);
|
| - return;
|
| + if (!info[2]->IsUndefined()) {
|
| + TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalLongArg2, toInt32(info[2], exceptionState), exceptionState);
|
| + } else {
|
| + optionalLongArg2Missing = true;
|
| }
|
| - TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalLongArg2, toInt32(info[2], exceptionState), exceptionState);
|
| }
|
| - impl->voidMethodLongArgOptionalLongArgOptionalLongArg(longArg, optionalLongArg1, optionalLongArg2);
|
| + impl->voidMethodLongArgOptionalLongArgOptionalLongArg(longArg, Optional<int>(optionalLongArg1, optionalLongArg1Missing), Optional<int>(optionalLongArg2, optionalLongArg2Missing));
|
| }
|
|
|
| static void voidMethodLongArgOptionalLongArgOptionalLongArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| @@ -7257,18 +7272,19 @@ static void voidMethodLongArgOptionalTestInterfaceEmptyArgMethod(const v8::Funct
|
| }
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| int longArg;
|
| - TestInterfaceEmpty* optionalTestInterfaceEmpty;
|
| + TestInterfaceEmpty* optionalTestInterfaceEmpty = nullptr;
|
| + bool optionalTestInterfaceEmptyMissing = false;
|
| {
|
| v8::TryCatch block;
|
| V8RethrowTryCatchScope rethrow(block);
|
| TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[0], exceptionState), exceptionState);
|
| - if (UNLIKELY(info.Length() <= 1)) {
|
| - impl->voidMethodLongArgOptionalTestInterfaceEmptyArg(longArg);
|
| - return;
|
| + if (!info[1]->IsUndefined()) {
|
| + TONATIVE_VOID_INTERNAL(optionalTestInterfaceEmpty, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[1]));
|
| + } else {
|
| + optionalTestInterfaceEmptyMissing = true;
|
| }
|
| - TONATIVE_VOID_INTERNAL(optionalTestInterfaceEmpty, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[1]));
|
| }
|
| - impl->voidMethodLongArgOptionalTestInterfaceEmptyArg(longArg, optionalTestInterfaceEmpty);
|
| + impl->voidMethodLongArgOptionalTestInterfaceEmptyArg(longArg, Optional<RefPtr<TestInterfaceEmpty> >(optionalTestInterfaceEmpty, optionalTestInterfaceEmptyMissing));
|
| }
|
|
|
| static void voidMethodLongArgOptionalTestInterfaceEmptyArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| @@ -7288,18 +7304,19 @@ static void voidMethodTestInterfaceEmptyArgOptionalLongArgMethod(const v8::Funct
|
| }
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| TestInterfaceEmpty* optionalTestInterfaceEmpty;
|
| - int longArg;
|
| + int longArg = 0;
|
| + bool longArgMissing = false;
|
| {
|
| v8::TryCatch block;
|
| V8RethrowTryCatchScope rethrow(block);
|
| TONATIVE_VOID_INTERNAL(optionalTestInterfaceEmpty, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
|
| - if (UNLIKELY(info.Length() <= 1)) {
|
| - impl->voidMethodTestInterfaceEmptyArgOptionalLongArg(optionalTestInterfaceEmpty);
|
| - return;
|
| + if (!info[1]->IsUndefined()) {
|
| + TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[1], exceptionState), exceptionState);
|
| + } else {
|
| + longArgMissing = true;
|
| }
|
| - TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[1], exceptionState), exceptionState);
|
| }
|
| - impl->voidMethodTestInterfaceEmptyArgOptionalLongArg(optionalTestInterfaceEmpty, longArg);
|
| + impl->voidMethodTestInterfaceEmptyArgOptionalLongArg(optionalTestInterfaceEmpty, Optional<int>(longArg, longArgMissing));
|
| }
|
|
|
| static void voidMethodTestInterfaceEmptyArgOptionalLongArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| @@ -7313,16 +7330,21 @@ static void voidMethodOptionalDictionaryArgMethod(const v8::FunctionCallbackInfo
|
| {
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| Dictionary optionalDictionaryArg;
|
| + bool optionalDictionaryArgMissing = false;
|
| {
|
| v8::TryCatch block;
|
| V8RethrowTryCatchScope rethrow(block);
|
| - TONATIVE_VOID_INTERNAL(optionalDictionaryArg, Dictionary(info[0], info.GetIsolate()));
|
| - if (!optionalDictionaryArg.isUndefinedOrNull() && !optionalDictionaryArg.isObject()) {
|
| - V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute("voidMethodOptionalDictionaryArg", "TestObject", "parameter 1 ('optionalDictionaryArg') is not an object."), info.GetIsolate());
|
| - return;
|
| + if (!info[0]->IsUndefined()) {
|
| + TONATIVE_VOID_INTERNAL(optionalDictionaryArg, Dictionary(info[0], info.GetIsolate()));
|
| + if (!optionalDictionaryArg.isUndefinedOrNull() && !optionalDictionaryArg.isObject()) {
|
| + V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute("voidMethodOptionalDictionaryArg", "TestObject", "parameter 1 ('optionalDictionaryArg') is not an object."), info.GetIsolate());
|
| + return;
|
| + }
|
| + } else {
|
| + optionalDictionaryArgMissing = true;
|
| }
|
| }
|
| - impl->voidMethodOptionalDictionaryArg(optionalDictionaryArg);
|
| + impl->voidMethodOptionalDictionaryArg(Optional<Dictionary>(optionalDictionaryArg, optionalDictionaryArgMissing));
|
| }
|
|
|
| static void voidMethodOptionalDictionaryArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| @@ -7550,6 +7572,36 @@ static void voidMethodDefaultNullableTestInterfaceArgMethodCallback(const v8::Fu
|
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
|
| }
|
|
|
| +static void voidMethodOptionalArgWithoutDefaultMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| +{
|
| + TestObject* impl = V8TestObject::toNative(info.Holder());
|
| + V8StringResource<> optionalStringArg;
|
| + bool optionalStringArgMissing = false;
|
| + bool defaultBooleanArg;
|
| + {
|
| + v8::TryCatch block;
|
| + V8RethrowTryCatchScope rethrow(block);
|
| + if (!info[0]->IsUndefined()) {
|
| + TOSTRING_VOID_INTERNAL(optionalStringArg, info[0]);
|
| + } else {
|
| + optionalStringArgMissing = true;
|
| + }
|
| + if (!info[1]->IsUndefined()) {
|
| + TONATIVE_VOID_INTERNAL(defaultBooleanArg, info[1]->BooleanValue());
|
| + } else {
|
| + defaultBooleanArg = false;
|
| + }
|
| + }
|
| + impl->voidMethodOptionalArgWithoutDefault(Optional<V8StringResource<> >(optionalStringArg, optionalStringArgMissing), defaultBooleanArg);
|
| +}
|
| +
|
| +static void voidMethodOptionalArgWithoutDefaultMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| +{
|
| + TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
|
| + TestObjectV8Internal::voidMethodOptionalArgWithoutDefaultMethod(info);
|
| + TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
|
| +}
|
| +
|
| static void voidMethodVariadicStringArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| @@ -7772,18 +7824,19 @@ static void overloadedMethodB2Method(const v8::FunctionCallbackInfo<v8::Value>&
|
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedMethodB", "TestObject", info.Holder(), info.GetIsolate());
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| V8StringResource<> stringArg;
|
| - int longArg;
|
| + int longArg = 0;
|
| + bool longArgMissing = false;
|
| {
|
| v8::TryCatch block;
|
| V8RethrowTryCatchScope rethrow(block);
|
| TOSTRING_VOID_INTERNAL(stringArg, info[0]);
|
| - if (UNLIKELY(info.Length() <= 1)) {
|
| - impl->overloadedMethodB(stringArg);
|
| - return;
|
| + if (!info[1]->IsUndefined()) {
|
| + TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[1], exceptionState), exceptionState);
|
| + } else {
|
| + longArgMissing = true;
|
| }
|
| - TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[1], exceptionState), exceptionState);
|
| }
|
| - impl->overloadedMethodB(stringArg, longArg);
|
| + impl->overloadedMethodB(stringArg, Optional<int>(longArg, longArgMissing));
|
| }
|
|
|
| static void overloadedMethodBMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| @@ -7999,14 +8052,15 @@ static void overloadedMethodF1Method(const v8::FunctionCallbackInfo<v8::Value>&
|
| {
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| V8StringResource<> stringArg;
|
| + bool stringArgMissing = false;
|
| {
|
| - if (UNLIKELY(info.Length() <= 0)) {
|
| - impl->overloadedMethodF();
|
| - return;
|
| + if (!info[0]->IsUndefined()) {
|
| + TOSTRING_VOID_INTERNAL(stringArg, info[0]);
|
| + } else {
|
| + stringArgMissing = true;
|
| }
|
| - TOSTRING_VOID_INTERNAL(stringArg, info[0]);
|
| }
|
| - impl->overloadedMethodF(stringArg);
|
| + impl->overloadedMethodF(Optional<V8StringResource<> >(stringArg, stringArgMissing));
|
| }
|
|
|
| static void overloadedMethodF2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| @@ -8516,62 +8570,6 @@ static void voidMethodClampUnsignedLongArgMethodCallback(const v8::FunctionCallb
|
| TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
|
| }
|
|
|
| -static void voidMethodDefaultUndefinedTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| -{
|
| - TestObject* impl = V8TestObject::toNative(info.Holder());
|
| - TestInterfaceEmpty* defaultUndefinedTestInterfaceEmptyArg;
|
| - {
|
| - v8::TryCatch block;
|
| - V8RethrowTryCatchScope rethrow(block);
|
| - TONATIVE_VOID_INTERNAL(defaultUndefinedTestInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
|
| - }
|
| - impl->voidMethodDefaultUndefinedTestInterfaceEmptyArg(defaultUndefinedTestInterfaceEmptyArg);
|
| -}
|
| -
|
| -static void voidMethodDefaultUndefinedTestInterfaceEmptyArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| -{
|
| - TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
|
| - TestObjectV8Internal::voidMethodDefaultUndefinedTestInterfaceEmptyArgMethod(info);
|
| - TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
|
| -}
|
| -
|
| -static void voidMethodDefaultUndefinedLongArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| -{
|
| - ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodDefaultUndefinedLongArg", "TestObject", info.Holder(), info.GetIsolate());
|
| - TestObject* impl = V8TestObject::toNative(info.Holder());
|
| - int defaultUndefinedLongArg;
|
| - {
|
| - v8::TryCatch block;
|
| - V8RethrowTryCatchScope rethrow(block);
|
| - TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(defaultUndefinedLongArg, toInt32(info[0], exceptionState), exceptionState);
|
| - }
|
| - impl->voidMethodDefaultUndefinedLongArg(defaultUndefinedLongArg);
|
| -}
|
| -
|
| -static void voidMethodDefaultUndefinedLongArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| -{
|
| - TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
|
| - TestObjectV8Internal::voidMethodDefaultUndefinedLongArgMethod(info);
|
| - TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
|
| -}
|
| -
|
| -static void voidMethodDefaultUndefinedStringArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| -{
|
| - TestObject* impl = V8TestObject::toNative(info.Holder());
|
| - V8StringResource<> defaultUndefinedStringArg;
|
| - {
|
| - TOSTRING_VOID_INTERNAL(defaultUndefinedStringArg, info[0]);
|
| - }
|
| - impl->voidMethodDefaultUndefinedStringArg(defaultUndefinedStringArg);
|
| -}
|
| -
|
| -static void voidMethodDefaultUndefinedStringArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| -{
|
| - TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
|
| - TestObjectV8Internal::voidMethodDefaultUndefinedStringArgMethod(info);
|
| - TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
|
| -}
|
| -
|
| static void voidMethodEnforceRangeLongArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodEnforceRangeLongArg", "TestObject", info.Holder(), info.GetIsolate());
|
| @@ -8755,21 +8753,20 @@ static void callWithScriptStateScriptArgumentsVoidMethodMethodCallback(const v8:
|
| static void callWithScriptStateScriptArgumentsVoidMethodOptionalBooleanArgMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| {
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| - bool optionalBooleanArg;
|
| + bool optionalBooleanArg = false;
|
| + bool optionalBooleanArgMissing = false;
|
| {
|
| v8::TryCatch block;
|
| V8RethrowTryCatchScope rethrow(block);
|
| - if (UNLIKELY(info.Length() <= 0)) {
|
| - ScriptState* scriptState = ScriptState::current(info.GetIsolate());
|
| - RefPtrWillBeRawPtr<ScriptArguments> scriptArguments(createScriptArguments(scriptState, info, 1));
|
| - impl->callWithScriptStateScriptArgumentsVoidMethodOptionalBooleanArg(scriptState, scriptArguments.release());
|
| - return;
|
| + if (!info[0]->IsUndefined()) {
|
| + TONATIVE_VOID_INTERNAL(optionalBooleanArg, info[0]->BooleanValue());
|
| + } else {
|
| + optionalBooleanArgMissing = true;
|
| }
|
| - TONATIVE_VOID_INTERNAL(optionalBooleanArg, info[0]->BooleanValue());
|
| }
|
| ScriptState* scriptState = ScriptState::current(info.GetIsolate());
|
| RefPtrWillBeRawPtr<ScriptArguments> scriptArguments(createScriptArguments(scriptState, info, 1));
|
| - impl->callWithScriptStateScriptArgumentsVoidMethodOptionalBooleanArg(scriptState, scriptArguments.release(), optionalBooleanArg);
|
| + impl->callWithScriptStateScriptArgumentsVoidMethodOptionalBooleanArg(scriptState, scriptArguments.release(), Optional<bool>(optionalBooleanArg, optionalBooleanArgMissing));
|
| }
|
|
|
| static void callWithScriptStateScriptArgumentsVoidMethodOptionalBooleanArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| @@ -9537,21 +9534,18 @@ static void raisesExceptionVoidMethodOptionalLongArgMethod(const v8::FunctionCal
|
| {
|
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "raisesExceptionVoidMethodOptionalLongArg", "TestObject", info.Holder(), info.GetIsolate());
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| - int optionalLongArg;
|
| + int optionalLongArg = 0;
|
| + bool optionalLongArgMissing = false;
|
| {
|
| v8::TryCatch block;
|
| V8RethrowTryCatchScope rethrow(block);
|
| - if (UNLIKELY(info.Length() <= 0)) {
|
| - impl->raisesExceptionVoidMethodOptionalLongArg(exceptionState);
|
| - if (exceptionState.hadException()) {
|
| - exceptionState.throwIfNeeded();
|
| - return;
|
| - }
|
| - return;
|
| + if (!info[0]->IsUndefined()) {
|
| + TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalLongArg, toInt32(info[0], exceptionState), exceptionState);
|
| + } else {
|
| + optionalLongArgMissing = true;
|
| }
|
| - TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(optionalLongArg, toInt32(info[0], exceptionState), exceptionState);
|
| }
|
| - impl->raisesExceptionVoidMethodOptionalLongArg(optionalLongArg, exceptionState);
|
| + impl->raisesExceptionVoidMethodOptionalLongArg(Optional<int>(optionalLongArg, optionalLongArgMissing), exceptionState);
|
| if (exceptionState.hadException()) {
|
| exceptionState.throwIfNeeded();
|
| return;
|
| @@ -9602,17 +9596,22 @@ static void raisesExceptionVoidMethodOptionalTestCallbackInterfaceArgMethod(cons
|
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "raisesExceptionVoidMethodOptionalTestCallbackInterfaceArg", "TestObject", info.Holder(), info.GetIsolate());
|
| TestObject* impl = V8TestObject::toNative(info.Holder());
|
| OwnPtr<TestCallbackInterface> optionalTestCallbackInterfaceArg;
|
| + bool optionalTestCallbackInterfaceArgMissing = false;
|
| {
|
| - if (info.Length() > 0 && !isUndefinedOrNull(info[0])) {
|
| - if (!info[0]->IsFunction()) {
|
| - exceptionState.throwTypeError("The callback provided as parameter 1 is not a function.");
|
| - exceptionState.throwIfNeeded();
|
| - return;
|
| + if (!info[0]->IsUndefined()) {
|
| + if (info.Length() > 0 && !isUndefinedOrNull(info[0])) {
|
| + if (!info[0]->IsFunction()) {
|
| + exceptionState.throwTypeError("The callback provided as parameter 1 is not a function.");
|
| + exceptionState.throwIfNeeded();
|
| + return;
|
| + }
|
| + optionalTestCallbackInterfaceArg = V8TestCallbackInterface::create(v8::Handle<v8::Function>::Cast(info[0]), ScriptState::current(info.GetIsolate()));
|
| }
|
| - optionalTestCallbackInterfaceArg = V8TestCallbackInterface::create(v8::Handle<v8::Function>::Cast(info[0]), ScriptState::current(info.GetIsolate()));
|
| + } else {
|
| + optionalTestCallbackInterfaceArgMissing = true;
|
| }
|
| }
|
| - impl->raisesExceptionVoidMethodOptionalTestCallbackInterfaceArg(optionalTestCallbackInterfaceArg.release(), exceptionState);
|
| + impl->raisesExceptionVoidMethodOptionalTestCallbackInterfaceArg(Optional<OwnPtr<TestCallbackInterface> >(optionalTestCallbackInterfaceArg, optionalTestCallbackInterfaceArgMissing), exceptionState);
|
| if (exceptionState.hadException()) {
|
| exceptionState.throwIfNeeded();
|
| return;
|
| @@ -10591,6 +10590,7 @@ static const V8DOMConfiguration::MethodConfiguration V8TestObjectMethods[] = {
|
| {"voidMethodDefaultNullableByteStringArg", TestObjectV8Internal::voidMethodDefaultNullableByteStringArgMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
|
| {"voidMethodDefaultNullableStringArg", TestObjectV8Internal::voidMethodDefaultNullableStringArgMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
|
| {"voidMethodDefaultNullableTestInterfaceArg", TestObjectV8Internal::voidMethodDefaultNullableTestInterfaceArgMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
|
| + {"voidMethodOptionalArgWithoutDefault", TestObjectV8Internal::voidMethodOptionalArgWithoutDefaultMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
|
| {"voidMethodVariadicStringArg", TestObjectV8Internal::voidMethodVariadicStringArgMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
|
| {"voidMethodStringArgVariadicStringArg", TestObjectV8Internal::voidMethodStringArgVariadicStringArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
|
| {"voidMethodVariadicTestInterfaceEmptyArg", TestObjectV8Internal::voidMethodVariadicTestInterfaceEmptyArgMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
|
| @@ -10610,9 +10610,6 @@ static const V8DOMConfiguration::MethodConfiguration V8TestObjectMethods[] = {
|
| {"overloadedPerWorldBindingsMethod", TestObjectV8Internal::overloadedPerWorldBindingsMethodMethodCallback, TestObjectV8Internal::overloadedPerWorldBindingsMethodMethodCallbackForMainWorld, 0, V8DOMConfiguration::ExposedToAllScripts},
|
| {"voidMethodClampUnsignedShortArg", TestObjectV8Internal::voidMethodClampUnsignedShortArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
|
| {"voidMethodClampUnsignedLongArg", TestObjectV8Internal::voidMethodClampUnsignedLongArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
|
| - {"voidMethodDefaultUndefinedTestInterfaceEmptyArg", TestObjectV8Internal::voidMethodDefaultUndefinedTestInterfaceEmptyArgMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
|
| - {"voidMethodDefaultUndefinedLongArg", TestObjectV8Internal::voidMethodDefaultUndefinedLongArgMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
|
| - {"voidMethodDefaultUndefinedStringArg", TestObjectV8Internal::voidMethodDefaultUndefinedStringArgMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts},
|
| {"voidMethodEnforceRangeLongArg", TestObjectV8Internal::voidMethodEnforceRangeLongArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
|
| {"voidMethodTreatNullAsEmptyStringStringArg", TestObjectV8Internal::voidMethodTreatNullAsEmptyStringStringArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
|
| {"voidMethodTreatNullAsNullStringStringArg", TestObjectV8Internal::voidMethodTreatNullAsNullStringStringArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
|
|
|