Bug 761057 - Part 1: disable some v1.4 parameters for compatibility, r=philikon
authorVicamo Yang <vyang@mozilla.com>
Thu, 26 Jul 2012 12:11:33 +0800
changeset 100524 83254a09a38fa418e4d2d60ec6ce4cb21c6ee3de
parent 100523 283e4488bb3e4b7efa54e1075e0431e46ee9947b
child 100525 7001e01f26ecf30487b51ed382a4faa4ae0afe89
push idunknown
push userunknown
push dateunknown
reviewersphilikon
bugs761057
milestone17.0a1
Bug 761057 - Part 1: disable some v1.4 parameters for compatibility, r=philikon Carrier's MMS implementation may not be up-to-date. Encoding some mandatory well known parameters with newest version might cause problem and not accepted by MMSC.
dom/mms/src/ril/MmsPduHelper.jsm
dom/mms/src/ril/WspPduHelper.jsm
dom/mms/tests/test_wsp_pdu_helper.js
--- a/dom/mms/src/ril/MmsPduHelper.jsm
+++ b/dom/mms/src/ril/MmsPduHelper.jsm
@@ -1206,17 +1206,17 @@ const MMS_PDU_TYPES = (function () {
                                            "x-mms-status"]);
 
   return pdus;
 })();
 
 /**
  * Header field names and assigned numbers.
  *
- * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.3.4
+ * @see OMA-TS-MMS_ENC-V1_3-20110913-A clause 7.4
  */
 const MMS_HEADER_FIELDS = (function () {
   let names = {};
   function add(name, number, coder) {
     let entry = {
       name: name,
       number: number,
       coder: coder,
@@ -1299,16 +1299,17 @@ const MMS_WELL_KNOWN_PARAMS = (function 
     let entry = {
       name: name,
       number: number,
       coder: coder,
     };
     params[name] = params[number] = entry;
   }
 
+  // Encoding Version: 1.2
   add("type", 0x02, WSP.TypeValue);
 
   return params;
 })();
 
 let debug;
 if (DEBUG) {
   debug = function (s) {
--- a/dom/mms/src/ril/WspPduHelper.jsm
+++ b/dom/mms/src/ril/WspPduHelper.jsm
@@ -1882,16 +1882,17 @@ const WSP_HEADER_FIELDS = (function () {
     let entry = {
       name: name,
       number: number,
       coder: coder,
     };
     names[name] = names[number] = entry;
   }
 
+  // Encoding Version: 1.1
   //add("accept",               0x00);
   //add("accept-charset",       0x01); Deprecated
   //add("accept-encoding",      0x02); Deprecated
   //add("accept-language",      0x03);
   //add("accept-ranges",        0x04);
   add("age",                    0x05, DeltaSecondsValue);
   //add("allow",                0x06);
   //add("authorization",        0x07);
@@ -1929,37 +1930,43 @@ const WSP_HEADER_FIELDS = (function () {
   //add("transfer-encoding",    0x27);
   add("upgrade",                0x28, TextString);
   add("user-agent",             0x29, TextString);
   //add("vary",                 0x2A);
   add("via",                    0x2B, TextString);
   //add("warning",              0x2C);
   //add("www-authenticate",     0x2D);
   //add("content-disposition",  0x2E); Deprecated
+
+  // Encoding Version: 1.2
   add("x-wap-application-id",   0x2F, ApplicationIdValue);
   add("x-wap-content-uri",      0x30, UriValue);
   add("x-wap-initiator-uri",    0x31, UriValue);
   //add("accept-application",   0x32);
   add("bearer-indication",      0x33, IntegerValue);
   add("push-flag",              0x34, ShortInteger);
   add("profile",                0x35, UriValue);
   //add("profile-diff",         0x36);
   //add("profile-warning",      0x37); Deprecated
+
+  // Encoding Version: 1.3
   //add("expect",               0x38);
   //add("te",                   0x39);
   //add("trailer",              0x3A);
   add("accept-charset",         0x3B, AcceptCharsetValue);
   //add("accept-encoding",      0x3C);
   //add("cache-control",        0x3D); Deprecated
   //add("content-range",        0x3E);
   add("x-wap-tod",              0x3F, DateValue);
   add("content-id",             0x40, QuotedString);
   //add("set-cookie",           0x41);
   //add("cookie",               0x42);
   //add("encoding-version",     0x43);
+
+  // Encoding Version: 1.4
   //add("profile-warning",      0x44);
   //add("content-disposition",  0x45);
   //add("x-wap-security",       0x46);
   //add("cache-control",        0x47);
 
   return names;
 })();
 
@@ -1972,17 +1979,20 @@ const WSP_WELL_KNOWN_CONTENT_TYPES = (fu
     let entry = {
       type: type,
       number: number,
     };
     types[type] = types[number] = entry;
   }
 
   // Well Known Values
+  // Encoding Version: 1.2
   add("application/vnd.wap.multipart.related", 0x33);
+
+  // Encoding Version: 1.4
   add("application/vnd.wap.mms-message", 0x3E);
 
   return types;
 })();
 
 // WSP Well-Known Parameter Assignments
 // Note: Items commented out are either deprecated or not implemented.
 //       Deprecated items should not be used.
@@ -1994,41 +2004,48 @@ const WSP_WELL_KNOWN_PARAMS = (function 
     let entry = {
       name: name,
       number: number,
       coder: coder,
     };
     params[name] = params[number] = entry;
   }
 
+  // Encoding Version: 1.1
   add("q",                 0x00, QValue);
   add("charset",           0x01, WellKnownCharset);
   add("level",             0x02, VersionValue);
   add("type",              0x03, IntegerValue);
   add("name",              0x05, TextValue); // Deprecated, but used in some carriers, eg. Hinet.
   //add("filename",        0x06); Deprecated
   add("differences",       0x07, FieldName);
   add("padding",           0x08, ShortInteger);
+
+  // Encoding Version: 1.2
   add("type",              0x09, TypeValue);
   add("start",             0x0A, TextValue); // Deprecated, but used in some carriers, eg. T-Mobile.
   //add("start-info",      0x0B); Deprecated
+
+  // Encoding Version: 1.3
   //add("comment",         0x0C); Deprecated
   //add("domain",          0x0D); Deprecated
   add("max-age",           0x0E, DeltaSecondsValue);
   //add("path",            0x0F); Deprecated
   add("secure",            0x10, NoValue);
+
+  // Encoding Version: 1.4
   add("sec",               0x11, ShortInteger);
   add("mac",               0x12, TextValue);
   add("creation-date",     0x13, DateValue);
   add("modification-date", 0x14, DateValue);
   add("read-date",         0x15, DateValue);
   add("size",              0x16, IntegerValue);
-  add("name",              0x17, TextValue);
+  //add("name",            0x17, TextValue); // Not supported in some carriers, eg. Hinet.
   add("filename",          0x18, TextValue);
-  add("start",             0x19, TextValue);
+  //add("start",           0x19, TextValue); // Not supported in some carriers, eg. Hinet.
   add("start-info",        0x1A, TextValue);
   add("comment",           0x1B, TextValue);
   add("domain",            0x1C, TextValue);
   add("path",              0x1D, TextValue);
 
   return params;
 })();
 
--- a/dom/mms/tests/test_wsp_pdu_helper.js
+++ b/dom/mms/tests/test_wsp_pdu_helper.js
@@ -576,20 +576,20 @@ add_test(function test_Parameter_decodeT
   // Test for NotWellKnownEncodingError
   wsp_decode_test_ex(func, [1, 0xFF], null, "NotWellKnownEncodingError");
   // Test for parameter specific decoder
   wsp_decode_test_ex(func, [1, 0, 100], {name: "q", value: 0.99});
   // Test for TextValue
   wsp_decode_test_ex(func, [1, 0x10, 48, 46, 57, 57, 0],
                      {name: "secure", value: "0.99"});
   // Test for TextString
-  wsp_decode_test_ex(func, [1, 0x19, 60, 115, 109, 105, 108, 62, 0],
+  wsp_decode_test_ex(func, [1, 0x0A, 60, 115, 109, 105, 108, 62, 0],
                      {name: "start", value: "<smil>"});
   // Test for skipValue
-  wsp_decode_test_ex(func, [1, 0x19, 128], null);
+  wsp_decode_test_ex(func, [1, 0x0A, 128], null);
 
   run_next_test();
 });
 
 //// Parameter.decodeUntypedParameter ////
 
 add_test(function test_Parameter_decodeUntypedParameter() {
   function func (data) {
@@ -604,29 +604,29 @@ add_test(function test_Parameter_decodeU
   wsp_decode_test_ex(func, [65, 0, 66, 0], {name: "a", value: "B"});
 
   run_next_test();
 });
 
 //// Parameter.decode ////
 
 add_test(function test_Parameter_decode() {
-  wsp_decode_test(WSP.Parameter, [1, 0x19, 60, 115, 109, 105, 108, 62, 0],
+  wsp_decode_test(WSP.Parameter, [1, 0x0A, 60, 115, 109, 105, 108, 62, 0],
                   {name: "start", value: "<smil>"});
   wsp_decode_test(WSP.Parameter, [65, 0, 66, 0], {name: "a", value: "B"});
 
   run_next_test();
 });
 
 //// Parameter.decodeMultiple ////
 
 add_test(function test_Parameter_decodeMultiple() {
   wsp_decode_test_ex(function (data) {
       return WSP.Parameter.decodeMultiple(data, 13);
-    }, [1, 0x19, 60, 115, 109, 105, 108, 62, 0, 65, 0, 66, 0], {start: "<smil>", a: "B"}
+    }, [1, 0x0A, 60, 115, 109, 105, 108, 62, 0, 65, 0, 66, 0], {start: "<smil>", a: "B"}
   );
 
   run_next_test();
 });
 
 //
 // Test target: Header
 //
@@ -809,40 +809,40 @@ add_test(function test_ContentTypeValue_
 add_test(function test_ContentTypeValue_decodeMediaType() {
   wsp_decode_test_ex(function (data) {
       return WSP.ContentTypeValue.decodeMediaType(data, 1);
     }, [0x3E | 0x80],
     {media: "application/vnd.wap.mms-message", params: null}
   );
   wsp_decode_test_ex(function (data) {
       return WSP.ContentTypeValue.decodeMediaType(data, 14);
-    }, [0x3E | 0x80, 1, 0x19, 60, 115, 109, 105, 108, 62, 0, 65, 0, 66, 0],
+    }, [0x3E | 0x80, 1, 0x0A, 60, 115, 109, 105, 108, 62, 0, 65, 0, 66, 0],
     {media: "application/vnd.wap.mms-message", params: {start: "<smil>", a: "B"}}
   );
 
   run_next_test();
 });
 
 //// ContentTypeValue.decodeContentGeneralForm ////
 
 add_test(function test_ContentTypeValue_decodeContentGeneralForm() {
   wsp_decode_test_ex(function (data) {
       return WSP.ContentTypeValue.decodeContentGeneralForm(data);
-    }, [14, 0x3E | 0x80, 1, 0x19, 60, 115, 109, 105, 108, 62, 0, 65, 0, 66, 0],
+    }, [14, 0x3E | 0x80, 1, 0x0A, 60, 115, 109, 105, 108, 62, 0, 65, 0, 66, 0],
     {media: "application/vnd.wap.mms-message", params: {start: "<smil>", a: "B"}}
   );
 
   run_next_test();
 });
 
 //// ContentTypeValue.decode ////
 
 add_test(function test_ContentTypeValue_decode() {
   wsp_decode_test(WSP.ContentTypeValue,
-    [14, 0x3E | 0x80, 1, 0x19, 60, 115, 109, 105, 108, 62, 0, 65, 0, 66, 0],
+    [14, 0x3E | 0x80, 1, 0x0A, 60, 115, 109, 105, 108, 62, 0, 65, 0, 66, 0],
     {media: "application/vnd.wap.mms-message", params: {start: "<smil>", a: "B"}}
   );
 
   wsp_decode_test(WSP.ContentTypeValue, [0x33 | 0x80],
     {media: "application/vnd.wap.multipart.related", params: null}
   );
 
   run_next_test();