mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 15a281081b97 (bug 958782) for bustage on a CLOSED TREE
This commit is contained in:
parent
16657f2318
commit
601b428c17
@ -127,14 +127,15 @@ MobileMessageManager::GetSegmentInfoForText(const nsAString& aText,
|
||||
}
|
||||
|
||||
nsresult
|
||||
MobileMessageManager::Send(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGlobal,
|
||||
nsISmsService* aSmsService,
|
||||
MobileMessageManager::Send(JSContext* aCx, JS::Handle<JSObject*> aGlobal,
|
||||
uint32_t aServiceId,
|
||||
JS::Handle<JSString*> aNumber,
|
||||
const nsAString& aText,
|
||||
const nsAString& aMessage,
|
||||
JS::MutableHandle<JS::Value> aRequest)
|
||||
{
|
||||
nsCOMPtr<nsISmsService> smsService = do_GetService(SMS_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(smsService, NS_ERROR_FAILURE);
|
||||
|
||||
nsDependentJSString number;
|
||||
number.init(aCx, aNumber);
|
||||
|
||||
@ -143,8 +144,8 @@ MobileMessageManager::Send(JSContext* aCx,
|
||||
new MobileMessageCallback(request);
|
||||
|
||||
// By default, we don't send silent messages via MobileMessageManager.
|
||||
nsresult rv = aSmsService->Send(aServiceId, number, aText,
|
||||
false, msgCallback);
|
||||
nsresult rv = smsService->Send(aServiceId, number, aMessage,
|
||||
false, msgCallback);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
js::AssertSameCompartment(aCx, aGlobal);
|
||||
@ -161,7 +162,7 @@ MobileMessageManager::Send(JSContext* aCx,
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileMessageManager::Send(JS::Handle<JS::Value> aNumber,
|
||||
const nsAString& aText,
|
||||
const nsAString& aMessage,
|
||||
JS::Handle<JS::Value> aSendParams,
|
||||
JSContext* aCx,
|
||||
uint8_t aArgc,
|
||||
@ -189,25 +190,23 @@ MobileMessageManager::Send(JS::Handle<JS::Value> aNumber,
|
||||
|
||||
// Use the default one unless |aSendParams.serviceId| is available.
|
||||
uint32_t serviceId;
|
||||
RootedDictionary<SmsSendParameters> sendParams(aCx);
|
||||
rv = smsService->GetSmsDefaultServiceId(&serviceId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aArgc >= 1) {
|
||||
if (aArgc == 1) {
|
||||
JS::Rooted<JS::Value> param(aCx, aSendParams);
|
||||
RootedDictionary<SmsSendParameters> sendParams(aCx);
|
||||
if (!sendParams.Init(aCx, param)) {
|
||||
return NS_ERROR_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
if (sendParams.mServiceId.WasPassed()) {
|
||||
serviceId = sendParams.mServiceId.Value();
|
||||
} else {
|
||||
rv = smsService->GetSmsDefaultServiceId(&serviceId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (sendParams.mServiceId.WasPassed()) {
|
||||
serviceId = sendParams.mServiceId.Value();
|
||||
}
|
||||
}
|
||||
|
||||
if (aNumber.isString()) {
|
||||
JS::Rooted<JSString*> str(aCx, aNumber.toString());
|
||||
return Send(aCx, global, smsService, serviceId, str, aText, aReturn);
|
||||
return Send(aCx, global, serviceId, str, aMessage, aReturn);
|
||||
}
|
||||
|
||||
// Must be an array then.
|
||||
@ -235,7 +234,7 @@ MobileMessageManager::Send(JS::Handle<JS::Value> aNumber,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult rv = Send(aCx, global, smsService, serviceId, str, aText, requests[i]);
|
||||
nsresult rv = Send(aCx, global, serviceId, str, aMessage, requests[i]);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
@ -261,21 +260,18 @@ MobileMessageManager::SendMMS(JS::Handle<JS::Value> aParams,
|
||||
|
||||
// Use the default one unless |aSendParams.serviceId| is available.
|
||||
uint32_t serviceId;
|
||||
RootedDictionary<MmsSendParameters> sendParams(aCx);
|
||||
nsresult rv;
|
||||
nsresult rv = mmsService->GetMmsDefaultServiceId(&serviceId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aArgc >= 1) {
|
||||
if (aArgc == 1) {
|
||||
JS::Rooted<JS::Value> param(aCx, aSendParams);
|
||||
RootedDictionary<MmsSendParameters> sendParams(aCx);
|
||||
if (!sendParams.Init(aCx, param)) {
|
||||
return NS_ERROR_TYPE_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
if (sendParams.mServiceId.WasPassed()) {
|
||||
serviceId = sendParams.mServiceId.Value();
|
||||
} else {
|
||||
rv = mmsService->GetMmsDefaultServiceId(&serviceId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (sendParams.mServiceId.WasPassed()) {
|
||||
serviceId = sendParams.mServiceId.Value();
|
||||
}
|
||||
}
|
||||
|
||||
nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());
|
||||
@ -288,16 +284,15 @@ MobileMessageManager::SendMMS(JS::Handle<JS::Value> aParams,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileMessageManager::GetMessageMoz(int32_t aId,
|
||||
nsIDOMDOMRequest** aRequest)
|
||||
MobileMessageManager::GetMessageMoz(int32_t aId, nsIDOMDOMRequest** aRequest)
|
||||
{
|
||||
nsCOMPtr<nsIMobileMessageDatabaseService> dbService =
|
||||
nsCOMPtr<nsIMobileMessageDatabaseService> mobileMessageDBService =
|
||||
do_GetService(MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(dbService, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(mobileMessageDBService, NS_ERROR_FAILURE);
|
||||
|
||||
nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());
|
||||
nsCOMPtr<nsIMobileMessageCallback> msgCallback = new MobileMessageCallback(request);
|
||||
nsresult rv = dbService->GetMessageMoz(aId, msgCallback);
|
||||
nsresult rv = mobileMessageDBService->GetMessageMoz(aId, msgCallback);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
request.forget(aRequest);
|
||||
@ -324,8 +319,7 @@ MobileMessageManager::GetMessageId(JSContext* aCx,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileMessageManager::Delete(JS::Handle<JS::Value> aParam,
|
||||
JSContext* aCx,
|
||||
MobileMessageManager::Delete(JS::Handle<JS::Value> aParam, JSContext* aCx,
|
||||
nsIDOMDOMRequest** aRequest)
|
||||
{
|
||||
// We expect Int32, SmsMessage, MmsMessage, Int32[], SmsMessage[], MmsMessage[]
|
||||
@ -420,19 +414,19 @@ MobileMessageManager::GetMessages(nsIDOMMozSmsFilter* aFilter,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileMessageManager::MarkMessageRead(int32_t aId,
|
||||
bool aValue,
|
||||
MobileMessageManager::MarkMessageRead(int32_t aId, bool aValue,
|
||||
bool aSendReadReport,
|
||||
nsIDOMDOMRequest** aRequest)
|
||||
{
|
||||
nsCOMPtr<nsIMobileMessageDatabaseService> dbService =
|
||||
nsCOMPtr<nsIMobileMessageDatabaseService> mobileMessageDBService =
|
||||
do_GetService(MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(dbService, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(mobileMessageDBService, NS_ERROR_FAILURE);
|
||||
|
||||
nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());
|
||||
nsCOMPtr<nsIMobileMessageCallback> msgCallback = new MobileMessageCallback(request);
|
||||
nsresult rv = dbService->MarkMessageRead(aId, aValue, aSendReadReport,
|
||||
msgCallback);
|
||||
nsresult rv = mobileMessageDBService->MarkMessageRead(aId, aValue,
|
||||
aSendReadReport,
|
||||
msgCallback);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
request.forget(aRequest);
|
||||
@ -461,20 +455,20 @@ MobileMessageManager::GetThreads(nsIDOMDOMCursor** aCursor)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileMessageManager::RetrieveMMS(int32_t aId,
|
||||
MobileMessageManager::RetrieveMMS(int32_t id,
|
||||
nsIDOMDOMRequest** aRequest)
|
||||
{
|
||||
nsCOMPtr<nsIMmsService> mmsService = do_GetService(MMS_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(mmsService, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIMmsService> mmsService = do_GetService(MMS_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(mmsService, NS_ERROR_FAILURE);
|
||||
|
||||
nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());
|
||||
nsCOMPtr<nsIMobileMessageCallback> msgCallback = new MobileMessageCallback(request);
|
||||
nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());
|
||||
nsCOMPtr<nsIMobileMessageCallback> msgCallback = new MobileMessageCallback(request);
|
||||
|
||||
nsresult rv = mmsService->Retrieve(aId, msgCallback);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsresult rv = mmsService->Retrieve(id, msgCallback);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
request.forget(aRequest);
|
||||
return NS_OK;
|
||||
request.forget(aRequest);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -558,15 +552,14 @@ MobileMessageManager::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileMessageManager::GetSmscAddress(uint32_t aServiceId,
|
||||
uint8_t aArgc,
|
||||
MobileMessageManager::GetSmscAddress(uint32_t aServiceId, uint8_t aArgc,
|
||||
nsIDOMDOMRequest** aRequest)
|
||||
{
|
||||
nsCOMPtr<nsISmsService> smsService = do_GetService(SMS_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(smsService, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv;
|
||||
if (aArgc == 0) {
|
||||
if (aArgc != 1) {
|
||||
rv = smsService->GetSmsDefaultServiceId(&aServiceId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "nsIDOMMobileMessageManager.h"
|
||||
#include "nsIObserver.h"
|
||||
|
||||
class nsISmsService;
|
||||
class nsIDOMMozSmsMessage;
|
||||
class nsIDOMMozMmsMessage;
|
||||
|
||||
@ -35,27 +34,21 @@ private:
|
||||
/**
|
||||
* Internal Send() method used to send one message.
|
||||
*/
|
||||
nsresult
|
||||
Send(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGlobal,
|
||||
nsISmsService* aSmsService,
|
||||
uint32_t aServiceId,
|
||||
JS::Handle<JSString*> aNumber,
|
||||
const nsAString& aText,
|
||||
JS::MutableHandle<JS::Value> aRequest);
|
||||
nsresult Send(JSContext* aCx, JS::Handle<JSObject*> aGlobal,
|
||||
uint32_t aServiceId,
|
||||
JS::Handle<JSString*> aNumber,
|
||||
const nsAString& aMessage,
|
||||
JS::MutableHandle<JS::Value> aRequest);
|
||||
|
||||
nsresult
|
||||
DispatchTrustedSmsEventToSelf(const char* aTopic,
|
||||
const nsAString& aEventName,
|
||||
nsISupports* aMsg);
|
||||
nsresult DispatchTrustedSmsEventToSelf(const char* aTopic,
|
||||
const nsAString& aEventName,
|
||||
nsISupports* aMsg);
|
||||
|
||||
/**
|
||||
* Helper to get message ID from SMS/MMS Message object
|
||||
*/
|
||||
nsresult
|
||||
GetMessageId(JSContext* aCx,
|
||||
const JS::Value& aMessage,
|
||||
int32_t* aId);
|
||||
nsresult GetMessageId(JSContext* aCx, const JS::Value& aMessage,
|
||||
int32_t* aId);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
Loading…
Reference in New Issue
Block a user