function AUS__postUpdateProcessing() {
    if (!this.canCheckForUpdates || !this.canApplyUpdates) {
      LOG("UpdateService:_postUpdateProcessing - unable to check for or apply " +
          "updates... returning early");
      return;
    }

    var status = readStatusFile(getUpdatesDir());
    // STATE_NONE status means that the update.status file is present but a
    // background download error occurred.
    if (status == STATE_NONE) {
      LOG("UpdateService:_postUpdateProcessing - no status, no update");
      cleanupActiveUpdate();
      return;
    }

    var um = Cc["@mozilla.org/updates/update-manager;1"].
             getService(Ci.nsIUpdateManager);
    var update = um.activeUpdate;

    if (status == STATE_DOWNLOADING) {
      LOG("UpdateService:_postUpdateProcessing - patch found in downloading " +
          "state");
      if (update && update.state != STATE_SUCCEEDED) {
        // Resume download
        var status = this.downloadUpdate(update, true);
        if (status == STATE_NONE)
          cleanupActiveUpdate();
      }
      return;
    }

    if (status == STATE_APPLYING) {
      // This indicates that the background updater service is in either of the
      // following two states:
      // 1. It is in the process of applying an update in the background, and
      //    we just happen to be racing against that.
      // 2. It has failed to apply an update for some reason, and we hit this
      //    case because the updater process has set the update status to
      //    applying, but has never finished.
      // In order to differentiate between these two states, we look at the
      // state field of the update object.  If it's "pending", then we know
      // that this is the first time we're hitting this case, so we switch
      // that state to "applying" and we just wait and hope for the best.
      // If it's "applying", we know that we've already been here once, so
      // we really want to start from a clean state.
      if (update &&
          (update.state == STATE_PENDING || update.state == STATE_PENDING_SVC)) {
        LOG("UpdateService:_postUpdateProcessing - patch found in applying " +
            "state for the first time");
        update.state = STATE_APPLYING;
        um.saveUpdates();
      } else { // We get here even if we don't have an update object
        LOG("UpdateService:_postUpdateProcessing - patch found in applying " +
            "state for the second time");
        cleanupActiveUpdate();
      }
      return;
    }

    if (!update)
      update = new Update(null);

    var prompter = Cc["@mozilla.org/updates/update-prompt;1"].
                   createInstance(Ci.nsIUpdatePrompt);

    update.state = status;
    this._sendStatusCodeTelemetryPing(status);

    if (status == STATE_SUCCEEDED) {
      // Report telemetry that we want after each successful update.
      // We do this only on successful updates so that we only get
      // one report from each user for each version.  If a user cancels
      // UAC for example, we don't want 2 reports from them on the same
      // version.
      this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_ENABLED,
                                      "UPDATER_UPDATES_ENABLED");
      this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_AUTO,
                                      "UPDATER_UPDATES_AUTOMATIC");
      this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_STAGE_ENABLED,
                                      "UPDATER_STAGE_ENABLED");

//@line 1635 "e:\builds\moz2_slave\rel-m-rel-xr-w32-bld\build\toolkit\mozapps\update\nsUpdateService.js"
      this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_SERVICE_ENABLED,
                                      "UPDATER_SERVICE_ENABLED");
      this._sendIntPrefTelemetryPing(PREF_APP_UPDATE_SERVICE_ERRORS,
                                     "UPDATER_SERVICE_ERRORS");
      this._sendServiceInstalledTelemetryPing();
//@line 1641 "e:\builds\moz2_slave\rel-m-rel-xr-w32-bld\build\toolkit\mozapps\update\nsUpdateService.js"

      update.statusText = gUpdateBundle.GetStringFromName("installSuccess");

      // Update the patch's metadata.
      um.activeUpdate = update;
      Services.prefs.setBoolPref(PREF_APP_UPDATE_POSTUPDATE, true);
      prompter.showUpdateInstalled();

      // Done with this update. Clean it up.
      cleanupActiveUpdate();
    }
    else {
      // If we hit an error, then the error code will be included in the status
      // string following a colon and a space. If we had an I/O error, then we
      // assume that the patch is not invalid, and we re-stage the patch so that
      // it can be attempted again the next time we restart. This will leave a
      // space at the beginning of the error code when there is a failure which
      // will be removed by using parseInt below. This prevents panic which has
      // occurred numerous times previously (see bug 569642 comment #9 for one
      // example) when testing releases due to forgetting to include the space.
      var ary = status.split(":");
      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, false);

      prompter.showUpdateError(update);
    }
  }
