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

Side by Side Diff: Source/bindings/core/dart/DartJsInterop.cpp

Issue 1677783002: Fix multiscript tests. Code merged for 45 was accidentally crashing the render process when V8 thre… (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/2454_1
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 971
972 Vector<v8::Local<v8::Value> > v8Args; 972 Vector<v8::Local<v8::Value> > v8Args;
973 argsListToV8(domData, Dart_GetNativeArgument(args, 2), &v8Args, exceptio n); 973 argsListToV8(domData, Dart_GetNativeArgument(args, 2), &v8Args, exceptio n);
974 if (exception) 974 if (exception)
975 goto fail; 975 goto fail;
976 if (!Dart_IsString(name)) 976 if (!Dart_IsString(name))
977 name = Dart_ToString(name); 977 name = Dart_ToString(name);
978 978
979 v8::Local<v8::Value> value = v8Receiver->Get(V8Converter::stringToV8(nam e)); 979 v8::Local<v8::Value> value = v8Receiver->Get(V8Converter::stringToV8(nam e));
980 v8::Local<v8::Value> ret; 980 v8::Local<v8::Value> ret;
981
981 if (value->IsFunction()) { 982 if (value->IsFunction()) {
982 ret = V8ScriptRunner::callFunction(value.As<v8::Function>(), DartUti lities::scriptExecutionContext(), receiver->localV8Object(), v8Args.size(), v8Ar gs.data(), v8::Isolate::GetCurrent()).ToLocalChecked(); 983
984 v8::Local<v8::Value> result;
985 if (!V8ScriptRunner::callFunction(value.As<v8::Function>(),
986 DartUtilities::scriptExecutionContext(), receiver->localV8Object (), v8Args.size(), v8Args.data(), v8::Isolate::GetCurrent()).ToLocal(&ret)) {
987 exception = Dart_NewStringFromCString("V8 Exception");
988 goto fail;
989 }
983 } else { 990 } else {
984 // FIXME: we currently convert this exception to a NoSuchMethod 991 // FIXME: we currently convert this exception to a NoSuchMethod
985 // exception in the Dart code that wraps this native method. 992 // exception in the Dart code that wraps this native method.
986 // Consider throwing a NoSuchMethod exception directly instead. 993 // Consider throwing a NoSuchMethod exception directly instead.
987 exception = Dart_NewStringFromCString("property is not a function"); 994 exception = Dart_NewStringFromCString("property is not a function");
988 goto fail; 995 goto fail;
989 } 996 }
990 997
991 if (scopes.handleJsException(&exception)) 998 if (scopes.handleJsException(&exception))
992 goto fail; 999 goto fail;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 } else { 1113 } else {
1107 thisArg = JsInterop::fromDart(domData, thisArgDart, exception); 1114 thisArg = JsInterop::fromDart(domData, thisArgDart, exception);
1108 if (exception) 1115 if (exception)
1109 goto fail; 1116 goto fail;
1110 if (!thisArg->IsObject()) { 1117 if (!thisArg->IsObject()) {
1111 exception = Dart_NewStringFromCString("thisArg is not an object" ); 1118 exception = Dart_NewStringFromCString("thisArg is not an object" );
1112 goto fail; 1119 goto fail;
1113 } 1120 }
1114 } 1121 }
1115 1122
1116 v8::Local<v8::Value> ret = V8ScriptRunner::callFunction(receiver->localV 8Function(), 1123 v8::Local<v8::Value> ret;
1117 DartUtilities::scriptExecutionContext(), 1124 if (!V8ScriptRunner::callFunction(receiver->localV8Function(),
1118 thisArg.As<v8::Object>(), 1125 DartUtilities::scriptExecutionContext(),
1119 v8Args.size(), 1126 thisArg.As<v8::Object>(),
1120 v8Args.data(), 1127 v8Args.size(),
1121 v8::Isolate::GetCurrent()).ToLocalChecked(); 1128 v8Args.data(),
1129 v8::Isolate::GetCurrent()).ToLocal(&ret)) {
1130 exception = Dart_NewStringFromCString("V8 Exception");
1131 goto fail;
1132 }
1122 if (scopes.handleJsException(&exception)) 1133 if (scopes.handleJsException(&exception))
1123 goto fail; 1134 goto fail;
1124 scopes.setReturnValue(ret); 1135 scopes.setReturnValue(ret);
1125 return; 1136 return;
1126 } 1137 }
1127 1138
1128 fail: 1139 fail:
1129 Dart_ThrowException(exception); 1140 Dart_ThrowException(exception);
1130 ASSERT_NOT_REACHED(); 1141 ASSERT_NOT_REACHED();
1131 } 1142 }
(...skipping 19 matching lines...) Expand all
1151 } else { 1162 } else {
1152 thisArg = JsInterop::fromDart(domData, thisArgDart, exception); 1163 thisArg = JsInterop::fromDart(domData, thisArgDart, exception);
1153 if (exception) 1164 if (exception)
1154 goto fail; 1165 goto fail;
1155 if (!thisArg->IsObject()) { 1166 if (!thisArg->IsObject()) {
1156 exception = Dart_NewStringFromCString("thisArg is not an object" ); 1167 exception = Dart_NewStringFromCString("thisArg is not an object" );
1157 goto fail; 1168 goto fail;
1158 } 1169 }
1159 } 1170 }
1160 1171
1161 v8::Local<v8::Value> ret = V8ScriptRunner::callFunction(receiver->localV 8Function(), 1172 v8::Local<v8::Value> ret;
1162 DartUtilities::scriptExecutionContext(), 1173 if (!V8ScriptRunner::callFunction(receiver->localV8Function(),
1163 thisArg.As<v8::Object>(), 1174 DartUtilities::scriptExecutionContext(),
1164 v8Args.size(), 1175 thisArg.As<v8::Object>(),
1165 v8Args.data(), 1176 v8Args.size(),
1166 v8::Isolate::GetCurrent()).ToLocalChecked(); 1177 v8Args.data(),
1178 v8::Isolate::GetCurrent()).ToLocal(&ret)) {
1179 exception = Dart_NewStringFromCString("V8 Exception");
1180 goto fail;
1181 }
1167 if (scopes.handleJsException(&exception)) 1182 if (scopes.handleJsException(&exception))
1168 goto fail; 1183 goto fail;
1169 scopes.setReturnValue(ret); 1184 scopes.setReturnValue(ret);
1170 return; 1185 return;
1171 } 1186 }
1172 1187
1173 fail: 1188 fail:
1174 Dart_ThrowException(exception); 1189 Dart_ThrowException(exception);
1175 ASSERT_NOT_REACHED(); 1190 ASSERT_NOT_REACHED();
1176 } 1191 }
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 { 1819 {
1805 JsInteropInternal::callMethodCallback(args); 1820 JsInteropInternal::callMethodCallback(args);
1806 } 1821 }
1807 1822
1808 void JsInterop::jsInteropContextCallback(Dart_NativeArguments args) 1823 void JsInterop::jsInteropContextCallback(Dart_NativeArguments args)
1809 { 1824 {
1810 return JsInteropInternal::contextCallback(args); 1825 return JsInteropInternal::contextCallback(args);
1811 } 1826 }
1812 1827
1813 } 1828 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698