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

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

Issue 221073003: Add helper functions for throwing arity-related TypeErrors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix style nits. Created 6 years, 8 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 | Annotate | Revision Log
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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 } 739 }
740 740
741 static void TestInterfaceImplementationReplaceableAttributeSetterCallback(v8::Lo cal<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackIn fo<void>& info) 741 static void TestInterfaceImplementationReplaceableAttributeSetterCallback(v8::Lo cal<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackIn fo<void>& info)
742 { 742 {
743 TestInterfaceImplementationV8Internal::TestInterfaceImplementationReplaceabl eAttributeSetter(name, v8Value, info); 743 TestInterfaceImplementationV8Internal::TestInterfaceImplementationReplaceabl eAttributeSetter(name, v8Value, info);
744 } 744 }
745 745
746 static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info) 746 static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info)
747 { 747 {
748 if (UNLIKELY(info.Length() < 1)) { 748 if (UNLIKELY(info.Length() < 1)) {
749 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestInterfa ceEmptyArg", "TestInterface", ExceptionMessages::notEnoughArguments(1, info.Leng th())), info.GetIsolate()); 749 throwArityTypeErrorForMethod("voidMethodTestInterfaceEmptyArg", "TestInt erface", 1, info.Length(), info.GetIsolate());
750 return; 750 return;
751 } 751 }
752 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 752 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
753 if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], info.Ge tIsolate())) { 753 if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], info.Ge tIsolate())) {
754 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestInterfa ceEmptyArg", "TestInterface", "parameter 1 is not of type 'TestInterfaceEmpty'." ), info.GetIsolate()); 754 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestInterfa ceEmptyArg", "TestInterface", "parameter 1 is not of type 'TestInterfaceEmpty'." ), info.GetIsolate());
755 return; 755 return;
756 } 756 }
757 V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceE mpty::toNativeWithTypeCheck(info.GetIsolate(), info[0])); 757 V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceE mpty::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
758 impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg); 758 impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg);
759 } 759 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 { 802 {
803 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 803 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
804 TestInterfaceImplementationV8Internal::implementsVoidMethodMethod(info); 804 TestInterfaceImplementationV8Internal::implementsVoidMethodMethod(info);
805 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 805 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
806 } 806 }
807 807
808 static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val ue>& info) 808 static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val ue>& info)
809 { 809 {
810 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsC omplexMethod", "TestInterface", info.Holder(), info.GetIsolate()); 810 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsC omplexMethod", "TestInterface", info.Holder(), info.GetIsolate());
811 if (UNLIKELY(info.Length() < 2)) { 811 if (UNLIKELY(info.Length() < 2)) {
812 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 812 throwArityTypeError(exceptionState, 2, info.Length());
813 exceptionState.throwIfNeeded();
814 return; 813 return;
815 } 814 }
816 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 815 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
817 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 816 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
818 if (info.Length() > 1 && !V8TestInterfaceEmpty::hasInstance(info[1], info.Ge tIsolate())) { 817 if (info.Length() > 1 && !V8TestInterfaceEmpty::hasInstance(info[1], info.Ge tIsolate())) {
819 exceptionState.throwTypeError("parameter 2 is not of type 'TestInterface Empty'."); 818 exceptionState.throwTypeError("parameter 2 is not of type 'TestInterface Empty'.");
820 exceptionState.throwIfNeeded(); 819 exceptionState.throwIfNeeded();
821 return; 820 return;
822 } 821 }
823 V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceE mpty::toNativeWithTypeCheck(info.GetIsolate(), info[1])); 822 V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceE mpty::toNativeWithTypeCheck(info.GetIsolate(), info[1]));
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 TestInterfaceImplementationV8Internal::partialStaticVoidMethodMethod(info); 925 TestInterfaceImplementationV8Internal::partialStaticVoidMethodMethod(info);
927 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 926 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
928 } 927 }
929 #endif // ENABLE(PARTIAL_CONDITION) 928 #endif // ENABLE(PARTIAL_CONDITION)
930 929
931 #if ENABLE(PARTIAL_CONDITION) 930 #if ENABLE(PARTIAL_CONDITION)
932 static void partialVoidMethodLongArgMethod(const v8::FunctionCallbackInfo<v8::Va lue>& info) 931 static void partialVoidMethodLongArgMethod(const v8::FunctionCallbackInfo<v8::Va lue>& info)
933 { 932 {
934 ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialVoid MethodLongArg", "TestInterface", info.Holder(), info.GetIsolate()); 933 ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialVoid MethodLongArg", "TestInterface", info.Holder(), info.GetIsolate());
935 if (UNLIKELY(info.Length() < 1)) { 934 if (UNLIKELY(info.Length() < 1)) {
936 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 935 throwArityTypeError(exceptionState, 1, info.Length());
937 exceptionState.throwIfNeeded();
938 return; 936 return;
939 } 937 }
940 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 938 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
941 V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[0], exceptionState), ex ceptionState); 939 V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[0], exceptionState), ex ceptionState);
942 ASSERT(impl); 940 ASSERT(impl);
943 TestPartialInterface::partialVoidMethodLongArg(*impl, longArg); 941 TestPartialInterface::partialVoidMethodLongArg(*impl, longArg);
944 } 942 }
945 #endif // ENABLE(PARTIAL_CONDITION) 943 #endif // ENABLE(PARTIAL_CONDITION)
946 944
947 #if ENABLE(PARTIAL_CONDITION) 945 #if ENABLE(PARTIAL_CONDITION)
(...skipping 24 matching lines...) Expand all
972 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 970 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
973 TestInterfaceImplementationV8Internal::partialCallWithExecutionContextRaises ExceptionVoidMethodMethod(info); 971 TestInterfaceImplementationV8Internal::partialCallWithExecutionContextRaises ExceptionVoidMethodMethod(info);
974 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 972 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
975 } 973 }
976 #endif // ENABLE(PARTIAL_CONDITION) 974 #endif // ENABLE(PARTIAL_CONDITION)
977 975
978 #if ENABLE(PARTIAL_CONDITION) 976 #if ENABLE(PARTIAL_CONDITION)
979 static void partialVoidMethodPartialCallbackTypeArgMethod(const v8::FunctionCall backInfo<v8::Value>& info) 977 static void partialVoidMethodPartialCallbackTypeArgMethod(const v8::FunctionCall backInfo<v8::Value>& info)
980 { 978 {
981 if (UNLIKELY(info.Length() < 1)) { 979 if (UNLIKELY(info.Length() < 1)) {
982 throwTypeError(ExceptionMessages::failedToExecute("partialVoidMethodPart ialCallbackTypeArg", "TestInterface", ExceptionMessages::notEnoughArguments(1, i nfo.Length())), info.GetIsolate()); 980 throwArityTypeErrorForMethod("partialVoidMethodPartialCallbackTypeArg", "TestInterface", 1, info.Length(), info.GetIsolate());
983 return; 981 return;
984 } 982 }
985 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 983 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
986 V8TRYCATCH_VOID(ScriptValue, partialCallbackTypeArg, ScriptValue(info[0], in fo.GetIsolate())); 984 V8TRYCATCH_VOID(ScriptValue, partialCallbackTypeArg, ScriptValue(info[0], in fo.GetIsolate()));
987 ASSERT(impl); 985 ASSERT(impl);
988 TestPartialInterface::partialVoidMethodPartialCallbackTypeArg(*impl, partial CallbackTypeArg); 986 TestPartialInterface::partialVoidMethodPartialCallbackTypeArg(*impl, partial CallbackTypeArg);
989 } 987 }
990 #endif // ENABLE(PARTIAL_CONDITION) 988 #endif // ENABLE(PARTIAL_CONDITION)
991 989
992 #if ENABLE(PARTIAL_CONDITION) 990 #if ENABLE(PARTIAL_CONDITION)
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 } 1381 }
1384 1382
1385 template<> 1383 template<>
1386 v8::Handle<v8::Value> toV8NoInline(TestInterfaceImplementation* impl, v8::Handle <v8::Object> creationContext, v8::Isolate* isolate) 1384 v8::Handle<v8::Value> toV8NoInline(TestInterfaceImplementation* impl, v8::Handle <v8::Object> creationContext, v8::Isolate* isolate)
1387 { 1385 {
1388 return toV8(impl, creationContext, isolate); 1386 return toV8(impl, creationContext, isolate);
1389 } 1387 }
1390 1388
1391 } // namespace WebCore 1389 } // namespace WebCore
1392 #endif // ENABLE(CONDITION) 1390 #endif // ENABLE(CONDITION)
OLDNEW
« no previous file with comments | « Source/bindings/templates/methods.cpp ('k') | Source/bindings/tests/results/V8TestInterface2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698