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

Unified Diff: sdk/lib/_internal/js_runtime/lib/isolate_patch.dart

Issue 2414173003: Check for the type of the the spawned function. (Closed)
Patch Set: Rename typedefs. Created 4 years, 2 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 | « runtime/lib/isolate_patch.dart ('k') | tests/co19/co19-dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « runtime/lib/isolate_patch.dart ('k') | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698