Bug 863337 - [homescreen] If an icon is changed in an update, it's not updated before the next reboot. r=fabrice, r=ferjm, a=lsblakk
authorJulien Wajsberg <jwajsberg@mozilla.com>
Wed, 22 May 2013 15:08:59 +0200
changeset 119482 09ac1fd2959cd867d0deb62f4e5283fdb59b170f
parent 119481 01a6302719f4cd2dd426f7f74d8ce900790b5fc1
child 119483 bc0f1c04e1da6d85a0e8e5ca6d0dc1be06e4dcef
push id838
push userryanvm@gmail.com
push dateThu, 30 May 2013 12:36:48 +0000
reviewersfabrice, ferjm, lsblakk
bugs863337
milestone18.0
Bug 863337 - [homescreen] If an icon is changed in an update, it's not updated before the next reboot. r=fabrice, r=ferjm, a=lsblakk
dom/apps/src/Webapps.js
dom/apps/src/Webapps.jsm
--- a/dom/apps/src/Webapps.js
+++ b/dom/apps/src/Webapps.js
@@ -564,19 +564,35 @@ WebappsApplication.prototype = {
         break;
       case "Webapps:CheckForUpdate:Return:KO":
         Services.DOMRequest.fireError(req, msg.error);
         break;
       case "Webapps:CheckForUpdate:Return:OK":
         if (msg.manifestURL != this.manifestURL)
           return;
 
-        for (let prop in msg.app) {
-          this[prop] = msg.app[prop];
-        }
+        manifestCache.evict(this.manifestURL, this.innerWindowID);
+
+        let hiddenProps = ["manifest", "updateManifest"];
+        let updatableProps = ["installOrigin", "installTime", "installState",
+            "lastUpdateCheck", "updateTime", "progress", "downloadAvailable",
+            "downloading", "readyToApplyDownload", "downloadSize"];
+        // Props that we don't update: origin, receipts, manifestURL, removable.
+
+        updatableProps.forEach(function(prop) {
+          if (msg.app[prop]) {
+            this[prop] = msg.app[prop];
+          }
+        }, this);
+
+        hiddenProps.forEach(function(prop) {
+          if (msg.app[prop]) {
+            this["_" + prop] = msg.app[prop];
+          }
+        }, this);
 
         if (msg.event == "downloadapplied") {
           this._fireEvent("downloadapplied", this._ondownloadapplied);
         } else if (msg.event == "downloadavailable") {
           this._fireEvent("downloadavailable", this._ondownloadavailable);
         }
 
         if (req) {
--- a/dom/apps/src/Webapps.jsm
+++ b/dom/apps/src/Webapps.jsm
@@ -1417,16 +1417,17 @@ this.DOMApplicationRegistry = {
         PermissionsInstaller.installPermissions({
           manifest: app.manifest,
           origin: app.origin,
           manifestURL: aData.manifestURL
         }, true);
 
         app.name = manifest.name;
         app.csp = manifest.csp || "";
+        app.updateTime = Date.now();
       } else {
         manifest = new ManifestHelper(aOldManifest, app.origin);
       }
 
       // Update the registry.
       this.webapps[id] = app;
       this._saveApps(function() {
         let reg = DOMApplicationRegistry;