diff --git a/dom/mobilemessage/src/gonk/MmsService.js b/dom/mobilemessage/src/gonk/MmsService.js index 4e1106f41363..8d5f6d1b7509 100644 --- a/dom/mobilemessage/src/gonk/MmsService.js +++ b/dom/mobilemessage/src/gonk/MmsService.js @@ -1955,8 +1955,7 @@ MmsService.prototype = { .setMessageReadStatusByEnvelopeId(envelopeId, address, readStatus, (function(aRv, aDomMessage) { if (!Components.isSuccessCode(aRv)) { - // Notifying observers the read status is error. - Services.obs.notifyObservers(aDomMessage, kSmsReadSuccessObserverTopic, null); + if (DEBUG) debug("Failed to update read status: " + aRv); return; } @@ -2171,7 +2170,7 @@ MmsService.prototype = { // If the messsage has been deleted (because the sending process is // cancelled), we don't need to reset the its delievery state/status. if (aErrorCode == Ci.nsIMobileMessageCallback.NOT_FOUND_ERROR) { - aRequest.notifySendMessageFailed(aErrorCode); + aRequest.notifySendMessageFailed(aErrorCode, aDomMessage); Services.obs.notifyObservers(aDomMessage, kSmsFailedObserverTopic, null); return; } @@ -2188,7 +2187,7 @@ MmsService.prototype = { // TODO bug 832140 handle !Components.isSuccessCode(aRv) if (!isSentSuccess) { if (DEBUG) debug("Sending MMS failed."); - aRequest.notifySendMessageFailed(aErrorCode); + aRequest.notifySendMessageFailed(aErrorCode, aDomMessage); Services.obs.notifyObservers(aDomMessage, kSmsFailedObserverTopic, null); return; } @@ -2214,7 +2213,8 @@ MmsService.prototype = { if (!Components.isSuccessCode(aRv)) { if (DEBUG) debug("Error! Fail to save sending message! rv = " + aRv); aRequest.notifySendMessageFailed( - gMobileMessageDatabaseService.translateCrErrorToMessageCallbackError(aRv)); + gMobileMessageDatabaseService.translateCrErrorToMessageCallbackError(aRv), + aDomMessage); Services.obs.notifyObservers(aDomMessage, kSmsFailedObserverTopic, null); return; } diff --git a/dom/system/gonk/RadioInterfaceLayer.js b/dom/system/gonk/RadioInterfaceLayer.js index 9761dc440664..77358a478ec2 100644 --- a/dom/system/gonk/RadioInterfaceLayer.js +++ b/dom/system/gonk/RadioInterfaceLayer.js @@ -4082,7 +4082,8 @@ RadioInterface.prototype = { if (!Components.isSuccessCode(rv)) { if (DEBUG) this.debug("Error! Fail to save sending message! rv = " + rv); request.notifySendMessageFailed( - gMobileMessageDatabaseService.translateCrErrorToMessageCallbackError(rv)); + gMobileMessageDatabaseService.translateCrErrorToMessageCallbackError(rv), + domMessage); Services.obs.notifyObservers(domMessage, kSmsFailedObserverTopic, null); return; } @@ -4108,7 +4109,7 @@ RadioInterface.prototype = { } if (errorCode) { if (silent) { - request.notifySendMessageFailed(errorCode); + request.notifySendMessageFailed(errorCode, domMessage); return; } @@ -4120,7 +4121,7 @@ RadioInterface.prototype = { null, function notifyResult(rv, domMessage) { // TODO bug 832140 handle !Components.isSuccessCode(rv) - request.notifySendMessageFailed(errorCode); + request.notifySendMessageFailed(errorCode, domMessage); Services.obs.notifyObservers(domMessage, kSmsFailedObserverTopic, null); }); return; @@ -4150,7 +4151,25 @@ RadioInterface.prototype = { } if (context.silent) { - context.request.notifySendMessageFailed(error); + // There is no way to modify nsIDOMMozSmsMessage attributes as they + // are read only so we just create a new sms instance to send along + // with the notification. + let sms = context.sms; + context.request.notifySendMessageFailed( + error, + gMobileMessageService.createSmsMessage(sms.id, + sms.threadId, + sms.iccId, + DOM_MOBILE_MESSAGE_DELIVERY_ERROR, + RIL.GECKO_SMS_DELIVERY_STATUS_ERROR, + sms.sender, + sms.receiver, + sms.body, + sms.messageClass, + sms.timestamp, + 0, + 0, + sms.read)); return false; } @@ -4162,7 +4181,7 @@ RadioInterface.prototype = { null, function notifyResult(rv, domMessage) { // TODO bug 832140 handle !Components.isSuccessCode(rv) - context.request.notifySendMessageFailed(error); + context.request.notifySendMessageFailed(error, domMessage); Services.obs.notifyObservers(domMessage, kSmsFailedObserverTopic, null); }); return false;