B2G/gecko/toolkit/mozapps/update/nsUpdateService.js
/**
   * The XMLHttpRequest succeeded and the document was loaded.
   * @param   event
   *          The nsIDOMEvent for the load
   */
The XMLHttpRequest succeeded and the document was loaded.
@param   event
The nsIDOMEvent for the load
The XMLHttpRequest succeeded and the document was loaded . @param event The nsIDOMEvent for the load
function UC_onLoad(event) {
    LOG("Checker:onLoad - request completed downloading document");
    var prefs = Services.prefs;
    var certs = null;
    if (!prefs.prefHasUserValue(PREF_APP_UPDATE_URL_OVERRIDE) &&
        getPref("getBoolPref", PREF_APP_UPDATE_CERT_CHECKATTRS, true)) {
      certs = gCertUtils.readCertPrefs(PREF_APP_UPDATE_CERTS_BRANCH);
    }
    try {
      var updates = this._updates;
      LOG("Checker:onLoad - number of updates available: " + updates.length);
      var allowNonBuiltIn = !getPref("getBoolPref",
                                     PREF_APP_UPDATE_CERT_REQUIREBUILTIN, true);
      gCertUtils.checkCert(this._request.channel, allowNonBuiltIn, certs);
      if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_CERT_ERRORS))
        Services.prefs.clearUserPref(PREF_APP_UPDATE_CERT_ERRORS);
      if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_BACKGROUNDERRORS))
        Services.prefs.clearUserPref(PREF_APP_UPDATE_BACKGROUNDERRORS);
      this._callback.onCheckComplete(event.target, updates, updates.length);
    }
    catch (e) {
      LOG("Checker:onLoad - there was a problem checking for updates. " +
          "Exception: " + e);
      var request = event.target;
      var status = this._getChannelStatus(request);
      LOG("Checker:onLoad - request.status: " + status);
      var update = new Update(null);
      update.errorCode = status;
      update.statusText = getStatusTextFromCode(status, 404);
      if (this._isHttpStatusCode(status)) {
        update.errorCode = HTTP_ERROR_OFFSET + status;
      }
      if (e.result == Cr.NS_ERROR_ILLEGAL_VALUE) {
        update.errorCode = updates[0] ? CERT_ATTR_CHECK_FAILED_HAS_UPDATE
                                      : CERT_ATTR_CHECK_FAILED_NO_UPDATE;
      }
      this._callback.onError(request, update);
    }
    this._callback = null;
    this._request = null;
  }
function UC_onLoad ( event ) { LOG ( "Checker:onLoad - request completed downloading document" ) ; var prefs = Services . prefs ; var certs = null ; if ( ! prefs . prefHasUserValue ( PREF_APP_UPDATE_URL_OVERRIDE ) && getPref ( "getBoolPref" , PREF_APP_UPDATE_CERT_CHECKATTRS , true ) ) { certs = gCertUtils . readCertPrefs ( PREF_APP_UPDATE_CERTS_BRANCH ) ; } try { var updates = this . _updates ; LOG ( "Checker:onLoad - number of updates available: " + updates . length ) ; var allowNonBuiltIn = ! getPref ( "getBoolPref" , PREF_APP_UPDATE_CERT_REQUIREBUILTIN , true ) ; gCertUtils . checkCert ( this . _request . channel , allowNonBuiltIn , certs ) ; if ( Services . prefs . prefHasUserValue ( PREF_APP_UPDATE_CERT_ERRORS ) ) Services . prefs . clearUserPref ( PREF_APP_UPDATE_CERT_ERRORS ) ; if ( Services . prefs . prefHasUserValue ( PREF_APP_UPDATE_BACKGROUNDERRORS ) ) Services . prefs . clearUserPref ( PREF_APP_UPDATE_BACKGROUNDERRORS ) ; this . _callback . onCheckComplete ( event . target , updates , updates . length ) ; } catch ( e ) { LOG ( "Checker:onLoad - there was a problem checking for updates. " + "Exception: " + e ) ; var request = event . target ; var status = this . _getChannelStatus ( request ) ; LOG ( "Checker:onLoad - request.status: " + status ) ; var update = new Update ( null ) ; update . errorCode = status ; update . statusText = getStatusTextFromCode ( status , 404 ) ; if ( this . _isHttpStatusCode ( status ) ) { update . errorCode = HTTP_ERROR_OFFSET + status ; } if ( e . result == Cr . NS_ERROR_ILLEGAL_VALUE ) { update . errorCode = updates [ 0 ] ? CERT_ATTR_CHECK_FAILED_HAS_UPDATE : CERT_ATTR_CHECK_FAILED_NO_UPDATE ; } this . _callback . onError ( request , update ) ; } this . _callback = null ; this . _request = null ; }
The XMLHttpRequest succeeded and the document was loaded.
The XMLHttpRequest succeeded and the document was loaded .
// Analyze the resulting DOM and determine the set of updates. // Tell the Update Service about the updates