B2G/gecko/netwerk/test/httpserver/test/test_async_response_sending.js
/**
       * Dispatches a pending stream-ready event ahead of schedule, rather than
       * waiting for it to be dispatched in response to normal writes.  This is
       * useful when writing to the output has completed, and we need to have
       * read all data written to this stream.  If the output isn't closed and
       * the reading of data from this races ahead of the last write to output,
       * we need a notification to know when everything that's been written has
       * been read.  This ordinarily might be supplied by closing output, but
       * in some cases it's not desirable to close output, so this supplies an
       * alternative method to get notified when the last write has occurred.
       */
Dispatches a pending stream-ready event ahead of schedule, rather than
waiting for it to be dispatched in response to normal writes.  This is
useful when writing to the output has completed, and we need to have
read all data written to this stream.  If the output isn't closed and
the reading of data from this races ahead of the last write to output,
we need a notification to know when everything that's been written has
been read.  This ordinarily might be supplied by closing output, but
in some cases it's not desirable to close output, so this supplies an
alternative method to get notified when the last write has occurred.
Dispatches a pending stream - ready event ahead of schedule rather than waiting for it to be dispatched in response to normal writes . This is useful when writing to the output has completed and we need to have read all data written to this stream . If the output isn ' t closed and the reading of data from this races ahead of the last write to output we need a notification to know when everything that ' s been written has been read . This ordinarily might be supplied by closing output but in some cases it ' s not desirable to close output so this supplies an alternative method to get notified when the last write has occurred .
function maybeNotifyFinally()
      {
        dumpn("*** [" + this.name + "].maybeNotifyFinally()");
        do_check_true(this._waiter !== null, "must be waiting now");
        if (self._data.length > 0)
        {
          dumpn("*** data still pending, normal notifications will signal " +
                "completion");
          return;
        }
        this._notify();
      }
function maybeNotifyFinally ( ) { dumpn ( "*** [" + this . name + "].maybeNotifyFinally()" ) ; do_check_true ( this . _waiter !== null , "must be waiting now" ) ; if ( self . _data . length > 0 ) { dumpn ( "*** data still pending, normal notifications will signal " + "completion" ) ; return ; } this . _notify ( ) ; }
Dispatches a pending stream-ready event ahead of schedule, rather than
 waiting for it to be dispatched in response to normal writes.
Dispatches a pending stream - ready event ahead of schedule rather than waiting for it to be dispatched in response to normal writes .
// No data waiting to be written, so notify.  We could just close the // stream, but that's less faithful to the server's behavior (it doesn't // close the stream, and we're pretending to impersonate the server as // much as we can here), so instead we're going to notify when no data // can be read.  The CopyTest has already been flagged as complete, so // the stream listener will detect that this is a wrap-it-up notify and // invoke the next test.