B2G/gecko/browser/components/downloads/content/downloads.js
/**
   * Updates the main status line, including bytes transferred, bytes total,
   * download rate, and time remaining.
   */
Updates the main status line, including bytes transferred, bytes total,
download rate, and time remaining.
Updates the main status line including bytes transferred bytes total download rate and time remaining .
function DVI_updateStatusLine() {
    const nsIDM = Ci.nsIDownloadManager;
    let status = "";
    let statusTip = "";
    if (this.dataItem.paused) {
      let transfer = DownloadUtils.getTransferTotal(this.dataItem.currBytes,
                                                    this.dataItem.maxBytes);
      status = DownloadsCommon.strings.statusSeparatorBeforeNumber(
                                            DownloadsCommon.strings.statePaused,
                                            transfer);
    } else if (this.dataItem.state == nsIDM.DOWNLOAD_DOWNLOADING) {
      let newEstimatedSecondsLeft;
      [status, newEstimatedSecondsLeft] =
        DownloadUtils.getDownloadStatus(this.dataItem.currBytes,
                                        this.dataItem.maxBytes,
                                        this.dataItem.speed,
                                        this.lastEstimatedSecondsLeft);
      this.lastEstimatedSecondsLeft = newEstimatedSecondsLeft;
    } else if (this.dataItem.starting) {
      status = DownloadsCommon.strings.stateStarting;
    } else if (this.dataItem.state == nsIDM.DOWNLOAD_SCANNING) {
      status = DownloadsCommon.strings.stateScanning;
    } else if (!this.dataItem.inProgress) {
      let stateLabel = function () {
        let s = DownloadsCommon.strings;
        switch (this.dataItem.state) {
          case nsIDM.DOWNLOAD_FAILED:           return s.stateFailed;
          case nsIDM.DOWNLOAD_CANCELED:         return s.stateCanceled;
          case nsIDM.DOWNLOAD_BLOCKED_PARENTAL: return s.stateBlockedParentalControls;
          case nsIDM.DOWNLOAD_BLOCKED_POLICY:   return s.stateBlockedPolicy;
          case nsIDM.DOWNLOAD_DIRTY:            return s.stateDirty;
          case nsIDM.DOWNLOAD_FINISHED:         return this._fileSizeText;
        }
        return null;
      }.apply(this);
      let [displayHost, fullHost] =
        DownloadUtils.getURIHost(this.dataItem.referrer || this.dataItem.uri);
      let end = new Date(this.dataItem.endTime);
      let [displayDate, fullDate] = DownloadUtils.getReadableDates(end);
      let firstPart = DownloadsCommon.strings.statusSeparator(stateLabel,
                                                              displayHost);
      status = DownloadsCommon.strings.statusSeparator(firstPart, displayDate);
      statusTip = DownloadsCommon.strings.statusSeparator(fullHost, fullDate);
    }
    this._element.setAttribute("status", status);
    this._element.setAttribute("statusTip", statusTip || status);
  }
function DVI_updateStatusLine ( ) { const nsIDM = Ci . nsIDownloadManager ; let status = "" ; let statusTip = "" ; if ( this . dataItem . paused ) { let transfer = DownloadUtils . getTransferTotal ( this . dataItem . currBytes , this . dataItem . maxBytes ) ; status = DownloadsCommon . strings . statusSeparatorBeforeNumber ( DownloadsCommon . strings . statePaused , transfer ) ; } else if ( this . dataItem . state == nsIDM . DOWNLOAD_DOWNLOADING ) { let newEstimatedSecondsLeft ; [ status , newEstimatedSecondsLeft ] = DownloadUtils . getDownloadStatus ( this . dataItem . currBytes , this . dataItem . maxBytes , this . dataItem . speed , this . lastEstimatedSecondsLeft ) ; this . lastEstimatedSecondsLeft = newEstimatedSecondsLeft ; } else if ( this . dataItem . starting ) { status = DownloadsCommon . strings . stateStarting ; } else if ( this . dataItem . state == nsIDM . DOWNLOAD_SCANNING ) { status = DownloadsCommon . strings . stateScanning ; } else if ( ! this . dataItem . inProgress ) { let stateLabel = function ( ) { let s = DownloadsCommon . strings ; switch ( this . dataItem . state ) { case nsIDM . DOWNLOAD_FAILED : return s . stateFailed ; case nsIDM . DOWNLOAD_CANCELED : return s . stateCanceled ; case nsIDM . DOWNLOAD_BLOCKED_PARENTAL : return s . stateBlockedParentalControls ; case nsIDM . DOWNLOAD_BLOCKED_POLICY : return s . stateBlockedPolicy ; case nsIDM . DOWNLOAD_DIRTY : return s . stateDirty ; case nsIDM . DOWNLOAD_FINISHED : return this . _fileSizeText ; } return null ; } . apply ( this ) ; let [ displayHost , fullHost ] = DownloadUtils . getURIHost ( this . dataItem . referrer || this . dataItem . uri ) ; let end = new Date ( this . dataItem . endTime ) ; let [ displayDate , fullDate ] = DownloadUtils . getReadableDates ( end ) ; let firstPart = DownloadsCommon . strings . statusSeparator ( stateLabel , displayHost ) ; status = DownloadsCommon . strings . statusSeparator ( firstPart , displayDate ) ; statusTip = DownloadsCommon . strings . statusSeparator ( fullHost , fullDate ) ; } this . _element . setAttribute ( "status" , status ) ; this . _element . setAttribute ( "statusTip" , statusTip || status ) ; }
Updates the main status line, including bytes transferred, bytes total,
 download rate, and time remaining.
Updates the main status line including bytes transferred bytes total download rate and time remaining .
// We use the same XUL label to display both the state and the amount // transferred, for example "Paused -  1.1 MB". // We use the same XUL label to display the state, the host name, and the // end time, for example "Canceled - 222.net - 11:15" or "1.1 MB - // website2.com - Yesterday".  We show the full host and the complete date // in the tooltip.