mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1023695 - Part 4: Implementation of .webidl change. r=vyang,smaug.
This commit is contained in:
parent
f5bd2367f0
commit
af7847c86c
@ -702,6 +702,7 @@ GK_ATOM(oncut, "oncut")
|
||||
GK_ATOM(ondatachange, "ondatachange")
|
||||
GK_ATOM(ondataerror, "ondataerror")
|
||||
GK_ATOM(ondblclick, "ondblclick")
|
||||
GK_ATOM(ondeleted, "ondeleted")
|
||||
GK_ATOM(ondeliverysuccess, "ondeliverysuccess")
|
||||
GK_ATOM(ondeliveryerror, "ondeliveryerror")
|
||||
GK_ATOM(ondevicefound, "ondevicefound")
|
||||
|
@ -249,6 +249,10 @@ const kEventConstructors = {
|
||||
return new MozEmergencyCbModeEvent(aName, aProps);
|
||||
},
|
||||
},
|
||||
MozMessageDeletedEvent: { create: function (aName, aProps) {
|
||||
return new MozMessageDeletedEvent(aName, aProps);
|
||||
},
|
||||
},
|
||||
MozMmsEvent: { create: function (aName, aProps) {
|
||||
return new MozMmsEvent(aName, aProps);
|
||||
},
|
||||
|
@ -5,11 +5,13 @@
|
||||
|
||||
#include "MobileMessageManager.h"
|
||||
|
||||
#include "DeletedMessageInfo.h"
|
||||
#include "DOMCursor.h"
|
||||
#include "DOMRequest.h"
|
||||
#include "MobileMessageCallback.h"
|
||||
#include "MobileMessageCursorCallback.h"
|
||||
#include "mozilla/dom/mobilemessage/Constants.h" // For kSms*ObserverTopic
|
||||
#include "mozilla/dom/MozMessageDeletedEvent.h"
|
||||
#include "mozilla/dom/MozMmsEvent.h"
|
||||
#include "mozilla/dom/MozMobileMessageManagerBinding.h"
|
||||
#include "mozilla/dom/MozSmsEvent.h"
|
||||
@ -35,6 +37,7 @@
|
||||
#define DELIVERY_ERROR_EVENT_NAME NS_LITERAL_STRING("deliveryerror")
|
||||
#define READ_SUCCESS_EVENT_NAME NS_LITERAL_STRING("readsuccess")
|
||||
#define READ_ERROR_EVENT_NAME NS_LITERAL_STRING("readerror")
|
||||
#define DELETED_EVENT_NAME NS_LITERAL_STRING("deleted")
|
||||
|
||||
using namespace mozilla::dom::mobilemessage;
|
||||
|
||||
@ -71,6 +74,7 @@ MobileMessageManager::Init()
|
||||
obs->AddObserver(this, kSmsDeliveryErrorObserverTopic, false);
|
||||
obs->AddObserver(this, kSmsReadSuccessObserverTopic, false);
|
||||
obs->AddObserver(this, kSmsReadErrorObserverTopic, false);
|
||||
obs->AddObserver(this, kSmsDeletedObserverTopic, false);
|
||||
}
|
||||
|
||||
void
|
||||
@ -91,6 +95,7 @@ MobileMessageManager::Shutdown()
|
||||
obs->RemoveObserver(this, kSmsDeliveryErrorObserverTopic);
|
||||
obs->RemoveObserver(this, kSmsReadSuccessObserverTopic);
|
||||
obs->RemoveObserver(this, kSmsReadErrorObserverTopic);
|
||||
obs->RemoveObserver(this, kSmsDeletedObserverTopic);
|
||||
}
|
||||
|
||||
JSObject*
|
||||
@ -518,6 +523,39 @@ MobileMessageManager::DispatchTrustedSmsEventToSelf(const char* aTopic,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
MobileMessageManager::DispatchTrustedDeletedEventToSelf(nsISupports* aDeletedInfo)
|
||||
{
|
||||
nsCOMPtr<nsIDeletedMessageInfo> deletedInfo = do_QueryInterface(aDeletedInfo);
|
||||
if (deletedInfo) {
|
||||
MozMessageDeletedEventInit init;
|
||||
init.mBubbles = false;
|
||||
init.mCancelable = false;
|
||||
DeletedMessageInfo* info =
|
||||
static_cast<DeletedMessageInfo*>(deletedInfo.get());
|
||||
|
||||
uint32_t msgIdLength = info->GetData().deletedMessageIds().Length();
|
||||
if (msgIdLength) {
|
||||
Sequence<int32_t>& deletedMsgIds = init.mDeletedMessageIds.SetValue();
|
||||
deletedMsgIds.AppendElements(info->GetData().deletedMessageIds());
|
||||
}
|
||||
|
||||
uint32_t threadIdLength = info->GetData().deletedThreadIds().Length();
|
||||
if (threadIdLength) {
|
||||
Sequence<uint64_t>& deletedThreadIds = init.mDeletedThreadIds.SetValue();
|
||||
deletedThreadIds.AppendElements(info->GetData().deletedThreadIds());
|
||||
}
|
||||
|
||||
nsRefPtr<MozMessageDeletedEvent> event =
|
||||
MozMessageDeletedEvent::Constructor(this, DELETED_EVENT_NAME, init);
|
||||
return DispatchTrustedEvent(event);
|
||||
}
|
||||
|
||||
NS_ERROR("Got a 'deleted' topic without a valid message!");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileMessageManager::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
const char16_t* aData)
|
||||
@ -558,6 +596,10 @@ MobileMessageManager::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
return DispatchTrustedSmsEventToSelf(aTopic, READ_ERROR_EVENT_NAME, aSubject);
|
||||
}
|
||||
|
||||
if (!strcmp(aTopic, kSmsDeletedObserverTopic)) {
|
||||
return DispatchTrustedDeletedEventToSelf(aSubject);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -124,6 +124,7 @@ public:
|
||||
IMPL_EVENT_HANDLER(deliveryerror)
|
||||
IMPL_EVENT_HANDLER(readsuccess)
|
||||
IMPL_EVENT_HANDLER(readerror)
|
||||
IMPL_EVENT_HANDLER(deleted)
|
||||
|
||||
private:
|
||||
~MobileMessageManager() {}
|
||||
@ -148,6 +149,9 @@ private:
|
||||
const nsAString& aEventName,
|
||||
nsISupports* aMsg);
|
||||
|
||||
nsresult
|
||||
DispatchTrustedDeletedEventToSelf(nsISupports* aDeletedInfo);
|
||||
|
||||
/**
|
||||
* Helper to get message ID from SMS/MMS Message object
|
||||
*/
|
||||
|
@ -657,6 +657,8 @@ var interfaceNamesInGlobalScope =
|
||||
{name: "MozInputContext", b2g: true},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "MozInputMethodManager", b2g: true},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{name: "MozMessageDeletedEvent", b2g: true, pref: "dom.sms.enabled"},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
"MozMmsEvent",
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
|
Loading…
Reference in New Issue
Block a user