Index: runtime/bin/main.cc |
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc |
index 7337d57969328a763215d111e542b3c9b70ede37..4037874fec6826d772dda68c8cd320f5954a0112 100644 |
--- a/runtime/bin/main.cc |
+++ b/runtime/bin/main.cc |
@@ -838,8 +838,20 @@ static Dart_Isolate IsolateSetupHelper(Dart_Isolate isolate, |
Dart_Handle result = Dart_SetLibraryTagHandler(Loader::LibraryTagHandler); |
CHECK_RESULT(result); |
+ // Prepare builtin and other core libraries for use to resolve URIs. |
+ // Set up various closures, e.g: printing, timers etc. |
+ // Set up 'package root' for URI resolution. |
+ result = DartUtils::PrepareForScriptLoading(false, trace_loading); |
+ CHECK_RESULT(result); |
+ |
if (kernel_program != NULL) { |
- Dart_Handle result = Dart_LoadKernel(kernel_program); |
+ Dart_Handle uri = Dart_NewStringFromCString(script_uri); |
+ CHECK_RESULT(uri); |
+ Dart_Handle resolved_script_uri = DartUtils::ResolveScript(uri); |
+ CHECK_RESULT(resolved_script_uri); |
+ result = |
+ Dart_LoadScript(uri, resolved_script_uri, |
+ reinterpret_cast<Dart_Handle>(kernel_program), 0, 0); |
CHECK_RESULT(result); |
} |
if (set_native_resolvers) { |
@@ -852,12 +864,6 @@ static Dart_Isolate IsolateSetupHelper(Dart_Isolate isolate, |
CHECK_RESULT(result); |
} |
- // Prepare builtin and other core libraries for use to resolve URIs. |
- // Set up various closures, e.g: printing, timers etc. |
- // Set up 'package root' for URI resolution. |
- result = DartUtils::PrepareForScriptLoading(false, trace_loading); |
- CHECK_RESULT(result); |
- |
// Set up the load port provided by the service isolate so that we can |
// load scripts. |
result = DartUtils::SetupServiceLoadPort(); |