Bug 1460095 Always flush the jar cache after looking at an xpi file r=kmag
authorAndrew Swan <aswan@mozilla.com>
Wed, 09 May 2018 13:54:13 -0700
changeset 417632 7758499ad01f8a5775f90a66bc1b1adfb2776507
parent 417631 117b148d7a02e03f53e7bbbd5d3c32325678bae3
child 417633 b7832a2c2c296390c57c1261d805759530020b26
push id33974
push userncsoregi@mozilla.com
push dateThu, 10 May 2018 09:47:43 +0000
treeherdermozilla-central@b52b2eb81d1e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1460095
milestone62.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 1460095 Always flush the jar cache after looking at an xpi file r=kmag MozReview-Commit-ID: FHsbewyAnDm
toolkit/mozapps/extensions/internal/XPIInstall.jsm
--- a/toolkit/mozapps/extensions/internal/XPIInstall.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIInstall.jsm
@@ -341,26 +341,22 @@ DirPackage = class DirPackage extends Pa
   }
 };
 
 XPIPackage = class XPIPackage extends Package {
   constructor(file) {
     super(file, getJarURI(file));
 
     this.zipReader = new ZipReader(file);
-    this.needFlush = false;
   }
 
   close() {
     this.zipReader.close();
     this.zipReader = null;
-
-    if (this.needFlush) {
-      this.flushCache();
-    }
+    this.flushCache();
   }
 
   async hasResource(...path) {
     return this.zipReader.hasEntry(path.join("/"));
   }
 
   async iterFiles(callback) {
     for (let path of XPCOMUtils.IterStringEnumerator(this.zipReader.findEntries("*"))) {
@@ -369,17 +365,16 @@ XPIPackage = class XPIPackage extends Pa
         path,
         isDir: entry.isDirectory,
         size: entry.realSize,
       });
     }
   }
 
   async readBinary(...path) {
-    this.needFlush = true;
     let response = await fetch(this.rootURI.resolve(path.join("/")));
     return response.arrayBuffer();
   }
 
   verifySignedStateForRoot(addon, root) {
     return new Promise(resolve => {
       let callback = {
         openSignedAppFileFinished(aRv, aZipReader, aCert) {
@@ -396,17 +391,16 @@ XPIPackage = class XPIPackage extends Pa
       callback.wrappedJSObject = callback;
 
       gCertDB.openSignedAppFileAsync(root, this.file, callback);
     });
   }
 
   flushCache() {
     flushJarCache(this.file);
-    this.needFlush = false;
   }
 };
 
 /**
  * Determine the reason to pass to an extension's bootstrap methods when
  * switch between versions.
  *
  * @param {string} oldVersion The version of the existing extension instance.