| Index: mojo/dart/embedder/dart_controller.cc
|
| diff --git a/mojo/dart/embedder/dart_controller.cc b/mojo/dart/embedder/dart_controller.cc
|
| index 7ab36a006f809ddd0fc42da6d3acc5c5df8e8c30..93f704ff825ba580e90412167fd0a07c983d328c 100644
|
| --- a/mojo/dart/embedder/dart_controller.cc
|
| +++ b/mojo/dart/embedder/dart_controller.cc
|
| @@ -423,17 +423,10 @@ bool DartController::RunDartScript(const DartControllerConfig& config) {
|
| Dart_Handle result;
|
| Dart_EnterScope();
|
|
|
| - Dart_Handle root_lib = Dart_RootLibrary();
|
| - DART_CHECK_VALID(root_lib);
|
| -
|
| - Dart_Handle builtin_lib =
|
| - Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
|
| - DART_CHECK_VALID(builtin_lib);
|
| + // Start the MojoHandleWatcher.
|
| Dart_Handle mojo_core_lib =
|
| Builtin::LoadAndCheckLibrary(Builtin::kMojoCoreLibrary);
|
| DART_CHECK_VALID(mojo_core_lib);
|
| -
|
| - // Start the MojoHandleWatcher.
|
| Dart_Handle handle_watcher_type = Dart_GetType(
|
| mojo_core_lib,
|
| Dart_NewStringFromCString("MojoHandleWatcher"),
|
| @@ -451,6 +444,12 @@ bool DartController::RunDartScript(const DartControllerConfig& config) {
|
| result = Dart_RunLoop();
|
| DART_CHECK_VALID(result);
|
|
|
| + // Load the root library into the builtin library so that main can be found.
|
| + Dart_Handle builtin_lib =
|
| + Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
|
| + DART_CHECK_VALID(builtin_lib);
|
| + Dart_Handle root_lib = Dart_RootLibrary();
|
| + DART_CHECK_VALID(root_lib);
|
| result = Dart_LibraryImportLibrary(builtin_lib, root_lib, Dart_Null());
|
| DART_CHECK_VALID(result);
|
|
|
| @@ -471,9 +470,14 @@ bool DartController::RunDartScript(const DartControllerConfig& config) {
|
| const intptr_t kNumIsolateArgs = 2;
|
| Dart_Handle isolate_args[kNumIsolateArgs];
|
| isolate_args[0] = main_closure; // entryPoint
|
| - isolate_args[1] = Dart_NewList(1); // args
|
| + isolate_args[1] = Dart_NewList(2); // args
|
| DART_CHECK_VALID(isolate_args[1]);
|
| +
|
| + Dart_Handle script_uri = Dart_NewStringFromUTF8(
|
| + reinterpret_cast<const uint8_t*>(config.script_uri.data()),
|
| + config.script_uri.length());
|
| Dart_ListSetAt(isolate_args[1], 0, Dart_NewInteger(config.handle));
|
| + Dart_ListSetAt(isolate_args[1], 1, script_uri);
|
|
|
| Dart_Handle isolate_lib =
|
| Dart_LookupLibrary(Dart_NewStringFromCString(kIsolateLibURL));
|
|
|