Bug 1092013 - Part 1: mozMobileConnection.data.cell is reset to null unexpectedly in MobileConnectionService. r=hsinyi

This commit is contained in:
Edgar Chen 2014-10-31 15:15:47 +08:00
parent 9cc321b6d8
commit 134c9ac6cf

View File

@ -478,6 +478,12 @@ MobileConnectionProvider.prototype = {
return true;
},
/**
* The design of this updating function is to update the attribute in
* |aDestInfo| *only if* new data (e.g. aSrcInfo) contains the same attribute.
* Thus, for the attribute in |aDestInfo| that isn't showed in |aSrcInfo|, it
* should just keep the original value unchanged.
*/
_updateConnectionInfo: function(aDestInfo, aSrcInfo) {
let isUpdated = false;
for (let key in aSrcInfo) {
@ -502,15 +508,13 @@ MobileConnectionProvider.prototype = {
} else {
aDestInfo.network = this._operatorInfo;
if (aSrcInfo.cell == null) {
if (aDestInfo.cell != null) {
isUpdated = true;
aDestInfo.cell = null;
}
} else {
if (aDestInfo.cell == null) {
// If no new cell data is passed, we should just keep the original cell
// data unchanged.
if (aSrcInfo.cell) {
if (!aDestInfo.cell) {
aDestInfo.cell = new MobileCellInfo();
}
isUpdated = this._updateInfo(aDestInfo.cell, aSrcInfo.cell) || isUpdated;
}
}
@ -520,6 +524,12 @@ MobileConnectionProvider.prototype = {
return isUpdated;
},
/**
* The design of this updating function is to update the attribute in
* |aDestInfo| *only if* new data (e.g. aSrcInfo) contains the same attribute.
* Thus, for the attribute in |aDestInfo| that isn't showed in |aSrcInfo|, it
* should just keep the original value unchanged.
*/
_updateInfo: function(aDestInfo, aSrcInfo) {
let isUpdated = false;
for (let key in aSrcInfo) {