Bug 764587 - Do not throttle the download of a complete mar if we fall back to a complete update after attempting to stage a partial update; r=rstrong
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 13 Jun 2012 22:00:03 -0400
changeset 96689 15aaf2a0cb1dd5ff30223cbae6fc80bee120cf65
parent 96688 12e5dbd60ed8e0e3b2471795e564ad9f8bf0357b
child 96690 983b91e5aa1715332f78d09a6035382d968c03d2
push id10660
push usereakhgari@mozilla.com
push dateThu, 14 Jun 2012 13:37:41 +0000
treeherdermozilla-inbound@3d4982f32837 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrstrong
bugs764587
milestone16.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 764587 - Do not throttle the download of a complete mar if we fall back to a complete update after attempting to stage a partial update; r=rstrong
toolkit/mozapps/update/nsUpdateService.js
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -1009,31 +1009,32 @@ function handleUpdateFailure(update, err
   
   return false;
 }
 
 /**
  * Fall back to downloading a complete update in case an update has failed.
  *
  * @param update the update object that has failed to apply.
+ * @param postStaging true if we have just attempted to stage an update.
  */
-function handleFallbackToCompleteUpdate(update) {
+function handleFallbackToCompleteUpdate(update, postStaging) {
   cleanupActiveUpdate();
 
   update.statusText = gUpdateBundle.GetStringFromName("patchApplyFailure");
   var oldType = update.selectedPatch ? update.selectedPatch.type
                                      : "complete";
   if (update.selectedPatch && oldType == "partial" && update.patchCount == 2) {
     // Partial patch application failed, try downloading the complete
     // update in the background instead.
     LOG("UpdateService:_postUpdateProcessing - install of partial patch " +
         "failed, downloading complete patch");
     var status = Cc["@mozilla.org/updates/update-service;1"].
                  getService(Ci.nsIApplicationUpdateService).
-                 downloadUpdate(update, true);
+                 downloadUpdate(update, !postStaging);
     if (status == STATE_NONE)
       cleanupActiveUpdate();
   }
   else {
     LOG("handleFallbackToCompleteUpdate - install of complete or " +
         "only one patch offered failed.");
   }
   update.QueryInterface(Ci.nsIWritablePropertyBag);
@@ -1616,17 +1617,17 @@ UpdateService.prototype = {
       update.state = ary[0];
       if (update.state == STATE_FAILED && ary[1]) {
         if (handleUpdateFailure(update, ary[1])) {
           return;
         }
       }
 
       // Something went wrong with the patch application process.
-      handleFallbackToCompleteUpdate(update);
+      handleFallbackToCompleteUpdate(update, false);
 
       prompter.showUpdateError(update);
     }
   },
 
   /**
    * Submit the results of applying the update via telemetry.
    *
@@ -2431,17 +2432,17 @@ UpdateManager.prototype = {
   refreshUpdateStatus: function UM_refreshUpdateStatus(update) {
     var updateSucceeded = true;
     var status = readStatusFile(getUpdatesDir());
     var ary = status.split(":");
     update.state = ary[0];
     if (update.state == STATE_FAILED && ary[1]) {
       updateSucceeded = false;
       if (!handleUpdateFailure(update, ary[1])) {
-        handleFallbackToCompleteUpdate(update);
+        handleFallbackToCompleteUpdate(update, true);
       }
     }
     if (update.state == STATE_APPLIED && shouldUseService()) {
       writeStatusFile(getUpdatesDir(), update.state = STATE_APPLIED_SVC);
     }
     var um = Cc["@mozilla.org/updates/update-manager;1"].
              getService(Ci.nsIUpdateManager);
     um.saveUpdates();