Index: runtime/lib/isolate.cc |
diff --git a/runtime/lib/isolate.cc b/runtime/lib/isolate.cc |
index 7219bda38b16d78209b6de077e7da862ef5cc014..3bb05c39c41f455c29fee41a908089792657e005 100644 |
--- a/runtime/lib/isolate.cc |
+++ b/runtime/lib/isolate.cc |
@@ -91,8 +91,7 @@ static void ShutdownIsolate(uword parameter) { |
Error& error = Error::Handle(); |
error = isolate->object_store()->sticky_error(); |
if (!error.IsNull()) { |
- OS::PrintErr("%s\n", error.ToErrorCString()); |
- exit(255); |
+ OS::PrintErr("in ShutdownIsolate: %s\n", error.ToErrorCString()); |
} |
} |
{ |
@@ -388,6 +387,14 @@ static RawObject* Spawn(NativeArguments* arguments, SpawnState* state) { |
Exceptions::PropagateError(Error::Cast(port)); |
} |
+ // If specified, set the new isolate's uncaught exception handler. |
+ ASSERT(arguments->NativeArgCount() == 2); |
+ const Object& arg = Object::Handle(arguments->NativeArgAt(1)); |
+ if (!arg.IsNull()) { |
+ const Instance& callback = Instance::Cast(arg); |
+ state->isolate()->object_store()->set_unhandled_exception_closure(callback); |
+ } |
+ |
// Start the new isolate. |
state->isolate()->set_spawn_data(reinterpret_cast<uword>(state)); |
state->isolate()->message_handler()->Run( |
@@ -398,7 +405,7 @@ static RawObject* Spawn(NativeArguments* arguments, SpawnState* state) { |
} |
-DEFINE_NATIVE_ENTRY(isolate_spawnFunction, 1) { |
+DEFINE_NATIVE_ENTRY(isolate_spawnFunction, 2) { |
GET_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(0)); |
bool throw_exception = false; |
Function& func = Function::Handle(); |
@@ -427,7 +434,7 @@ DEFINE_NATIVE_ENTRY(isolate_spawnFunction, 1) { |
} |
-DEFINE_NATIVE_ENTRY(isolate_spawnUri, 1) { |
+DEFINE_NATIVE_ENTRY(isolate_spawnUri, 2) { |
GET_NATIVE_ARGUMENT(String, uri, arguments->NativeArgAt(0)); |
// Canonicalize the uri with respect to the current isolate. |