/**
   * Perform post-processing on updates lingering in the updates directory
   * from a previous browser session - either report install failures (and
   * optionally attempt to fetch a different version if appropriate) or
   * notify the user of install success.
   */
Perform post-processing on updates lingering in the updates directory
from a previous browser session - either report install failures (and
optionally attempt to fetch a different version if appropriate) or
notify the user of install success.
Perform post - processing on updates lingering in the updates directory from a previous browser session - either report install failures ( and optionally attempt to fetch a different version if appropriate ) or notify the user of install success .
function AUS__postUpdateProcessing() {
    if (!this.canCheckForUpdates || !this.canApplyUpdates) {
      LOG("UpdateService:_postUpdateProcessing - unable to check for or apply " +
          "updates... returning early");
      return;
    }
    var status = readStatusFile(getUpdatesDir());
    if (status == STATE_NONE) {
      LOG("UpdateService:_postUpdateProcessing - no status, no update");
      cleanupActiveUpdate();
      return;
    }
    var um = Cc["@mozilla.org/updates/update-manager;1"].
             getService(Ci.nsIUpdateManager);
    var update = um.activeUpdate;
    if (status == STATE_DOWNLOADING) {
      LOG("UpdateService:_postUpdateProcessing - patch found in downloading " +
          "state");
      if (update && update.state != STATE_SUCCEEDED) {
        var status = this.downloadUpdate(update, true);
        if (status == STATE_NONE)
          cleanupActiveUpdate();
      }
      return;
    }
    if (status == STATE_APPLYING) {
      if (update &&
          (update.state == STATE_PENDING || update.state == STATE_PENDING_SVC)) {
        LOG("UpdateService:_postUpdateProcessing - patch found in applying " +
            "state for the first time");
        update.state = STATE_APPLYING;
        um.saveUpdates();
      } else { 
        LOG("UpdateService:_postUpdateProcessing - patch found in applying " +
            "state for the second time");
        cleanupActiveUpdate();
      }
      return;
    }
    if (!update)
      update = new Update(null);
    var prompter = Cc["@mozilla.org/updates/update-prompt;1"].
                   createInstance(Ci.nsIUpdatePrompt);
    update.state = status;
    this._sendStatusCodeTelemetryPing(status);
    if (status == STATE_SUCCEEDED) {
      this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_ENABLED,
                                      "UPDATER_UPDATES_ENABLED");
      this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_AUTO,
                                      "UPDATER_UPDATES_AUTOMATIC");
      this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_STAGE_ENABLED,
                                      "UPDATER_STAGE_ENABLED");
      this._sendBoolPrefTelemetryPing(PREF_APP_UPDATE_SERVICE_ENABLED,
                                      "UPDATER_SERVICE_ENABLED");
      this._sendIntPrefTelemetryPing(PREF_APP_UPDATE_SERVICE_ERRORS,
                                     "UPDATER_SERVICE_ERRORS");
      this._sendServiceInstalledTelemetryPing();
      update.statusText = gUpdateBundle.GetStringFromName("installSuccess");
      um.activeUpdate = update;
      Services.prefs.setBoolPref(PREF_APP_UPDATE_POSTUPDATE, true);
      prompter.showUpdateInstalled();
      cleanupActiveUpdate();
    }
    else {
      var ary = status.split(":");
      update.state = ary[0];
      if (update.state == STATE_FAILED && ary[1]) {
        if (handleUpdateFailure(update, ary[1])) {
          return;
        }
      }
      handleFallbackToCompleteUpdate(update, false);
      prompter.showUpdateError(update);
    }
  }
