Bug 961468 - In _readManifests, read the manifests without checking file existence. r=fabrice
authorMarco Castelluccio <mar.castelluccio@studenti.unina.it>
Fri, 31 Jan 2014 13:14:17 -0500
changeset 166312 a2c030eb1c50e142fd1f3dcc664a19ef2607c4c3
parent 166311 ec4d78ce039fe8e33ead58ef5e53ce3309b3e1f1
child 166313 111d77c40e201dffbe483f35e569ac2f5cdec62d
push id26117
push userryanvm@gmail.com
push dateSat, 01 Feb 2014 01:57:30 +0000
treeherdermozilla-central@00b86eca0baf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs961468
milestone29.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 961468 - In _readManifests, read the manifests without checking file existence. r=fabrice
dom/apps/src/Webapps.jsm
--- a/dom/apps/src/Webapps.jsm
+++ b/dom/apps/src/Webapps.jsm
@@ -2582,39 +2582,33 @@ onInstallSuccessAck: function onInstallS
   /**
     * Asynchronously reads a list of manifests
     */
 
   _manifestCache: {},
 
   _readManifests: function(aData) {
     return Task.spawn(function*() {
-      if (!aData.length) {
-        return aData;
-      }
-
       for (let elem of aData) {
         let id = elem.id;
 
         if (!this._manifestCache[id]) {
           // the manifest file used to be named manifest.json, so fallback on this.
           let baseDir = this.webapps[id].basePath == this.getCoreAppsBasePath()
                           ? "coreAppsDir" : DIRECTORY_NAME;
 
-          let file = FileUtils.getFile(baseDir, ["webapps", id, "manifest.webapp"], true);
-
-          if (!file.exists()) {
-            file = FileUtils.getFile(baseDir, ["webapps", id, "update.webapp"], true);
+          let dir = FileUtils.getDir(baseDir, ["webapps", id], false, true);
+
+          let fileNames = ["manifest.webapp", "update.webapp", "manifest.json"];
+          for (let fileName of fileNames) {
+            this._manifestCache[id] = yield this._loadJSONAsync(OS.Path.join(dir.path, fileName));
+            if (this._manifestCache[id]) {
+              break;
+            }
           }
-
-          if (!file.exists()) {
-            file = FileUtils.getFile(baseDir, ["webapps", id, "manifest.json"], true);
-          }
-
-          this._manifestCache[id] = yield this._loadJSONAsync(file.path);
         }
 
         elem.manifest = this._manifestCache[id];
       }
 
       return aData;
     }.bind(this)).then(null, Cu.reportError);
   },