B2G/gecko/dom/mobilemessage/src/ril/MmsPduHelper.jsm
/**
   * @param data [optional]
   *        A wrapped object to store encoded raw data. Created if undefined.
   * @param headers
   *        A dictionary object containing multiple name/value mapping.
   *
   * @return the passed data parameter or a created one.
   */
@param data [optional]
A wrapped object to store encoded raw data. Created if undefined.
@param headers
A dictionary object containing multiple name/value mapping.

@return the passed data parameter or a created one.
@param data [ optional ] A wrapped object to store encoded raw data . Created if undefined . @param headers A dictionary object containing multiple name / value mapping . @return the passed data parameter or a created one .
function encodeHeaders(data, headers) {
    if (!data) {
      data = {array: [], offset: 0};
    }
    this.encodeHeader(data, headers, "x-mms-message-type");
    this.encodeHeaderIfExists(data, headers, "x-mms-transaction-id");
    this.encodeHeaderIfExists(data, headers, "x-mms-mms-version");
    for (let key in headers) {
      if ((key == "x-mms-message-type")
          || (key == "x-mms-transaction-id")
          || (key == "x-mms-mms-version")
          || (key == "content-type")) {
        continue;
      }
      this.encodeHeader(data, headers, key);
    }
    this.encodeHeaderIfExists(data, headers, "content-type");
    return data;
  }
function encodeHeaders ( data , headers ) { if ( ! data ) { data = { array : [ ] , offset : 0 } ; } this . encodeHeader ( data , headers , "x-mms-message-type" ) ; this . encodeHeaderIfExists ( data , headers , "x-mms-transaction-id" ) ; this . encodeHeaderIfExists ( data , headers , "x-mms-mms-version" ) ; for ( let key in headers ) { if ( ( key == "x-mms-message-type" ) || ( key == "x-mms-transaction-id" ) || ( key == "x-mms-mms-version" ) || ( key == "content-type" ) ) { continue ; } this . encodeHeader ( data , headers , key ) ; } this . encodeHeaderIfExists ( data , headers , "content-type" ) ; return data ; }
@param data [optional]
        A wrapped object to store encoded raw data.
@param data [ optional ] A wrapped object to store encoded raw data .
// `In the encoding of the header fields, the order of the fields is not // significant, except that X-Mms-Message-Type, X-Mms-Transaction-ID (when // present) and X-Mms-MMS-Version MUST be at the beginning of the message // headers, in that order, and if the PDU contains a message body the // Content Type MUST be the last header field, followed by message body.` // ~ OMA-TS-MMS_ENC-V1_3-20110913-A section 7