Bug 1403348: Add better diagnostic crash reasons for URLPreloader failure. r?mccr8 data-r?rweiss draft
authorKris Maglione <maglione.k@gmail.com>
Sun, 29 Oct 2017 19:12:37 -0700
changeset 688387 445e7e465783bbd8dcfe4233e6c6557336c19357
parent 688384 f584176734b9390854147d5c1c6200f482557d41
child 738058 d15d600667040fe3c1ff6fe2f9c6b8df7411482a
push id86736
push usermaglione.k@gmail.com
push dateMon, 30 Oct 2017 02:13:00 +0000
reviewersmccr8
bugs1403348
milestone58.0a1
Bug 1403348: Add better diagnostic crash reasons for URLPreloader failure. r?mccr8 data-r?rweiss The crash reports for this section of code suggest that in some cases, we're ending up with a null Omnijar archive when trying to pre-load files. Since the pre-load file list is determined in the previous session, and the startup cache (where the pre-load list is stored) is cleared whenever the build ID changes, it should never be possible for the given omnijar archive to be missing here. These crashes also tend to appear in conjunction with crashes due to failures in the GetSharedGlobal function, and may have a similar cause. This change adds better diagnostic information to these crashes, and should at least tell us which omnijar archive we're failing to get, and the archive path that caused us to load that archive. It may not tell us much, but it may point to data corruption, or provide some other clues. MozReview-Commit-ID: EKq3r4eG5ii
js/xpconnect/loader/URLPreloader.cpp
--- a/js/xpconnect/loader/URLPreloader.cpp
+++ b/js/xpconnect/loader/URLPreloader.cpp
@@ -371,16 +371,21 @@ URLPreloader::BackgroundReadFiles()
         // the actual reading and decompression can safely be done off-thread,
         // as is the case for thread-retargeted jar: channels.
         for (auto entry : pendingURLs) {
             if (entry->mType == entry->TypeFile) {
                 continue;
             }
 
             RefPtr<nsZipArchive> zip = entry->Archive();
+            if (!zip) {
+                MOZ_CRASH_UNSAFE_PRINTF(
+                    "Failed to get Omnijar %s archive for entry (path: \"%s\")",
+                    entry->TypeString(), entry->mPath.get());
+            }
 
             auto item = zip->GetItem(entry->mPath.get());
             if (!item) {
                 entry->mResultCode = NS_ERROR_FILE_NOT_FOUND;
                 continue;
             }
 
             size_t size = item->RealSize();