提交 a6ffc52b 编写于 作者: R Ryan Macnak

Ensure isolates have a root library so createMirrorSystem() and spawnUri() are happy.

https://github.com/domokit/mojo/issues/98

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1088263004
上级 11315b53
......@@ -204,6 +204,10 @@ static Dart_Isolate IsolateCreateCallback(const char* script_uri,
DartApiScope apiScope;
Builtin::SetNativeResolver(Builtin::kBuiltinLibrary);
Builtin::SetNativeResolver(Builtin::kMojoInternalLibrary);
// Ensure the isolate has a root library.
Dart_LoadScript(Dart_NewStringFromCString("dart:empty"),
Dart_NewStringFromCString(""), 0, 0);
}
Dart_ExitIsolate();
......@@ -273,6 +277,10 @@ void DartController::CreateIsolateFor(Document* document) {
{
DartApiScope apiScope;
// Ensure the isolate has a root library.
Dart_LoadScript(Dart_NewStringFromCString("dart:empty"),
Dart_NewStringFromCString(""), 0, 0);
Builtin::SetNativeResolver(Builtin::kBuiltinLibrary);
Builtin::SetNativeResolver(Builtin::kMojoInternalLibrary);
BuiltinNatives::Init();
......
<script>
import "dart:mirrors";
import "dart:sky.internals" as internals;
// Regression test for the embedder not setting up the root library.
// Used to crash.
void main() {
if (currentMirrorSystem().isolate.rootLibrary == null) {
throw "Missing root library";
}
internals.notifyTestComplete("PASS");
}
</script>>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册