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

Unified Diff: runtime/bin/loader.cc

Issue 2045023003: Fix deferred load errors / bug #26482 (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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: runtime/bin/loader.cc
diff --git a/runtime/bin/loader.cc b/runtime/bin/loader.cc
index f43cf30056225291aa737c67d9a5b46e6d4d8145..c4e472b1cd7a2147e5075452497fd6da3d6e89e6 100644
--- a/runtime/bin/loader.cc
+++ b/runtime/bin/loader.cc
@@ -213,17 +213,6 @@ void Loader::BlockUntilComplete() {
bool Loader::ProcessResultLocked(Loader::IOResult* result) {
- // A negative result tag indicates a loading error occurred in the service
- // isolate. The payload is a C string of the error message.
- if (result->tag < 0) {
- error_ =
- Dart_NewUnhandledExceptionError(
- Dart_NewStringFromUTF8(result->payload,
- result->payload_length));
-
- return false;
- }
-
// We have to copy everything we care about out of |result| because after
// dropping the lock below |result| may no longer valid.
Dart_Handle uri =
@@ -233,6 +222,29 @@ bool Loader::ProcessResultLocked(Loader::IOResult* result) {
library_uri =
Dart_NewStringFromCString(reinterpret_cast<char*>(result->library_uri));
}
+
+ // A negative result tag indicates a loading error occurred in the service
+ // isolate. The payload is a C string of the error message.
+ if (result->tag < 0) {
+ Dart_Handle library = Dart_LookupLibrary(uri);
+ Dart_Handle error = Dart_NewStringFromUTF8(result->payload,
+ result->payload_length);
+ // If a library with the given uri exists, give it a chance to handle
+ // the error. If the load requests stems from a deferred library load,
+ // an IO error is not fatal.
+ if ((library != Dart_Null()) && !Dart_IsError(library)) {
hausner 2016/06/07 21:47:05 Is there a difference between x != Dart_Null() and
Cutch 2016/06/07 22:29:26 No difference, but I switched to Dart_IsNull().
+ ASSERT(Dart_IsLibrary(library));
+ Dart_Handle res = Dart_LibraryHandleError(library, error);
+ if (Dart_IsNull(res)) {
+ return true;
+ }
+ }
+ // Fall through
+ error_ = Dart_NewUnhandledExceptionError(error);
+ return false;
+ }
+
+
// Check for payload and load accordingly.
bool is_snapshot = false;
const uint8_t* payload = result->payload;
« no previous file with comments | « runtime/bin/loader.h ('k') | runtime/lib/lib_prefix.dart » ('j') | runtime/lib/lib_prefix.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698