Index: runtime/lib/isolate_patch.dart |
diff --git a/runtime/lib/isolate_patch.dart b/runtime/lib/isolate_patch.dart |
index 79c895a87a3206d1be92c84eb517672bc87e4568..c93c27dc30cde0525d42bb3853146868353cb1eb 100644 |
--- a/runtime/lib/isolate_patch.dart |
+++ b/runtime/lib/isolate_patch.dart |
@@ -300,7 +300,8 @@ patch class Isolate { |
static bool _packageSupported() => |
(VMLibraryHooks.packageRootUriFuture != null) && |
- (VMLibraryHooks.packageConfigUriFuture != null); |
+ (VMLibraryHooks.packageConfigUriFuture != null) && |
+ (VMLibraryHooks.resolvePackageUriFuture != null); |
/* patch */ static Future<Isolate> spawn( |
void entryPoint(message), var message, |
@@ -318,7 +319,14 @@ patch class Isolate { |
packageConfig = (await Isolate.packageConfig)?.toString(); |
} |
- _spawnFunction(readyPort.sendPort, entryPoint, message, |
+ var script = VMLibraryHooks.platformScript; |
+ if (script != null) { |
+ if (script.scheme == "package") { |
+ script = await Isolate.resolvePackageUri(script); |
+ } |
+ } |
+ |
+ _spawnFunction(readyPort.sendPort, script.toString(), entryPoint, message, |
paused, errorsAreFatal, onExit, onError, |
packageRoot, packageConfig); |
return await _spawnCommon(readyPort); |
@@ -365,7 +373,7 @@ patch class Isolate { |
} |
} |
try { |
- // Resolve the uri agains the current isolate's root Uri first. |
+ // Resolve the uri against the current isolate's root Uri first. |
var spawnedUri = _rootUri.resolveUri(uri); |
// Inherit this isolate's package resolution setup if not overridden. |
@@ -379,10 +387,19 @@ patch class Isolate { |
} |
// Ensure to resolve package: URIs being handed in as parameters. |
- packageRoot = (packageRoot == null) ? null : |
- await Isolate.resolvePackageUri(packageRoot); |
- packageConfig = (packageConfig == null) ? null : |
- await Isolate.resolvePackageUri(packageConfig); |
+ if (packageRoot != null) { |
+ // Avoid calling resolvePackageUri if not stricly necessary in case |
+ // the API is not supported. |
+ if (packageRoot.scheme == "package") { |
+ packageRoot = await Isolate.resolvePackageUri(packageRoot); |
+ } |
+ } else if (packageConfig != null) { |
+ // Avoid calling resolvePackageUri if not strictly necessary in case |
+ // the API is not supported. |
+ if (packageConfig.scheme == "package") { |
+ packageConfig = await Isolate.resolvePackageUri(packageConfig); |
+ } |
+ } |
// The VM will invoke [_startIsolate] and not `main`. |
readyPort = new RawReceivePort(); |
@@ -400,7 +417,7 @@ patch class Isolate { |
if (readyPort != null) { |
readyPort.close(); |
} |
- return await new Future<Isolate>.error(e, st); |
+ rethrow; |
} |
} |
@@ -442,7 +459,8 @@ patch class Isolate { |
static const _ERROR_FATAL = 9; |
- static void _spawnFunction(SendPort readyPort, Function topLevelFunction, |
+ static void _spawnFunction(SendPort readyPort, String uri, |
+ Function topLevelFunction, |
var message, bool paused, bool errorsAreFatal, |
SendPort onExit, SendPort onError, |
String packageRoot, String packageConfig) |