Chromium Code Reviews| Index: Source/bindings/tests/results/core/V8TestObject.cpp |
| diff --git a/Source/bindings/tests/results/core/V8TestObject.cpp b/Source/bindings/tests/results/core/V8TestObject.cpp |
| index 1e7e2d8e877d308e6ab8094070b47d803687bce2..8f5724cdd963848454d83d8ce999fd8f2e58186e 100644 |
| --- a/Source/bindings/tests/results/core/V8TestObject.cpp |
| +++ b/Source/bindings/tests/results/core/V8TestObject.cpp |
| @@ -7742,6 +7742,9 @@ static void overloadedMethodAMethod(const v8::FunctionCallbackInfo<v8::Value>& i |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 1) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -7810,6 +7813,9 @@ static void overloadedMethodBMethod(const v8::FunctionCallbackInfo<v8::Value>& i |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 1) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -7861,6 +7867,9 @@ static void overloadedMethodCMethod(const v8::FunctionCallbackInfo<v8::Value>& i |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 1) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -7913,6 +7922,9 @@ static void overloadedMethodDMethod(const v8::FunctionCallbackInfo<v8::Value>& i |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 1) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -7968,6 +7980,9 @@ static void overloadedMethodEMethod(const v8::FunctionCallbackInfo<v8::Value>& i |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 1) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -8037,6 +8052,9 @@ static void overloadedMethodFMethod(const v8::FunctionCallbackInfo<v8::Value>& i |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 0) { |
|
bashi
2014/12/02 23:56:17
nit: It's nice to avoid generating this branch, bu
Jens Widell
2014/12/03 07:19:31
This could be fixed by adding {% if overloads.leng
|
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -8106,6 +8124,9 @@ static void overloadedMethodGMethod(const v8::FunctionCallbackInfo<v8::Value>& i |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 0) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -8156,6 +8177,9 @@ static void overloadedMethodHMethod(const v8::FunctionCallbackInfo<v8::Value>& i |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 1) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -8211,6 +8235,9 @@ static void overloadedMethodIMethod(const v8::FunctionCallbackInfo<v8::Value>& i |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 1) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -8267,6 +8294,9 @@ static void overloadedMethodJMethod(const v8::FunctionCallbackInfo<v8::Value>& i |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 1) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -8317,6 +8347,9 @@ static void overloadedMethodKMethod(const v8::FunctionCallbackInfo<v8::Value>& i |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 1) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -8391,6 +8424,9 @@ static void overloadedMethodLMethod(const v8::FunctionCallbackInfo<v8::Value>& i |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 1) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -8464,6 +8500,9 @@ static void promiseOverloadMethodMethod(const v8::FunctionCallbackInfo<v8::Value |
| v8SetReturnValue(info, exceptionState.reject(ScriptState::current(info.GetIsolate())).v8Value()); |
| return; |
| } |
| + break; |
| + } |
| + if (info.Length() < 0) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, info.Length())); |
| v8SetReturnValue(info, exceptionState.reject(ScriptState::current(info.GetIsolate())).v8Value()); |
| return; |
| @@ -8519,6 +8558,9 @@ static void overloadedPerWorldBindingsMethodMethod(const v8::FunctionCallbackInf |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 0) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -8562,6 +8604,9 @@ static void overloadedPerWorldBindingsMethodMethodForMainWorld(const v8::Functio |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 0) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -8616,6 +8661,9 @@ static void overloadedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Valu |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 1) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -9130,6 +9178,9 @@ static void DeprecateAsOverloadedMethodMethod(const v8::FunctionCallbackInfo<v8: |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 0) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -9180,6 +9231,9 @@ static void DeprecateAsSameValueOverloadedMethodMethod(const v8::FunctionCallbac |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 0) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -9231,6 +9285,9 @@ static void measureAsOverloadedMethodMethod(const v8::FunctionCallbackInfo<v8::V |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 0) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -9281,6 +9338,9 @@ static void measureAsSameValueOverloadedMethodMethod(const v8::FunctionCallbackI |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 0) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -9333,6 +9393,9 @@ static void deprecateAsMeasureAsSameValueOverloadedMethodMethod(const v8::Functi |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 0) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -9385,6 +9448,9 @@ static void deprecateAsSameValueMeasureAsOverloadedMethodMethod(const v8::Functi |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 0) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -9436,6 +9502,9 @@ static void deprecateAsSameValueMeasureAsSameValueOverloadedMethodMethod(const v |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 0) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -9874,6 +9943,9 @@ static void runtimeEnabledOverloadedVoidMethodMethod(const v8::FunctionCallbackI |
| } |
| break; |
| default: |
| + break; |
| + } |
| + if (info.Length() < 1) { |
| exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| @@ -9914,16 +9986,29 @@ static void partiallyRuntimeEnabledOverloadedVoidMethod3Method(const v8::Functio |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "partiallyRuntimeEnabledOverloadedVoidMethod", "TestObject", info.Holder(), info.GetIsolate()); |
| TestObject* impl = V8TestObject::toImpl(info.Holder()); |
| int longArg; |
| + V8StringResource<> stringArg; |
| { |
| TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[0], exceptionState), exceptionState); |
| + TOSTRING_VOID_INTERNAL(stringArg, info[1]); |
| } |
| - impl->partiallyRuntimeEnabledOverloadedVoidMethod(longArg); |
| + impl->partiallyRuntimeEnabledOverloadedVoidMethod(longArg, stringArg); |
| +} |
| + |
| +static int partiallyRuntimeEnabledOverloadedVoidMethodMethodLength() |
| +{ |
| + if (RuntimeEnabledFeatures::featureName1Enabled()) { |
| + return 1; |
| + } |
| + if (RuntimeEnabledFeatures::featureName2Enabled()) { |
| + return 1; |
| + } |
| + return 2; |
| } |
| static void partiallyRuntimeEnabledOverloadedVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "partiallyRuntimeEnabledOverloadedVoidMethod", "TestObject", info.Holder(), info.GetIsolate()); |
| - switch (std::min(1, info.Length())) { |
| + switch (std::min(2, info.Length())) { |
| case 1: |
| if (RuntimeEnabledFeatures::featureName2Enabled()) { |
| if (V8TestInterface::hasInstance(info[0], info.GetIsolate())) { |
| @@ -9931,23 +10016,24 @@ static void partiallyRuntimeEnabledOverloadedVoidMethodMethod(const v8::Function |
| return; |
| } |
| } |
| - if (info[0]->IsNumber()) { |
| - partiallyRuntimeEnabledOverloadedVoidMethod3Method(info); |
| - return; |
| - } |
| if (RuntimeEnabledFeatures::featureName1Enabled()) { |
| if (true) { |
| partiallyRuntimeEnabledOverloadedVoidMethod1Method(info); |
| return; |
| } |
| } |
| + break; |
| + case 2: |
| if (true) { |
| partiallyRuntimeEnabledOverloadedVoidMethod3Method(info); |
| return; |
| } |
| break; |
| default: |
| - exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); |
| + break; |
| + } |
| + if (info.Length() < TestObjectV8Internal::partiallyRuntimeEnabledOverloadedVoidMethodMethodLength()) { |
| + exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(TestObjectV8Internal::partiallyRuntimeEnabledOverloadedVoidMethodMethodLength(), info.Length())); |
| exceptionState.throwIfNeeded(); |
| return; |
| } |
| @@ -10866,7 +10952,6 @@ static const V8DOMConfiguration::MethodConfiguration V8TestObjectMethods[] = { |
| {"raisesExceptionVoidMethodOptionalTestCallbackInterfaceArg", TestObjectV8Internal::raisesExceptionVoidMethodOptionalTestCallbackInterfaceArgMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, |
| {"raisesExceptionTestInterfaceEmptyVoidMethod", TestObjectV8Internal::raisesExceptionTestInterfaceEmptyVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, |
| {"callWithExecutionContextRaisesExceptionVoidMethodLongArg", TestObjectV8Internal::callWithExecutionContextRaisesExceptionVoidMethodLongArgMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts}, |
| - {"partiallyRuntimeEnabledOverloadedVoidMethod", TestObjectV8Internal::partiallyRuntimeEnabledOverloadedVoidMethodMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts}, |
| {"treatReturnedNullStringAsNullStringMethod", TestObjectV8Internal::treatReturnedNullStringAsNullStringMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, |
| {"treatReturnedNullStringAsUndefinedStringMethod", TestObjectV8Internal::treatReturnedNullStringAsUndefinedStringMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, |
| {"treatReturnedNullStringAsNullByteStringMethod", TestObjectV8Internal::treatReturnedNullStringAsNullByteStringMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts}, |
| @@ -10970,47 +11055,51 @@ static void installV8TestObjectTemplate(v8::Handle<v8::FunctionTemplate> functio |
| COMPILE_ASSERT(1 == TestObject::MEASURED_CONSTANT, TheValueOfTestObject_MEASURED_CONSTANTDoesntMatchWithImplementation); |
| COMPILE_ASSERT(1 == TestObject::FEATURE_ENABLED_CONST, TheValueOfTestObject_FEATURE_ENABLED_CONSTDoesntMatchWithImplementation); |
| COMPILE_ASSERT(1 == TestObject::CONST_IMPL, TheValueOfTestObject_CONST_IMPLDoesntMatchWithImplementation); |
| - static const V8DOMConfiguration::MethodConfiguration staticVoidMethodMethodConfiguration = { |
| + const V8DOMConfiguration::MethodConfiguration staticVoidMethodMethodConfiguration = { |
| "staticVoidMethod", TestObjectV8Internal::staticVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signature>(), v8::None, staticVoidMethodMethodConfiguration, isolate); |
| - static const V8DOMConfiguration::MethodConfiguration overloadedStaticMethodMethodConfiguration = { |
| + const V8DOMConfiguration::MethodConfiguration overloadedStaticMethodMethodConfiguration = { |
| "overloadedStaticMethod", TestObjectV8Internal::overloadedStaticMethodMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signature>(), v8::None, overloadedStaticMethodMethodConfiguration, isolate); |
| #if ENABLE(CONDITION) |
| - static const V8DOMConfiguration::MethodConfiguration conditionalConditionStaticVoidMethodMethodConfiguration = { |
| + const V8DOMConfiguration::MethodConfiguration conditionalConditionStaticVoidMethodMethodConfiguration = { |
| "conditionalConditionStaticVoidMethod", TestObjectV8Internal::conditionalConditionStaticVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(functionTemplate, v8::Local<v8::Signature>(), v8::None, conditionalConditionStaticVoidMethodMethodConfiguration, isolate); |
| #endif // ENABLE(CONDITION) |
| - static const V8DOMConfiguration::MethodConfiguration doNotCheckSignatureVoidMethodMethodConfiguration = { |
| + const V8DOMConfiguration::MethodConfiguration doNotCheckSignatureVoidMethodMethodConfiguration = { |
| "doNotCheckSignatureVoidMethod", TestObjectV8Internal::doNotCheckSignatureVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(prototypeTemplate, v8::Local<v8::Signature>(), v8::None, doNotCheckSignatureVoidMethodMethodConfiguration, isolate); |
| - static const V8DOMConfiguration::MethodConfiguration notEnumerableVoidMethodMethodConfiguration = { |
| + const V8DOMConfiguration::MethodConfiguration notEnumerableVoidMethodMethodConfiguration = { |
| "notEnumerableVoidMethod", TestObjectV8Internal::notEnumerableVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::DontEnum), notEnumerableVoidMethodMethodConfiguration, isolate); |
| if (RuntimeEnabledFeatures::featureNameEnabled()) { |
| - static const V8DOMConfiguration::MethodConfiguration runtimeEnabledVoidMethodMethodConfiguration = { |
| + const V8DOMConfiguration::MethodConfiguration runtimeEnabledVoidMethodMethodConfiguration = { |
| "runtimeEnabledVoidMethod", TestObjectV8Internal::runtimeEnabledVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::None, runtimeEnabledVoidMethodMethodConfiguration, isolate); |
| } |
| if (RuntimeEnabledFeatures::featureNameEnabled()) { |
| - static const V8DOMConfiguration::MethodConfiguration perWorldBindingsRuntimeEnabledVoidMethodMethodConfiguration = { |
| + const V8DOMConfiguration::MethodConfiguration perWorldBindingsRuntimeEnabledVoidMethodMethodConfiguration = { |
| "perWorldBindingsRuntimeEnabledVoidMethod", TestObjectV8Internal::perWorldBindingsRuntimeEnabledVoidMethodMethodCallback, TestObjectV8Internal::perWorldBindingsRuntimeEnabledVoidMethodMethodCallbackForMainWorld, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::None, perWorldBindingsRuntimeEnabledVoidMethodMethodConfiguration, isolate); |
| } |
| if (RuntimeEnabledFeatures::featureNameEnabled()) { |
| - static const V8DOMConfiguration::MethodConfiguration runtimeEnabledOverloadedVoidMethodMethodConfiguration = { |
| + const V8DOMConfiguration::MethodConfiguration runtimeEnabledOverloadedVoidMethodMethodConfiguration = { |
| "runtimeEnabledOverloadedVoidMethod", TestObjectV8Internal::runtimeEnabledOverloadedVoidMethodMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::None, runtimeEnabledOverloadedVoidMethodMethodConfiguration, isolate); |
| } |
| - static const V8DOMConfiguration::MethodConfiguration unforgeableVoidMethodMethodConfiguration = { |
| + const V8DOMConfiguration::MethodConfiguration partiallyRuntimeEnabledOverloadedVoidMethodMethodConfiguration = { |
| + "partiallyRuntimeEnabledOverloadedVoidMethod", TestObjectV8Internal::partiallyRuntimeEnabledOverloadedVoidMethodMethodCallback, 0, TestObjectV8Internal::partiallyRuntimeEnabledOverloadedVoidMethodMethodLength(), V8DOMConfiguration::ExposedToAllScripts, |
| + }; |
| + V8DOMConfiguration::installMethod(prototypeTemplate, defaultSignature, v8::None, partiallyRuntimeEnabledOverloadedVoidMethodMethodConfiguration, isolate); |
| + const V8DOMConfiguration::MethodConfiguration unforgeableVoidMethodMethodConfiguration = { |
| "unforgeableVoidMethod", TestObjectV8Internal::unforgeableVoidMethodMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScripts, |
| }; |
| V8DOMConfiguration::installMethod(instanceTemplate, defaultSignature, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly), unforgeableVoidMethodMethodConfiguration, isolate); |