Bug 915987 - Part 1: reuse nsIDOMContact.id. r=vicamo

This commit is contained in:
"allstars.chh" 2013-09-12 23:52:07 +02:00
parent b9587869f5
commit 2ca3a937e0
2 changed files with 14 additions and 0 deletions

View File

@ -1025,6 +1025,8 @@ RILContentHelper.prototype = {
iccContact.email = contact.email[0].value;
}
iccContact.id = contact.id;
cpmm.sendAsyncMessage("RIL:UpdateIccContact", {
clientId: 0,
data: {
@ -1683,6 +1685,7 @@ RILContentHelper.prototype = {
}
contact.init(prop);
contact.id = message.iccid + c.recordId;
return contact;
});

View File

@ -876,6 +876,7 @@ let RIL = {
function onsuccess(contacts) {
// Reuse 'options' to get 'requestId' and 'contactType'.
options.contacts = contacts;
options.iccid = RIL.iccInfo.iccid;
RIL.sendChromeMessage(options);
}.bind(this),
function onerror(errorMsg) {
@ -908,6 +909,16 @@ let RIL = {
return;
}
let contact = options.contact;
let iccid = RIL.iccInfo.iccid;
if (contact.id.startsWith(iccid)) {
contact.recordId = contact.id.substring(iccid.length);
}
if (DEBUG) {
debug("Update ICC Contact " + JSON.stringify(contact));
}
// If contact has 'recordId' property, updates corresponding record.
// If not, inserts the contact into a free record.
if (options.contact.recordId) {