Bug 808220 - [SMS API] Retrieve a 'sent' message show field 'sender' as 'undefined' STRING, not undefined [r=ferjm]
authorFabrice Desré <fabrice@mozilla.com>
Thu, 29 Nov 2012 05:21:11 -0800
changeset 123588 5b625f3f1fe5d66ee4bbfb03ab36d958dedf6ee6
parent 123587 de95a2aa8a8b1ac762f981e12e7150df2ff6495c
child 123589 2425d2241d280ffb7dd1204a981d2e8252dbd3d0
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersferjm
bugs808220
milestone20.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 808220 - [SMS API] Retrieve a 'sent' message show field 'sender' as 'undefined' STRING, not undefined [r=ferjm]
dom/sms/src/ril/SmsDatabaseService.js
--- a/dom/sms/src/ril/SmsDatabaseService.js
+++ b/dom/sms/src/ril/SmsDatabaseService.js
@@ -446,30 +446,42 @@ SmsDatabaseService.prototype = {
 
   /**
    * nsISmsDatabaseService API
    */
 
   saveReceivedMessage: function saveReceivedMessage(sender, body, messageClass, date) {
     let receiver = this.mRIL.rilContext.icc ? this.mRIL.rilContext.icc.msisdn : null;
 
+    // Workaround an xpconnect issue with undefined string objects.
+    // See bug 808220
+    if (receiver === undefined || receiver === "undefined") {
+      receiver = null;
+    }
+
     let message = {delivery:       DELIVERY_RECEIVED,
                    deliveryStatus: DELIVERY_STATUS_SUCCESS,
                    sender:         sender,
                    receiver:       receiver,
                    body:           body,
                    messageClass:   messageClass,
                    timestamp:      date,
                    read:           FILTER_READ_UNREAD};
     return this.saveMessage(message);
   },
 
   saveSentMessage: function saveSentMessage(receiver, body, date) {
     let sender = this.mRIL.rilContext.icc ? this.mRIL.rilContext.icc.msisdn : null;
 
+    // Workaround an xpconnect issue with undefined string objects.
+    // See bug 808220
+    if (sender === undefined || sender === "undefined") {
+      sender = null;
+    }
+
     let message = {delivery:       DELIVERY_SENT,
                    deliveryStatus: DELIVERY_STATUS_PENDING,
                    sender:         sender,
                    receiver:       receiver,
                    body:           body,
                    messageClass:   MESSAGE_CLASS_NORMAL,
                    timestamp:      date,
                    read:           FILTER_READ_READ};