Bug 993011 - Update eisting Gaia apps fields. r=fabrice
authorAlexandre Lissy <lissyx@lissyx.dyndns.org>
Wed, 01 Oct 2014 08:37:00 +0200
changeset 231571 fb0d1cc20298a9827fd373359e9ce1aa08e60d23
parent 231570 34519185fe24c2e637870cf4ec9dbd769a38317e
child 231572 366b01141df5a6dd6e54a1524e0cd89895961bc4
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs993011, 989876
milestone35.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 993011 - Update eisting Gaia apps fields. r=fabrice When performing an update, whether OTA or FOTA, some already existing Gaia apps field may have changed. This happened in the past with bug 989876 where we lacked a proper updateTime value, and this may bite us later. So we update all field, except some that we now must not be changing.
dom/apps/Webapps.jsm
--- a/dom/apps/Webapps.jsm
+++ b/dom/apps/Webapps.jsm
@@ -627,21 +627,28 @@ this.DOMApplicationRegistry = {
           // Create a new localId.
           this.webapps[id].localId = this._nextLocalId();
 
           // Core apps are not removable.
           if (this.webapps[id].removable === undefined) {
             this.webapps[id].removable = false;
           }
         } else {
+          // Fields that we must not update. Confere bug 993011 comment 10.
+          let fieldsBlacklist = ["basePath", "id", "installerAppId",
+            "installerIsBrowser", "localId", "receipts", "storeId",
+            "storeVersion"];
           // we fall into this case if the app is present in /system/b2g/webapps/webapps.json
           // and in /data/local/webapps/webapps.json: this happens when updating gaia apps
           // Confere bug 989876
-          this.webapps[id].updateTime = data[id].updateTime;
-          this.webapps[id].lastUpdateCheck = data[id].updateTime;
+          for (let field in data[id]) {
+            if (fieldsBlacklist.indexOf(field) === -1) {
+              this.webapps[id][field] = data[id][field];
+            }
+          }
         }
       }
     }.bind(this)).then(null, Cu.reportError);
   },
 
   loadAndUpdateApps: function() {
     return Task.spawn(function() {
       let runUpdate = AppsUtils.isFirstRun(Services.prefs);