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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/dart/DartJsInterop.cpp
diff --git a/Source/bindings/core/dart/DartJsInterop.cpp b/Source/bindings/core/dart/DartJsInterop.cpp
index 4afe555d642e06a1da77065ccd5bf18c0dba5f38..80bda03720c1b086ea9c67221804044cc6ce17bd 100644
--- a/Source/bindings/core/dart/DartJsInterop.cpp
+++ b/Source/bindings/core/dart/DartJsInterop.cpp
@@ -978,8 +978,15 @@ static void callMethodCallback(Dart_NativeArguments args)
v8::Local<v8::Value> value = v8Receiver->Get(V8Converter::stringToV8(name));
v8::Local<v8::Value> ret;
+
if (value->IsFunction()) {
- ret = V8ScriptRunner::callFunction(value.As<v8::Function>(), DartUtilities::scriptExecutionContext(), receiver->localV8Object(), v8Args.size(), v8Args.data(), v8::Isolate::GetCurrent()).ToLocalChecked();
+
+ v8::Local<v8::Value> result;
+ if (!V8ScriptRunner::callFunction(value.As<v8::Function>(),
+ DartUtilities::scriptExecutionContext(), receiver->localV8Object(), v8Args.size(), v8Args.data(), v8::Isolate::GetCurrent()).ToLocal(&ret)) {
+ exception = Dart_NewStringFromCString("V8 Exception");
+ goto fail;
+ }
} else {
// FIXME: we currently convert this exception to a NoSuchMethod
// exception in the Dart code that wraps this native method.
@@ -1113,12 +1120,16 @@ static void applyCallback(Dart_NativeArguments args)
}
}
- v8::Local<v8::Value> ret = V8ScriptRunner::callFunction(receiver->localV8Function(),
- DartUtilities::scriptExecutionContext(),
- thisArg.As<v8::Object>(),
- v8Args.size(),
- v8Args.data(),
- v8::Isolate::GetCurrent()).ToLocalChecked();
+ v8::Local<v8::Value> ret;
+ if (!V8ScriptRunner::callFunction(receiver->localV8Function(),
+ DartUtilities::scriptExecutionContext(),
+ thisArg.As<v8::Object>(),
+ v8Args.size(),
+ v8Args.data(),
+ v8::Isolate::GetCurrent()).ToLocal(&ret)) {
+ exception = Dart_NewStringFromCString("V8 Exception");
+ goto fail;
+ }
if (scopes.handleJsException(&exception))
goto fail;
scopes.setReturnValue(ret);
@@ -1158,12 +1169,16 @@ static void applyDebuggerOnlyCallback(Dart_NativeArguments args)
}
}
- v8::Local<v8::Value> ret = V8ScriptRunner::callFunction(receiver->localV8Function(),
- DartUtilities::scriptExecutionContext(),
- thisArg.As<v8::Object>(),
- v8Args.size(),
- v8Args.data(),
- v8::Isolate::GetCurrent()).ToLocalChecked();
+ v8::Local<v8::Value> ret;
+ if (!V8ScriptRunner::callFunction(receiver->localV8Function(),
+ DartUtilities::scriptExecutionContext(),
+ thisArg.As<v8::Object>(),
+ v8Args.size(),
+ v8Args.data(),
+ v8::Isolate::GetCurrent()).ToLocal(&ret)) {
+ exception = Dart_NewStringFromCString("V8 Exception");
+ goto fail;
+ }
if (scopes.handleJsException(&exception))
goto fail;
scopes.setReturnValue(ret);
« 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