diff --git a/dom/mobilemessage/interfaces/nsIDOMMozMmsMessage.idl b/dom/mobilemessage/interfaces/nsIDOMMozMmsMessage.idl index 5d7ed281a10d..0b921be210c3 100644 --- a/dom/mobilemessage/interfaces/nsIDOMMozMmsMessage.idl +++ b/dom/mobilemessage/interfaces/nsIDOMMozMmsMessage.idl @@ -11,8 +11,7 @@ dictionary MmsAttachment { DOMString? id; DOMString? location; - nsIDOMBlob content; // If the content blob is a text/plain type, the encoding - // for text should always be "utf-8". + nsIDOMBlob content; }; [scriptable, builtinclass, uuid(2e5e1c16-b7af-11e2-af04-8f4b1610a600)] diff --git a/dom/mobilemessage/src/ril/WspPduHelper.jsm b/dom/mobilemessage/src/ril/WspPduHelper.jsm index 0613b50d0907..7047d905eec5 100644 --- a/dom/mobilemessage/src/ril/WspPduHelper.jsm +++ b/dom/mobilemessage/src/ril/WspPduHelper.jsm @@ -2292,40 +2292,18 @@ this.PduHelper = { let octetArray = Octet.decodeMultiple(data, contentEnd); let content = null; if (octetArray) { - let charset = headers["content-type"].params && - headers["content-type"].params.charset - ? headers["content-type"].params.charset.charset - : null; - - let mimeType = headers["content-type"].media; - - if (mimeType) { - if (mimeType == "application/smil") { - // If the content is a SMIL type, convert it to a string. - // We hope to save and expose the SMIL content in a string way. - content = this.decodeStringContent(octetArray, charset); - } else if (mimeType.indexOf("text/") == 0 && charset != "utf-8") { - // If the content is a "text/plain" type, we have to make sure - // the encoding of the blob content should always be "utf-8". - let tmpStr = this.decodeStringContent(octetArray, charset); - let encoder = new TextEncoder("UTF-8"); - content = new Blob([encoder.encode(tmpStr)], {type : mimeType}); - - // Make up the missing encoding info. - if (!headers["content-type"].params) { - headers["content-type"].params = {}; - } - if (!headers["content-type"].params.charset) { - headers["content-type"].params.charset = {}; - } - if (!headers["content-type"].params.charset.charset) { - headers["content-type"].params.charset.charset = "utf-8"; - } - } + // If the content is a SMIL type, convert it to a string. + // We hope to save and expose the SMIL content as a string way. + if (headers["content-type"].media == "application/smil") { + let charset = headers["content-type"].params && + headers["content-type"].params.charset + ? headers["content-type"].params.charset["charset"] + : null; + content = this.decodeStringContent(octetArray, charset); } - if (!content) { - content = new Blob([octetArray], {type : mimeType}); + content = new Blob([octetArray], + {type : headers["content-type"].media}); } }