зеркало из https://github.com/mozilla/gecko-dev.git
Bug 885652 - B2G SMS: DOMRequest in sending SMS API does not trigger onsuccess or onerror function when the SIM card is not installed or radio is disabled. r=vicamo a=leo+
This commit is contained in:
Родитель
d91f2378da
Коммит
08d3ecb8a3
|
@ -1454,7 +1454,7 @@ MmsService.prototype = {
|
|||
send: function send(aParams, aRequest) {
|
||||
if (DEBUG) debug("send: aParams: " + JSON.stringify(aParams));
|
||||
if (aParams.receivers.length == 0) {
|
||||
aRequest.notifySendMmsMessageFailed(Ci.nsIMobileMessageCallback.INTERNAL_ERROR);
|
||||
aRequest.notifySendMessageFailed(Ci.nsIMobileMessageCallback.INTERNAL_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1497,14 +1497,14 @@ MmsService.prototype = {
|
|||
if (DEBUG) debug("Saving sending message is done. Start to send.");
|
||||
|
||||
// For radio disabled error.
|
||||
if(gMmsConnection.radioDisabled) {
|
||||
if (gMmsConnection.radioDisabled) {
|
||||
if (DEBUG) debug("Error! Radio is disabled when sending MMS.");
|
||||
sendTransactionCb(aDomMessage.id, Ci.nsIMobileMessageCallback.RADIO_DISABLED_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
// For SIM card is not ready.
|
||||
if(gRIL.rilContext.cardState != "ready") {
|
||||
if (gRIL.rilContext.cardState != "ready") {
|
||||
if (DEBUG) debug("Error! SIM card is not ready when sending MMS.");
|
||||
sendTransactionCb(aDomMessage.id, Ci.nsIMobileMessageCallback.NO_SIM_CARD_ERROR);
|
||||
return;
|
||||
|
|
|
@ -2840,6 +2840,30 @@ RadioInterfaceLayer.prototype = {
|
|||
// TODO bug 832140 handle !Components.isSuccessCode(rv)
|
||||
Services.obs.notifyObservers(domMessage, kSmsSendingObserverTopic, null);
|
||||
|
||||
// If the radio is disabled or the SIM card is not ready, just directly
|
||||
// return with the corresponding error code.
|
||||
let errorCode;
|
||||
if (!this._radioEnabled) {
|
||||
debug("Error! Radio is disabled when sending SMS.");
|
||||
errorCode = Ci.nsIMobileMessageCallback.RADIO_DISABLED_ERROR;
|
||||
} else if (this.rilContext.cardState != "ready") {
|
||||
debug("Error! SIM card is not ready when sending SMS.");
|
||||
errorCode = Ci.nsIMobileMessageCallback.NO_SIM_CARD_ERROR;
|
||||
}
|
||||
if (errorCode) {
|
||||
gMobileMessageDatabaseService
|
||||
.setMessageDelivery(domMessage.id,
|
||||
null,
|
||||
DOM_MOBILE_MESSAGE_DELIVERY_ERROR,
|
||||
RIL.GECKO_SMS_DELIVERY_STATUS_ERROR,
|
||||
function notifyResult(rv, domMessage) {
|
||||
// TODO bug 832140 handle !Components.isSuccessCode(rv)
|
||||
request.notifySendMessageFailed(errorCode);
|
||||
Services.obs.notifyObservers(domMessage, kSmsFailedObserverTopic, null);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Keep current SMS message info for sent/delivered notifications
|
||||
options.envelopeId = this.createSmsEnvelope({
|
||||
request: request,
|
||||
|
|
Загрузка…
Ссылка в новой задаче