B2G/gecko/browser/devtools/shared/Undo.jsm
/**
   * End a batch of related changes, performing its action and adding
   * it to the undo stack.
   */
End a batch of related changes, performing its action and adding
it to the undo stack.
End a batch of related changes performing its action and adding it to the undo stack .
function Undo_endBatch()
  {
    if (--this._batchDepth > 0) {
      return;
    }
    let start = Math.max((this._index + 1) - this.maxUndo, 0);
    this._stack = this._stack.slice(start, this._index);
    let batch = this._batch;
    delete this._batch;
    let entry = {
      do: function() {
        for (let item of batch) {
          item.do();
        }
      },
      undo: function() {
        for (let i = batch.length - 1; i >= 0; i--) {
          batch[i].undo();
        }
      }
    };
    this._stack.push(entry);
    this._index = this._stack.length;
    entry.do();
    this._change();
  }
function Undo_endBatch ( ) { if ( -- this . _batchDepth > 0 ) { return ; } let start = Math . max ( ( this . _index + 1 ) - this . maxUndo , 0 ) ; this . _stack = this . _stack . slice ( start , this . _index ) ; let batch = this . _batch ; delete this . _batch ; let entry = { do : function ( ) { for ( let item of batch ) { item . do ( ) ; } } , undo : function ( ) { for ( let i = batch . length - 1 ; i >= 0 ; i -- ) { batch [ i ] . undo ( ) ; } } } ; this . _stack . push ( entry ) ; this . _index = this . _stack . length ; entry . do ( ) ; this . _change ( ) ; }
End a batch of related changes, performing its action and adding
 it to the undo stack.
End a batch of related changes performing its action and adding it to the undo stack .
// Cut off the end of the undo stack at the current index, // and the beginning to prevent a stack larger than maxUndo.