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

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

Issue 68563003: Create DOM exceptions in the correct context. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased onto df9a982fbe97 Created 7 years, 1 month 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 static void typedArrayAttrAttributeSetterCallback(v8::Local<v8::String>, v8::Loc al<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 844 static void typedArrayAttrAttributeSetterCallback(v8::Local<v8::String>, v8::Loc al<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
845 { 845 {
846 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 846 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
847 TestObjV8Internal::typedArrayAttrAttributeSetter(jsValue, info); 847 TestObjV8Internal::typedArrayAttrAttributeSetter(jsValue, info);
848 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 848 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
849 } 849 }
850 850
851 static void attrWithGetterExceptionAttributeGetter(const v8::PropertyCallbackInf o<v8::Value>& info) 851 static void attrWithGetterExceptionAttributeGetter(const v8::PropertyCallbackInf o<v8::Value>& info)
852 { 852 {
853 TestObj* imp = V8TestObject::toNative(info.Holder()); 853 TestObj* imp = V8TestObject::toNative(info.Holder());
854 ExceptionState exceptionState(info.GetIsolate()); 854 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
855 int jsValue = imp->attrWithGetterException(exceptionState); 855 int jsValue = imp->attrWithGetterException(exceptionState);
856 if (UNLIKELY(exceptionState.throwIfNeeded())) 856 if (UNLIKELY(exceptionState.throwIfNeeded()))
857 return; 857 return;
858 v8SetReturnValueInt(info, jsValue); 858 v8SetReturnValueInt(info, jsValue);
859 } 859 }
860 860
861 static void attrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::String> , const v8::PropertyCallbackInfo<v8::Value>& info) 861 static void attrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::String> , const v8::PropertyCallbackInfo<v8::Value>& info)
862 { 862 {
863 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 863 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
864 TestObjV8Internal::attrWithGetterExceptionAttributeGetter(info); 864 TestObjV8Internal::attrWithGetterExceptionAttributeGetter(info);
(...skipping 24 matching lines...) Expand all
889 { 889 {
890 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 890 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
891 TestObjV8Internal::attrWithSetterExceptionAttributeGetter(info); 891 TestObjV8Internal::attrWithSetterExceptionAttributeGetter(info);
892 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 892 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
893 } 893 }
894 894
895 static void attrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 895 static void attrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
896 { 896 {
897 TestObj* imp = V8TestObject::toNative(info.Holder()); 897 TestObj* imp = V8TestObject::toNative(info.Holder());
898 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue)); 898 V8TRYCATCH_VOID(int, cppValue, toInt32(jsValue));
899 ExceptionState exceptionState(info.GetIsolate()); 899 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
900 imp->setAttrWithSetterException(cppValue, exceptionState); 900 imp->setAttrWithSetterException(cppValue, exceptionState);
901 exceptionState.throwIfNeeded(); 901 exceptionState.throwIfNeeded();
902 } 902 }
903 903
904 static void attrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::String> , v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 904 static void attrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::String> , v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
905 { 905 {
906 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 906 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
907 TestObjV8Internal::attrWithSetterExceptionAttributeSetter(jsValue, info); 907 TestObjV8Internal::attrWithSetterExceptionAttributeSetter(jsValue, info);
908 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 908 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
909 } 909 }
910 910
911 static void stringAttrWithGetterExceptionAttributeGetter(const v8::PropertyCallb ackInfo<v8::Value>& info) 911 static void stringAttrWithGetterExceptionAttributeGetter(const v8::PropertyCallb ackInfo<v8::Value>& info)
912 { 912 {
913 TestObj* imp = V8TestObject::toNative(info.Holder()); 913 TestObj* imp = V8TestObject::toNative(info.Holder());
914 ExceptionState exceptionState(info.GetIsolate()); 914 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
915 String jsValue = imp->stringAttrWithGetterException(exceptionState); 915 String jsValue = imp->stringAttrWithGetterException(exceptionState);
916 if (UNLIKELY(exceptionState.throwIfNeeded())) 916 if (UNLIKELY(exceptionState.throwIfNeeded()))
917 return; 917 return;
918 v8SetReturnValueString(info, jsValue, info.GetIsolate()); 918 v8SetReturnValueString(info, jsValue, info.GetIsolate());
919 } 919 }
920 920
921 static void stringAttrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::S tring>, const v8::PropertyCallbackInfo<v8::Value>& info) 921 static void stringAttrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::S tring>, const v8::PropertyCallbackInfo<v8::Value>& info)
922 { 922 {
923 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 923 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
924 TestObjV8Internal::stringAttrWithGetterExceptionAttributeGetter(info); 924 TestObjV8Internal::stringAttrWithGetterExceptionAttributeGetter(info);
(...skipping 24 matching lines...) Expand all
949 { 949 {
950 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 950 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
951 TestObjV8Internal::stringAttrWithSetterExceptionAttributeGetter(info); 951 TestObjV8Internal::stringAttrWithSetterExceptionAttributeGetter(info);
952 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 952 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
953 } 953 }
954 954
955 static void stringAttrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> js Value, const v8::PropertyCallbackInfo<void>& info) 955 static void stringAttrWithSetterExceptionAttributeSetter(v8::Local<v8::Value> js Value, const v8::PropertyCallbackInfo<void>& info)
956 { 956 {
957 TestObj* imp = V8TestObject::toNative(info.Holder()); 957 TestObj* imp = V8TestObject::toNative(info.Holder());
958 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); 958 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue);
959 ExceptionState exceptionState(info.GetIsolate()); 959 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
960 imp->setStringAttrWithSetterException(cppValue, exceptionState); 960 imp->setStringAttrWithSetterException(cppValue, exceptionState);
961 exceptionState.throwIfNeeded(); 961 exceptionState.throwIfNeeded();
962 } 962 }
963 963
964 static void stringAttrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::S tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info ) 964 static void stringAttrWithSetterExceptionAttributeSetterCallback(v8::Local<v8::S tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info )
965 { 965 {
966 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 966 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
967 TestObjV8Internal::stringAttrWithSetterExceptionAttributeSetter(jsValue, inf o); 967 TestObjV8Internal::stringAttrWithSetterExceptionAttributeSetter(jsValue, inf o);
968 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 968 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
969 } 969 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 static void withActiveWindowAndFirstWindowAttributeAttributeSetterCallback(v8::L ocal<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v oid>& info) 1071 static void withActiveWindowAndFirstWindowAttributeAttributeSetterCallback(v8::L ocal<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v oid>& info)
1072 { 1072 {
1073 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1073 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
1074 TestObjV8Internal::withActiveWindowAndFirstWindowAttributeAttributeSetter(js Value, info); 1074 TestObjV8Internal::withActiveWindowAndFirstWindowAttributeAttributeSetter(js Value, info);
1075 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1075 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
1076 } 1076 }
1077 1077
1078 static void withScriptStateAttributeRaisesAttributeGetter(const v8::PropertyCall backInfo<v8::Value>& info) 1078 static void withScriptStateAttributeRaisesAttributeGetter(const v8::PropertyCall backInfo<v8::Value>& info)
1079 { 1079 {
1080 TestObj* imp = V8TestObject::toNative(info.Holder()); 1080 TestObj* imp = V8TestObject::toNative(info.Holder());
1081 ExceptionState exceptionState(info.GetIsolate()); 1081 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
1082 ScriptState* currentState = ScriptState::current(); 1082 ScriptState* currentState = ScriptState::current();
1083 if (!currentState) 1083 if (!currentState)
1084 return v8Undefined(); 1084 return v8Undefined();
1085 ScriptState& state = *currentState; 1085 ScriptState& state = *currentState;
1086 RefPtr<TestObj> jsValue = imp->withScriptStateAttributeRaises(&state, except ionState); 1086 RefPtr<TestObj> jsValue = imp->withScriptStateAttributeRaises(&state, except ionState);
1087 if (UNLIKELY(exceptionState.throwIfNeeded())) 1087 if (UNLIKELY(exceptionState.throwIfNeeded()))
1088 return; 1088 return;
1089 if (state.hadException()) { 1089 if (state.hadException()) {
1090 throwError(state.exception(), info.GetIsolate()); 1090 throwError(state.exception(), info.GetIsolate());
1091 return; 1091 return;
(...skipping 24 matching lines...) Expand all
1116 static void withScriptStateAttributeRaisesAttributeSetterCallback(v8::Local<v8:: String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf o) 1116 static void withScriptStateAttributeRaisesAttributeSetterCallback(v8::Local<v8:: String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& inf o)
1117 { 1117 {
1118 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1118 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
1119 TestObjV8Internal::withScriptStateAttributeRaisesAttributeSetter(jsValue, in fo); 1119 TestObjV8Internal::withScriptStateAttributeRaisesAttributeSetter(jsValue, in fo);
1120 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1120 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
1121 } 1121 }
1122 1122
1123 static void withExecutionContextAttributeRaisesAttributeGetter(const v8::Propert yCallbackInfo<v8::Value>& info) 1123 static void withExecutionContextAttributeRaisesAttributeGetter(const v8::Propert yCallbackInfo<v8::Value>& info)
1124 { 1124 {
1125 TestObj* imp = V8TestObject::toNative(info.Holder()); 1125 TestObj* imp = V8TestObject::toNative(info.Holder());
1126 ExceptionState exceptionState(info.GetIsolate()); 1126 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
1127 ExecutionContext* scriptContext = getExecutionContext(); 1127 ExecutionContext* scriptContext = getExecutionContext();
1128 RefPtr<TestObj> jsValue = imp->withExecutionContextAttributeRaises(scriptCon text, exceptionState); 1128 RefPtr<TestObj> jsValue = imp->withExecutionContextAttributeRaises(scriptCon text, exceptionState);
1129 if (UNLIKELY(exceptionState.throwIfNeeded())) 1129 if (UNLIKELY(exceptionState.throwIfNeeded()))
1130 return; 1130 return;
1131 v8SetReturnValueFast(info, jsValue.release(), imp); 1131 v8SetReturnValueFast(info, jsValue.release(), imp);
1132 } 1132 }
1133 1133
1134 static void withExecutionContextAttributeRaisesAttributeGetterCallback(v8::Local <v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 1134 static void withExecutionContextAttributeRaisesAttributeGetterCallback(v8::Local <v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
1135 { 1135 {
1136 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 1136 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 static void withExecutionContextAndScriptStateAttributeAttributeSetterCallback(v 8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackIn fo<void>& info) 1188 static void withExecutionContextAndScriptStateAttributeAttributeSetterCallback(v 8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackIn fo<void>& info)
1189 { 1189 {
1190 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1190 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
1191 TestObjV8Internal::withExecutionContextAndScriptStateAttributeAttributeSette r(jsValue, info); 1191 TestObjV8Internal::withExecutionContextAndScriptStateAttributeAttributeSette r(jsValue, info);
1192 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1192 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
1193 } 1193 }
1194 1194
1195 static void withExecutionContextAndScriptStateAttributeRaisesAttributeGetter(con st v8::PropertyCallbackInfo<v8::Value>& info) 1195 static void withExecutionContextAndScriptStateAttributeRaisesAttributeGetter(con st v8::PropertyCallbackInfo<v8::Value>& info)
1196 { 1196 {
1197 TestObj* imp = V8TestObject::toNative(info.Holder()); 1197 TestObj* imp = V8TestObject::toNative(info.Holder());
1198 ExceptionState exceptionState(info.GetIsolate()); 1198 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
1199 ScriptState* currentState = ScriptState::current(); 1199 ScriptState* currentState = ScriptState::current();
1200 if (!currentState) 1200 if (!currentState)
1201 return v8Undefined(); 1201 return v8Undefined();
1202 ScriptState& state = *currentState; 1202 ScriptState& state = *currentState;
1203 ExecutionContext* scriptContext = getExecutionContext(); 1203 ExecutionContext* scriptContext = getExecutionContext();
1204 RefPtr<TestObj> jsValue = imp->withExecutionContextAndScriptStateAttributeRa ises(&state, scriptContext, exceptionState); 1204 RefPtr<TestObj> jsValue = imp->withExecutionContextAndScriptStateAttributeRa ises(&state, scriptContext, exceptionState);
1205 if (UNLIKELY(exceptionState.throwIfNeeded())) 1205 if (UNLIKELY(exceptionState.throwIfNeeded()))
1206 return; 1206 return;
1207 if (state.hadException()) { 1207 if (state.hadException()) {
1208 throwError(state.exception(), info.GetIsolate()); 1208 throwError(state.exception(), info.GetIsolate());
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 static void messagePortArrayAttributeSetterCallback(v8::Local<v8::String>, v8::L ocal<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 1810 static void messagePortArrayAttributeSetterCallback(v8::Local<v8::String>, v8::L ocal<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
1811 { 1811 {
1812 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 1812 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
1813 TestObjV8Internal::messagePortArrayAttributeSetter(jsValue, info); 1813 TestObjV8Internal::messagePortArrayAttributeSetter(jsValue, info);
1814 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 1814 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
1815 } 1815 }
1816 1816
1817 static void contentDocumentAttributeGetter(const v8::PropertyCallbackInfo<v8::Va lue>& info) 1817 static void contentDocumentAttributeGetter(const v8::PropertyCallbackInfo<v8::Va lue>& info)
1818 { 1818 {
1819 TestObj* imp = V8TestObject::toNative(info.Holder()); 1819 TestObj* imp = V8TestObject::toNative(info.Holder());
1820 ExceptionState exceptionState(info.GetIsolate()); 1820 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
1821 if (!BindingSecurity::shouldAllowAccessToNode(imp->contentDocument(), except ionState)) { 1821 if (!BindingSecurity::shouldAllowAccessToNode(imp->contentDocument(), except ionState)) {
1822 v8SetReturnValueNull(info); 1822 v8SetReturnValueNull(info);
1823 exceptionState.throwIfNeeded(); 1823 exceptionState.throwIfNeeded();
1824 return; 1824 return;
1825 } 1825 }
1826 v8SetReturnValueFast(info, imp->contentDocument(), imp); 1826 v8SetReturnValueFast(info, imp->contentDocument(), imp);
1827 } 1827 }
1828 1828
1829 static void contentDocumentAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 1829 static void contentDocumentAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
1830 { 1830 {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
2067 static void nullableLongSettableAttributeAttributeSetterCallback(v8::Local<v8::S tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info ) 2067 static void nullableLongSettableAttributeAttributeSetterCallback(v8::Local<v8::S tring>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info )
2068 { 2068 {
2069 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2069 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
2070 TestObjV8Internal::nullableLongSettableAttributeAttributeSetter(jsValue, inf o); 2070 TestObjV8Internal::nullableLongSettableAttributeAttributeSetter(jsValue, inf o);
2071 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2071 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
2072 } 2072 }
2073 2073
2074 static void nullableStringValueAttributeGetter(const v8::PropertyCallbackInfo<v8 ::Value>& info) 2074 static void nullableStringValueAttributeGetter(const v8::PropertyCallbackInfo<v8 ::Value>& info)
2075 { 2075 {
2076 TestObj* imp = V8TestObject::toNative(info.Holder()); 2076 TestObj* imp = V8TestObject::toNative(info.Holder());
2077 ExceptionState exceptionState(info.GetIsolate()); 2077 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
2078 bool isNull = false; 2078 bool isNull = false;
2079 int jsValue = imp->nullableStringValue(isNull, exceptionState); 2079 int jsValue = imp->nullableStringValue(isNull, exceptionState);
2080 if (isNull) { 2080 if (isNull) {
2081 v8SetReturnValueNull(info); 2081 v8SetReturnValueNull(info);
2082 return; 2082 return;
2083 } 2083 }
2084 if (UNLIKELY(exceptionState.throwIfNeeded())) 2084 if (UNLIKELY(exceptionState.throwIfNeeded()))
2085 return; 2085 return;
2086 v8SetReturnValueInt(info, jsValue); 2086 v8SetReturnValueInt(info, jsValue);
2087 } 2087 }
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
2796 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2796 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
2797 } 2797 }
2798 2798
2799 static void locationWithExceptionAttributeSetter(v8::Local<v8::Value> jsValue, c onst v8::PropertyCallbackInfo<void>& info) 2799 static void locationWithExceptionAttributeSetter(v8::Local<v8::Value> jsValue, c onst v8::PropertyCallbackInfo<void>& info)
2800 { 2800 {
2801 TestObj* proxyImp = V8TestObject::toNative(info.Holder()); 2801 TestObj* proxyImp = V8TestObject::toNative(info.Holder());
2802 TestNode* imp = proxyImp->locationWithException(); 2802 TestNode* imp = proxyImp->locationWithException();
2803 if (!imp) 2803 if (!imp)
2804 return; 2804 return;
2805 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); 2805 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue);
2806 ExceptionState exceptionState(info.GetIsolate()); 2806 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
2807 imp->setHrefThrows(cppValue, exceptionState); 2807 imp->setHrefThrows(cppValue, exceptionState);
2808 exceptionState.throwIfNeeded(); 2808 exceptionState.throwIfNeeded();
2809 } 2809 }
2810 2810
2811 static void locationWithExceptionAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 2811 static void locationWithExceptionAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
2812 { 2812 {
2813 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); 2813 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
2814 TestObjV8Internal::locationWithExceptionAttributeSetter(jsValue, info); 2814 TestObjV8Internal::locationWithExceptionAttributeSetter(jsValue, info);
2815 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2815 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
2816 } 2816 }
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
2994 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 2994 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
2995 } 2995 }
2996 2996
2997 static void methodThatRequiresAllArgsAndThrowsMethod(const v8::FunctionCallbackI nfo<v8::Value>& info) 2997 static void methodThatRequiresAllArgsAndThrowsMethod(const v8::FunctionCallbackI nfo<v8::Value>& info)
2998 { 2998 {
2999 if (UNLIKELY(info.Length() < 2)) { 2999 if (UNLIKELY(info.Length() < 2)) {
3000 throwTypeError(ExceptionMessages::failedToExecute("methodThatRequiresAll ArgsAndThrows", "TestObject", ExceptionMessages::notEnoughArguments(2, info.Leng th())), info.GetIsolate()); 3000 throwTypeError(ExceptionMessages::failedToExecute("methodThatRequiresAll ArgsAndThrows", "TestObject", ExceptionMessages::notEnoughArguments(2, info.Leng th())), info.GetIsolate());
3001 return; 3001 return;
3002 } 3002 }
3003 TestObj* imp = V8TestObject::toNative(info.Holder()); 3003 TestObj* imp = V8TestObject::toNative(info.Holder());
3004 ExceptionState exceptionState(info.GetIsolate()); 3004 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
3005 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 3005 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
3006 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[1], info.Ge tIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8 ::Object>::Cast(info[1])) : 0); 3006 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[1], info.Ge tIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8 ::Object>::Cast(info[1])) : 0);
3007 RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, obj Arg, exceptionState); 3007 RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, obj Arg, exceptionState);
3008 if (exceptionState.throwIfNeeded()) 3008 if (exceptionState.throwIfNeeded())
3009 return; 3009 return;
3010 v8SetReturnValue(info, result.release()); 3010 v8SetReturnValue(info, result.release());
3011 } 3011 }
3012 3012
3013 static void methodThatRequiresAllArgsAndThrowsMethodCallback(const v8::FunctionC allbackInfo<v8::Value>& info) 3013 static void methodThatRequiresAllArgsAndThrowsMethodCallback(const v8::FunctionC allbackInfo<v8::Value>& info)
3014 { 3014 {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
3061 static void optionsObjectMethodCallback(const v8::FunctionCallbackInfo<v8::Value >& info) 3061 static void optionsObjectMethodCallback(const v8::FunctionCallbackInfo<v8::Value >& info)
3062 { 3062 {
3063 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3063 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
3064 TestObjV8Internal::optionsObjectMethod(info); 3064 TestObjV8Internal::optionsObjectMethod(info);
3065 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3065 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
3066 } 3066 }
3067 3067
3068 static void methodWithExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 3068 static void methodWithExceptionMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
3069 { 3069 {
3070 TestObj* imp = V8TestObject::toNative(info.Holder()); 3070 TestObj* imp = V8TestObject::toNative(info.Holder());
3071 ExceptionState exceptionState(info.GetIsolate()); 3071 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
3072 imp->methodWithException(exceptionState); 3072 imp->methodWithException(exceptionState);
3073 if (exceptionState.throwIfNeeded()) 3073 if (exceptionState.throwIfNeeded())
3074 return; 3074 return;
3075 } 3075 }
3076 3076
3077 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info) 3077 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info)
3078 { 3078 {
3079 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3079 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
3080 TestObjV8Internal::methodWithExceptionMethod(info); 3080 TestObjV8Internal::methodWithExceptionMethod(info);
3081 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3081 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
(...skipping 11 matching lines...) Expand all
3093 { 3093 {
3094 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3094 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
3095 V8TestObject::customMethodWithArgsMethodCustom(info); 3095 V8TestObject::customMethodWithArgsMethodCustom(info);
3096 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3096 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
3097 } 3097 }
3098 3098
3099 static void addEventListenerMethod(const v8::FunctionCallbackInfo<v8::Value>& in fo) 3099 static void addEventListenerMethod(const v8::FunctionCallbackInfo<v8::Value>& in fo)
3100 { 3100 {
3101 EventTarget* impl = V8TestObject::toNative(info.Holder()); 3101 EventTarget* impl = V8TestObject::toNative(info.Holder());
3102 if (DOMWindow* window = impl->toDOMWindow()) { 3102 if (DOMWindow* window = impl->toDOMWindow()) {
3103 ExceptionState exceptionState(info.GetIsolate()); 3103 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
3104 if (!BindingSecurity::shouldAllowAccessToFrame(window->frame(), exceptio nState)) { 3104 if (!BindingSecurity::shouldAllowAccessToFrame(window->frame(), exceptio nState)) {
3105 exceptionState.throwIfNeeded(); 3105 exceptionState.throwIfNeeded();
3106 return; 3106 return;
3107 } 3107 }
3108 if (!window->document()) 3108 if (!window->document())
3109 return; 3109 return;
3110 } 3110 }
3111 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(info[ 1], false, ListenerFindOrCreate); 3111 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(info[ 1], false, ListenerFindOrCreate);
3112 if (listener) { 3112 if (listener) {
3113 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, ev entName, info[0]); 3113 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, ev entName, info[0]);
3114 impl->addEventListener(eventName, listener, info[2]->BooleanValue()); 3114 impl->addEventListener(eventName, listener, info[2]->BooleanValue());
3115 if (!impl->toNode()) 3115 if (!impl->toNode())
3116 createHiddenDependency(info.Holder(), info[1], V8TestObject::eventLi stenerCacheIndex, info.GetIsolate()); 3116 createHiddenDependency(info.Holder(), info[1], V8TestObject::eventLi stenerCacheIndex, info.GetIsolate());
3117 } 3117 }
3118 } 3118 }
3119 3119
3120 static void addEventListenerMethodCallback(const v8::FunctionCallbackInfo<v8::Va lue>& info) 3120 static void addEventListenerMethodCallback(const v8::FunctionCallbackInfo<v8::Va lue>& info)
3121 { 3121 {
3122 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3122 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
3123 TestObjV8Internal::addEventListenerMethod(info); 3123 TestObjV8Internal::addEventListenerMethod(info);
3124 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3124 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
3125 } 3125 }
3126 3126
3127 static void removeEventListenerMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 3127 static void removeEventListenerMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
3128 { 3128 {
3129 EventTarget* impl = V8TestObject::toNative(info.Holder()); 3129 EventTarget* impl = V8TestObject::toNative(info.Holder());
3130 if (DOMWindow* window = impl->toDOMWindow()) { 3130 if (DOMWindow* window = impl->toDOMWindow()) {
3131 ExceptionState exceptionState(info.GetIsolate()); 3131 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
3132 if (!BindingSecurity::shouldAllowAccessToFrame(window->frame(), exceptio nState)) { 3132 if (!BindingSecurity::shouldAllowAccessToFrame(window->frame(), exceptio nState)) {
3133 exceptionState.throwIfNeeded(); 3133 exceptionState.throwIfNeeded();
3134 return; 3134 return;
3135 } 3135 }
3136 if (!window->document()) 3136 if (!window->document())
3137 return; 3137 return;
3138 } 3138 }
3139 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(info[ 1], false, ListenerFindOnly); 3139 RefPtr<EventListener> listener = V8EventListenerList::getEventListener(info[ 1], false, ListenerFindOnly);
3140 if (listener) { 3140 if (listener) {
3141 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, ev entName, info[0]); 3141 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithNullCheck>, ev entName, info[0]);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
3195 static void withScriptStateObjMethodCallback(const v8::FunctionCallbackInfo<v8:: Value>& info) 3195 static void withScriptStateObjMethodCallback(const v8::FunctionCallbackInfo<v8:: Value>& info)
3196 { 3196 {
3197 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3197 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
3198 TestObjV8Internal::withScriptStateObjMethod(info); 3198 TestObjV8Internal::withScriptStateObjMethod(info);
3199 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3199 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
3200 } 3200 }
3201 3201
3202 static void withScriptStateVoidExceptionMethod(const v8::FunctionCallbackInfo<v8 ::Value>& info) 3202 static void withScriptStateVoidExceptionMethod(const v8::FunctionCallbackInfo<v8 ::Value>& info)
3203 { 3203 {
3204 TestObj* imp = V8TestObject::toNative(info.Holder()); 3204 TestObj* imp = V8TestObject::toNative(info.Holder());
3205 ExceptionState exceptionState(info.GetIsolate()); 3205 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
3206 ScriptState* currentState = ScriptState::current(); 3206 ScriptState* currentState = ScriptState::current();
3207 if (!currentState) 3207 if (!currentState)
3208 return; 3208 return;
3209 ScriptState& state = *currentState; 3209 ScriptState& state = *currentState;
3210 imp->withScriptStateVoidException(&state, exceptionState); 3210 imp->withScriptStateVoidException(&state, exceptionState);
3211 if (exceptionState.throwIfNeeded()) 3211 if (exceptionState.throwIfNeeded())
3212 return; 3212 return;
3213 if (state.hadException()) { 3213 if (state.hadException()) {
3214 v8::Local<v8::Value> exception = state.exception(); 3214 v8::Local<v8::Value> exception = state.exception();
3215 state.clearException(); 3215 state.clearException();
3216 throwError(exception, info.GetIsolate()); 3216 throwError(exception, info.GetIsolate());
3217 return; 3217 return;
3218 } 3218 }
3219 } 3219 }
3220 3220
3221 static void withScriptStateVoidExceptionMethodCallback(const v8::FunctionCallbac kInfo<v8::Value>& info) 3221 static void withScriptStateVoidExceptionMethodCallback(const v8::FunctionCallbac kInfo<v8::Value>& info)
3222 { 3222 {
3223 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3223 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
3224 TestObjV8Internal::withScriptStateVoidExceptionMethod(info); 3224 TestObjV8Internal::withScriptStateVoidExceptionMethod(info);
3225 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3225 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
3226 } 3226 }
3227 3227
3228 static void withScriptStateObjExceptionMethod(const v8::FunctionCallbackInfo<v8: :Value>& info) 3228 static void withScriptStateObjExceptionMethod(const v8::FunctionCallbackInfo<v8: :Value>& info)
3229 { 3229 {
3230 TestObj* imp = V8TestObject::toNative(info.Holder()); 3230 TestObj* imp = V8TestObject::toNative(info.Holder());
3231 ExceptionState exceptionState(info.GetIsolate()); 3231 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
3232 ScriptState* currentState = ScriptState::current(); 3232 ScriptState* currentState = ScriptState::current();
3233 if (!currentState) 3233 if (!currentState)
3234 return; 3234 return;
3235 ScriptState& state = *currentState; 3235 ScriptState& state = *currentState;
3236 RefPtr<TestObj> result = imp->withScriptStateObjException(&state, exceptionS tate); 3236 RefPtr<TestObj> result = imp->withScriptStateObjException(&state, exceptionS tate);
3237 if (exceptionState.throwIfNeeded()) 3237 if (exceptionState.throwIfNeeded())
3238 return; 3238 return;
3239 if (state.hadException()) { 3239 if (state.hadException()) {
3240 v8::Local<v8::Value> exception = state.exception(); 3240 v8::Local<v8::Value> exception = state.exception();
3241 state.clearException(); 3241 state.clearException();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
3286 static void withExecutionContextAndScriptStateMethodCallback(const v8::FunctionC allbackInfo<v8::Value>& info) 3286 static void withExecutionContextAndScriptStateMethodCallback(const v8::FunctionC allbackInfo<v8::Value>& info)
3287 { 3287 {
3288 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3288 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
3289 TestObjV8Internal::withExecutionContextAndScriptStateMethod(info); 3289 TestObjV8Internal::withExecutionContextAndScriptStateMethod(info);
3290 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3290 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
3291 } 3291 }
3292 3292
3293 static void withExecutionContextAndScriptStateObjExceptionMethod(const v8::Funct ionCallbackInfo<v8::Value>& info) 3293 static void withExecutionContextAndScriptStateObjExceptionMethod(const v8::Funct ionCallbackInfo<v8::Value>& info)
3294 { 3294 {
3295 TestObj* imp = V8TestObject::toNative(info.Holder()); 3295 TestObj* imp = V8TestObject::toNative(info.Holder());
3296 ExceptionState exceptionState(info.GetIsolate()); 3296 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
3297 ScriptState* currentState = ScriptState::current(); 3297 ScriptState* currentState = ScriptState::current();
3298 if (!currentState) 3298 if (!currentState)
3299 return; 3299 return;
3300 ScriptState& state = *currentState; 3300 ScriptState& state = *currentState;
3301 ExecutionContext* scriptContext = getExecutionContext(); 3301 ExecutionContext* scriptContext = getExecutionContext();
3302 RefPtr<TestObj> result = imp->withExecutionContextAndScriptStateObjException (&state, scriptContext, exceptionState); 3302 RefPtr<TestObj> result = imp->withExecutionContextAndScriptStateObjException (&state, scriptContext, exceptionState);
3303 if (exceptionState.throwIfNeeded()) 3303 if (exceptionState.throwIfNeeded())
3304 return; 3304 return;
3305 if (state.hadException()) { 3305 if (state.hadException()) {
3306 v8::Local<v8::Value> exception = state.exception(); 3306 v8::Local<v8::Value> exception = state.exception();
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
4134 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4134 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4135 } 4135 }
4136 4136
4137 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 4137 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
4138 { 4138 {
4139 if (UNLIKELY(info.Length() < 1)) { 4139 if (UNLIKELY(info.Length() < 1)) {
4140 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.Ge tIsolate()); 4140 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.Ge tIsolate());
4141 return; 4141 return;
4142 } 4142 }
4143 TestObj* imp = V8TestObject::toNative(info.Holder()); 4143 TestObj* imp = V8TestObject::toNative(info.Holder());
4144 ExceptionState exceptionState(info.GetIsolate()); 4144 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
4145 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in fo.GetIsolate())); 4145 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in fo.GetIsolate()));
4146 Vector<String> result = imp->stringArrayFunction(values, exceptionState); 4146 Vector<String> result = imp->stringArrayFunction(values, exceptionState);
4147 if (exceptionState.throwIfNeeded()) 4147 if (exceptionState.throwIfNeeded())
4148 return; 4148 return;
4149 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); 4149 v8SetReturnValue(info, v8Array(result, info.GetIsolate()));
4150 } 4150 }
4151 4151
4152 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info) 4152 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info)
4153 { 4153 {
4154 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4154 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4155 TestObjV8Internal::stringArrayFunctionMethod(info); 4155 TestObjV8Internal::stringArrayFunctionMethod(info);
4156 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4156 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4157 } 4157 }
4158 4158
4159 static void domStringListFunctionMethod(const v8::FunctionCallbackInfo<v8::Value >& info) 4159 static void domStringListFunctionMethod(const v8::FunctionCallbackInfo<v8::Value >& info)
4160 { 4160 {
4161 if (UNLIKELY(info.Length() < 1)) { 4161 if (UNLIKELY(info.Length() < 1)) {
4162 throwTypeError(ExceptionMessages::failedToExecute("domStringListFunction ", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info. GetIsolate()); 4162 throwTypeError(ExceptionMessages::failedToExecute("domStringListFunction ", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info. GetIsolate());
4163 return; 4163 return;
4164 } 4164 }
4165 TestObj* imp = V8TestObject::toNative(info.Holder()); 4165 TestObj* imp = V8TestObject::toNative(info.Holder());
4166 ExceptionState exceptionState(info.GetIsolate()); 4166 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
4167 V8TRYCATCH_VOID(DOMStringList*, values, V8DOMStringList::hasInstance(info[0] , info.GetIsolate(), worldType(info.GetIsolate())) ? V8DOMStringList::toNative(v 8::Handle<v8::Object>::Cast(info[0])) : 0); 4167 V8TRYCATCH_VOID(DOMStringList*, values, V8DOMStringList::hasInstance(info[0] , info.GetIsolate(), worldType(info.GetIsolate())) ? V8DOMStringList::toNative(v 8::Handle<v8::Object>::Cast(info[0])) : 0);
4168 RefPtr<DOMStringList> result = imp->domStringListFunction(values, exceptionS tate); 4168 RefPtr<DOMStringList> result = imp->domStringListFunction(values, exceptionS tate);
4169 if (exceptionState.throwIfNeeded()) 4169 if (exceptionState.throwIfNeeded())
4170 return; 4170 return;
4171 v8SetReturnValue(info, result.release()); 4171 v8SetReturnValue(info, result.release());
4172 } 4172 }
4173 4173
4174 static void domStringListFunctionMethodCallback(const v8::FunctionCallbackInfo<v 8::Value>& info) 4174 static void domStringListFunctionMethodCallback(const v8::FunctionCallbackInfo<v 8::Value>& info)
4175 { 4175 {
4176 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4176 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4177 TestObjV8Internal::domStringListFunctionMethod(info); 4177 TestObjV8Internal::domStringListFunctionMethod(info);
4178 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4178 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4179 } 4179 }
4180 4180
4181 static void getSVGDocumentMethod(const v8::FunctionCallbackInfo<v8::Value>& info ) 4181 static void getSVGDocumentMethod(const v8::FunctionCallbackInfo<v8::Value>& info )
4182 { 4182 {
4183 TestObj* imp = V8TestObject::toNative(info.Holder()); 4183 TestObj* imp = V8TestObject::toNative(info.Holder());
4184 ExceptionState exceptionState(info.GetIsolate()); 4184 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
4185 if (!BindingSecurity::shouldAllowAccessToNode(imp->getSVGDocument(exceptionS tate), exceptionState)) { 4185 if (!BindingSecurity::shouldAllowAccessToNode(imp->getSVGDocument(exceptionS tate), exceptionState)) {
4186 v8SetReturnValueNull(info); 4186 v8SetReturnValueNull(info);
4187 exceptionState.throwIfNeeded(); 4187 exceptionState.throwIfNeeded();
4188 return; 4188 return;
4189 } 4189 }
4190 RefPtr<SVGDocument> result = imp->getSVGDocument(exceptionState); 4190 RefPtr<SVGDocument> result = imp->getSVGDocument(exceptionState);
4191 if (exceptionState.throwIfNeeded()) 4191 if (exceptionState.throwIfNeeded())
4192 return; 4192 return;
4193 v8SetReturnValue(info, result.release()); 4193 v8SetReturnValue(info, result.release());
4194 } 4194 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
4285 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4285 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4286 } 4286 }
4287 4287
4288 static void strictSVGPointMethodMethod(const v8::FunctionCallbackInfo<v8::Value> & info) 4288 static void strictSVGPointMethodMethod(const v8::FunctionCallbackInfo<v8::Value> & info)
4289 { 4289 {
4290 if (UNLIKELY(info.Length() < 2)) { 4290 if (UNLIKELY(info.Length() < 2)) {
4291 throwTypeError(ExceptionMessages::failedToExecute("strictSVGPointMethod" , "TestObject", ExceptionMessages::notEnoughArguments(2, info.Length())), info.G etIsolate()); 4291 throwTypeError(ExceptionMessages::failedToExecute("strictSVGPointMethod" , "TestObject", ExceptionMessages::notEnoughArguments(2, info.Length())), info.G etIsolate());
4292 return; 4292 return;
4293 } 4293 }
4294 TestObj* imp = V8TestObject::toNative(info.Holder()); 4294 TestObj* imp = V8TestObject::toNative(info.Holder());
4295 ExceptionState exceptionState(info.GetIsolate()); 4295 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
4296 if (info.Length() > 0 && !isUndefinedOrNull(info[0]) && !V8SVGPoint::hasInst ance(info[0], info.GetIsolate(), worldType(info.GetIsolate()))) { 4296 if (info.Length() > 0 && !isUndefinedOrNull(info[0]) && !V8SVGPoint::hasInst ance(info[0], info.GetIsolate(), worldType(info.GetIsolate()))) {
4297 throwTypeError(ExceptionMessages::failedToExecute("strictSVGPointMethod" , "TestObject", "parameter 1 is not of type 'SVGPoint'."), info.GetIsolate()); 4297 throwTypeError(ExceptionMessages::failedToExecute("strictSVGPointMethod" , "TestObject", "parameter 1 is not of type 'SVGPoint'."), info.GetIsolate());
4298 return; 4298 return;
4299 } 4299 }
4300 V8TRYCATCH_VOID(RefPtr<SVGPropertyTearOff<SVGPoint> >, item, V8SVGPoint::has Instance(info[0], info.GetIsolate(), worldType(info.GetIsolate())) ? V8SVGPoint: :toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0); 4300 V8TRYCATCH_VOID(RefPtr<SVGPropertyTearOff<SVGPoint> >, item, V8SVGPoint::has Instance(info[0], info.GetIsolate(), worldType(info.GetIsolate())) ? V8SVGPoint: :toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0);
4301 V8TRYCATCH_VOID(unsigned, index, toUInt32(info[1])); 4301 V8TRYCATCH_VOID(unsigned, index, toUInt32(info[1]));
4302 if (!item) { 4302 if (!item) {
4303 throwUninformativeAndGenericTypeError(info.GetIsolate()); 4303 throwUninformativeAndGenericTypeError(info.GetIsolate());
4304 return; 4304 return;
4305 } 4305 }
(...skipping 23 matching lines...) Expand all
4329 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4329 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4330 } 4330 }
4331 4331
4332 static void strictFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& info ) 4332 static void strictFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& info )
4333 { 4333 {
4334 if (UNLIKELY(info.Length() < 3)) { 4334 if (UNLIKELY(info.Length() < 3)) {
4335 throwTypeError(ExceptionMessages::failedToExecute("strictFunction", "Tes tObject", ExceptionMessages::notEnoughArguments(3, info.Length())), info.GetIsol ate()); 4335 throwTypeError(ExceptionMessages::failedToExecute("strictFunction", "Tes tObject", ExceptionMessages::notEnoughArguments(3, info.Length())), info.GetIsol ate());
4336 return; 4336 return;
4337 } 4337 }
4338 TestObj* imp = V8TestObject::toNative(info.Holder()); 4338 TestObj* imp = V8TestObject::toNative(info.Holder());
4339 ExceptionState exceptionState(info.GetIsolate()); 4339 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
4340 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str, info[0]); 4340 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str, info[0]);
4341 V8TRYCATCH_VOID(float, a, static_cast<float>(info[1]->NumberValue())); 4341 V8TRYCATCH_VOID(float, a, static_cast<float>(info[1]->NumberValue()));
4342 V8TRYCATCH_VOID(int, b, toInt32(info[2])); 4342 V8TRYCATCH_VOID(int, b, toInt32(info[2]));
4343 bool result = imp->strictFunction(str, a, b, exceptionState); 4343 bool result = imp->strictFunction(str, a, b, exceptionState);
4344 if (exceptionState.throwIfNeeded()) 4344 if (exceptionState.throwIfNeeded())
4345 return; 4345 return;
4346 v8SetReturnValueBool(info, result); 4346 v8SetReturnValueBool(info, result);
4347 } 4347 }
4348 4348
4349 static void strictFunctionMethodCallback(const v8::FunctionCallbackInfo<v8::Valu e>& info) 4349 static void strictFunctionMethodCallback(const v8::FunctionCallbackInfo<v8::Valu e>& info)
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
4863 4863
4864 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info) 4864 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info)
4865 { 4865 {
4866 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 4866 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
4867 TestObjV8Internal::namedPropertyGetter(name, info); 4867 TestObjV8Internal::namedPropertyGetter(name, info);
4868 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4868 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4869 } 4869 }
4870 4870
4871 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo) 4871 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo)
4872 { 4872 {
4873 ExceptionState exceptionState(info.GetIsolate()); 4873 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
4874 TestObj* collection = V8TestObject::toNative(info.Holder()); 4874 TestObj* collection = V8TestObject::toNative(info.Holder());
4875 Vector<String> names; 4875 Vector<String> names;
4876 collection->namedPropertyEnumerator(names, exceptionState); 4876 collection->namedPropertyEnumerator(names, exceptionState);
4877 if (exceptionState.throwIfNeeded()) 4877 if (exceptionState.throwIfNeeded())
4878 return; 4878 return;
4879 v8::Handle<v8::Array> v8names = v8::Array::New(names.size()); 4879 v8::Handle<v8::Array> v8names = v8::Array::New(names.size());
4880 for (size_t i = 0; i < names.size(); ++i) 4880 for (size_t i = 0; i < names.size(); ++i)
4881 v8names->Set(v8::Integer::New(i, info.GetIsolate()), v8String(names[i], info.GetIsolate())); 4881 v8names->Set(v8::Integer::New(i, info.GetIsolate()), v8String(names[i], info.GetIsolate()));
4882 v8SetReturnValue(info, v8names); 4882 v8SetReturnValue(info, v8names);
4883 } 4883 }
4884 4884
4885 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info) 4885 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info)
4886 { 4886 {
4887 TestObj* collection = V8TestObject::toNative(info.Holder()); 4887 TestObj* collection = V8TestObject::toNative(info.Holder());
4888 AtomicString propertyName = toWebCoreAtomicString(name); 4888 AtomicString propertyName = toWebCoreAtomicString(name);
4889 ExceptionState exceptionState(info.GetIsolate()); 4889 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
4890 bool result = collection->namedPropertyQuery(propertyName, exceptionState); 4890 bool result = collection->namedPropertyQuery(propertyName, exceptionState);
4891 if (exceptionState.throwIfNeeded()) 4891 if (exceptionState.throwIfNeeded())
4892 return; 4892 return;
4893 if (!result) 4893 if (!result)
4894 return; 4894 return;
4895 v8SetReturnValueInt(info, v8::None); 4895 v8SetReturnValueInt(info, v8::None);
4896 } 4896 }
4897 4897
4898 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info) 4898 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info)
4899 { 4899 {
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
5279 V8DOMWrapper::associateObjectWithWrapper<V8TestObject>(impl, &wrapperTypeInf o, wrapper, isolate, WrapperConfiguration::Independent); 5279 V8DOMWrapper::associateObjectWithWrapper<V8TestObject>(impl, &wrapperTypeInf o, wrapper, isolate, WrapperConfiguration::Independent);
5280 return wrapper; 5280 return wrapper;
5281 } 5281 }
5282 5282
5283 void V8TestObject::derefObject(void* object) 5283 void V8TestObject::derefObject(void* object)
5284 { 5284 {
5285 fromInternalPointer(object)->deref(); 5285 fromInternalPointer(object)->deref();
5286 } 5286 }
5287 5287
5288 } // namespace WebCore 5288 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestNode.cpp ('k') | Source/bindings/tests/results/V8TestObjectPython.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698