Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(813)

Side by Side Diff: Source/bindings/tests/results/V8TestInterface.cpp

Issue 460923002: Decouple arity errors creation from throwing. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6 6
7 #include "config.h" 7 #include "config.h"
8 #if ENABLE(CONDITION) 8 #if ENABLE(CONDITION)
9 #include "V8TestInterface.h" 9 #include "V8TestInterface.h"
10 10
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 } 922 }
923 923
924 static void TestInterfaceImplementationForceSetAttributeOnThisCallback(v8::Local <v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo< void>& info) 924 static void TestInterfaceImplementationForceSetAttributeOnThisCallback(v8::Local <v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo< void>& info)
925 { 925 {
926 TestInterfaceImplementationV8Internal::TestInterfaceImplementationForceSetAt tributeOnThis(name, v8Value, info); 926 TestInterfaceImplementationV8Internal::TestInterfaceImplementationForceSetAt tributeOnThis(name, v8Value, info);
927 } 927 }
928 928
929 static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info) 929 static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info)
930 { 930 {
931 if (UNLIKELY(info.Length() < 1)) { 931 if (UNLIKELY(info.Length() < 1)) {
932 throwMinimumArityTypeErrorForMethod("voidMethodTestInterfaceEmptyArg", " TestInterface", 1, info.Length(), info.GetIsolate()); 932 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v oidMethodTestInterfaceEmptyArg", "TestInterface", 1, info.Length(), info.GetIsol ate()), info.GetIsolate());
933 return; 933 return;
934 } 934 }
935 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 935 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
936 TestInterfaceEmpty* testInterfaceEmptyArg; 936 TestInterfaceEmpty* testInterfaceEmptyArg;
937 { 937 {
938 v8::TryCatch block; 938 v8::TryCatch block;
939 V8RethrowTryCatchScope rethrow(block); 939 V8RethrowTryCatchScope rethrow(block);
940 if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], inf o.GetIsolate())) { 940 if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], inf o.GetIsolate())) {
941 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "voidMethodTestInterfaceEmptyArg", "TestInterface", "parameter 1 is not of type 'TestInterfaceEmpty'."), info.GetIsolate()); 941 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "voidMethodTestInterfaceEmptyArg", "TestInterface", "parameter 1 is not of type 'TestInterfaceEmpty'."), info.GetIsolate());
942 return; 942 return;
943 } 943 }
944 TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNa tiveWithTypeCheck(info.GetIsolate(), info[0])); 944 TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNa tiveWithTypeCheck(info.GetIsolate(), info[0]));
945 } 945 }
946 impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg); 946 impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg);
947 } 947 }
948 948
949 static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info) 949 static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info)
950 { 950 {
951 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 951 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
952 TestInterfaceImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethod (info); 952 TestInterfaceImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethod (info);
953 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 953 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
954 } 954 }
955 955
956 static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info) 956 static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info)
957 { 957 {
958 if (UNLIKELY(info.Length() < 2)) { 958 if (UNLIKELY(info.Length() < 2)) {
959 throwMinimumArityTypeErrorForMethod("voidMethodDoubleArgFloatArg", "Test Interface", 2, info.Length(), info.GetIsolate()); 959 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v oidMethodDoubleArgFloatArg", "TestInterface", 2, info.Length(), info.GetIsolate( )), info.GetIsolate());
960 return; 960 return;
961 } 961 }
962 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 962 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
963 double doubleArg; 963 double doubleArg;
964 float floatArg; 964 float floatArg;
965 { 965 {
966 v8::TryCatch block; 966 v8::TryCatch block;
967 V8RethrowTryCatchScope rethrow(block); 967 V8RethrowTryCatchScope rethrow(block);
968 TONATIVE_VOID_INTERNAL(doubleArg, static_cast<double>(info[0]->NumberVal ue())); 968 TONATIVE_VOID_INTERNAL(doubleArg, static_cast<double>(info[0]->NumberVal ue()));
969 if (!std::isfinite(doubleArg)) { 969 if (!std::isfinite(doubleArg)) {
(...skipping 12 matching lines...) Expand all
982 static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info) 982 static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info)
983 { 983 {
984 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 984 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
985 TestInterfaceImplementationV8Internal::voidMethodDoubleArgFloatArgMethod(inf o); 985 TestInterfaceImplementationV8Internal::voidMethodDoubleArgFloatArgMethod(inf o);
986 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 986 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
987 } 987 }
988 988
989 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8:: FunctionCallbackInfo<v8::Value>& info) 989 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8:: FunctionCallbackInfo<v8::Value>& info)
990 { 990 {
991 if (UNLIKELY(info.Length() < 2)) { 991 if (UNLIKELY(info.Length() < 2)) {
992 throwMinimumArityTypeErrorForMethod("voidMethodUnrestrictedDoubleArgUnre strictedFloatArg", "TestInterface", 2, info.Length(), info.GetIsolate()); 992 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v oidMethodUnrestrictedDoubleArgUnrestrictedFloatArg", "TestInterface", 2, info.Le ngth(), info.GetIsolate()), info.GetIsolate());
993 return; 993 return;
994 } 994 }
995 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 995 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
996 double unrestrictedDoubleArg; 996 double unrestrictedDoubleArg;
997 float unrestrictedFloatArg; 997 float unrestrictedFloatArg;
998 { 998 {
999 v8::TryCatch block; 999 v8::TryCatch block;
1000 V8RethrowTryCatchScope rethrow(block); 1000 V8RethrowTryCatchScope rethrow(block);
1001 TONATIVE_VOID_INTERNAL(unrestrictedDoubleArg, static_cast<double>(info[0 ]->NumberValue())); 1001 TONATIVE_VOID_INTERNAL(unrestrictedDoubleArg, static_cast<double>(info[0 ]->NumberValue()));
1002 TONATIVE_VOID_INTERNAL(unrestrictedFloatArg, static_cast<float>(info[1]- >NumberValue())); 1002 TONATIVE_VOID_INTERNAL(unrestrictedFloatArg, static_cast<float>(info[1]- >NumberValue()));
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 { 1135 {
1136 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 1136 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1137 TestInterfaceImplementationV8Internal::implementsVoidMethodMethod(info); 1137 TestInterfaceImplementationV8Internal::implementsVoidMethodMethod(info);
1138 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 1138 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1139 } 1139 }
1140 1140
1141 static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val ue>& info) 1141 static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val ue>& info)
1142 { 1142 {
1143 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsC omplexMethod", "TestInterface", info.Holder(), info.GetIsolate()); 1143 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsC omplexMethod", "TestInterface", info.Holder(), info.GetIsolate());
1144 if (UNLIKELY(info.Length() < 2)) { 1144 if (UNLIKELY(info.Length() < 2)) {
1145 throwMinimumArityTypeError(exceptionState, 2, info.Length()); 1145 setMinimumArityTypeError(exceptionState, 2, info.Length());
1146 exceptionState.throwIfNeeded();
1146 return; 1147 return;
1147 } 1148 }
1148 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 1149 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
1149 V8StringResource<> strArg; 1150 V8StringResource<> strArg;
1150 TestInterfaceEmpty* testInterfaceEmptyArg; 1151 TestInterfaceEmpty* testInterfaceEmptyArg;
1151 { 1152 {
1152 v8::TryCatch block; 1153 v8::TryCatch block;
1153 V8RethrowTryCatchScope rethrow(block); 1154 V8RethrowTryCatchScope rethrow(block);
1154 TOSTRING_VOID_INTERNAL(strArg, info[0]); 1155 TOSTRING_VOID_INTERNAL(strArg, info[0]);
1155 if (info.Length() > 1 && !V8TestInterfaceEmpty::hasInstance(info[1], inf o.GetIsolate())) { 1156 if (info.Length() > 1 && !V8TestInterfaceEmpty::hasInstance(info[1], inf o.GetIsolate())) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 TestInterfaceImplementationV8Internal::partialStaticVoidMethodMethod(info); 1264 TestInterfaceImplementationV8Internal::partialStaticVoidMethodMethod(info);
1264 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 1265 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1265 } 1266 }
1266 #endif // ENABLE(PARTIAL_CONDITION) 1267 #endif // ENABLE(PARTIAL_CONDITION)
1267 1268
1268 #if ENABLE(PARTIAL_CONDITION) 1269 #if ENABLE(PARTIAL_CONDITION)
1269 static void partialVoidMethodLongArgMethod(const v8::FunctionCallbackInfo<v8::Va lue>& info) 1270 static void partialVoidMethodLongArgMethod(const v8::FunctionCallbackInfo<v8::Va lue>& info)
1270 { 1271 {
1271 ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialVoid MethodLongArg", "TestInterface", info.Holder(), info.GetIsolate()); 1272 ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialVoid MethodLongArg", "TestInterface", info.Holder(), info.GetIsolate());
1272 if (UNLIKELY(info.Length() < 1)) { 1273 if (UNLIKELY(info.Length() < 1)) {
1273 throwMinimumArityTypeError(exceptionState, 1, info.Length()); 1274 setMinimumArityTypeError(exceptionState, 1, info.Length());
1275 exceptionState.throwIfNeeded();
1274 return; 1276 return;
1275 } 1277 }
1276 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 1278 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
1277 int longArg; 1279 int longArg;
1278 { 1280 {
1279 v8::TryCatch block; 1281 v8::TryCatch block;
1280 V8RethrowTryCatchScope rethrow(block); 1282 V8RethrowTryCatchScope rethrow(block);
1281 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[0], exceptio nState), exceptionState); 1283 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[0], exceptio nState), exceptionState);
1282 } 1284 }
1283 TestPartialInterface::partialVoidMethodLongArg(*impl, longArg); 1285 TestPartialInterface::partialVoidMethodLongArg(*impl, longArg);
(...skipping 29 matching lines...) Expand all
1313 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 1315 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1314 TestInterfaceImplementationV8Internal::partialCallWithExecutionContextRaises ExceptionVoidMethodMethod(info); 1316 TestInterfaceImplementationV8Internal::partialCallWithExecutionContextRaises ExceptionVoidMethodMethod(info);
1315 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 1317 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1316 } 1318 }
1317 #endif // ENABLE(PARTIAL_CONDITION) 1319 #endif // ENABLE(PARTIAL_CONDITION)
1318 1320
1319 #if ENABLE(PARTIAL_CONDITION) 1321 #if ENABLE(PARTIAL_CONDITION)
1320 static void partialVoidMethodPartialCallbackTypeArgMethod(const v8::FunctionCall backInfo<v8::Value>& info) 1322 static void partialVoidMethodPartialCallbackTypeArgMethod(const v8::FunctionCall backInfo<v8::Value>& info)
1321 { 1323 {
1322 if (UNLIKELY(info.Length() < 1)) { 1324 if (UNLIKELY(info.Length() < 1)) {
1323 throwMinimumArityTypeErrorForMethod("partialVoidMethodPartialCallbackTyp eArg", "TestInterface", 1, info.Length(), info.GetIsolate()); 1325 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("p artialVoidMethodPartialCallbackTypeArg", "TestInterface", 1, info.Length(), info .GetIsolate()), info.GetIsolate());
1324 return; 1326 return;
1325 } 1327 }
1326 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 1328 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
1327 ScriptValue partialCallbackTypeArg; 1329 ScriptValue partialCallbackTypeArg;
1328 { 1330 {
1329 v8::TryCatch block; 1331 v8::TryCatch block;
1330 V8RethrowTryCatchScope rethrow(block); 1332 V8RethrowTryCatchScope rethrow(block);
1331 TONATIVE_VOID_INTERNAL(partialCallbackTypeArg, ScriptValue(ScriptState:: current(info.GetIsolate()), info[0])); 1333 TONATIVE_VOID_INTERNAL(partialCallbackTypeArg, ScriptValue(ScriptState:: current(info.GetIsolate()), info[0]));
1332 } 1334 }
1333 TestPartialInterface::partialVoidMethodPartialCallbackTypeArg(*impl, partial CallbackTypeArg); 1335 TestPartialInterface::partialVoidMethodPartialCallbackTypeArg(*impl, partial CallbackTypeArg);
1334 } 1336 }
1335 #endif // ENABLE(PARTIAL_CONDITION) 1337 #endif // ENABLE(PARTIAL_CONDITION)
1336 1338
1337 #if ENABLE(PARTIAL_CONDITION) 1339 #if ENABLE(PARTIAL_CONDITION)
1338 static void partialVoidMethodPartialCallbackTypeArgMethodCallback(const v8::Func tionCallbackInfo<v8::Value>& info) 1340 static void partialVoidMethodPartialCallbackTypeArgMethodCallback(const v8::Func tionCallbackInfo<v8::Value>& info)
1339 { 1341 {
1340 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 1342 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1341 TestInterfaceImplementationV8Internal::partialVoidMethodPartialCallbackTypeA rgMethod(info); 1343 TestInterfaceImplementationV8Internal::partialVoidMethodPartialCallbackTypeA rgMethod(info);
1342 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 1344 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1343 } 1345 }
1344 #endif // ENABLE(PARTIAL_CONDITION) 1346 #endif // ENABLE(PARTIAL_CONDITION)
1345 1347
1346 #if ENABLE(PARTIAL_CONDITION) 1348 #if ENABLE(PARTIAL_CONDITION)
1347 static void shortMethodWithShortArgumentImplementedInPrivateScriptMethod(const v 8::FunctionCallbackInfo<v8::Value>& info) 1349 static void shortMethodWithShortArgumentImplementedInPrivateScriptMethod(const v 8::FunctionCallbackInfo<v8::Value>& info)
1348 { 1350 {
1349 ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethod WithShortArgumentImplementedInPrivateScript", "TestInterface", info.Holder(), in fo.GetIsolate()); 1351 ExceptionState exceptionState(ExceptionState::ExecutionContext, "shortMethod WithShortArgumentImplementedInPrivateScript", "TestInterface", info.Holder(), in fo.GetIsolate());
1350 if (UNLIKELY(info.Length() < 1)) { 1352 if (UNLIKELY(info.Length() < 1)) {
1351 throwMinimumArityTypeError(exceptionState, 1, info.Length()); 1353 setMinimumArityTypeError(exceptionState, 1, info.Length());
1354 exceptionState.throwIfNeeded();
1352 return; 1355 return;
1353 } 1356 }
1354 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 1357 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
1355 int value; 1358 int value;
1356 { 1359 {
1357 v8::TryCatch block; 1360 v8::TryCatch block;
1358 V8RethrowTryCatchScope rethrow(block); 1361 V8RethrowTryCatchScope rethrow(block);
1359 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(value, toInt16(info[0], exceptionS tate), exceptionState); 1362 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(value, toInt16(info[0], exceptionS tate), exceptionState);
1360 } 1363 }
1361 int result = 0; 1364 int result = 0;
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1948 RELEASE_ASSERT_NOT_REACHED(); 1951 RELEASE_ASSERT_NOT_REACHED();
1949 } 1952 }
1950 block.ReThrow(); 1953 block.ReThrow();
1951 return false; 1954 return false;
1952 } 1955 }
1953 return true; 1956 return true;
1954 } 1957 }
1955 1958
1956 } // namespace blink 1959 } // namespace blink
1957 #endif // ENABLE(CONDITION) 1960 #endif // ENABLE(CONDITION)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698