Merge mozilla-central and b2g-inbound

This commit is contained in:
Ed Morley 2013-08-27 15:20:08 +01:00
commit 3f79ac47a5
19 changed files with 399 additions and 17 deletions

View File

@ -1,4 +1,4 @@
{ {
"revision": "e8f63cae5aff3b61c0a49a9209ae971092ddee22", "revision": "bb61eb10b38726305bc033cc23e1024b489dc8c8",
"repo_path": "/integration/gaia-central" "repo_path": "/integration/gaia-central"
} }

View File

@ -753,6 +753,7 @@ GK_ATOM(onobsolete, "onobsolete")
GK_ATOM(ononline, "ononline") GK_ATOM(ononline, "ononline")
GK_ATOM(onoffline, "onoffline") GK_ATOM(onoffline, "onoffline")
GK_ATOM(onopen, "onopen") GK_ATOM(onopen, "onopen")
GK_ATOM(onotastatuschange, "onotastatuschange")
GK_ATOM(onoverflow, "onoverflow") GK_ATOM(onoverflow, "onoverflow")
GK_ATOM(onoverflowchanged, "onoverflowchanged") GK_ATOM(onoverflowchanged, "onoverflowchanged")
GK_ATOM(onpagehide, "onpagehide") GK_ATOM(onpagehide, "onpagehide")

View File

@ -22,6 +22,7 @@ if CONFIG['MOZ_B2G_RIL']:
'nsIDOMCFStateChangeEvent.idl', 'nsIDOMCFStateChangeEvent.idl',
'nsIDOMMobileConnection.idl', 'nsIDOMMobileConnection.idl',
'nsIDOMMozEmergencyCbModeEvent.idl', 'nsIDOMMozEmergencyCbModeEvent.idl',
'nsIDOMMozOtaStatusEvent.idl',
'nsIDOMNetworkStats.idl', 'nsIDOMNetworkStats.idl',
'nsIDOMNetworkStatsManager.idl', 'nsIDOMNetworkStatsManager.idl',
'nsIMobileConnectionProvider.idl', 'nsIMobileConnectionProvider.idl',

View File

@ -11,7 +11,7 @@ interface nsIDOMMozMobileNetworkInfo;
interface nsIDOMMozMobileCellInfo; interface nsIDOMMozMobileCellInfo;
interface nsIDOMMozMobileCFInfo; interface nsIDOMMozMobileCFInfo;
[scriptable, builtinclass, uuid(8284af62-c39d-4a59-b258-107040040418)] [scriptable, builtinclass, uuid(095b3720-058c-11e3-8ffd-0800200c9a66)]
interface nsIDOMMozMobileConnection : nsIDOMEventTarget interface nsIDOMMozMobileConnection : nsIDOMEventTarget
{ {
const long ICC_SERVICE_CLASS_VOICE = (1 << 0); const long ICC_SERVICE_CLASS_VOICE = (1 << 0);
@ -263,6 +263,21 @@ interface nsIDOMMozMobileConnection : nsIDOMEventTarget
*/ */
nsIDOMDOMRequest getCallBarringOption(in jsval option); 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. * Configures call waiting options.
* *
@ -362,6 +377,12 @@ interface nsIDOMMozMobileConnection : nsIDOMEventTarget
* callback mode changes. * callback mode changes.
*/ */
[implicit_jscontext] attribute jsval onemergencycbmodechange; [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)] [scriptable, uuid(49706beb-a160-40b7-b745-50f62e389a2c)]

View File

@ -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;
};

View File

