diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index 5fcc795ac98b..3164a337a527 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -693,6 +693,7 @@ GK_ATOM(onget, "onget") GK_ATOM(onhashchange, "onhashchange") GK_ATOM(onheld, "onheld") GK_ATOM(onholding, "onholding") +GK_ATOM(oniccinfochange, "oniccinfochange") GK_ATOM(onincoming, "onincoming") GK_ATOM(oninput, "oninput") GK_ATOM(oninvalid, "oninvalid") diff --git a/dom/network/src/MobileConnection.cpp b/dom/network/src/MobileConnection.cpp index 08c4ede3edfc..a1ae23a28cfd 100644 --- a/dom/network/src/MobileConnection.cpp +++ b/dom/network/src/MobileConnection.cpp @@ -16,6 +16,7 @@ #define VOICECHANGE_EVENTNAME NS_LITERAL_STRING("voicechange") #define DATACHANGE_EVENTNAME NS_LITERAL_STRING("datachange") #define CARDSTATECHANGE_EVENTNAME NS_LITERAL_STRING("cardstatechange") +#define ICCINFOCHANGE_EVENTNAME NS_LITERAL_STRING("iccinfochange") #define USSDRECEIVED_EVENTNAME NS_LITERAL_STRING("ussdreceived") DOMCI_DATA(MozMobileConnection, mozilla::dom::network::MobileConnection) @@ -27,6 +28,7 @@ namespace network { const char* kVoiceChangedTopic = "mobile-connection-voice-changed"; const char* kDataChangedTopic = "mobile-connection-data-changed"; const char* kCardStateChangedTopic = "mobile-connection-cardstate-changed"; +const char* kIccInfoChangedTopic = "mobile-connection-iccinfo-changed"; const char* kUssdReceivedTopic = "mobile-connection-ussd-received"; NS_IMPL_CYCLE_COLLECTION_CLASS(MobileConnection) @@ -51,6 +53,7 @@ NS_IMPL_ADDREF_INHERITED(MobileConnection, nsDOMEventTargetHelper) NS_IMPL_RELEASE_INHERITED(MobileConnection, nsDOMEventTargetHelper) NS_IMPL_EVENT_HANDLER(MobileConnection, cardstatechange) +NS_IMPL_EVENT_HANDLER(MobileConnection, iccinfochange) NS_IMPL_EVENT_HANDLER(MobileConnection, voicechange) NS_IMPL_EVENT_HANDLER(MobileConnection, datachange) NS_IMPL_EVENT_HANDLER(MobileConnection, ussdreceived) @@ -80,6 +83,7 @@ MobileConnection::Init(nsPIDOMWindow* aWindow) obs->AddObserver(this, kVoiceChangedTopic, false); obs->AddObserver(this, kDataChangedTopic, false); obs->AddObserver(this, kCardStateChangedTopic, false); + obs->AddObserver(this, kIccInfoChangedTopic, false); obs->AddObserver(this, kUssdReceivedTopic, false); mIccManager = new icc::IccManager(); @@ -98,6 +102,7 @@ MobileConnection::Shutdown() obs->RemoveObserver(this, kVoiceChangedTopic); obs->RemoveObserver(this, kDataChangedTopic); obs->RemoveObserver(this, kCardStateChangedTopic); + obs->RemoveObserver(this, kIccInfoChangedTopic); obs->RemoveObserver(this, kUssdReceivedTopic); if (mIccManager) { @@ -128,6 +133,11 @@ MobileConnection::Observe(nsISupports* aSubject, return NS_OK; } + if (!strcmp(aTopic, kIccInfoChangedTopic)) { + InternalDispatchEvent(ICCINFOCHANGE_EVENTNAME); + return NS_OK; + } + if (!strcmp(aTopic, kUssdReceivedTopic)) { nsString ussd; ussd.Assign(aData); @@ -157,6 +167,16 @@ MobileConnection::GetCardState(nsAString& cardState) return mProvider->GetCardState(cardState); } +NS_IMETHODIMP +MobileConnection::GetIccInfo(nsIDOMMozMobileICCInfo** aIccInfo) +{ + if (!mProvider) { + *aIccInfo = nullptr; + return NS_OK; + } + return mProvider->GetIccInfo(aIccInfo); +} + NS_IMETHODIMP MobileConnection::GetVoice(nsIDOMMozMobileConnectionInfo** voice) {