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

Unified Diff: runtime/lib/isolate.cc

Issue 13351002: First step for fixing Issue 9416. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/isolate.cc
===================================================================
--- runtime/lib/isolate.cc (revision 20756)
+++ runtime/lib/isolate.cc (working copy)
@@ -171,32 +171,34 @@
char** canonical_uri,
char** error) {
Zone* zone = isolate->current_zone();
+ bool retval = false;
Dart_LibraryTagHandler handler = isolate->library_tag_handler();
- if (handler == NULL) {
+ if (handler != NULL) {
+ Dart_EnterScope();
+ Dart_Handle result = handler(kCanonicalizeUrl,
+ Api::NewHandle(isolate, library.raw()),
+ Api::NewHandle(isolate, uri.raw()));
+ const Object& obj = Object::Handle(Api::UnwrapHandle(result));
+ if (obj.IsString()) {
+ *canonical_uri = zone->MakeCopyOfString(String::Cast(obj).ToCString());
+ retval = true;
+ } else if (obj.IsError()) {
+ Error& error_obj = Error::Handle();
+ error_obj ^= obj.raw();
+ *error = zone->PrintToString("Unable to canonicalize uri '%s': %s",
+ uri.ToCString(), error_obj.ToErrorCString());
+ } else {
+ *error = zone->PrintToString("Unable to canonicalize uri '%s': "
+ "library tag handler returned wrong type",
+ uri.ToCString());
+ }
+ Dart_ExitScope();
+ } else {
*error = zone->PrintToString(
"Unable to canonicalize uri '%s': no library tag handler found.",
uri.ToCString());
- return false;
}
- Dart_Handle result = handler(kCanonicalizeUrl,
- Api::NewHandle(isolate, library.raw()),
- Api::NewHandle(isolate, uri.raw()));
- const Object& obj = Object::Handle(Api::UnwrapHandle(result));
- if (obj.IsError()) {
- Error& error_obj = Error::Handle();
- error_obj ^= obj.raw();
- *error = zone->PrintToString("Unable to canonicalize uri '%s': %s",
- uri.ToCString(), error_obj.ToErrorCString());
- return false;
- } else if (obj.IsString()) {
- *canonical_uri = zone->MakeCopyOfString(String::Cast(obj).ToCString());
- return true;
- } else {
- *error = zone->PrintToString("Unable to canonicalize uri '%s': "
- "library tag handler returned wrong type",
- uri.ToCString());
- return false;
- }
+ return retval;
}
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698