B2G/gecko/toolkit/devtools/webconsole/NetworkHelper.jsm
/**
   * Reads the posted text from aRequest.
   *
   * @param nsIHttpChannel aRequest
   * @param string aCharset
   *        The content document charset, used when reading the POSTed data.
   * @returns string or null
   *          Returns the posted string if it was possible to read from aRequest
   *          otherwise null.
   */
Reads the posted text from aRequest.
@param nsIHttpChannel aRequest
@param string aCharset
The content document charset, used when reading the POSTed data.
@returns string or null
Returns the posted string if it was possible to read from aRequest
otherwise null.
Reads the posted text from aRequest . @param nsIHttpChannel aRequest @param string aCharset The content document charset used when reading the POSTed data . @returns string or null Returns the posted string if it was possible to read from aRequest otherwise null .
function NH_readPostTextFromRequest(aRequest, aCharset)
  {
    if (aRequest instanceof Ci.nsIUploadChannel) {
      let iStream = aRequest.uploadStream;
      let isSeekableStream = false;
      if (iStream instanceof Ci.nsISeekableStream) {
        isSeekableStream = true;
      }
      let prevOffset;
      if (isSeekableStream) {
        prevOffset = iStream.tell();
        iStream.seek(Ci.nsISeekableStream.NS_SEEK_SET, 0);
      }
      let text = this.readAndConvertFromStream(iStream, aCharset);
      if (isSeekableStream && prevOffset == 0) {
        iStream.seek(Ci.nsISeekableStream.NS_SEEK_SET, 0);
      }
      return text;
    }
    return null;
  }
function NH_readPostTextFromRequest ( aRequest , aCharset ) { if ( aRequest instanceof Ci . nsIUploadChannel ) { let iStream = aRequest . uploadStream ; let isSeekableStream = false ; if ( iStream instanceof Ci . nsISeekableStream ) { isSeekableStream = true ; } let prevOffset ; if ( isSeekableStream ) { prevOffset = iStream . tell ( ) ; iStream . seek ( Ci . nsISeekableStream . NS_SEEK_SET , 0 ) ; } let text = this . readAndConvertFromStream ( iStream , aCharset ) ; if ( isSeekableStream && prevOffset == 0 ) { iStream . seek ( Ci . nsISeekableStream . NS_SEEK_SET , 0 ) ; } return text ; } return null ; }
Reads the posted text from aRequest.
Reads the posted text from aRequest .
// Read data from the stream. // Seek locks the file, so seek to the beginning only if necko hasn't // read it yet, since necko doesn't seek to 0 before reading (at lest // not till 459384 is fixed).