mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 4b0f636041e5 (bug 814634) for missing r= in comment
This commit is contained in:
parent
86d21a4f76
commit
f087795a0d
@ -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<JSObject*> 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<uint32_t>& 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<nsIDOMMozVoicemailStatus>
|
||||
Voicemail::GetStatus(const Optional<uint32_t>& 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<nsIDOMMozVoicemailStatus> 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<uint32_t>& aServiceId,
|
||||
}
|
||||
|
||||
void
|
||||
Voicemail::GetNumber(const Optional<uint32_t>& aServiceId, nsString& aNumber,
|
||||
ErrorResult& aRv) const
|
||||
Voicemail::GetNumber(nsString& aNumber, ErrorResult& aRv) const
|
||||
{
|
||||
aNumber.SetIsVoid(true);
|
||||
|
||||
@ -130,18 +97,11 @@ Voicemail::GetNumber(const Optional<uint32_t>& 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<uint32_t>& aServiceId, nsString& aDisplayName,
|
||||
ErrorResult& aRv) const
|
||||
Voicemail::GetDisplayName(nsString& aDisplayName, ErrorResult& aRv) const
|
||||
{
|
||||
aDisplayName.SetIsVoid(true);
|
||||
|
||||
@ -150,13 +110,7 @@ Voicemail::GetDisplayName(const Optional<uint32_t>& 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
|
||||
|
@ -52,28 +52,19 @@ public:
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
|
||||
already_AddRefed<nsIDOMMozVoicemailStatus>
|
||||
GetStatus(const Optional<uint32_t>& aServiceId, ErrorResult& aRv) const;
|
||||
GetStatus(ErrorResult& aRv) const;
|
||||
|
||||
void
|
||||
GetNumber(const Optional<uint32_t>& aServiceId, nsString& aNumber,
|
||||
ErrorResult& aRv) const;
|
||||
GetNumber(nsString& aNumber, ErrorResult& aRv) const;
|
||||
|
||||
void
|
||||
GetDisplayName(const Optional<uint32_t>& aServiceId, nsString& aDisplayName,
|
||||
ErrorResult& aRv) const;
|
||||
GetDisplayName(nsString& aDisplayName, ErrorResult& aRv) const;
|
||||
|
||||
IMPL_EVENT_HANDLER(statuschanged)
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIVoicemailProvider> mProvider;
|
||||
nsRefPtr<Listener> mListener;
|
||||
|
||||
bool
|
||||
IsValidServiceId(uint32_t aServiceId) const;
|
||||
|
||||
bool
|
||||
PassedOrDefaultServiceId(const Optional<uint32_t>& aServiceId,
|
||||
uint32_t& aResult) const;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
Loading…
Reference in New Issue
Block a user