bin/XULRunner21_0/components/nsUpdateService.js
/**
   * When new data has been downloaded
   * @param   request
   *          The nsIRequest object for the transfer
   * @param   context
   *          Additional data
   * @param   progress
   *          The current number of bytes transferred
   * @param   maxProgress
   *          The total number of bytes that must be transferred
   */
When new data has been downloaded
@param   request
The nsIRequest object for the transfer
@param   context
Additional data
@param   progress
The current number of bytes transferred
@param   maxProgress
The total number of bytes that must be transferred
When new data has been downloaded @param request The nsIRequest object for the transfer @param context Additional data @param progress The current number of bytes transferred @param maxProgress The total number of bytes that must be transferred
function Downloader_onProgress(request, context, progress,
                                             maxProgress) {
    LOG("Downloader:onProgress - progress: " + progress + "/" + maxProgress);
    if (progress > this._patch.size) {
      LOG("Downloader:onProgress - progress: " + progress +
          " is higher than patch size: " + this._patch.size);
      this.cancel(Cr.NS_ERROR_UNEXPECTED);
      return;
    }
    if (maxProgress != this._patch.size) {
      LOG("Downloader:onProgress - maxProgress: " + maxProgress +
          " is not equal to expectd patch size: " + this._patch.size);
      this.cancel(Cr.NS_ERROR_UNEXPECTED);
      return;
    }
    var listeners = this._listeners.concat();
    var listenerCount = listeners.length;
    for (var i = 0; i < listenerCount; ++i) {
      var listener = listeners[i];
      if (listener instanceof Ci.nsIProgressEventSink)
        listener.onProgress(request, context, progress, maxProgress);
    }
    this.updateService._consecutiveSocketErrors = 0;
  }
function Downloader_onProgress ( request , context , progress , maxProgress ) { LOG ( "Downloader:onProgress - progress: " + progress + "/" + maxProgress ) ; if ( progress > this . _patch . size ) { LOG ( "Downloader:onProgress - progress: " + progress + " is higher than patch size: " + this . _patch . size ) ; this . cancel ( Cr . NS_ERROR_UNEXPECTED ) ; return ; } if ( maxProgress != this . _patch . size ) { LOG ( "Downloader:onProgress - maxProgress: " + maxProgress + " is not equal to expectd patch size: " + this . _patch . size ) ; this . cancel ( Cr . NS_ERROR_UNEXPECTED ) ; return ; } var listeners = this . _listeners . concat ( ) ; var listenerCount = listeners . length ; for ( var i = 0 ; i < listenerCount ; ++ i ) { var listener = listeners [ i ] ; if ( listener instanceof Ci . nsIProgressEventSink ) listener . onProgress ( request , context , progress , maxProgress ) ; } this . updateService . _consecutiveSocketErrors = 0 ; }
When new data has been downloaded
 @param   request
          The nsIRequest object for the transfer
 @param   context
          Additional data
 @param   progress
          The current number of bytes transferred
 @param   maxProgress
          The total number of bytes that must be transferred
When new data has been downloaded @param request The nsIRequest object for the transfer @param context Additional data @param progress The current number of bytes transferred @param maxProgress The total number of bytes that must be transferred
// It's important that we use a different code than // NS_ERROR_CORRUPTED_CONTENT so that tests can verify the difference // between a hash error and a wrong download error. // It's important that we use a different code than // NS_ERROR_CORRUPTED_CONTENT so that tests can verify the difference // between a hash error and a wrong download error.