B2G/gecko/browser/components/downloads/src/DownloadsCommon.jsm
/**
   * Initializes this object from a download object of the Download Manager.
   *
   * The endTime property is initialized to the current date and time.
   *
   * @param aDownload
   *        The nsIDownload with the current state.
   */
Initializes this object from a download object of the Download Manager.
The endTime property is initialized to the current date and time.

@param aDownload
The nsIDownload with the current state.
Initializes this object from a download object of the Download Manager . The endTime property is initialized to the current date and time . @param aDownload The nsIDownload with the current state .
function DDI_initFromDownload(aDownload)
  {
    this.download = aDownload;
    this.downloadId = aDownload.id;
    this.file = aDownload.target.spec;
    this.target = aDownload.displayName;
    this.uri = aDownload.source.spec;
    this.referrer = aDownload.referrer && aDownload.referrer.spec;
    this.state = aDownload.state;
    this.startTime = Math.round(aDownload.startTime / 1000);
    this.endTime = Date.now();
    this.currBytes = aDownload.amountTransferred;
    this.maxBytes = aDownload.size;
    this.resumable = aDownload.resumable;
    this.speed = aDownload.speed;
    this.percentComplete = aDownload.percentComplete;
  }
function DDI_initFromDownload ( aDownload ) { this . download = aDownload ; this . downloadId = aDownload . id ; this . file = aDownload . target . spec ; this . target = aDownload . displayName ; this . uri = aDownload . source . spec ; this . referrer = aDownload . referrer && aDownload . referrer . spec ; this . state = aDownload . state ; this . startTime = Math . round ( aDownload . startTime / 1000 ) ; this . endTime = Date . now ( ) ; this . currBytes = aDownload . amountTransferred ; this . maxBytes = aDownload . size ; this . resumable = aDownload . resumable ; this . speed = aDownload . speed ; this . percentComplete = aDownload . percentComplete ; }
Initializes this object from a download object of the Download Manager.
Initializes this object from a download object of the Download Manager .
// Fetch all the download properties eagerly.