From 4c7e6ba39b240cd08a39408d03cf4bf41479e4a8 Mon Sep 17 00:00:00 2001 From: Bevis Tseng Date: Thu, 2 Jul 2015 16:37:09 +0800 Subject: [PATCH] Bug 1167507 - Wrap the input of the FDN Contact to MozIcc.updateContact() as a mozContact. --- apps/settings/js/modules/fdn_context.js | 10 ++++++++-- tests/atoms/gaia_data_layer.js | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/settings/js/modules/fdn_context.js b/apps/settings/js/modules/fdn_context.js index 00852cc5ef40..fb0d3bd62e9b 100644 --- a/apps/settings/js/modules/fdn_context.js +++ b/apps/settings/js/modules/fdn_context.js @@ -83,7 +83,7 @@ define(function() { * @param {String} action * @param {Number} options.cardIndex * @param {Object} options.contact - * @return {Object} + * @return {mozContact} */ createAction: function(action, options) { var simContact = {}; @@ -109,7 +109,13 @@ define(function() { simContact.tel[0].value = ''; break; } - return simContact; + + var result = new window.mozContact(simContact); + if ('id' in simContact) { + result.id = simContact.id; + } + + return result; } }; diff --git a/tests/atoms/gaia_data_layer.js b/tests/atoms/gaia_data_layer.js index 91073c13cdd2..7e85d79db34a 100644 --- a/tests/atoms/gaia_data_layer.js +++ b/tests/atoms/gaia_data_layer.js @@ -110,7 +110,12 @@ var GaiaDataLayer = { var iccId = window.navigator.mozIccManager.iccIds[0]; var icc = window.navigator.mozIccManager.getIccById(iccId); - var req = icc.updateContact(aType, aContact); + var simContact = new window.mozContact(aContact); + if ('id' in aContact) { + simContact.id = aContact.id; + } + + var req = icc.updateContact(aType, simContact); req.onsuccess = function() { console.log('success saving contact to SIM'); marionetteScriptFinished(req.result);