B2G/gecko/browser/components/downloads/content/downloads.js
/**
 * Builds and updates a single item in the downloads list widget, responding to
 * changes in the download state and real-time data.
 *
 * @param aDataItem
 *        DownloadsDataItem to be associated with the view item.
 * @param aElement
 *        XUL element corresponding to the single download item in the view.
 */
Builds and updates a single item in the downloads list widget, responding to
changes in the download state and real-time data.

@param aDataItem
DownloadsDataItem to be associated with the view item.
@param aElement
XUL element corresponding to the single download item in the view.
Builds and updates a single item in the downloads list widget responding to changes in the download state and real - time data . @param aDataItem DownloadsDataItem to be associated with the view item . @param aElement XUL element corresponding to the single download item in the view .
function DownloadsViewItem(aDataItem, aElement)
{
  this._element = aElement;
  this.dataItem = aDataItem;
  this.wasDone = this.dataItem.done;
  this.wasInProgress = this.dataItem.inProgress;
  this.lastEstimatedSecondsLeft = Infinity;
  this.image = "moz-icon://" + this.dataItem.file + "?size=32";
  let attributes = {
    "type": "download",
    "class": "download-state",
    "id": "downloadsItem_" + this.dataItem.downloadId,
    "downloadId": this.dataItem.downloadId,
    "state": this.dataItem.state,
    "progress": this.dataItem.inProgress ? this.dataItem.percentComplete : 100,
    "target": this.dataItem.target,
    "image": this.image
  };
  for (let attributeName in attributes) {
    this._element.setAttribute(attributeName, attributes[attributeName]);
  }
  this._updateProgress();
  this._updateStatusLine();
}
function DownloadsViewItem ( aDataItem , aElement ) { this . _element = aElement ; this . dataItem = aDataItem ; this . wasDone = this . dataItem . done ; this . wasInProgress = this . dataItem . inProgress ; this . lastEstimatedSecondsLeft = Infinity ; this . image = "moz-icon://" + this . dataItem . file + "?size=32" ; let attributes = { "type" : "download" , "class" : "download-state" , "id" : "downloadsItem_" + this . dataItem . downloadId , "downloadId" : this . dataItem . downloadId , "state" : this . dataItem . state , "progress" : this . dataItem . inProgress ? this . dataItem . percentComplete : 100 , "target" : this . dataItem . target , "image" : this . image } ; for ( let attributeName in attributes ) { this . _element . setAttribute ( attributeName , attributes [ attributeName ] ) ; } this . _updateProgress ( ) ; this . _updateStatusLine ( ) ; }
Builds and updates a single item in the downloads list widget, responding to
 changes in the download state and real-time data.
Builds and updates a single item in the downloads list widget responding to changes in the download state and real - time data .
// Set the URI that represents the correct icon for the target file.  As soon // as bug 239948 comment 12 is handled, the "file" property will be always a // file URL rather than a file name.  At that point we should remove the "//" // (double slash) from the icon URI specification (see test_moz_icon_uri.js). // Initialize more complex attributes.