@ -10,7 +10,7 @@ interface nsIDOMMozMobileConnectionInfo;
interface nsIDOMMozMobileNetworkInfo; interface nsIDOMMozMobileNetworkInfo;
interface nsIDOMWindow; interface nsIDOMWindow;
[scriptable, uuid(7da2d9f6-eba1-4339-bde1-dc6732d42cdf)] [scriptable, uuid(f1878629-4151-4e02-a22a-8cec3d7eddee)]
interface nsIMobileConnectionListener : nsISupports interface nsIMobileConnectionListener : nsISupports
{ {
void notifyVoiceChanged(); void notifyVoiceChanged();
@ -26,13 +26,14 @@ interface nsIMobileConnectionListener : nsISupports
in unsigned short serviceClass); in unsigned short serviceClass);
void notifyEmergencyCbModeChanged(in boolean active, void notifyEmergencyCbModeChanged(in boolean active,
in unsigned long timeoutMs); in unsigned long timeoutMs);
void notifyOtaStatusChanged(in DOMString status);
}; };
/** /**
* XPCOM component (in the content process) that provides the mobile * XPCOM component (in the content process) that provides the mobile
* network information. * network information.
*/ */
[scriptable, uuid(576c7c00-7319-4309-aa9e-1dab102e0874)] [scriptable, uuid(c66652e0-0628-11e3-8ffd-0800200c9a66)]
interface nsIMobileConnectionProvider : nsISupports interface nsIMobileConnectionProvider : nsISupports
{ {
/** /**
@ -71,6 +72,8 @@ interface nsIMobileConnectionProvider : nsISupports
in jsval option); in jsval option);
nsIDOMDOMRequest setCallBarringOption(in nsIDOMWindow window, nsIDOMDOMRequest setCallBarringOption(in nsIDOMWindow window,
in jsval option); in jsval option);
nsIDOMDOMRequest changeCallBarringPassword(in nsIDOMWindow window,
in jsval info);
nsIDOMDOMRequest setCallWaitingOption(in nsIDOMWindow window, nsIDOMDOMRequest setCallWaitingOption(in nsIDOMWindow window,
in bool enabled); in bool enabled);

View File

@ -3,7 +3,6 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "MobileConnection.h" #include "MobileConnection.h"
#include "GeneratedEvents.h" #include "GeneratedEvents.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "nsDOMEvent.h" #include "nsDOMEvent.h"
@ -12,6 +11,7 @@
#include "nsIDOMDOMRequest.h" #include "nsIDOMDOMRequest.h"
#include "nsIDOMDataErrorEvent.h" #include "nsIDOMDataErrorEvent.h"
#include "nsIDOMMozEmergencyCbModeEvent.h" #include "nsIDOMMozEmergencyCbModeEvent.h"
#include "nsIDOMMozOtaStatusEvent.h"
#include "nsIDOMUSSDReceivedEvent.h" #include "nsIDOMUSSDReceivedEvent.h"
#include "nsIPermissionManager.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, dataerror)
NS_IMPL_EVENT_HANDLER(MobileConnection, cfstatechange) NS_IMPL_EVENT_HANDLER(MobileConnection, cfstatechange)
NS_IMPL_EVENT_HANDLER(MobileConnection, emergencycbmodechange) NS_IMPL_EVENT_HANDLER(MobileConnection, emergencycbmodechange)
NS_IMPL_EVENT_HANDLER(MobileConnection, otastatuschange)
MobileConnection::MobileConnection() MobileConnection::MobileConnection()
{ {
@ -406,6 +407,23 @@ MobileConnection::SetCallBarringOption(const JS::Value& aOption,
return mProvider->SetCallBarringOption(GetOwner(), aOption, aRequest); 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 NS_IMETHODIMP
MobileConnection::GetCallWaitingOption(nsIDOMDOMRequest** aRequest) MobileConnection::GetCallWaitingOption(nsIDOMDOMRequest** aRequest)
{ {
@ -594,3 +612,22 @@ MobileConnection::NotifyEmergencyCbModeChanged(bool aActive,
return DispatchTrustedEvent(ce); return DispatchTrustedEvent(ce);
} }
NS_IMETHODIMP
MobileConnection::NotifyOtaStatusChanged(const nsAString& aStatus)
{
if (!CheckPermission("mobileconnection")) {
return NS_OK;
}
nsCOMPtr<nsIDOMEvent> event;
NS_NewDOMMozOtaStatusEvent(getter_AddRefs(event), this, nullptr, nullptr);
MOZ_ASSERT(event);
nsCOMPtr<nsIDOMMozOtaStatusEvent> ce = do_QueryInterface(event);
nsresult rv = ce->InitMozOtaStatusEvent(NS_LITERAL_STRING("otastatuschange"),
false, false, aStatus);
NS_ENSURE_SUCCESS(rv, rv);
return DispatchTrustedEvent(ce);
}

View File

@ -16,3 +16,4 @@ disabled = Bug 808783
[test_mobile_roaming_preference.js] [test_mobile_roaming_preference.js]
[test_call_barring_get_option.js] [test_call_barring_get_option.js]
[test_call_barring_set_error.js] [test_call_barring_set_error.js]
[test_call_barring_change_password.js]

View File

@ -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();
}

View File

@ -92,6 +92,7 @@ const RIL_IPC_MSG_NAMES = [
"RIL:GetCallForwardingOption", "RIL:GetCallForwardingOption",
"RIL:SetCallBarringOption", "RIL:SetCallBarringOption",
"RIL:GetCallBarringOption", "RIL:GetCallBarringOption",
"RIL:ChangeCallBarringPassword",
"RIL:SetCallWaitingOption", "RIL:SetCallWaitingOption",
"RIL:GetCallWaitingOption", "RIL:GetCallWaitingOption",
"RIL:SetCallingLineIdRestriction", "RIL:SetCallingLineIdRestriction",
@ -109,7 +110,8 @@ const RIL_IPC_MSG_NAMES = [
"RIL:ExitEmergencyCbMode", "RIL:ExitEmergencyCbMode",
"RIL:SetVoicePrivacyMode", "RIL:SetVoicePrivacyMode",
"RIL:GetVoicePrivacyMode", "RIL:GetVoicePrivacyMode",
"RIL:ConferenceCallStateChanged" "RIL:ConferenceCallStateChanged",
"RIL:OtaStatusChanged"
]; ];
XPCOMUtils.defineLazyServiceGetter(this, "cpmm", XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
@ -1102,6 +1104,31 @@ RILContentHelper.prototype = {
return request; 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) { getCallWaitingOption: function getCallWaitingOption(window) {
if (window == null) { if (window == null) {
throw Components.Exception("Can't get window object", throw Components.Exception("Can't get window object",
@ -1531,6 +1558,11 @@ RILContentHelper.prototype = {
"notifyDataChanged", "notifyDataChanged",
null); null);
break; break;
case "RIL:OtaStatusChanged":
this._deliverEvent("_mobileConnectionListeners",
"notifyOtaStatusChanged",
[msg.json.data]);
break;
case "RIL:EnumerateCalls": case "RIL:EnumerateCalls":
this.handleEnumerateCalls(msg.json.calls); this.handleEnumerateCalls(msg.json.calls);
break; break;
@ -1658,6 +1690,9 @@ RILContentHelper.prototype = {
case "RIL:SetCallBarringOption": case "RIL:SetCallBarringOption":
this.handleSimpleRequest(msg.json.requestId, msg.json.errorMsg, null); this.handleSimpleRequest(msg.json.requestId, msg.json.errorMsg, null);
break; break;
case "RIL:ChangeCallBarringPassword":
this.handleSimpleRequest(msg.json.requestId, msg.json.errorMsg, null);
break;
case "RIL:GetCallWaitingOption": case "RIL:GetCallWaitingOption":
this.handleSimpleRequest(msg.json.requestId, msg.json.errorMsg, this.handleSimpleRequest(msg.json.requestId, msg.json.errorMsg,
msg.json.enabled); msg.json.enabled);

View File

@ -109,6 +109,7 @@ const RIL_IPC_MOBILECONNECTION_MSG_NAMES = [
"RIL:GetCallForwardingOption", "RIL:GetCallForwardingOption",
"RIL:SetCallBarringOption", "RIL:SetCallBarringOption",
"RIL:GetCallBarringOption", "RIL:GetCallBarringOption",
"RIL:ChangeCallBarringPassword",
"RIL:SetCallWaitingOption", "RIL:SetCallWaitingOption",
"RIL:GetCallWaitingOption", "RIL:GetCallWaitingOption",
"RIL:SetCallingLineIdRestriction", "RIL:SetCallingLineIdRestriction",
@ -1017,6 +1018,9 @@ RadioInterface.prototype = {
case "RIL:GetCallBarringOption": case "RIL:GetCallBarringOption":
this.workerMessenger.sendWithIPCMessage(msg, "queryCallBarringStatus"); this.workerMessenger.sendWithIPCMessage(msg, "queryCallBarringStatus");
break; break;
case "RIL:ChangeCallBarringPassword":
this.workerMessenger.sendWithIPCMessage(msg, "changeCallBarringPassword");
break;
case "RIL:SetCallWaitingOption": case "RIL:SetCallWaitingOption":
this.workerMessenger.sendWithIPCMessage(msg, "setCallWaiting"); this.workerMessenger.sendWithIPCMessage(msg, "setCallWaiting");
break; break;
@ -1100,6 +1104,9 @@ RadioInterface.prototype = {
case "operatorchange": case "operatorchange":
this.handleOperatorChange(message); this.handleOperatorChange(message);
break; break;
case "otastatuschange":
this.handleOtaStatus(message);
break;
case "radiostatechange": case "radiostatechange":
this.handleRadioStateChange(message); this.handleRadioStateChange(message);
break; 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) { handleRadioStateChange: function handleRadioStateChange(message) {
this._changingRadioPower = false; this._changingRadioPower = false;

View File

@ -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_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; 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(). // Allow this file to be imported via Components.utils.import().
this.EXPORTED_SYMBOLS = Object.keys(this); this.EXPORTED_SYMBOLS = Object.keys(this);

View File

@ -2327,6 +2327,25 @@ let RIL = {
this.setICCFacilityLock(options); 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. * 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); 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) { RIL[REQUEST_SIM_OPEN_CHANNEL] = function REQUEST_SIM_OPEN_CHANNEL(length, options) {
if (options.rilRequestError) { if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[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", this.sendChromeMessage({rilMessageType: "cdmaCallWaiting",
number: call.number}); 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_CDMA_INFO_REC] = null;
RIL[UNSOLICITED_OEM_HOOK_RAW] = null; RIL[UNSOLICITED_OEM_HOOK_RAW] = null;
RIL[UNSOLICITED_RINGBACK_TONE] = null; RIL[UNSOLICITED_RINGBACK_TONE] = null;

View File

@ -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();
});

View File

@ -17,3 +17,4 @@ tail =
[test_ril_worker_voiceprivacy.js] [test_ril_worker_voiceprivacy.js]
[test_ril_worker_ecm.js] [test_ril_worker_ecm.js]
[test_ril_worker_stk.js] [test_ril_worker_stk.js]
[test_ril_worker_barring_password.js]

View File

@ -58,31 +58,26 @@ interface MozInputMethodManager {
[JSImplementation="@mozilla.org/b2g-inputcontext;1"] [JSImplementation="@mozilla.org/b2g-inputcontext;1"]
interface MozInputContext: EventTarget { interface MozInputContext: EventTarget {
// The tag name of input field, which is enum of "input", "textarea", or "contenteditable" // 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. // 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 // 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. * 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 * 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. * The primary language for the input field.
* It is the value of HTMLElement.lang. * It is the value of HTMLElement.lang.
* See http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#htmlelement * 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. * Get the whole text content of the input field.
* @return DOMString * @return DOMString
*/ */
Promise getText(optional long offset, optional long length); Promise getText(optional long offset, optional long length);
// The start and stop position of the selection. // The start and stop position of the selection.
readonly attribute long selectionStart; readonly attribute long selectionStart;
readonly attribute long selectionEnd; readonly attribute long selectionEnd;

View File

@ -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 = "";
};

View File

@ -498,6 +498,7 @@ webidl_files += \
MozCellBroadcast.webidl \ MozCellBroadcast.webidl \
MozCellBroadcastEvent.webidl \ MozCellBroadcastEvent.webidl \
MozEmergencyCbModeEvent.webidl \ MozEmergencyCbModeEvent.webidl \
MozOtaStatusEvent.webidl \
MozVoicemailEvent.webidl \ MozVoicemailEvent.webidl \
MozWifiConnectionInfoEvent.webidl \ MozWifiConnectionInfoEvent.webidl \
MozWifiStatusChangeEvent.webidl \ MozWifiStatusChangeEvent.webidl \

View File

@ -36,6 +36,7 @@ simple_events = [
'DataErrorEvent', 'DataErrorEvent',
'IccCardLockErrorEvent', 'IccCardLockErrorEvent',
'MozEmergencyCbModeEvent', 'MozEmergencyCbModeEvent',
'MozOtaStatusEvent',
'MozWifiStatusChangeEvent', 'MozWifiStatusChangeEvent',
'MozWifiConnectionInfoEvent', 'MozWifiConnectionInfoEvent',
'MozCellBroadcastEvent', 'MozCellBroadcastEvent',