Index: sdk/lib/_internal/js_runtime/lib/isolate_patch.dart |
diff --git a/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart b/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart |
index 79931ba3039fc1ecb99f22516e6c19d3cb74bccf..ed72e6c09fa64493de08b5803cab910249f3cedf 100644 |
--- a/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart |
+++ b/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart |
@@ -10,6 +10,8 @@ import 'dart:_isolate_helper' show CapabilityImpl, |
ReceivePortImpl, |
RawReceivePortImpl; |
+typedef _UnaryFunction(arg); |
+ |
@patch |
class Isolate { |
static final _currentIsolateCache = IsolateNatives.currentIsolate; |
@@ -42,6 +44,11 @@ class Isolate { |
(onExit != null) || |
(onError != null); |
try { |
+ // Check for the type of `entryPoint` on the spawning isolate to make |
+ // error-handling easier. |
+ if (entryPoint is! _UnaryFunction) { |
+ throw new ArgumentError(entryPoint); |
+ } |
// TODO: Consider passing the errorsAreFatal/onExit/onError values |
// as arguments to the internal spawnUri instead of setting |
// them after the isolate has been created. |