B2G/gecko/netwerk/test/httpserver/test/test_async_response_sending.js
/**
   * Increases available space in the sink by the given amount, waits for the
   * given series of arrays of bytes to be written to sink by the copier, and
   * causes execution to asynchronously continue to the next task when the last
   * of those arrays of bytes is received.
   *
   * @param bytes : uint
   *   number of bytes of space to make available in the sink
   * @param dataQuantums : [[uint]]
   *   array of byte arrays to expect to be written in sequence to the sink
   */
Increases available space in the sink by the given amount, waits for the
given series of arrays of bytes to be written to sink by the copier, and
causes execution to asynchronously continue to the next task when the last
of those arrays of bytes is received.

@param bytes : uint
number of bytes of space to make available in the sink
@param dataQuantums : [[uint]]
array of byte arrays to expect to be written in sequence to the sink
Increases available space in the sink by the given amount waits for the given series of arrays of bytes to be written to sink by the copier and causes execution to asynchronously continue to the next task when the last of those arrays of bytes is received . @param bytes : uint number of bytes of space to make available in the sink @param dataQuantums : [[ uint ]] array of byte arrays to expect to be written in sequence to the sink
function makeSinkWritableByIncrementsAndWaitFor(bytes, dataQuantums)
  {
    var self = this;
    var desiredAmounts = dataQuantums.map(function(v) { return v.length; });
    do_check_eq(bytes, sum(desiredAmounts), "bytes/quantums mismatch");
    function increaseSinkSpaceByIncrementsTask()
    {
      self._sink.makeWritableByIncrements(desiredAmounts);
    }
    this._waitForHelper("increaseSinkSpaceByIncrementsTask",
                        dataQuantums, increaseSinkSpaceByIncrementsTask);
  }
function makeSinkWritableByIncrementsAndWaitFor ( bytes , dataQuantums ) { var self = this ; var desiredAmounts = dataQuantums . map ( function ( v ) { return v . length ; } ) ; do_check_eq ( bytes , sum ( desiredAmounts ) , "bytes/quantums mismatch" ) ; function increaseSinkSpaceByIncrementsTask ( ) { self . _sink . makeWritableByIncrements ( desiredAmounts ) ; } this . _waitForHelper ( "increaseSinkSpaceByIncrementsTask" , dataQuantums , increaseSinkSpaceByIncrementsTask ) ; }
Increases available space in the sink by the given amount, waits for the
 given series of arrays of bytes to be written to sink by the copier, and
 causes execution to asynchronously continue to the next task when the last
 of those arrays of bytes is received.
Increases available space in the sink by the given amount waits for the given series of arrays of bytes to be written to sink by the copier and causes execution to asynchronously continue to the next task when the last of those arrays of bytes is received .
/* Now do the actual work to trigger the interceptor incrementally. */