function AUS__postUpdateProcessing ( ) { if ( ! this . canCheckForUpdates || ! this . canApplyUpdates ) { LOG ( "UpdateService:_postUpdateProcessing - unable to check for or apply " + "updates... returning early" ) ; return ; } var status = readStatusFile ( getUpdatesDir ( ) ) ; if ( status == STATE_NONE ) { LOG ( "UpdateService:_postUpdateProcessing - no status, no update" ) ; cleanupActiveUpdate ( ) ; return ; } var um = Cc [ "@mozilla.org/updates/update-manager;1" ] . getService ( Ci . nsIUpdateManager ) ; var update = um . activeUpdate ; if ( status == STATE_DOWNLOADING ) { LOG ( "UpdateService:_postUpdateProcessing - patch found in downloading " + "state" ) ; if ( update && update . state != STATE_SUCCEEDED ) { var status = this . downloadUpdate ( update , true ) ; if ( status == STATE_NONE ) cleanupActiveUpdate ( ) ; } return ; } if ( status == STATE_APPLYING ) { if ( update && ( update . state == STATE_PENDING || update . state == STATE_PENDING_SVC ) ) { LOG ( "UpdateService:_postUpdateProcessing - patch found in applying " + "state for the first time" ) ; update . state = STATE_APPLYING ; um . saveUpdates ( ) ; } else { LOG ( "UpdateService:_postUpdateProcessing - patch found in applying " + "state for the second time" ) ; cleanupActiveUpdate ( ) ; } return ; } if ( ! update ) update = new Update ( null ) ; var prompter = Cc [ "@mozilla.org/updates/update-prompt;1" ] . createInstance ( Ci . nsIUpdatePrompt ) ; update . state = status ; this . _sendStatusCodeTelemetryPing ( status ) ; if ( status == STATE_SUCCEEDED ) { this . _sendBoolPrefTelemetryPing ( PREF_APP_UPDATE_ENABLED , "UPDATER_UPDATES_ENABLED" ) ; this . _sendBoolPrefTelemetryPing ( PREF_APP_UPDATE_AUTO , "UPDATER_UPDATES_AUTOMATIC" ) ; this . _sendBoolPrefTelemetryPing ( PREF_APP_UPDATE_STAGE_ENABLED , "UPDATER_STAGE_ENABLED" ) ; this . _sendBoolPrefTelemetryPing ( PREF_APP_UPDATE_SERVICE_ENABLED , "UPDATER_SERVICE_ENABLED" ) ; this . _sendIntPrefTelemetryPing ( PREF_APP_UPDATE_SERVICE_ERRORS , "UPDATER_SERVICE_ERRORS" ) ; this . _sendServiceInstalledTelemetryPing ( ) ; update . statusText = gUpdateBundle . GetStringFromName ( "installSuccess" ) ; um . activeUpdate = update ; Services . prefs . setBoolPref ( PREF_APP_UPDATE_POSTUPDATE , true ) ; prompter . showUpdateInstalled ( ) ; cleanupActiveUpdate ( ) ; } else { var ary = status . split ( ":" ) ; update . state = ary [ 0 ] ; if ( update . state == STATE_FAILED && ary [ 1 ] ) { if ( handleUpdateFailure ( update , ary [ 1 ] ) ) { return ; } } handleFallbackToCompleteUpdate ( update , false ) ; prompter . showUpdateError ( update ) ; } }
Perform post-processing on updates lingering in the updates directory
 from a previous browser session - either report install failures (and
 optionally attempt to fetch a different version if appropriate) or
 notify the user of install success.
Perform post - processing on updates lingering in the updates directory from a previous browser session - either report install failures ( and optionally attempt to fetch a different version if appropriate ) or notify the user of install success .
// STATE_NONE status means that the update.status file is present but a // background download error occurred. // Resume download // This indicates that the background updater service is in either of the // following two states: // 1. It is in the process of applying an update in the background, and //    we just happen to be racing against that. // 2. It has failed to apply an update for some reason, and we hit this //    case because the updater process has set the update status to //    applying, but has never finished. // In order to differentiate between these two states, we look at the // state field of the update object.  If it's "pending", then we know // that this is the first time we're hitting this case, so we switch // that state to "applying" and we just wait and hope for the best. // If it's "applying", we know that we've already been here once, so // we really want to start from a clean state. // We get here even if we don't have an update object // Report telemetry that we want after each successful update. // We do this only on successful updates so that we only get // one report from each user for each version.  If a user cancels // UAC for example, we don't want 2 reports from them on the same // version. //@line 1635 "e:\builds\moz2_slave\rel-m-rel-xr-w32-bld\build\toolkit\mozapps\update\nsUpdateService.js" //@line 1641 "e:\builds\moz2_slave\rel-m-rel-xr-w32-bld\build\toolkit\mozapps\update\nsUpdateService.js" // Update the patch's metadata. // Done with this update. Clean it up. // If we hit an error, then the error code will be included in the status // string following a colon and a space. If we had an I/O error, then we // assume that the patch is not invalid, and we re-stage the patch so that // it can be attempted again the next time we restart. This will leave a // space at the beginning of the error code when there is a failure which // will be removed by using parseInt below. This prevents panic which has // occurred numerous times previously (see bug 569642 comment #9 for one // example) when testing releases due to forgetting to include the space. // Something went wrong with the patch application process.