B2G/gecko/browser/components/downloads/content/downloads.js
/**
   * Called when a new download data item is available, either during the
   * asynchronous data load or when a new download is started.
   *
   * @param aDataItem
   *        DownloadsDataItem object that was just added.
   * @param aNewest
   *        When true, indicates that this item is the most recent and should be
   *        added in the topmost position.  This happens when a new download is
   *        started.  When false, indicates that the item is the least recent
   *        and should be appended.  The latter generally happens during the
   *        asynchronous data load.
   */
Called when a new download data item is available, either during the
asynchronous data load or when a new download is started.

@param aDataItem
DownloadsDataItem object that was just added.
@param aNewest
When true, indicates that this item is the most recent and should be
added in the topmost position.  This happens when a new download is
started.  When false, indicates that the item is the least recent
and should be appended.  The latter generally happens during the
asynchronous data load.
Called when a new download data item is available either during the asynchronous data load or when a new download is started . @param aDataItem DownloadsDataItem object that was just added . @param aNewest When true indicates that this item is the most recent and should be added in the topmost position . This happens when a new download is started . When false indicates that the item is the least recent and should be appended . The latter generally happens during the asynchronous data load .
function DV_onDataItemAdded(aDataItem, aNewest)
  {
    if (aNewest) {
      this._dataItems.unshift(aDataItem);
    } else {
      this._dataItems.push(aDataItem);
    }
    let itemsNowOverflow = this._dataItems.length > this.kItemCountLimit;
    if (aNewest || !itemsNowOverflow) {
      this._addViewItem(aDataItem, aNewest);
    }
    if (aNewest && itemsNowOverflow) {
      this._removeViewItem(this._dataItems[this.kItemCountLimit]);
    }
    if (!this.loading) {
      this._itemCountChanged();
    }
  }
function DV_onDataItemAdded ( aDataItem , aNewest ) { if ( aNewest ) { this . _dataItems . unshift ( aDataItem ) ; } else { this . _dataItems . push ( aDataItem ) ; } let itemsNowOverflow = this . _dataItems . length > this . kItemCountLimit ; if ( aNewest || ! itemsNowOverflow ) { this . _addViewItem ( aDataItem , aNewest ) ; } if ( aNewest && itemsNowOverflow ) { this . _removeViewItem ( this . _dataItems [ this . kItemCountLimit ] ) ; } if ( ! this . loading ) { this . _itemCountChanged ( ) ; } }
Called when a new download data item is available, either during the
 asynchronous data load or when a new download is started.
Called when a new download data item is available either during the asynchronous data load or when a new download is started .
// The newly added item is visible in the panel and we must add the // corresponding element.  This is either because it is the first item, or // because it was added at the bottom but the list still doesn't overflow. // If the list overflows, remove the last item from the panel to make room // for the new one that we just added at the top. // For better performance during batch loads, don't update the count for // every item, because the interface won't be visible until load finishes.