Bug 974260: fix potential xpcshell errors in test_ril_worker_icc.js when RILQUIRKS_V5_LEGACY is set to true. r=yoshi

This commit is contained in:
Vicamo Yang 2014-02-19 20:02:16 +08:00
Родитель efb01cca88
Коммит 07cdd0806b
2 изменённых файлов: 20 добавлений и 25 удалений

Просмотреть файл

@ -13941,16 +13941,14 @@ ICCContactHelperObject.prototype = {
* @param onerror Callback to be called when error.
*/
addICCContact: function(appType, contactType, contact, pin2, onsuccess, onerror) {
let ICCContactHelper = this.context.ICCContactHelper;
let foundFreeCb = function foundFreeCb(pbrIndex, recordId) {
let foundFreeCb = (function foundFreeCb(pbrIndex, recordId) {
contact.pbrIndex = pbrIndex;
contact.recordId = recordId;
ICCContactHelper.updateICCContact(appType, contactType, contact, pin2, onsuccess, onerror);
};
this.updateICCContact(appType, contactType, contact, pin2, onsuccess, onerror);
}).bind(this);
// Find free record first.
ICCContactHelper.findFreeICCContact(appType, contactType, foundFreeCb, onerror);
this.findFreeICCContact(appType, contactType, foundFreeCb, onerror);
},
/**
@ -14061,7 +14059,6 @@ ICCContactHelperObject.prototype = {
* @param onerror Callback to be called when error.
*/
readSupportedPBRFields: function(pbr, contacts, onsuccess, onerror) {
let ICCContactHelper = this.context.ICCContactHelper;
let fieldIndex = 0;
(function readField() {
let field = USIM_PBR_FIELDS[fieldIndex];
@ -14073,8 +14070,8 @@ ICCContactHelperObject.prototype = {
return;
}
ICCContactHelper.readPhonebookField(pbr, contacts, field, readField, onerror);
})();
this.readPhonebookField(pbr, contacts, field, readField.bind(this), onerror);
}).call(this);
},
/**
@ -14094,7 +14091,6 @@ ICCContactHelperObject.prototype = {
return;
}
let ICCContactHelper = this.context.ICCContactHelper;
(function doReadContactField(n) {
if (n >= contacts.length) {
// All contact's fields are read.
@ -14105,9 +14101,9 @@ ICCContactHelperObject.prototype = {
}
// get n-th contact's field.
ICCContactHelper.readContactField(
pbr, contacts[n], field, doReadContactField.bind(this, n + 1), onerror);
})(0);
this.readContactField(pbr, contacts[n], field,
doReadContactField.bind(this, n + 1), onerror);
}).call(this, 0);
},
/**
@ -14258,7 +14254,6 @@ ICCContactHelperObject.prototype = {
* @param onerror Callback to be called when error.
*/
updateSupportedPBRFields: function(pbr, contact, onsuccess, onerror) {
let ICCContactHelper = this.context.ICCContactHelper;
let fieldIndex = 0;
(function updateField() {
let field = USIM_PBR_FIELDS[fieldIndex];
@ -14272,12 +14267,12 @@ ICCContactHelperObject.prototype = {
// Check if PBR has this field.
if (!pbr[field]) {
updateField();
updateField.call(this);
return;
}
ICCContactHelper.updateContactField(pbr, contact, field, updateField, onerror);
})();
this.updateContactField(pbr, contact, field, updateField.bind(this), onerror);
}).call(this);
},
/**

Просмотреть файл

@ -674,7 +674,7 @@ add_test(function test_icc_get_card_lock_state_fdn() {
this.readInt32();
// String Array Length.
do_check_eq(this.readInt32(), worker.RILQUIRKS_V5_LEGACY ? 3 : 4);
do_check_eq(this.readInt32(), ril.v5Legacy ? 3 : 4);
// Facility.
do_check_eq(this.readString(), ICC_CB_FACILITY_FDN);
@ -687,7 +687,7 @@ add_test(function test_icc_get_card_lock_state_fdn() {
ICC_SERVICE_CLASS_DATA |
ICC_SERVICE_CLASS_FAX).toString());
if (!worker.RILQUIRKS_V5_LEGACY) {
if (!ril.v5Legacy) {
// AID. Ignore because it's from modem.
this.readInt32();
}
@ -1120,7 +1120,7 @@ add_test(function test_update_email() {
// pin2.
do_check_eq(this.readString(), null);
if (!worker.RILQUIRKS_V5_LEGACY) {
if (!ril.v5Legacy) {
// AID. Ignore because it's from modem.
this.readInt32();
}
@ -1266,7 +1266,7 @@ add_test(function test_update_anr() {
// pin2.
do_check_eq(this.readString(), null);
if (!worker.RILQUIRKS_V5_LEGACY) {
if (!ril.v5Legacy) {
// AID. Ignore because it's from modem.
this.readInt32();
}
@ -1403,7 +1403,7 @@ add_test(function test_update_iap() {
// pin2.
do_check_eq(this.readString(), null);
if (!worker.RILQUIRKS_V5_LEGACY) {
if (!ril.v5Legacy) {
// AID. Ignore because it's from modem.
this.readInt32();
}
@ -1479,7 +1479,7 @@ add_test(function test_update_adn_like() {
do_check_eq(this.readString(), "1111");
}
if (!worker.RILQUIRKS_V5_LEGACY) {
if (!ril.v5Legacy) {
// AID. Ignore because it's from modem.
this.readInt32();
}
@ -2227,10 +2227,10 @@ add_test(function test_icc_permanent_blocked() {
add_test(function test_set_icc_card_lock_facility_lock() {
let worker = newUint8Worker();
let context = worker.ContextPool._contexts[0];
worker.RILQUIRKS_V5_LEGACY = false;
let aid = "123456789";
let ril = context.RIL;
ril.aid = aid;
ril.v5Legacy = false;
let buf = context.Buf;
let GECKO_CARDLOCK_TO_FACILITIY_LOCK = {};
@ -2728,7 +2728,7 @@ add_test(function test_update_mwis() {
// pin2.
do_check_eq(this.readString(), null);
if (!worker.RILQUIRKS_V5_LEGACY) {
if (!ril.v5Legacy) {
// AID. Ignore because it's from modem.
this.readInt32();
}