diff --git a/dom/voicemail/Voicemail.cpp b/dom/voicemail/Voicemail.cpp index 2b5c3bfec87..a4de3a68595 100644 --- a/dom/voicemail/Voicemail.cpp +++ b/dom/voicemail/Voicemail.cpp @@ -10,14 +10,12 @@ #include "nsIDOMMozVoicemailStatus.h" #include "nsIDOMMozVoicemailEvent.h" -#include "mozilla/Preferences.h" #include "mozilla/Services.h" #include "nsDOMClassInfo.h" #include "nsServiceManagerUtils.h" #include "GeneratedEvents.h" #define NS_RILCONTENTHELPER_CONTRACTID "@mozilla.org/ril/content-helper;1" -const char* kPrefRilNumRadioInterfaces = "ril.numRadioInterfaces"; using namespace mozilla::dom; @@ -69,48 +67,18 @@ Voicemail::WrapObject(JSContext* aCx, JS::Handle aScope) return MozVoicemailBinding::Wrap(aCx, aScope, this); } -bool -Voicemail::IsValidServiceId(uint32_t aServiceId) const -{ - uint32_t numClients = mozilla::Preferences::GetUint(kPrefRilNumRadioInterfaces, 1); - - return aServiceId < numClients; -} - -bool -Voicemail::PassedOrDefaultServiceId(const Optional& aServiceId, - uint32_t& aResult) const -{ - if (aServiceId.WasPassed()) { - if (!IsValidServiceId(aServiceId.Value())) { - return false; - } - aResult = aServiceId.Value(); - } else { - mProvider->GetVoicemailDefaultServiceId(&aResult); - } - - return true; -} - // MozVoicemail WebIDL already_AddRefed -Voicemail::GetStatus(const Optional& aServiceId, - ErrorResult& aRv) const +Voicemail::GetStatus(ErrorResult& aRv) const { if (!mProvider) { aRv.Throw(NS_ERROR_UNEXPECTED); return nullptr; } - uint32_t id = 0; - if (!PassedOrDefaultServiceId(aServiceId, id)) { - aRv.Throw(NS_ERROR_INVALID_ARG); - return nullptr; - } nsCOMPtr status; - nsresult rv = mProvider->GetVoicemailStatus(id, getter_AddRefs(status)); + nsresult rv = mProvider->GetVoicemailStatus(getter_AddRefs(status)); if (NS_FAILED(rv)) { aRv.Throw(rv); return nullptr; @@ -120,8 +88,7 @@ Voicemail::GetStatus(const Optional& aServiceId, } void -Voicemail::GetNumber(const Optional& aServiceId, nsString& aNumber, - ErrorResult& aRv) const +Voicemail::GetNumber(nsString& aNumber, ErrorResult& aRv) const { aNumber.SetIsVoid(true); @@ -130,18 +97,11 @@ Voicemail::GetNumber(const Optional& aServiceId, nsString& aNumber, return; } - uint32_t id = 0; - if (!PassedOrDefaultServiceId(aServiceId, id)) { - aRv.Throw(NS_ERROR_INVALID_ARG); - return; - } - - aRv = mProvider->GetVoicemailNumber(id, aNumber); + aRv = mProvider->GetVoicemailNumber(aNumber); } void -Voicemail::GetDisplayName(const Optional& aServiceId, nsString& aDisplayName, - ErrorResult& aRv) const +Voicemail::GetDisplayName(nsString& aDisplayName, ErrorResult& aRv) const { aDisplayName.SetIsVoid(true); @@ -150,13 +110,7 @@ Voicemail::GetDisplayName(const Optional& aServiceId, nsString& aDispl return; } - uint32_t id = 0; - if (!PassedOrDefaultServiceId(aServiceId, id)) { - aRv.Throw(NS_ERROR_INVALID_ARG); - return; - } - - aRv = mProvider->GetVoicemailDisplayName(id, aDisplayName); + aRv = mProvider->GetVoicemailDisplayName(aDisplayName); } // nsIVoicemailListener diff --git a/dom/voicemail/Voicemail.h b/dom/voicemail/Voicemail.h index 5da306ea22c..5ee5efef4c6 100644 --- a/dom/voicemail/Voicemail.h +++ b/dom/voicemail/Voicemail.h @@ -52,28 +52,19 @@ public: WrapObject(JSContext* aCx, JS::Handle aScope) MOZ_OVERRIDE; already_AddRefed - GetStatus(const Optional& aServiceId, ErrorResult& aRv) const; + GetStatus(ErrorResult& aRv) const; void - GetNumber(const Optional& aServiceId, nsString& aNumber, - ErrorResult& aRv) const; + GetNumber(nsString& aNumber, ErrorResult& aRv) const; void - GetDisplayName(const Optional& aServiceId, nsString& aDisplayName, - ErrorResult& aRv) const; + GetDisplayName(nsString& aDisplayName, ErrorResult& aRv) const; IMPL_EVENT_HANDLER(statuschanged) private: nsCOMPtr mProvider; nsRefPtr mListener; - - bool - IsValidServiceId(uint32_t aServiceId) const; - - bool - PassedOrDefaultServiceId(const Optional& aServiceId, - uint32_t& aResult) const; }; } // namespace dom