B2G/gecko/browser/devtools/webconsole/webconsole.js
/**
   * Prune the queue of messages to display. This avoids displaying messages
   * that will be removed at the end of the queue anyway.
   * @private
   */
Prune the queue of messages to display. This avoids displaying messages
that will be removed at the end of the queue anyway.
@private
Prune the queue of messages to display . This avoids displaying messages that will be removed at the end of the queue anyway . @private
function WCF__pruneOutputQueue()
  {
    let nodes = {};
    this._outputQueue.forEach(function(aItem, aIndex) {
      let [category] = aItem;
      if (!(category in nodes)) {
        nodes[category] = [];
      }
      nodes[category].push(aIndex);
    }, this);
    let pruned = 0;
    for (let category in nodes) {
      let limit = Utils.logLimitForCategory(category);
      let indexes = nodes[category];
      if (indexes.length > limit) {
        let n = Math.max(0, indexes.length - limit);
        pruned += n;
        for (let i = n - 1; i >= 0; i--) {
          this._pruneItemFromQueue(this._outputQueue[indexes[i]]);
          this._outputQueue.splice(indexes[i], 1);
        }
      }
    }
    return pruned;
  }
function WCF__pruneOutputQueue ( ) { let nodes = { } ; this . _outputQueue . forEach ( function ( aItem , aIndex ) { let [ category ] = aItem ; if ( ! ( category in nodes ) ) { nodes [ category ] = [ ] ; } nodes [ category ] . push ( aIndex ) ; } , this ) ; let pruned = 0 ; for ( let category in nodes ) { let limit = Utils . logLimitForCategory ( category ) ; let indexes = nodes [ category ] ; if ( indexes . length > limit ) { let n = Math . max ( 0 , indexes . length - limit ) ; pruned += n ; for ( let i = n - 1 ; i >= 0 ; i -- ) { this . _pruneItemFromQueue ( this . _outputQueue [ indexes [ i ] ] ) ; this . _outputQueue . splice ( indexes [ i ] , 1 ) ; } } } return pruned ; }
Prune the queue of messages to display.
Prune the queue of messages to display .
// Group the messages per category. // Loop through the categories we found and prune if needed.