Bug 828280 - (packaged) App won't install without `developer` field in its manifest. r=fabrice,a=release-drivers
authorAlexandre Poirot <poirot.alex@gmail.com>
Fri, 11 Jan 2013 06:47:00 +0100
changeset 118144 dc4f5e104c4e7c0e619a2abe377c584c87fefd72
parent 118143 77579969377c994a7e8cb261827b3844bd44ca89
child 118145 b7102f307ea0c6d25ca7638c128aaf3fd93ced2e
push id237
push userhfiguiere@mozilla.com
push dateFri, 11 Jan 2013 15:32:06 +0000
reviewersfabrice, release-drivers
bugs828280
milestone18.0
Bug 828280 - (packaged) App won't install without `developer` field in its manifest. r=fabrice,a=release-drivers
dom/apps/src/AppsUtils.jsm
dom/apps/src/Webapps.jsm
--- a/dom/apps/src/AppsUtils.jsm
+++ b/dom/apps/src/AppsUtils.jsm
@@ -370,17 +370,18 @@ this.AppsUtils = {
       }
 
       let dev1 = aRoot1.developer;
       let dev2 = aRoot2.developer;
       if ((dev1 && !dev2) || (dev2 && !dev1)) {
         return false;
       }
 
-      return (dev1.name === dev2.name && dev1.url === dev2.url);
+      return (!dev1 && !dev2) ||
+             (dev1.name === dev2.name && dev1.url === dev2.url);
     }
 
     // 2. For each locale, check if the name and dev info are the same.
     if (!checkNameAndDev(aManifest1, aManifest2)) {
       return false;
     }
 
     for (let locale in aManifest1.locales) {
@@ -436,17 +437,19 @@ ManifestHelper.prototype = {
     return this._localeProp("version");
   },
 
   get launch_path() {
     return this._localeProp("launch_path");
   },
 
   get developer() {
-    return this._localeProp("developer");
+    // Default to {} in order to avoid exception in code
+    // that doesn't check for null `developer`
+    return this._localeProp("developer") || {};
   },
 
   get icons() {
     return this._localeProp("icons");
   },
 
   get appcache_path() {
     return this._localeProp("appcache_path");
--- a/dom/apps/src/Webapps.jsm
+++ b/dom/apps/src/Webapps.jsm
@@ -2053,17 +2053,17 @@ this.DOMApplicationRegistry = {
               }
 
               if (aOnSuccess) {
                 aOnSuccess(id, manifest);
               }
             } catch (e) {
               // Something bad happened when reading the package.
               if (typeof e == 'object') {
-                debug(e);
+                Cu.reportError("Error while reading package:" + e);
                 cleanup("INVALID_PACKAGE");
               } else {
                 cleanup(e);
               }
             } finally {
               AppDownloadManager.remove(aApp.manifestURL);
               if (zipReader)
                 zipReader.close();