B2G/gecko/dom/mobilemessage/src/ril/WspPduHelper.jsm
/**
   * Parse multiple header fields with end mark.
   *
   * @param data
   *        A wrapped object containing raw PDU data.
   * @param end
   *        An ending offset indicating the end of headers.
   * @param headers [optional]
   *        An optional object to store parsed header fields. Created
   *        automatically if undefined.
   *
   * @return A object containing decoded header fields as its attributes.
   */
Parse multiple header fields with end mark.
@param data
A wrapped object containing raw PDU data.
@param end
An ending offset indicating the end of headers.
@param headers [optional]
An optional object to store parsed header fields. Created
automatically if undefined.

@return A object containing decoded header fields as its attributes.
Parse multiple header fields with end mark . @param data A wrapped object containing raw PDU data . @param end An ending offset indicating the end of headers . @param headers [ optional ] An optional object to store parsed header fields . Created automatically if undefined . @return A object containing decoded header fields as its attributes .
function parseHeaders(data, end, headers) {
    if (!headers) {
      headers = {};
    }
    let header;
    while (data.offset < end) {
      try {
        header = Header.decode(data);
      } catch (e) {
        break;
      }
      if (header) {
        headers[header.name] = header.value;
      }
    }
    if (data.offset != end) {
      debug("Parser expects ending in " + end + ", but in " + data.offset);
      data.offset = end;
    }
    return headers;
  }
function parseHeaders ( data , end , headers ) { if ( ! headers ) { headers = { } ; } let header ; while ( data . offset < end ) { try { header = Header . decode ( data ) ; } catch ( e ) { break ; } if ( header ) { headers [ header . name ] = header . value ; } } if ( data . offset != end ) { debug ( "Parser expects ending in " + end + ", but in " + data . offset ) ; data . offset = end ; } return headers ; }
Parse multiple header fields with end mark.
Parse multiple header fields with end mark .
// Explicitly seek to end in case of skipped header fields.