Bug 1544037 - Skip exists check when trying to open startupcache zip file archive. r=froydnj
authorMike Conley <mconley@mozilla.com>
Tue, 21 May 2019 17:32:45 +0000
changeset 474802 79a583fd7cd942da68e3944a88cde027ff959d33
parent 474801 1a44a048e2f0a93346f96b71b31845b89c55e98f
child 474803 9ee0f79d80d1a777869ec7dd2774694a0bef86f8
push id36046
push useraiakab@mozilla.com
push dateTue, 21 May 2019 21:45:52 +0000
treeherdermozilla-central@257f2c96cef5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1544037
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1544037 - Skip exists check when trying to open startupcache zip file archive. r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D31086
startupcache/StartupCache.cpp
--- a/startupcache/StartupCache.cpp
+++ b/startupcache/StartupCache.cpp
@@ -199,23 +199,23 @@ nsresult StartupCache::Init() {
 
 /**
  * LoadArchive can be called from the main thread or while reloading cache on
  * write thread.
  */
 nsresult StartupCache::LoadArchive() {
   if (gIgnoreDiskCache) return NS_ERROR_FAILURE;
 
-  bool exists;
-  mArchive = nullptr;
-  nsresult rv = mFile->Exists(&exists);
-  if (NS_FAILED(rv) || !exists) return NS_ERROR_FILE_NOT_FOUND;
+  mArchive = new nsZipArchive();
+  nsresult rv = mArchive->OpenArchive(mFile);
 
-  mArchive = new nsZipArchive();
-  rv = mArchive->OpenArchive(mFile);
+  if (NS_FAILED(rv)) {
+    mArchive = nullptr;
+  }
+
   return rv;
 }
 
 namespace {
 
 nsresult GetBufferFromZipArchive(nsZipArchive* zip, bool doCRC, const char* id,
                                  UniquePtr<char[]>* outbuf, uint32_t* length) {
   if (!zip) return NS_ERROR_NOT_AVAILABLE;