Bug 861095 - B2G MMS: handle MMS message in NotifyCursorResult() as well. r=mounir, a=leo+
authorVicamo Yang <vyang@mozilla.com>
Thu, 18 Apr 2013 09:10:00 +0800
changeset 119116 8e9066cd6a5d9446384b7b1573de1c01e42b25e9
parent 119115 addd4bc121bded0bd33bb06cbd29bd06ee4c768e
child 119117 f7fc76b6fa846e734311047284dfd4706470528d
push id680
push uservyang@mozilla.com
push dateThu, 18 Apr 2013 01:11:41 +0000
reviewersmounir, leo
bugs861095
milestone18.0
Bug 861095 - B2G MMS: handle MMS message in NotifyCursorResult() as well. r=mounir, a=leo+
dom/mobilemessage/src/ipc/SmsParent.cpp
--- a/dom/mobilemessage/src/ipc/SmsParent.cpp
+++ b/dom/mobilemessage/src/ipc/SmsParent.cpp
@@ -575,23 +575,23 @@ SmsRequestParent::NotifyMessageSent(nsIS
   nsCOMPtr<nsIDOMMozMmsMessage> mms = do_QueryInterface(aMessage);
   if (mms) {
     MmsMessage *msg = static_cast<MmsMessage*>(mms.get());
     ContentParent *parent = static_cast<ContentParent*>(Manager()->Manager());
     MmsMessageData data;
     if (!msg->GetData(parent, data)) {
       return NS_ERROR_FAILURE;
     }
-    return SendReply(MessageReply(ReplyMessageSend(MobileMessageData(data))));
+    return SendReply(ReplyMessageSend(MobileMessageData(data)));
   }
 
   nsCOMPtr<nsIDOMMozSmsMessage> sms = do_QueryInterface(aMessage);
   if (sms) {
     SmsMessage* msg = static_cast<SmsMessage*>(sms.get());
-    return SendReply(MessageReply(ReplyMessageSend(MobileMessageData(msg->GetData()))));
+    return SendReply(ReplyMessageSend(MobileMessageData(msg->GetData())));
   }
 
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 SmsRequestParent::NotifySendMessageFailed(int32_t aError)
 {
@@ -604,23 +604,23 @@ SmsRequestParent::NotifyMessageGot(nsISu
   nsCOMPtr<nsIDOMMozMmsMessage> mms = do_QueryInterface(aMessage);
   if (mms) {
     MmsMessage *msg = static_cast<MmsMessage*>(mms.get());
     ContentParent *parent = static_cast<ContentParent*>(Manager()->Manager());
     MmsMessageData data;
     if (!msg->GetData(parent, data)) {
       return NS_ERROR_FAILURE;
     }
-    return SendReply(MessageReply(ReplyGetMessage(MobileMessageData(data))));
+    return SendReply(ReplyGetMessage(MobileMessageData(data)));
   }
 
   nsCOMPtr<nsIDOMMozSmsMessage> sms = do_QueryInterface(aMessage);
   if (sms) {
     SmsMessage* msg = static_cast<SmsMessage*>(sms.get());
-    return SendReply(MessageReply(ReplyGetMessage(MobileMessageData(msg->GetData()))));
+    return SendReply(ReplyGetMessage(MobileMessageData(msg->GetData())));
   }
 
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 SmsRequestParent::NotifyGetMessageFailed(int32_t aError)
 {
@@ -739,23 +739,35 @@ MobileMessageCursorParent::NotifyCursorE
 NS_IMETHODIMP
 MobileMessageCursorParent::NotifyCursorResult(nsISupports* aResult)
 {
   // The child process could die before this asynchronous notification, in which
   // case ActorDestroy() was called and mContinueCallback is now null. Return an
   // error here to avoid sending a message to the dead process.
   NS_ENSURE_TRUE(mContinueCallback, NS_ERROR_FAILURE);
 
-  nsCOMPtr<nsIDOMMozSmsMessage> iMessage = do_QueryInterface(aResult);
-  if (iMessage) {
+  nsCOMPtr<nsIDOMMozSmsMessage> iSms = do_QueryInterface(aResult);
+  if (iSms) {
     SmsMessage* message = static_cast<SmsMessage*>(aResult);
     return SendNotifyResult(MobileMessageCursorData(message->GetData()))
       ? NS_OK : NS_ERROR_FAILURE;
   }
 
+  nsCOMPtr<nsIDOMMozMmsMessage> iMms = do_QueryInterface(aResult);
+  if (iMms) {
+    MmsMessage* message = static_cast<MmsMessage*>(aResult);
+    ContentParent* parent = static_cast<ContentParent*>(Manager()->Manager());
+    MmsMessageData data;
+    if (!message->GetData(parent, data)) {
+      return NS_ERROR_FAILURE;
+    }
+    return SendNotifyResult(MobileMessageCursorData(data))
+      ? NS_OK : NS_ERROR_FAILURE;
+  }
+
   nsCOMPtr<nsIDOMMozMobileMessageThread> iThread = do_QueryInterface(aResult);
   if (iThread) {
     MobileMessageThread* thread = static_cast<MobileMessageThread*>(aResult);
     return SendNotifyResult(MobileMessageCursorData(thread->GetData()))
       ? NS_OK : NS_ERROR_FAILURE;
   }
 
   MOZ_NOT_REACHED("Received invalid response parameters!");