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

Unified Diff: bin/gen_snapshot.cc

Issue 9614006: - Proper URI resolution when loading scripts from the standalone binary. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 9 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
Index: bin/gen_snapshot.cc
===================================================================
--- bin/gen_snapshot.cc (revision 4985)
+++ bin/gen_snapshot.cc (working copy)
@@ -182,7 +182,8 @@
if (tag == kCanonicalizeUrl) {
return url;
}
- return Dart_Error("unsupported url encountered %s", url_string);
+ // TODO(iposva): Make sure only the known libraries are being added.
+ return Dart_True();
}
return Dart_Error("unexpected tag encountered %d", tag);
}
@@ -195,19 +196,9 @@
return source; // source contains the error string.
}
Dart_Handle lib;
- if (id == Builtin::kBuiltinLibrary) {
- // Load the dart:builtin library as the script.
- Dart_Handle url = Dart_NewString(DartUtils::kBuiltinLibURL);
- Dart_Handle import_map = Dart_NewList(0);
- lib = Dart_LoadScript(url,
- source,
- BuiltinLibraryTagHandler,
- import_map);
- } else {
- // Load the builtin library to make it available in the snapshot
- // for importing.
- lib = Builtin::LoadLibrary(id);
- }
+ // Load the builtin library to make it available in the snapshot
+ // for importing.
+ lib = Builtin::LoadLibrary(id);
if (!Dart_IsError(lib)) {
Builtin::SetupLibrary(lib, id);
}
@@ -281,6 +272,13 @@
library = LoadSnapshotCreationScript(app_script_name);
VerifyLoaded(library);
} else {
+ // Load a dummy script as the script to setup the tag handler.
+ Dart_Handle empty_string = Dart_NewString("");
+ Dart_Handle import_map = Dart_NewList(0);
siva 2012/03/07 18:32:17 import_map = Dart_Null();
Ivan Posva 2012/03/08 00:49:33 Done.
+ Dart_Handle lib = Dart_LoadScript(empty_string,
+ empty_string,
+ BuiltinLibraryTagHandler,
+ import_map);
// This is a generic dart snapshot which needs builtin library setup.
library = LoadGenericSnapshotCreationScript(Builtin::kBuiltinLibrary);
VerifyLoaded(library);

Powered by Google App Engine
This is Rietveld 408576698