Bug 1550726 - save the update after setting the applyStart property value for telemetry. r=bytesized
authorRobert Strong <robert.bugzilla@gmail.com>
Fri, 10 May 2019 15:23:44 +0000
changeset 532233 a379c628a109147aa28215138c43c130393195ae
parent 532232 905f054bd2c9acc944a626d08e1f4071d45aa2ec
child 532234 b97aef38d5565a7c16879aac056ccaa7542a1d15
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbytesized
bugs1550726
milestone68.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 1550726 - save the update after setting the applyStart property value for telemetry. r=bytesized Differential Revision: https://phabricator.services.mozilla.com/D30639
toolkit/mozapps/update/UpdateService.jsm
--- a/toolkit/mozapps/update/UpdateService.jsm
+++ b/toolkit/mozapps/update/UpdateService.jsm
@@ -3237,16 +3237,24 @@ UpdateManager.prototype = {
     if (update.state == STATE_APPLIED && shouldUseService()) {
       writeStatusFile(getUpdatesDir(), update.state = STATE_APPLIED_SERVICE);
     }
 
     if (update.state == STATE_FAILED) {
       AUSTLMY.pingUpdatePhases(update, false);
     }
 
+    if (update.state == STATE_APPLIED ||
+        update.state == STATE_APPLIED_SERVICE ||
+        update.state == STATE_PENDING ||
+        update.state == STATE_PENDING_SERVICE ||
+        update.state == STATE_PENDING_ELEVATE) {
+      patch.setProperty("applyStart", Math.floor(Date.now() / 1000));
+    }
+
     // Now that the active update's properties have been updated write the
     // active-update.xml to disk. Since there have been no changes to the update
     // history the updates.xml will not be written to disk.
     this.saveUpdates();
 
     // Send an observer notification which the app update doorhanger uses to
     // display a restart notification
     LOG("UpdateManager:refreshUpdateStatus - Notifying observers that " +
@@ -3260,17 +3268,16 @@ UpdateManager.prototype = {
       return;
     }
 
     if (update.state == STATE_APPLIED ||
         update.state == STATE_APPLIED_SERVICE ||
         update.state == STATE_PENDING ||
         update.state == STATE_PENDING_SERVICE ||
         update.state == STATE_PENDING_ELEVATE) {
-      patch.setProperty("applyStart", Math.floor(Date.now() / 1000));
       // Notify the user that an update has been staged and is ready for
       // installation (i.e. that they should restart the application).
       let prompter = Cc["@mozilla.org/updates/update-prompt;1"].
                      createInstance(Ci.nsIUpdatePrompt);
       prompter.showUpdateDownloaded(update, true);
     }
   },
 
@@ -4608,16 +4615,17 @@ Downloader.prototype = {
           LOG("Downloader:onStopRequest - failed to stage update. Exception: " +
               e);
           if (this.background) {
             shouldShowPrompt = true;
           }
         }
       } else {
         this._patch.setProperty("applyStart", Math.floor(Date.now() / 1000));
+        um.saveUpdates();
       }
     }
 
     // Do this after *everything* else, since it will likely cause the app
     // to shut down.
     if (shouldShowPrompt) {
       // Notify the user that an update has been downloaded and is ready for
       // installation (i.e. that they should restart the application). We do