From 9a6aaf19c0dc66138df52442fc3046ad1b895cae Mon Sep 17 00:00:00 2001 From: Edgar Chen Date: Mon, 12 May 2014 18:29:53 +0800 Subject: [PATCH] Bug 991582 - Part 2: Handle the result of RIL request in a consistent way. r=aknow --- .../gonk/CellBroadcastService.js | 4 +- dom/system/gonk/ril_worker.js | 63 +++++-------------- .../test_ril_worker_cellbroadcast_config.js | 2 +- dom/system/gonk/tests/test_ril_worker_cf.js | 4 +- dom/system/gonk/tests/test_ril_worker_clip.js | 4 +- dom/system/gonk/tests/test_ril_worker_clir.js | 6 +- dom/system/gonk/tests/test_ril_worker_cw.js | 4 -- dom/system/gonk/tests/test_ril_worker_mmi.js | 26 ++++---- .../gonk/tests/test_ril_worker_mmi_cf.js | 3 - dom/telephony/gonk/TelephonyService.js | 18 +++--- 10 files changed, 44 insertions(+), 90 deletions(-) diff --git a/dom/cellbroadcast/gonk/CellBroadcastService.js b/dom/cellbroadcast/gonk/CellBroadcastService.js index 5b11d5f5cf8..a8490378c27 100644 --- a/dom/cellbroadcast/gonk/CellBroadcastService.js +++ b/dom/cellbroadcast/gonk/CellBroadcastService.js @@ -156,7 +156,7 @@ CellBroadcastService.prototype = { .getRadioInterface(clientId).sendWorkerMessage("setCellBroadcastSearchList", { searchList: newSearchList }, (function callback(aResponse) { - if (DEBUG && !aResponse.success) { + if (DEBUG && aResponse.errorMsg) { debug("Failed to set new search list: " + newSearchList + " to client id: " + clientId); } @@ -165,7 +165,7 @@ CellBroadcastService.prototype = { if (responses.length == numOfRilClients) { let successCount = 0; for (let i = 0; i < responses.length; i++) { - if (responses[i].success) { + if (!responses[i].errorMsg) { successCount++; } } diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js index a6682e9ef99..82eb7671ded 100644 --- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -1582,16 +1582,15 @@ RilObject.prototype = { try { let str = getSearchListStr(options.searchList); this.cellBroadcastConfigs.MMI = this._convertCellBroadcastSearchList(str); - options.success = true; } catch (e) { if (DEBUG) { this.context.debug("Invalid Cell Broadcast search list: " + e); } - options.success = false; + options.errorMsg = GECKO_ERROR_UNSPECIFIED_ERROR; } this.sendChromeMessage(options); - if (!options.success) { + if (options.errorMsg) { return; } @@ -1853,7 +1852,6 @@ RilObject.prototype = { } let _sendMMIError = (function(errorMsg) { - options.success = false; options.errorMsg = errorMsg; this.sendChromeMessage(options); }).bind(this); @@ -2028,7 +2026,6 @@ RilObject.prototype = { return; } // If we already had the device's IMEI, we just send it to chrome. - options.success = true; options.statusMessage = this.IMEI; this.sendChromeMessage(options); return; @@ -2163,7 +2160,6 @@ RilObject.prototype = { */ sendUSSD: function(options, checkSession = true) { if (checkSession && !this._ussdSession) { - options.success = false; options.errorMsg = GECKO_ERROR_GENERIC_FAILURE; this.sendChromeMessage(options); return; @@ -2889,7 +2885,6 @@ RilObject.prototype = { * Helper for processing responses of functions such as enterICC* and changeICC*. */ _processEnterAndChangeICCResponses: function(length, options) { - options.success = !options.errorMsg; options.retryCount = length ? this.context.Buf.readInt32List()[0] : -1; if (options.rilMessageType != "sendMMI") { this.sendChromeMessage(options); @@ -2898,7 +2893,7 @@ RilObject.prototype = { let serviceCode = options.mmi.serviceCode; - if (options.success) { + if (!options.errorMsg) { switch (serviceCode) { case MMI_SC_PIN: options.statusMessage = MMI_SM_KS_PIN_CHANGED; @@ -4381,7 +4376,6 @@ RilObject.prototype = { return; } - options.success = !options.errorMsg; this.sendChromeMessage(options); }, @@ -4753,7 +4747,7 @@ RilObject.prototype[REQUEST_SEND_USSD] = function REQUEST_SEND_USSD(length, opti if (DEBUG) { this.context.debug("REQUEST_SEND_USSD " + JSON.stringify(options)); } - options.success = (this._ussdSession = !options.errorMsg); + this._ussdSession = !options.errorMsg; this.sendChromeMessage(options); }; RilObject.prototype[REQUEST_CANCEL_USSD] = function REQUEST_CANCEL_USSD(length, options) { @@ -4761,8 +4755,7 @@ RilObject.prototype[REQUEST_CANCEL_USSD] = function REQUEST_CANCEL_USSD(length, this.context.debug("REQUEST_CANCEL_USSD" + JSON.stringify(options)); } - options.success = !options.errorMsg; - this._ussdSession = !options.success; + this._ussdSession = !!options.errorMsg; // The cancelUSSD is triggered by ril_worker itself. if (this.cachedUSSDRequest) { @@ -4775,8 +4768,7 @@ RilObject.prototype[REQUEST_CANCEL_USSD] = function REQUEST_CANCEL_USSD(length, this.sendChromeMessage(options); }; RilObject.prototype[REQUEST_GET_CLIR] = function REQUEST_GET_CLIR(length, options) { - options.success = !options.errorMsg; - if (!options.success) { + if (options.errorMsg) { this.sendChromeMessage(options); return; } @@ -4784,7 +4776,6 @@ RilObject.prototype[REQUEST_GET_CLIR] = function REQUEST_GET_CLIR(length, option let Buf = this.context.Buf; let bufLength = Buf.readInt32(); if (!bufLength || bufLength < 2) { - options.success = false; options.errorMsg = GECKO_ERROR_GENERIC_FAILURE; this.sendChromeMessage(options); return; @@ -4806,7 +4797,6 @@ RilObject.prototype[REQUEST_GET_CLIR] = function REQUEST_GET_CLIR(length, option break; // Unknown (e.g. no network, etc.). case 2: - options.success = false; options.errorMsg = MMI_ERROR_KS_ERROR; break; // CLIR temporary mode presentation restricted. @@ -4824,7 +4814,6 @@ RilObject.prototype[REQUEST_GET_CLIR] = function REQUEST_GET_CLIR(length, option options.statusMessage = MMI_SM_KS_CLIR_DEFAULT_ON_NEXT_CALL_OFF; break; default: - options.success = false; options.errorMsg = GECKO_ERROR_GENERIC_FAILURE; break; } @@ -4844,13 +4833,11 @@ RilObject.prototype[REQUEST_GET_CLIR] = function REQUEST_GET_CLIR(length, option options.statusMessage = MMI_SM_KS_CLIR_DEFAULT_OFF_NEXT_CALL_ON; break; default: - options.success = false; options.errorMsg = GECKO_ERROR_GENERIC_FAILURE; break; } break; default: - options.success = false; options.errorMsg = GECKO_ERROR_GENERIC_FAILURE; break; } @@ -4863,8 +4850,8 @@ RilObject.prototype[REQUEST_SET_CLIR] = function REQUEST_SET_CLIR(length, option // The request was made by ril_worker itself automatically. Don't report. return; } - options.success = !options.errorMsg; - if (options.success && options.rilMessageType === "sendMMI") { + + if (!options.errorMsg && options.rilMessageType === "sendMMI") { switch (options.procedure) { case MMI_PROCEDURE_ACTIVATION: options.statusMessage = MMI_SM_KS_SERVICE_ENABLED; @@ -4879,8 +4866,7 @@ RilObject.prototype[REQUEST_SET_CLIR] = function REQUEST_SET_CLIR(length, option RilObject.prototype[REQUEST_QUERY_CALL_FORWARD_STATUS] = function REQUEST_QUERY_CALL_FORWARD_STATUS(length, options) { - options.success = !options.errorMsg; - if (!options.success) { + if (options.errorMsg) { this.sendChromeMessage(options); return; } @@ -4891,7 +4877,6 @@ RilObject.prototype[REQUEST_QUERY_CALL_FORWARD_STATUS] = rulesLength = Buf.readInt32(); } if (!rulesLength) { - options.success = false; options.errorMsg = GECKO_ERROR_GENERIC_FAILURE; this.sendChromeMessage(options); return; @@ -4919,8 +4904,7 @@ RilObject.prototype[REQUEST_QUERY_CALL_FORWARD_STATUS] = }; RilObject.prototype[REQUEST_SET_CALL_FORWARD] = function REQUEST_SET_CALL_FORWARD(length, options) { - options.success = !options.errorMsg; - if (options.success && options.rilMessageType === "sendMMI") { + if (!options.errorMsg && options.rilMessageType === "sendMMI") { switch (options.action) { case CALL_FORWARD_ACTION_ENABLE: options.statusMessage = MMI_SM_KS_SERVICE_ENABLED; @@ -4940,8 +4924,7 @@ RilObject.prototype[REQUEST_SET_CALL_FORWARD] = }; RilObject.prototype[REQUEST_QUERY_CALL_WAITING] = function REQUEST_QUERY_CALL_WAITING(length, options) { - options.success = !options.errorMsg; - if (!options.success) { + if (options.errorMsg) { if (options.callback) { // Prevent DataCloneError when sending chrome messages. delete options.callback; @@ -4964,8 +4947,7 @@ RilObject.prototype[REQUEST_QUERY_CALL_WAITING] = }; RilObject.prototype[REQUEST_SET_CALL_WAITING] = function REQUEST_SET_CALL_WAITING(length, options) { - options.success = !options.errorMsg; - if (!options.success) { + if (options.errorMsg) { if (options.callback) { // Prevent DataCloneError when sending chrome messages. delete options.callback; @@ -4991,8 +4973,7 @@ RilObject.prototype[REQUEST_GET_IMEI] = function REQUEST_GET_IMEI(length, option return; } - options.success = !options.errorMsg; - if (options.success && this.IMEI == null) { + if (!options.errorMsg && this.IMEI == null) { options.errorMsg = GECKO_ERROR_GENERIC_FAILURE; } options.statusMessage = this.IMEI; @@ -5012,14 +4993,12 @@ RilObject.prototype[REQUEST_DEACTIVATE_DATA_CALL] = function REQUEST_DEACTIVATE_ this.sendChromeMessage(options); }; RilObject.prototype[REQUEST_QUERY_FACILITY_LOCK] = function REQUEST_QUERY_FACILITY_LOCK(length, options) { - options.success = !options.errorMsg; - if (!options.success) { + if (options.errorMsg) { this.sendChromeMessage(options); return; } if (!length) { - options.success = false; options.errorMsg = GECKO_ERROR_GENERIC_FAILURE; this.sendChromeMessage(options); return; @@ -5055,10 +5034,9 @@ RilObject.prototype[REQUEST_QUERY_FACILITY_LOCK] = function REQUEST_QUERY_FACILI this.sendChromeMessage(options); }; RilObject.prototype[REQUEST_SET_FACILITY_LOCK] = function REQUEST_SET_FACILITY_LOCK(length, options) { - options.success = !options.errorMsg; options.retryCount = length ? this.context.Buf.readInt32List()[0] : -1; - if (options.success && (options.rilMessageType === "sendMMI")) { + if (!options.errorMsg && (options.rilMessageType === "sendMMI")) { switch (options.procedure) { case MMI_PROCEDURE_ACTIVATION: options.statusMessage = MMI_SM_KS_SERVICE_ENABLED; @@ -5123,7 +5101,6 @@ RilObject.prototype[REQUEST_QUERY_AVAILABLE_NETWORKS] = function REQUEST_QUERY_A this.sendChromeMessage(options); }; RilObject.prototype[REQUEST_DTMF_START] = function REQUEST_DTMF_START(length, options) { - options.success = !options.errorMsg; this.sendChromeMessage(options); }; RilObject.prototype[REQUEST_DTMF_STOP] = null; @@ -5141,8 +5118,7 @@ RilObject.prototype[REQUEST_SEPARATE_CONNECTION] = function REQUEST_SEPARATE_CON RilObject.prototype[REQUEST_SET_MUTE] = null; RilObject.prototype[REQUEST_GET_MUTE] = null; RilObject.prototype[REQUEST_QUERY_CLIP] = function REQUEST_QUERY_CLIP(length, options) { - options.success = !options.errorMsg; - if (!options.success) { + if (options.errorMsg) { this.sendChromeMessage(options); return; } @@ -5150,7 +5126,6 @@ RilObject.prototype[REQUEST_QUERY_CLIP] = function REQUEST_QUERY_CLIP(length, op let Buf = this.context.Buf; let bufLength = Buf.readInt32(); if (!bufLength) { - options.success = false; options.errorMsg = GECKO_ERROR_GENERIC_FAILURE; this.sendChromeMessage(options); return; @@ -5171,7 +5146,6 @@ RilObject.prototype[REQUEST_QUERY_CLIP] = function REQUEST_QUERY_CLIP(length, op options.statusMessage = MMI_SM_KS_SERVICE_ENABLED; break; default: - options.success = false; options.errorMsg = MMI_ERROR_KS_ERROR; break; } @@ -5520,7 +5494,6 @@ RilObject.prototype[REQUEST_EXIT_EMERGENCY_CALLBACK_MODE] = function REQUEST_EXI return; } - options.success = !options.errorMsg; this.sendChromeMessage(options); }; RilObject.prototype[REQUEST_GET_SMSC_ADDRESS] = function REQUEST_GET_SMSC_ADDRESS(length, options) { @@ -5639,11 +5612,9 @@ RilObject.prototype[REQUEST_SET_DATA_SUBSCRIPTION] = function REQUEST_SET_DATA_S // The request was made by ril_worker itself. Don't report. return; } - options.success = !options.errorMsg; this.sendChromeMessage(options); }; RilObject.prototype[REQUEST_GET_UNLOCK_RETRY_COUNT] = function REQUEST_GET_UNLOCK_RETRY_COUNT(length, options) { - options.success = !options.errorMsg; options.retryCount = length ? this.context.Buf.readInt32List()[0] : -1; this.sendChromeMessage(options); }; @@ -5652,11 +5623,9 @@ RilObject.prototype[RIL_REQUEST_GPRS_ATTACH] = function RIL_REQUEST_GPRS_ATTACH( // The request was made by ril_worker itself. Don't report. return; } - options.success = !options.errorMsg; this.sendChromeMessage(options); }; RilObject.prototype[RIL_REQUEST_GPRS_DETACH] = function RIL_REQUEST_GPRS_DETACH(length, options) { - options.success = !options.errorMsg; this.sendChromeMessage(options); }; RilObject.prototype[UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED] = function UNSOLICITED_RESPONSE_RADIO_STATE_CHANGED() { diff --git a/dom/system/gonk/tests/test_ril_worker_cellbroadcast_config.js b/dom/system/gonk/tests/test_ril_worker_cellbroadcast_config.js index aa1a5616bb2..92b3639ccf6 100644 --- a/dom/system/gonk/tests/test_ril_worker_cellbroadcast_config.js +++ b/dom/system/gonk/tests/test_ril_worker_cellbroadcast_config.js @@ -156,7 +156,7 @@ add_test(function test_ril_worker_cellbroadcast_set_search_list() { context.RIL.setCellBroadcastSearchList(options); // Enforce the MMI result to string for comparison. equal("" + context.RIL.cellBroadcastConfigs.MMI, aExpected); - equal(options.success, true); + do_check_eq(options.errorMsg, undefined); } let searchListStr = "1,2,3,4"; diff --git a/dom/system/gonk/tests/test_ril_worker_cf.js b/dom/system/gonk/tests/test_ril_worker_cf.js index a04837b4855..b8db716b7c5 100644 --- a/dom/system/gonk/tests/test_ril_worker_cf.js +++ b/dom/system/gonk/tests/test_ril_worker_cf.js @@ -71,7 +71,7 @@ add_test(function test_setCallForward_unconditional() { let postedMessage = workerHelper.postedMessage; - ok(postedMessage.success); + equal(postedMessage.errorMsg, undefined); run_next_test(); }); @@ -115,7 +115,7 @@ add_test(function test_queryCallForwardStatus_unconditional() { let postedMessage = workerHelper.postedMessage; - ok(postedMessage.success); + equal(postedMessage.errorMsg, undefined); ok(Array.isArray(postedMessage.rules)); do_print(postedMessage.rules.length); equal(postedMessage.rules.length, 1); diff --git a/dom/system/gonk/tests/test_ril_worker_clip.js b/dom/system/gonk/tests/test_ril_worker_clip.js index 9393b808a46..d1ce5f61794 100644 --- a/dom/system/gonk/tests/test_ril_worker_clip.js +++ b/dom/system/gonk/tests/test_ril_worker_clip.js @@ -29,7 +29,6 @@ add_test(function test_queryCLIP_provisioned() { let postedMessage = workerHelper.postedMessage; equal(postedMessage.errorMsg, undefined); - ok(postedMessage.success); equal(postedMessage.provisioned, 1); run_next_test(); }); @@ -55,7 +54,6 @@ add_test(function test_getCLIP_error_generic_failure_invalid_length() { let postedMessage = workerHelper.postedMessage; - equal(postedMessage.errorMsg, "GenericFailure"); - ok(!postedMessage.success); + equal(postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE); run_next_test(); }); diff --git a/dom/system/gonk/tests/test_ril_worker_clir.js b/dom/system/gonk/tests/test_ril_worker_clir.js index 0f8ad38e4bf..5882a3c4cc4 100644 --- a/dom/system/gonk/tests/test_ril_worker_clir.js +++ b/dom/system/gonk/tests/test_ril_worker_clir.js @@ -34,7 +34,6 @@ add_test(function test_setCLIR_success() { let postedMessage = workerHelper.postedMessage; equal(postedMessage.errorMsg, undefined); - ok(postedMessage.success); run_next_test(); }); @@ -58,7 +57,6 @@ add_test(function test_setCLIR_generic_failure() { let postedMessage = workerHelper.postedMessage; equal(postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE); - ok(!postedMessage.success); run_next_test(); }); @@ -89,7 +87,6 @@ add_test(function test_getCLIR_n0_m1() { let postedMessage = workerHelper.postedMessage; equal(postedMessage.errorMsg, undefined); - ok(postedMessage.success); equal(postedMessage.n, 0); equal(postedMessage.m, 1); run_next_test(); @@ -120,7 +117,6 @@ add_test(function test_getCLIR_error_generic_failure_invalid_length() { let postedMessage = workerHelper.postedMessage; - equal(postedMessage.errorMsg, "GenericFailure"); - ok(!postedMessage.success); + equal(postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE); run_next_test(); }); diff --git a/dom/system/gonk/tests/test_ril_worker_cw.js b/dom/system/gonk/tests/test_ril_worker_cw.js index 6cbd019b967..1eaebf2efa9 100644 --- a/dom/system/gonk/tests/test_ril_worker_cw.js +++ b/dom/system/gonk/tests/test_ril_worker_cw.js @@ -23,7 +23,6 @@ add_test(function test_setCallWaiting_success() { let postedMessage = workerHelper.postedMessage; equal(postedMessage.errorMsg, undefined); - ok(postedMessage.success); run_next_test(); }); @@ -46,7 +45,6 @@ add_test(function test_setCallWaiting_generic_failure() { let postedMessage = workerHelper.postedMessage; equal(postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE); - ok(!postedMessage.success); run_next_test(); }); @@ -74,7 +72,6 @@ add_test(function test_queryCallWaiting_success_enabled_true() { let postedMessage = workerHelper.postedMessage; equal(postedMessage.errorMsg, undefined); - ok(postedMessage.success); equal(postedMessage.length, 1); ok(postedMessage.enabled); run_next_test(); @@ -103,7 +100,6 @@ add_test(function test_queryCallWaiting_success_enabled_false() { let postedMessage = workerHelper.postedMessage; equal(postedMessage.errorMsg, undefined); - ok(postedMessage.success); equal(postedMessage.length, 1); ok(!postedMessage.enabled); run_next_test(); diff --git a/dom/system/gonk/tests/test_ril_worker_mmi.js b/dom/system/gonk/tests/test_ril_worker_mmi.js index 8fb850cc7ee..d768b296f8f 100644 --- a/dom/system/gonk/tests/test_ril_worker_mmi.js +++ b/dom/system/gonk/tests/test_ril_worker_mmi.js @@ -63,7 +63,7 @@ add_test(function test_sendMMI_short_code() { let postedMessage = workerhelper.postedMessage; equal(ussdOptions.ussd, "**"); - ok(postedMessage.success); + equal(postedMessage.errorMsg, undefined); ok(context.RIL._ussdSession); run_next_test(); @@ -84,7 +84,7 @@ add_test(function test_sendMMI_change_PIN() { let postedMessage = workerhelper.postedMessage; - ok(postedMessage.success); + equal(postedMessage.errorMsg, undefined); run_next_test(); }); @@ -132,7 +132,7 @@ add_test(function test_sendMMI_change_PIN2() { let postedMessage = workerhelper.postedMessage; - ok(postedMessage.success); + equal(postedMessage.errorMsg, undefined); run_next_test(); }); @@ -180,7 +180,7 @@ add_test(function test_sendMMI_unblock_PIN() { let postedMessage = workerhelper.postedMessage; - ok(postedMessage.success); + equal(postedMessage.errorMsg, undefined); run_next_test(); }); @@ -228,7 +228,7 @@ add_test(function test_sendMMI_unblock_PIN2() { let postedMessage = workerhelper.postedMessage; - ok(postedMessage.success); + equal(postedMessage.errorMsg, undefined); run_next_test(); }); @@ -277,7 +277,7 @@ add_test(function test_sendMMI_get_IMEI() { let postedMessage = workerhelper.postedMessage; notEqual(mmiOptions.mmi, null); - ok(postedMessage.success); + equal(postedMessage.errorMsg, undefined); run_next_test(); }); @@ -301,7 +301,6 @@ add_test(function test_sendMMI_get_IMEI_error() { notEqual(mmiOptions.mmi, null); equal (postedMessage.errorMsg, GECKO_ERROR_RADIO_NOT_AVAILABLE); - ok(!postedMessage.success); run_next_test(); }); @@ -327,7 +326,7 @@ add_test(function test_sendMMI_call_barring_BAIC_interrogation_voice() { let postedMessage = workerhelper.postedMessage; - ok(postedMessage.success); + equal(postedMessage.errorMsg, undefined); ok(postedMessage.enabled); equal(postedMessage.statusMessage, MMI_SM_KS_SERVICE_ENABLED_FOR); ok(Array.isArray(postedMessage.additionalInformation)); @@ -357,7 +356,7 @@ add_test(function test_sendMMI_call_barring_BAIC_activation() { let postedMessage = workerhelper.postedMessage; equal(mmiOptions.procedure, MMI_PROCEDURE_ACTIVATION); - ok(postedMessage.success); + equal(postedMessage.errorMsg, undefined); equal(postedMessage.statusMessage, MMI_SM_KS_SERVICE_ENABLED); run_next_test(); @@ -384,7 +383,7 @@ add_test(function test_sendMMI_call_barring_BAIC_deactivation() { let postedMessage = workerhelper.postedMessage; equal(mmiOptions.procedure, MMI_PROCEDURE_DEACTIVATION); - ok(postedMessage.success); + equal(postedMessage.errorMsg, undefined); equal(postedMessage.statusMessage, MMI_SM_KS_SERVICE_DISABLED); run_next_test(); @@ -413,7 +412,7 @@ add_test(function test_sendMMI_USSD() { let postedMessage = workerhelper.postedMessage; equal(ussdOptions.ussd, "**123#"); - ok(postedMessage.success); + equal(postedMessage.errorMsg, undefined); ok(context.RIL._ussdSession); run_next_test(); @@ -439,7 +438,6 @@ add_test(function test_sendMMI_USSD_error() { equal(ussdOptions.ussd, "**123#"); equal(postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE); - ok(!postedMessage.success); ok(!context.RIL._ussdSession); run_next_test(); @@ -459,7 +457,7 @@ function setCallWaitingSuccess(mmi) { let postedMessage = workerhelper.postedMessage; - ok(postedMessage.success); + equal(postedMessage.errorMsg, undefined); } add_test(function test_sendMMI_call_waiting_activation() { @@ -509,7 +507,7 @@ add_test(function test_sendMMI_call_waiting_interrogation() { let postedMessage = workerhelper.postedMessage; - ok(postedMessage.success); + equal(postedMessage.errorMsg, undefined); equal(postedMessage.length, 2); ok(postedMessage.enabled); run_next_test(); diff --git a/dom/system/gonk/tests/test_ril_worker_mmi_cf.js b/dom/system/gonk/tests/test_ril_worker_mmi_cf.js index 08cd9b683c3..1362b313ef0 100644 --- a/dom/system/gonk/tests/test_ril_worker_mmi_cf.js +++ b/dom/system/gonk/tests/test_ril_worker_mmi_cf.js @@ -36,7 +36,6 @@ function setCallForwardSuccess(procedure, serviceCode, sia, sib, sic) { let postedMessage = workerhelper.postedMessage; equal(postedMessage.errorMsg, undefined); - ok(postedMessage.success); } add_test(function test_sendMMI_call_forwarding_activation() { @@ -82,7 +81,6 @@ add_test(function test_sendMMI_call_forwarding_interrogation() { let postedMessage = workerhelper.postedMessage; equal(postedMessage.errorMsg, undefined); - ok(postedMessage.success); ok(Array.isArray(postedMessage.rules)); equal(postedMessage.rules.length, 1); ok(postedMessage.rules[0].active); @@ -110,7 +108,6 @@ add_test(function test_sendMMI_call_forwarding_interrogation_no_rules() { let postedMessage = workerhelper.postedMessage; equal(postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE); - ok(!postedMessage.success); run_next_test(); }); diff --git a/dom/telephony/gonk/TelephonyService.js b/dom/telephony/gonk/TelephonyService.js index b76a8256261..69aefd26f56 100644 --- a/dom/telephony/gonk/TelephonyService.js +++ b/dom/telephony/gonk/TelephonyService.js @@ -783,7 +783,7 @@ TelephonyService.prototype = { _dialCdmaThreeWayCall: function(aClientId, aNumber, aCallback) { this._sendToRilWorker(aClientId, "cdmaFlash", { featureStr: aNumber }, response => { - if (!response.success) { + if (response.errorMsg) { aCallback.notifyError(response.errorMsg); return; } @@ -824,7 +824,7 @@ TelephonyService.prototype = { this._sendToRilWorker(aClientId, "dial", aOptions, response => { this._isDialing = false; - if (!response.success) { + if (response.errorMsg) { this._sendToRilWorker(aClientId, "getFailCause", null, response => { aCallback.notifyError(response.failCause); }); @@ -857,7 +857,7 @@ TelephonyService.prototype = { { mmi: aMmi }, response => { if (DEBUG) debug("MMI response: " + JSON.stringify(response)); - if (!response.success) { + if (response.errorMsg) { if (response.additionalInformation != null) { aCallback.notifyDialMMIErrorWithInfo(response.errorMsg, response.additionalInformation); @@ -973,7 +973,7 @@ TelephonyService.prototype = { * The response from ril_worker. */ _defaultCallbackHandler: function(aCallback, aResponse) { - if (!aResponse.success) { + if (aResponse.errorMsg) { aCallback.notifyError(aResponse.errorMsg); } else { aCallback.notifySuccess(); @@ -1080,7 +1080,7 @@ TelephonyService.prototype = { let tones = aDtmfChars; let playTone = (tone) => { this._sendToRilWorker(aClientId, "startTone", { dtmfChar: tone }, response => { - if (!response.success) { + if (response.errorMsg) { aCallback.notifyError(response.errorMsg); return; } @@ -1242,7 +1242,7 @@ TelephonyService.prototype = { _conferenceCallGsm: function(aClientId, aCallback) { this._sendToRilWorker(aClientId, "conferenceCall", null, response => { - if (!response.success) { + if (response.errorMsg) { aCallback.notifyError(RIL.GECKO_ERROR_GENERIC_FAILURE); // TODO: Bug 1124993. Deprecate it. Use callback response is enough. this._notifyAllListeners("notifyConferenceError", @@ -1264,7 +1264,7 @@ TelephonyService.prototype = { } this._sendToRilWorker(aClientId, "cdmaFlash", null, response => { - if (!response.success) { + if (response.errorMsg) { aCallback.notifyError(RIL.GECKO_ERROR_GENERIC_FAILURE); // TODO: Bug 1124993. Deprecate it. Use callback response is enough. this._notifyAllListeners("notifyConferenceError", @@ -1302,7 +1302,7 @@ TelephonyService.prototype = { _separateCallGsm: function(aClientId, aCallIndex, aCallback) { this._sendToRilWorker(aClientId, "separateCall", { callIndex: aCallIndex }, response => { - if (!response.success) { + if (response.errorMsg) { aCallback.notifyError(RIL.GECKO_ERROR_GENERIC_FAILURE); // TODO: Bug 1124993. Deprecate it. Use callback response is enough. this._notifyAllListeners("notifyConferenceError", @@ -1332,7 +1332,7 @@ TelephonyService.prototype = { // controlling subscriber and the second party. Go to the 2-way state. _separateCallCdma: function(aClientId, aCallIndex, aCallback) { this._sendToRilWorker(aClientId, "cdmaFlash", null, response => { - if (!response.success) { + if (response.errorMsg) { aCallback.notifyError(RIL.GECKO_ERROR_GENERIC_FAILURE); // TODO: Bug 1124993. Deprecate it. Use callback response is enough. this._notifyAllListeners("notifyConferenceError",