Bug 1112471 - Part 1: Introduce a new API for getting icc service state. r=hsinyi
--- a/dom/icc/interfaces/nsIIccProvider.idl
+++ b/dom/icc/interfaces/nsIIccProvider.idl
@@ -53,17 +53,17 @@ interface nsIIccChannelCallback : nsISup
*
*/
void notifyError(in DOMString error);
};
/**
* XPCOM component (in the content process) that provides the ICC information.
*/
-[scriptable, uuid(bf985ee1-14c9-43c6-a471-8ab52fb24b0d)]
+[scriptable, uuid(821bda2b-7abd-44c6-813e-d4bc68d73a0c)]
interface nsIIccProvider : nsISupports
{
// MUST match enum IccCardState in MozIcc.webidl!
const unsigned long CARD_STATE_UNKNOWN = 0;
const unsigned long CARD_STATE_READY = 1;
const unsigned long CARD_STATE_PIN_REQUIRED = 2;
const unsigned long CARD_STATE_PUK_REQUIRED = 3;
const unsigned long CARD_STATE_PERMANENT_BLOCKED = 4;
@@ -123,16 +123,19 @@ interface nsIIccProvider : nsISupports
const unsigned long CARD_CONTACT_TYPE_FDN = 1;
const unsigned long CARD_CONTACT_TYPE_SDN = 2;
// MUST match with enum IccMvnoType in MozIcc.webidl
const unsigned long CARD_MVNO_TYPE_IMSI = 0;
const unsigned long CARD_MVNO_TYPE_SPN = 1;
const unsigned long CARD_MVNO_TYPE_GID = 2;
+ // MUST match with enum IccService in MozIcc.webidl
+ const unsigned long CARD_SERVICE_FDN = 0;
+
/**
* Called when a content process registers receiving unsolicited messages from
* RadioInterfaceLayer in the chrome process. Only a content process that has
* the 'mobileconnection' permission is allowed to register.
*/
void registerIccMsg(in unsigned long clientId, in nsIIccListener listener);
void unregisterIccMsg(in unsigned long clientId, in nsIIccListener listener);
@@ -234,9 +237,13 @@ interface nsIIccProvider : nsISupports
/**
* Helpers
*/
nsIDOMDOMRequest matchMvno(in unsigned long clientId,
in nsIDOMWindow window,
in unsigned long mvnoType,
in DOMString mvnoData);
+
+ nsISupports getServiceState(in unsigned long clientId,
+ in nsIDOMWindow window,
+ in unsigned long service);
};
--- a/dom/webidl/MozIcc.webidl
+++ b/dom/webidl/MozIcc.webidl
@@ -84,16 +84,21 @@ enum IccContactType
enum IccMvnoType
{
"imsi",
"spn",
"gid"
};
+enum IccService
+{
+ "fdn"
+};
+
dictionary IccUnlockCardLockOptions
{
required IccLockType lockType;
DOMString? pin = null; // Necessary for lock types: "pin", "pin2", "nck",
// "nck1", "nck2", "hnck", "cck", "spck", "rcck",
// "rspck".
@@ -326,9 +331,22 @@ interface MozIcc : EventTarget
* Data to be compared with ICC's field.
*
* @return a DOMRequest.
* The request's result will be a boolean indicating the matching
* result.
*/
[Throws]
DOMRequest matchMvno(IccMvnoType mvnoType, DOMString matchData);
+
+ /**
+ * Retrieve the the availability of an icc service.
+ *
+ * @param service
+ * Identifies the service type.
+ *
+ * @return a Promise
+ * If succeeds, the promise is resolved with boolean indicating the
+ * availability of the service. Otherwise, rejected with a DOMError.
+ */
+ [NewObject, Throws]
+ Promise<boolean> getServiceState(IccService service);
};