diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 96ad5b2d814..59493394347 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,4 +1,4 @@ { - "revision": "e8f63cae5aff3b61c0a49a9209ae971092ddee22", + "revision": "bb61eb10b38726305bc033cc23e1024b489dc8c8", "repo_path": "/integration/gaia-central" } diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index 4f8f55e7ff7..5a209885095 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -753,6 +753,7 @@ GK_ATOM(onobsolete, "onobsolete") GK_ATOM(ononline, "ononline") GK_ATOM(onoffline, "onoffline") GK_ATOM(onopen, "onopen") +GK_ATOM(onotastatuschange, "onotastatuschange") GK_ATOM(onoverflow, "onoverflow") GK_ATOM(onoverflowchanged, "onoverflowchanged") GK_ATOM(onpagehide, "onpagehide") diff --git a/dom/network/interfaces/moz.build b/dom/network/interfaces/moz.build index eab9fffd446..9e7ce875f93 100644 --- a/dom/network/interfaces/moz.build +++ b/dom/network/interfaces/moz.build @@ -22,6 +22,7 @@ if CONFIG['MOZ_B2G_RIL']: 'nsIDOMCFStateChangeEvent.idl', 'nsIDOMMobileConnection.idl', 'nsIDOMMozEmergencyCbModeEvent.idl', + 'nsIDOMMozOtaStatusEvent.idl', 'nsIDOMNetworkStats.idl', 'nsIDOMNetworkStatsManager.idl', 'nsIMobileConnectionProvider.idl', diff --git a/dom/network/interfaces/nsIDOMMobileConnection.idl b/dom/network/interfaces/nsIDOMMobileConnection.idl index 2f7276af09c..f4567571f9f 100644 --- a/dom/network/interfaces/nsIDOMMobileConnection.idl +++ b/dom/network/interfaces/nsIDOMMobileConnection.idl @@ -11,7 +11,7 @@ interface nsIDOMMozMobileNetworkInfo; interface nsIDOMMozMobileCellInfo; interface nsIDOMMozMobileCFInfo; -[scriptable, builtinclass, uuid(8284af62-c39d-4a59-b258-107040040418)] +[scriptable, builtinclass, uuid(095b3720-058c-11e3-8ffd-0800200c9a66)] interface nsIDOMMozMobileConnection : nsIDOMEventTarget { const long ICC_SERVICE_CLASS_VOICE = (1 << 0); @@ -263,6 +263,21 @@ interface nsIDOMMozMobileConnection : nsIDOMEventTarget */ nsIDOMDOMRequest getCallBarringOption(in jsval option); + /** + * Change call barring facility password. + * + * @param info + * An object containing information about pin and newPin, and, + * this object must have both "pin" and "newPin" attributes + * to change the call barring facility password. + * + * Example: + * + * changeCallBarringPassword({pin: "...", + * newPin: "..."}); + */ + nsIDOMDOMRequest changeCallBarringPassword(in jsval info); + /** * Configures call waiting options. * @@ -362,6 +377,12 @@ interface nsIDOMMozMobileConnection : nsIDOMEventTarget * callback mode changes. */ [implicit_jscontext] attribute jsval onemergencycbmodechange; + + /** + * The 'onotastatuschange' event is notified whenever the ota provision status + * changes. + */ + [implicit_jscontext] attribute jsval onotastatuschange; }; [scriptable, uuid(49706beb-a160-40b7-b745-50f62e389a2c)] diff --git a/dom/network/interfaces/nsIDOMMozOtaStatusEvent.idl b/dom/network/interfaces/nsIDOMMozOtaStatusEvent.idl new file mode 100644 index 00000000000..aedd5bd6752 --- /dev/null +++ b/dom/network/interfaces/nsIDOMMozOtaStatusEvent.idl @@ -0,0 +1,21 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "nsIDOMEvent.idl" + +[scriptable, builtinclass, uuid(d3592cdc-c5cf-4c24-a27c-6f789ac94959)] +interface nsIDOMMozOtaStatusEvent : nsIDOMEvent +{ + readonly attribute DOMString status; + + [noscript] void initMozOtaStatusEvent(in DOMString aType, + in boolean aCanBubble, + in boolean aCancelable, + in DOMString aStatus); +}; + +dictionary MozOtaStatusEventInit : EventInit +{ + DOMString status; +}; diff --git a/dom/network/interfaces/nsIMobileConnectionProvider.idl b/dom/network/interfaces/nsIMobileConnectionProvider.idl index e867742f65f..c3e8679e448 100644 --- a/dom/network/interfaces/nsIMobileConnectionProvider.idl +++ b/dom/network/interfaces/nsIMobileConnectionProvider.idl @@ -10,7 +10,7 @@ interface nsIDOMMozMobileConnectionInfo; interface nsIDOMMozMobileNetworkInfo; interface nsIDOMWindow; -[scriptable, uuid(7da2d9f6-eba1-4339-bde1-dc6732d42cdf)] +[scriptable, uuid(f1878629-4151-4e02-a22a-8cec3d7eddee)] interface nsIMobileConnectionListener : nsISupports { void notifyVoiceChanged(); @@ -26,13 +26,14 @@ interface nsIMobileConnectionListener : nsISupports in unsigned short serviceClass); void notifyEmergencyCbModeChanged(in boolean active, in unsigned long timeoutMs); + void notifyOtaStatusChanged(in DOMString status); }; /** * XPCOM component (in the content process) that provides the mobile * network information. */ -[scriptable, uuid(576c7c00-7319-4309-aa9e-1dab102e0874)] +[scriptable, uuid(c66652e0-0628-11e3-8ffd-0800200c9a66)] interface nsIMobileConnectionProvider : nsISupports { /** @@ -71,6 +72,8 @@ interface nsIMobileConnectionProvider : nsISupports in jsval option); nsIDOMDOMRequest setCallBarringOption(in nsIDOMWindow window, in jsval option); + nsIDOMDOMRequest changeCallBarringPassword(in nsIDOMWindow window, + in jsval info); nsIDOMDOMRequest setCallWaitingOption(in nsIDOMWindow window, in bool enabled); diff --git a/dom/network/src/MobileConnection.cpp b/dom/network/src/MobileConnection.cpp index e6b1e9fc8f7..7ef1c6ec19e 100644 --- a/dom/network/src/MobileConnection.cpp +++ b/dom/network/src/MobileConnection.cpp @@ -3,7 +3,6 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "MobileConnection.h" - #include "GeneratedEvents.h" #include "mozilla/Preferences.h" #include "nsDOMEvent.h" @@ -12,6 +11,7 @@ #include "nsIDOMDOMRequest.h" #include "nsIDOMDataErrorEvent.h" #include "nsIDOMMozEmergencyCbModeEvent.h" +#include "nsIDOMMozOtaStatusEvent.h" #include "nsIDOMUSSDReceivedEvent.h" #include "nsIPermissionManager.h" @@ -76,6 +76,7 @@ NS_IMPL_EVENT_HANDLER(MobileConnection, ussdreceived) NS_IMPL_EVENT_HANDLER(MobileConnection, dataerror) NS_IMPL_EVENT_HANDLER(MobileConnection, cfstatechange) NS_IMPL_EVENT_HANDLER(MobileConnection, emergencycbmodechange) +NS_IMPL_EVENT_HANDLER(MobileConnection, otastatuschange) MobileConnection::MobileConnection() { @@ -406,6 +407,23 @@ MobileConnection::SetCallBarringOption(const JS::Value& aOption, return mProvider->SetCallBarringOption(GetOwner(), aOption, aRequest); } +NS_IMETHODIMP +MobileConnection::ChangeCallBarringPassword(const JS::Value& aInfo, + nsIDOMDOMRequest** aRequest) +{ + *aRequest = nullptr; + + if (!CheckPermission("mobileconnection")) { + return NS_OK; + } + + if (!mProvider) { + return NS_ERROR_FAILURE; + } + + return mProvider->ChangeCallBarringPassword(GetOwner(), aInfo, aRequest); +} + NS_IMETHODIMP MobileConnection::GetCallWaitingOption(nsIDOMDOMRequest** aRequest) { @@ -594,3 +612,22 @@ MobileConnection::NotifyEmergencyCbModeChanged(bool aActive, return DispatchTrustedEvent(ce); } + +NS_IMETHODIMP +MobileConnection::NotifyOtaStatusChanged(const nsAString& aStatus) +{ + if (!CheckPermission("mobileconnection")) { + return NS_OK; + } + + nsCOMPtr event; + NS_NewDOMMozOtaStatusEvent(getter_AddRefs(event), this, nullptr, nullptr); + MOZ_ASSERT(event); + + nsCOMPtr ce = do_QueryInterface(event); + nsresult rv = ce->InitMozOtaStatusEvent(NS_LITERAL_STRING("otastatuschange"), + false, false, aStatus); + NS_ENSURE_SUCCESS(rv, rv); + + return DispatchTrustedEvent(ce); +} diff --git a/dom/network/tests/marionette/manifest.ini b/dom/network/tests/marionette/manifest.ini index a8adccf5f0e..6c00d9eafe3 100644 --- a/dom/network/tests/marionette/manifest.ini +++ b/dom/network/tests/marionette/manifest.ini @@ -16,3 +16,4 @@ disabled = Bug 808783 [test_mobile_roaming_preference.js] [test_call_barring_get_option.js] [test_call_barring_set_error.js] +[test_call_barring_change_password.js] diff --git a/dom/network/tests/marionette/test_call_barring_change_password.js b/dom/network/tests/marionette/test_call_barring_change_password.js new file mode 100644 index 00000000000..678a004ea90 --- /dev/null +++ b/dom/network/tests/marionette/test_call_barring_change_password.js @@ -0,0 +1,63 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +MARIONETTE_TIMEOUT = 60000; + +SpecialPowers.addPermission("mobileconnection", true, document); + +// Permission changes can't change existing Navigator.prototype +// objects, so grab our objects from a new Navigator +let ifr = document.createElement("iframe"); +let connection; +ifr.onload = function() { + connection = ifr.contentWindow.navigator.mozMobileConnection; + + ok(connection instanceof ifr.contentWindow.MozMobileConnection, + "connection is instanceof " + connection.constructor); + + setTimeout(testChangeCallBarringPasswordWithFailure, 0); +}; +document.body.appendChild(ifr); + +function testChangeCallBarringPasswordWithFailure() { + // Incorrect parameters, expect onerror callback. + let options = [ + {pin: null, newPin: '0000'}, + {pin: '0000', newPin: null}, + {pin: null, newPin: null}, + {pin: '000', newPin: '0000'}, + {pin: '00000', newPin: '1111'}, + {pin: 'abcd', newPin: 'efgh'}, + ]; + + function do_test() { + for (let i = 0; i < options.length; i++) { + let request = connection.changeCallBarringPassword(options[i]); + + request.onsuccess = function() { + ok(false, 'Unexpected result.'); + setTimeout(cleanUp , 0); + }; + + request.onerror = function() { + ok(request.error.name === 'InvalidPassword', 'InvalidPassword'); + if (i >= options.length) { + setTimeout(testChangeCallBarringPasswordWithSuccess, 0); + } + }; + } + } + + do_test(); +} + +function testChangeCallBarringPasswordWithSuccess() { + // TODO: Bug 906603 - B2G RIL: Support Change Call Barring Password on + // Emulator. + setTimeout(cleanUp , 0); +} + +function cleanUp() { + SpecialPowers.removePermission("mobileconnection", document); + finish(); +} diff --git a/dom/system/gonk/RILContentHelper.js b/dom/system/gonk/RILContentHelper.js index 885bee351a8..e58f6d7bf1a 100644 --- a/dom/system/gonk/RILContentHelper.js +++ b/dom/system/gonk/RILContentHelper.js @@ -92,6 +92,7 @@ const RIL_IPC_MSG_NAMES = [ "RIL:GetCallForwardingOption", "RIL:SetCallBarringOption", "RIL:GetCallBarringOption", + "RIL:ChangeCallBarringPassword", "RIL:SetCallWaitingOption", "RIL:GetCallWaitingOption", "RIL:SetCallingLineIdRestriction", @@ -109,7 +110,8 @@ const RIL_IPC_MSG_NAMES = [ "RIL:ExitEmergencyCbMode", "RIL:SetVoicePrivacyMode", "RIL:GetVoicePrivacyMode", - "RIL:ConferenceCallStateChanged" + "RIL:ConferenceCallStateChanged", + "RIL:OtaStatusChanged" ]; XPCOMUtils.defineLazyServiceGetter(this, "cpmm", @@ -1102,6 +1104,31 @@ RILContentHelper.prototype = { return request; }, + changeCallBarringPassword: function changeCallBarringPassword(window, info) { + if (window == null) { + throw Components.Exception("Can't get window object", + Cr.NS_ERROR_UNEXPECTED); + } + let request = Services.DOMRequest.createRequest(window); + let requestId = this.getRequestId(request); + + // Checking valid PIN for supplementary services. See TS.22.004 clause 5.2. + if (info.pin == null || !info.pin.match(/^\d{4}$/) || + info.newPin == null || !info.newPin.match(/^\d{4}$/)) { + this.dispatchFireRequestError(requestId, "InvalidPassword"); + return request; + } + + if (DEBUG) debug("changeCallBarringPassword: " + JSON.stringify(info)); + info.requestId = requestId; + cpmm.sendAsyncMessage("RIL:ChangeCallBarringPassword", { + clientId: 0, + data: info + }); + + return request; + }, + getCallWaitingOption: function getCallWaitingOption(window) { if (window == null) { throw Components.Exception("Can't get window object", @@ -1531,6 +1558,11 @@ RILContentHelper.prototype = { "notifyDataChanged", null); break; + case "RIL:OtaStatusChanged": + this._deliverEvent("_mobileConnectionListeners", + "notifyOtaStatusChanged", + [msg.json.data]); + break; case "RIL:EnumerateCalls": this.handleEnumerateCalls(msg.json.calls); break; @@ -1658,6 +1690,9 @@ RILContentHelper.prototype = { case "RIL:SetCallBarringOption": this.handleSimpleRequest(msg.json.requestId, msg.json.errorMsg, null); break; + case "RIL:ChangeCallBarringPassword": + this.handleSimpleRequest(msg.json.requestId, msg.json.errorMsg, null); + break; case "RIL:GetCallWaitingOption": this.handleSimpleRequest(msg.json.requestId, msg.json.errorMsg, msg.json.enabled); diff --git a/dom/system/gonk/RadioInterfaceLayer.js b/dom/system/gonk/RadioInterfaceLayer.js index eed033e3edc..31c9f1b0124 100644 --- a/dom/system/gonk/RadioInterfaceLayer.js +++ b/dom/system/gonk/RadioInterfaceLayer.js @@ -109,6 +109,7 @@ const RIL_IPC_MOBILECONNECTION_MSG_NAMES = [ "RIL:GetCallForwardingOption", "RIL:SetCallBarringOption", "RIL:GetCallBarringOption", + "RIL:ChangeCallBarringPassword", "RIL:SetCallWaitingOption", "RIL:GetCallWaitingOption", "RIL:SetCallingLineIdRestriction", @@ -1017,6 +1018,9 @@ RadioInterface.prototype = { case "RIL:GetCallBarringOption": this.workerMessenger.sendWithIPCMessage(msg, "queryCallBarringStatus"); break; + case "RIL:ChangeCallBarringPassword": + this.workerMessenger.sendWithIPCMessage(msg, "changeCallBarringPassword"); + break; case "RIL:SetCallWaitingOption": this.workerMessenger.sendWithIPCMessage(msg, "setCallWaiting"); break; @@ -1100,6 +1104,9 @@ RadioInterface.prototype = { case "operatorchange": this.handleOperatorChange(message); break; + case "otastatuschange": + this.handleOtaStatus(message); + break; case "radiostatechange": this.handleRadioStateChange(message); break; @@ -1457,6 +1464,18 @@ RadioInterface.prototype = { } }, + handleOtaStatus: function handleOtaStatus(message) { + if (message.status < 0 || + RIL.CDMA_OTA_PROVISION_STATUS_TO_GECKO.length <= message.status) { + return; + } + + let status = RIL.CDMA_OTA_PROVISION_STATUS_TO_GECKO[message.status]; + + gMessageManager.sendMobileConnectionMessage("RIL:OtaStatusChanged", + this.clientId, status); + }, + handleRadioStateChange: function handleRadioStateChange(message) { this._changingRadioPower = false; diff --git a/dom/system/gonk/ril_consts.js b/dom/system/gonk/ril_consts.js index 521c2fecd0c..c1bb002902e 100644 --- a/dom/system/gonk/ril_consts.js +++ b/dom/system/gonk/ril_consts.js @@ -2814,5 +2814,38 @@ this.GECKO_SUPP_SVC_NOTIFICATION_FROM_CODE2 = {}; GECKO_SUPP_SVC_NOTIFICATION_FROM_CODE2[SUPP_SVC_NOTIFICATION_CODE2_PUT_ON_HOLD] = GECKO_SUPP_SVC_NOTIFICATION_REMOTE_HELD; GECKO_SUPP_SVC_NOTIFICATION_FROM_CODE2[SUPP_SVC_NOTIFICATION_CODE2_RETRIEVED] = GECKO_SUPP_SVC_NOTIFICATION_REMOTE_RESUMED; +/** + * The status for an Over-the-Air Service Provisioning / Over-the-Air + * Parameter Administration (OTASP/OTAPA) session. + * + * @see 3GPP2 C.S0016 + */ +this.GECKO_OTA_STATUS_SPL_UNLOCKED = "spl_unlocked"; +this.GECKO_OTA_STATUS_SPC_RETRIES_EXCEEDED = "spc_retries_exceeded"; +this.GECKO_OTA_STATUS_A_KEY_EXCHANGED = "a_key_exchanged"; +this.GECKO_OTA_STATUS_SSD_UPDATED = "ssd_updated"; +this.GECKO_OTA_STATUS_NAM_DOWNLOADED = "nam_downloaded"; +this.GECKO_OTA_STATUS_MDN_DOWNLOADED = "mdn_downloaded"; +this.GECKO_OTA_STATUS_IMSI_DOWNLOADED = "imsi_downloaded"; +this.GECKO_OTA_STATUS_PRL_DOWNLOADED = "prl_downloaded"; +this.GECKO_OTA_STATUS_COMMITTED = "committed"; +this.GECKO_OTA_STATUS_OTAPA_STARTED = "otapa_started"; +this.GECKO_OTA_STATUS_OTAPA_STOPPED = "otapa_stopped"; +this.GECKO_OTA_STATUS_OTAPA_ABORTED = "otapa_aborted"; +this.CDMA_OTA_PROVISION_STATUS_TO_GECKO = [ + GECKO_OTA_STATUS_SPL_UNLOCKED, + GECKO_OTA_STATUS_SPC_RETRIES_EXCEEDED, + GECKO_OTA_STATUS_A_KEY_EXCHANGED, + GECKO_OTA_STATUS_SSD_UPDATED, + GECKO_OTA_STATUS_NAM_DOWNLOADED, + GECKO_OTA_STATUS_MDN_DOWNLOADED, + GECKO_OTA_STATUS_IMSI_DOWNLOADED, + GECKO_OTA_STATUS_PRL_DOWNLOADED, + GECKO_OTA_STATUS_COMMITTED, + GECKO_OTA_STATUS_OTAPA_STARTED, + GECKO_OTA_STATUS_OTAPA_STOPPED, + GECKO_OTA_STATUS_OTAPA_ABORTED +]; + // Allow this file to be imported via Components.utils.import(). this.EXPORTED_SYMBOLS = Object.keys(this); diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js index 0daad9f52a4..fa100d28d3e 100644 --- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -2327,6 +2327,25 @@ let RIL = { this.setICCFacilityLock(options); }, + /** + * Change call barring facility password. + * + * @param pin + * Old password. + * @param newPin + * New password. + */ + changeCallBarringPassword: function changeCallBarringPassword(options) { + Buf.newParcel(REQUEST_CHANGE_BARRING_PASSWORD, options); + Buf.writeUint32(3); + // Set facility to ICC_CB_FACILITY_BA_ALL by following TS.22.030 clause + // 6.5.4 and Table B.1. + Buf.writeString(ICC_CB_FACILITY_BA_ALL); + Buf.writeString(options.pin); + Buf.writeString(options.newPin); + Buf.sendParcel(); + }, + /** * Handle STK CALL_SET_UP request. * @@ -5318,7 +5337,13 @@ RIL[REQUEST_SET_FACILITY_LOCK] = function REQUEST_SET_FACILITY_LOCK(length, opti } this.sendChromeMessage(options); }; -RIL[REQUEST_CHANGE_BARRING_PASSWORD] = null; +RIL[REQUEST_CHANGE_BARRING_PASSWORD] = + function REQUEST_CHANGE_BARRING_PASSWORD(length, options) { + if (options.rilRequestError) { + options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError]; + } + this.sendChromeMessage(options); +}; RIL[REQUEST_SIM_OPEN_CHANNEL] = function REQUEST_SIM_OPEN_CHANNEL(length, options) { if (options.rilRequestError) { options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError]; @@ -6000,7 +6025,11 @@ RIL[UNSOLICITED_CDMA_CALL_WAITING] = function UNSOLICITED_CDMA_CALL_WAITING(leng this.sendChromeMessage({rilMessageType: "cdmaCallWaiting", number: call.number}); }; -RIL[UNSOLICITED_CDMA_OTA_PROVISION_STATUS] = null; +RIL[UNSOLICITED_CDMA_OTA_PROVISION_STATUS] = function UNSOLICITED_CDMA_OTA_PROVISION_STATUS() { + let status = Buf.readUint32List()[0]; + this.sendChromeMessage({rilMessageType: "otastatuschange", + status: status}); +}; RIL[UNSOLICITED_CDMA_INFO_REC] = null; RIL[UNSOLICITED_OEM_HOOK_RAW] = null; RIL[UNSOLICITED_RINGBACK_TONE] = null; diff --git a/dom/system/gonk/tests/test_ril_worker_barring_password.js b/dom/system/gonk/tests/test_ril_worker_barring_password.js new file mode 100644 index 00000000000..2c7292841e2 --- /dev/null +++ b/dom/system/gonk/tests/test_ril_worker_barring_password.js @@ -0,0 +1,87 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +subscriptLoader.loadSubScript("resource://gre/modules/ril_consts.js", this); + +function run_test() { + run_next_test(); +} + +const PIN = "0000"; +const NEW_PIN = "1234"; + +/** + * Helper function. + */ +function newUint8Worker() { + let worker = newWorker(); + let index = 0; // index for read + let buf = []; + + worker.Buf.writeUint8 = function (value) { + buf.push(value); + }; + + worker.Buf.readUint8 = function () { + return buf[index++]; + }; + + worker.Buf.seekIncoming = function (offset) { + index += offset; + }; + + worker.debug = do_print; + + return worker; +} + +add_test(function test_change_call_barring_password() { + let worker = newUint8Worker(); + let buf = worker.Buf; + + function do_test(facility, pin, newPin) { + buf.sendParcel = function fakeSendParcel () { + // Request Type. + do_check_eq(this.readUint32(), REQUEST_CHANGE_BARRING_PASSWORD); + + // Token : we don't care. + this.readUint32(); + + let parcel = this.readStringList(); + do_check_eq(parcel.length, 3); + do_check_eq(parcel[0], facility); + do_check_eq(parcel[1], pin); + do_check_eq(parcel[2], newPin); + }; + + let options = {facility: facility, pin: pin, newPin: newPin}; + worker.RIL.changeCallBarringPassword(options); + } + + do_test(ICC_CB_FACILITY_BA_ALL, PIN, NEW_PIN); + + run_next_test(); +}); + +add_test(function test_check_change_call_barring_password_result() { + let barringPasswordOptions; + let worker = newWorker({ + postMessage: function fakePostMessage(message) { + do_check_eq(barringPasswordOptions.pin, PIN); + do_check_eq(barringPasswordOptions.newPin, NEW_PIN); + do_check_eq(message.errorMsg, GECKO_ERROR_SUCCESS); + } + }); + + worker.RIL.changeCallBarringPassword = + function fakeChangeCallBarringPassword(options) { + barringPasswordOptions = options; + worker.RIL[REQUEST_CHANGE_BARRING_PASSWORD](0, { + rilRequestError: ERROR_SUCCESS + }); + } + + worker.RIL.changeCallBarringPassword({pin: PIN, newPin: NEW_PIN}); + + run_next_test(); +}); diff --git a/dom/system/gonk/tests/xpcshell.ini b/dom/system/gonk/tests/xpcshell.ini index c78d1afe6f3..be21ccb3576 100644 --- a/dom/system/gonk/tests/xpcshell.ini +++ b/dom/system/gonk/tests/xpcshell.ini @@ -17,3 +17,4 @@ tail = [test_ril_worker_voiceprivacy.js] [test_ril_worker_ecm.js] [test_ril_worker_stk.js] +[test_ril_worker_barring_password.js] diff --git a/dom/webidl/InputMethod.webidl b/dom/webidl/InputMethod.webidl index 42a8fdd20a4..a87c6d2b7ef 100644 --- a/dom/webidl/InputMethod.webidl +++ b/dom/webidl/InputMethod.webidl @@ -58,31 +58,26 @@ interface MozInputMethodManager { [JSImplementation="@mozilla.org/b2g-inputcontext;1"] interface MozInputContext: EventTarget { // The tag name of input field, which is enum of "input", "textarea", or "contenteditable" - readonly attribute DOMString type; - + readonly attribute DOMString? type; // The type of the input field, which is enum of text, number, password, url, search, email, and so on. // See http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#states-of-the-type-attribute - readonly attribute DOMString inputType; - + readonly attribute DOMString? inputType; /* * The inputmode string, representing the input mode. * See http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#input-modalities:-the-inputmode-attribute */ - readonly attribute DOMString inputMode; - + readonly attribute DOMString? inputMode; /* * The primary language for the input field. * It is the value of HTMLElement.lang. * See http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#htmlelement */ - readonly attribute DOMString lang; - + readonly attribute DOMString? lang; /* * Get the whole text content of the input field. * @return DOMString */ Promise getText(optional long offset, optional long length); - // The start and stop position of the selection. readonly attribute long selectionStart; readonly attribute long selectionEnd; diff --git a/dom/webidl/MozOtaStatusEvent.webidl b/dom/webidl/MozOtaStatusEvent.webidl new file mode 100644 index 00000000000..4afc860d5c5 --- /dev/null +++ b/dom/webidl/MozOtaStatusEvent.webidl @@ -0,0 +1,33 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +[Constructor(DOMString type, optional MozOtaStatusEventInit eventInitDict), + HeaderFile="GeneratedEventClasses.h"] +interface MozOtaStatusEvent : Event +{ + /** + * One of the following values: + * + * spl_unlocked + * spc_retries_exceeded + * a_key_exchanged + * ssd_updated + * nam_downloaded + * mdn_downloaded + * imsi_downloaded + * prl_downloaded + * committed + * otapa_started + * otapa_stopped + * otapa_aborted + */ + readonly attribute DOMString status; +}; + +dictionary MozOtaStatusEventInit : EventInit +{ + DOMString status = ""; +}; diff --git a/dom/webidl/WebIDL.mk b/dom/webidl/WebIDL.mk index 0ddc86193c5..918c31c5f8b 100644 --- a/dom/webidl/WebIDL.mk +++ b/dom/webidl/WebIDL.mk @@ -498,6 +498,7 @@ webidl_files += \ MozCellBroadcast.webidl \ MozCellBroadcastEvent.webidl \ MozEmergencyCbModeEvent.webidl \ + MozOtaStatusEvent.webidl \ MozVoicemailEvent.webidl \ MozWifiConnectionInfoEvent.webidl \ MozWifiStatusChangeEvent.webidl \ diff --git a/js/xpconnect/src/event_impl_gen.conf.in b/js/xpconnect/src/event_impl_gen.conf.in index 24279486796..35eb971fd50 100644 --- a/js/xpconnect/src/event_impl_gen.conf.in +++ b/js/xpconnect/src/event_impl_gen.conf.in @@ -36,6 +36,7 @@ simple_events = [ 'DataErrorEvent', 'IccCardLockErrorEvent', 'MozEmergencyCbModeEvent', + 'MozOtaStatusEvent', 'MozWifiStatusChangeEvent', 'MozWifiConnectionInfoEvent', 'MozCellBroadcastEvent',