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

Unified Diff: runtime/bin/gen_snapshot.cc

Issue 2031103002: Fix canonicalization of --url_mapping URIs in gen_snapshot (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « runtime/bin/dartutils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/gen_snapshot.cc
diff --git a/runtime/bin/gen_snapshot.cc b/runtime/bin/gen_snapshot.cc
index dfc2aa0817f9ee47346d4c23ee25a8e8f507c10a..3cea08e8654fe9303a4b545022aee105225b9965 100644
--- a/runtime/bin/gen_snapshot.cc
+++ b/runtime/bin/gen_snapshot.cc
@@ -443,6 +443,32 @@ static Dart_Handle FilePathFromUri(const char* script_uri) {
}
+static Dart_Handle ResolveUri(const char* library_uri, const char* uri) {
+ bool failed = false;
+ char* result_string = NULL;
+
+ {
+ UriResolverIsolateScope scope;
+
+ // Run DartUtils::ResolveUri in context of uri resolver isolate.
+ Dart_Handle result = DartUtils::ResolveUri(
+ DartUtils::NewString(library_uri), DartUtils::NewString(uri));
+ if (Dart_IsError(result)) {
+ failed = true;
+ result_string = strdup(Dart_GetError(result));
+ } else {
+ result_string = strdup(DartUtils::GetStringValue(result));
+ }
+ }
+
+ Dart_Handle result = failed ? Dart_NewApiError(result_string) :
+ DartUtils::NewString(result_string);
+ free(result_string);
+ return result;
+}
+
+
+
static Builtin::BuiltinLibraryId BuiltinId(const char* url) {
if (DartUtils::IsDartBuiltinLibURL(url)) {
return Builtin::kBuiltinLibrary;
@@ -488,7 +514,7 @@ static Dart_Handle CreateSnapshotLibraryTagHandler(Dart_LibraryTag tag,
if (libraryBuiltinId != Builtin::kInvalidLibrary) {
return url;
}
- return Dart_DefaultCanonicalizeUrl(library, url);
+ return ResolveUri(library_url_string, url_string);
}
Builtin::BuiltinLibraryId builtinId = BuiltinId(url_string);
« no previous file with comments | « runtime/bin/dartutils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698