Bug 968750 - B2G MMS: MmsDeliveryInfo.readStatus saved as "pending" read status when toggled. r=echen
authorBevis Tseng <btseng@mozilla.com>
Fri, 14 Nov 2014 16:10:17 +0800
changeset 216847 0a8346276fb93d6929a04f4df1f5de9427fe4573
parent 216846 aa46b3ca0f9f507db37215265d9a8d10dfacb003
child 216848 6ccc4cc5d2d28b5808132580594c8109b468cae3
push id27866
push userkwierso@gmail.com
push dateFri, 21 Nov 2014 23:04:21 +0000
treeherderautoland@b612d5a501f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersechen
bugs968750
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 968750 - B2G MMS: MmsDeliveryInfo.readStatus saved as "pending" read status when toggled. r=echen
dom/mobilemessage/gonk/MmsService.js
--- a/dom/mobilemessage/gonk/MmsService.js
+++ b/dom/mobilemessage/gonk/MmsService.js
@@ -220,19 +220,21 @@ MmsConnection.prototype = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
 
   /** MMS proxy settings. */
   mmsc:     "",
   mmsProxy: "",
   mmsPort:  -1,
 
   setApnSetting: function(network) {
-    this.mmsc = network.mmsc;
     // Workaround an xpconnect issue with undefined string objects. See bug 808220.
-    this.mmsProxy = (network === "undefined") ? undefined : network.mmsProxy;
+    this.mmsc =
+      (network.mmsc === "undefined") ? undefined : network.mmsc;
+    this.mmsProxy =
+      (network.mmsProxy === "undefined") ? undefined : network.mmsProxy;
     this.mmsPort = network.mmsPort;
   },
 
   get proxyInfo() {
     if (!this.mmsProxy) {
       if (DEBUG) debug("getProxyInfo: MMS proxy is not available.");
       return null;
     }
@@ -1208,22 +1210,16 @@ function SendTransaction(mmsConnection, 
   let phoneNumber = mmsConnection.getPhoneNumber();
   let from = (phoneNumber) ? { address: phoneNumber, type: "PLMN" } : null;
   msg.headers["from"] = from;
 
   msg.headers["date"] = new Date();
   msg.headers["x-mms-message-class"] = "personal";
   msg.headers["x-mms-expiry"] = 7 * 24 * 60 * 60;
   msg.headers["x-mms-priority"] = 129;
-  try {
-    msg.headers["x-mms-read-report"] =
-      Services.prefs.getBoolPref("dom.mms.requestReadReport");
-  } catch (e) {
-    msg.headers["x-mms-read-report"] = true;
-  }
   msg.headers["x-mms-delivery-report"] = requestDeliveryReport;
 
   if (!gMmsTransactionHelper.checkMaxValuesParameters(msg)) {
     //We should notify end user that the header format is wrong.
     if (DEBUG) debug("Check max values parameters fail.");
     throw new Error("Check max values parameters fail.");
   }
 
@@ -2181,16 +2177,22 @@ MmsService.prototype = {
     aMessage["sender"] = aMmsConnection.getPhoneNumber();
     aMessage["iccId"] = aMmsConnection.getIccId();
     try {
       aMessage["deliveryStatusRequested"] =
         Services.prefs.getBoolPref("dom.mms.requestStatusReport");
     } catch (e) {
       aMessage["deliveryStatusRequested"] = false;
     }
+    try {
+      headers["x-mms-read-report"] =
+        Services.prefs.getBoolPref("dom.mms.requestReadReport");
+    } catch (e) {
+      headers["x-mms-read-report"] = false;
+    }
 
     if (DEBUG) debug("createSavableFromParams: aMessage: " +
                      JSON.stringify(aMessage));
 
     return isAddrValid ? Ci.nsIMobileMessageCallback.SUCCESS_NO_ERROR
                        : Ci.nsIMobileMessageCallback.INVALID_ADDRESS_ERROR;
   },