Bug 921918 - 3.g/4: fix possible "undefined" value for messageRecord.envelopeIdIndex. r=gene

This commit is contained in:
Vicamo Yang 2013-11-25 15:19:30 +08:00
parent 160f535c41
commit cd6f1090ff
2 changed files with 10 additions and 6 deletions

View File

@ -2104,7 +2104,7 @@ MmsService.prototype = {
if (errorCode !== Ci.nsIMobileMessageCallback.SUCCESS_NO_ERROR) {
if (DEBUG) debug("Error! The params for sending MMS are invalid.");
sendTransactionCb(aDomMessage, errorCode);
sendTransactionCb(aDomMessage, errorCode, null);
return;
}
@ -2117,7 +2117,7 @@ MmsService.prototype = {
} catch (e) {
if (DEBUG) debug("Exception: fail to create a SendTransaction instance.");
sendTransactionCb(aDomMessage,
Ci.nsIMobileMessageCallback.INTERNAL_ERROR);
Ci.nsIMobileMessageCallback.INTERNAL_ERROR, null);
return;
}
sendTransaction.run(function callback(aMmsStatus, aMsg) {
@ -2134,10 +2134,8 @@ MmsService.prototype = {
} else {
errorCode = Ci.nsIMobileMessageCallback.SUCCESS_NO_ERROR;
}
let envelopeId = null;
if (aMsg) {
envelopeId = aMsg.headers ? aMsg.headers["message-id"] : null;
}
let envelopeId =
aMsg && aMsg.headers && aMsg.headers["message-id"] || null;
sendTransactionCb(aDomMessage, errorCode, envelopeId);
});
});

View File

@ -1209,6 +1209,12 @@ MobileMessageDatabaseService.prototype = {
delete messageRecord.transactionId;
}
// xpconnect gives "undefined" for an unassigned argument of an interface
// method.
if (messageRecord.envelopeIdIndex === "undefined") {
delete messageRecord.envelopeIdIndex;
}
cursor.update(messageRecord);
cursor.continue();
};