mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 674725 - Part AH - Allow to pass a SmsMessage or an id to delete(). r=mrbkap
This commit is contained in:
parent
97a37fb5c9
commit
a921997fc2
@ -51,7 +51,9 @@ interface nsIDOMMozSmsManager : nsIDOMEventTarget
|
||||
jsval send(in jsval number, in DOMString message);
|
||||
|
||||
[binaryname(GetMessageMoz)] nsIDOMMozSmsRequest getMessage(in long id);
|
||||
nsIDOMMozSmsRequest delete(in long id);
|
||||
|
||||
// The parameter can be either a message id or a SmsMessage.
|
||||
nsIDOMMozSmsRequest delete(in jsval param);
|
||||
|
||||
attribute nsIDOMEventListener onreceived;
|
||||
attribute nsIDOMEventListener onsent;
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsISmsDatabaseService.h"
|
||||
#include "nsIXPConnect.h"
|
||||
|
||||
/**
|
||||
* We have to use macros here because our leak analysis tool things we are
|
||||
@ -227,7 +228,7 @@ SmsManager::GetMessageMoz(PRInt32 aId, nsIDOMMozSmsRequest** aRequest)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
SmsManager::Delete(PRInt32 aId, nsIDOMMozSmsRequest** aRequest)
|
||||
{
|
||||
int requestId =
|
||||
@ -243,6 +244,28 @@ SmsManager::Delete(PRInt32 aId, nsIDOMMozSmsRequest** aRequest)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SmsManager::Delete(const jsval& aParam, nsIDOMMozSmsRequest** aRequest)
|
||||
{
|
||||
if (aParam.isInt32()) {
|
||||
return Delete(aParam.toInt32(), aRequest);
|
||||
}
|
||||
|
||||
if (!aParam.isObject()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMMozSmsMessage> message =
|
||||
do_QueryInterface(nsContentUtils::XPConnect()->GetNativeOfWrapper(
|
||||
mScriptContext->GetNativeContext(), &aParam.toObject()));
|
||||
NS_ENSURE_TRUE(message, NS_ERROR_INVALID_ARG);
|
||||
|
||||
PRInt32 id;
|
||||
message->GetId(&id);
|
||||
|
||||
return Delete(id, aRequest);
|
||||
}
|
||||
|
||||
NS_IMPL_EVENT_HANDLER(SmsManager, received)
|
||||
NS_IMPL_EVENT_HANDLER(SmsManager, sent)
|
||||
NS_IMPL_EVENT_HANDLER(SmsManager, delivered)
|
||||
|
@ -72,6 +72,11 @@ private:
|
||||
nsresult Send(JSContext* aCx, JSObject* aGlobal, JSString* aNumber,
|
||||
const nsAString& aMessage, jsval* aRequest);
|
||||
|
||||
/**
|
||||
* Internal Delete() method used to delete a message.
|
||||
*/
|
||||
nsresult Delete(PRInt32 aId, nsIDOMMozSmsRequest** aRequest);
|
||||
|
||||
nsresult DispatchTrustedSmsEventToSelf(const nsAString& aEventName,
|
||||
nsIDOMMozSmsMessage* aMessage);
|
||||
NS_DECL_EVENT_HANDLER(received)
|
||||
|
Loading…
Reference in New Issue
Block a user