Bug 1311324 P2 Replace usage of ServiceWorkerMessageEvent with MessageEvent. r=bz

This commit is contained in:
Ben Kelly 2017-03-09 20:50:13 -05:00
Родитель 29ca0de50c
Коммит 546d811304
4 изменённых файлов: 8 добавлений и 18 удалений

Просмотреть файл

@ -95,13 +95,8 @@ BroadcastChannelChild::RecvNotify(const ClonedMessageData& aData)
init.mOrigin = mOrigin; init.mOrigin = mOrigin;
init.mData = value; init.mData = value;
ErrorResult rv;
RefPtr<MessageEvent> event = RefPtr<MessageEvent> event =
MessageEvent::Constructor(mBC, NS_LITERAL_STRING("message"), init, rv); MessageEvent::Constructor(mBC, NS_LITERAL_STRING("message"), init);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return IPC_OK();
}
event->SetTrusted(true); event->SetTrusted(true);

Просмотреть файл

@ -105,14 +105,13 @@ MessageEvent::Constructor(const GlobalObject& aGlobal,
ErrorResult& aRv) ErrorResult& aRv)
{ {
nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports()); nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
return Constructor(t, aType, aParam, aRv); return Constructor(t, aType, aParam);
} }
/* static */ already_AddRefed<MessageEvent> /* static */ already_AddRefed<MessageEvent>
MessageEvent::Constructor(EventTarget* aEventTarget, MessageEvent::Constructor(EventTarget* aEventTarget,
const nsAString& aType, const nsAString& aType,
const MessageEventInit& aParam, const MessageEventInit& aParam)
ErrorResult& aRv)
{ {
RefPtr<MessageEvent> event = new MessageEvent(aEventTarget, nullptr, nullptr); RefPtr<MessageEvent> event = new MessageEvent(aEventTarget, nullptr, nullptr);

Просмотреть файл

@ -62,8 +62,7 @@ public:
static already_AddRefed<MessageEvent> static already_AddRefed<MessageEvent>
Constructor(EventTarget* aEventTarget, Constructor(EventTarget* aEventTarget,
const nsAString& aType, const nsAString& aType,
const MessageEventInit& aEventInit, const MessageEventInit& aEventInit);
ErrorResult& aRv);
void InitMessageEvent(JSContext* aCx, const nsAString& aType, bool aCanBubble, void InitMessageEvent(JSContext* aCx, const nsAString& aType, bool aCanBubble,
bool aCancelable, JS::Handle<JS::Value> aData, bool aCancelable, JS::Handle<JS::Value> aData,

Просмотреть файл

@ -10,8 +10,6 @@
#include "mozilla/dom/MessageEvent.h" #include "mozilla/dom/MessageEvent.h"
#include "mozilla/dom/Navigator.h" #include "mozilla/dom/Navigator.h"
#include "mozilla/dom/ServiceWorkerMessageEvent.h"
#include "mozilla/dom/ServiceWorkerMessageEventBinding.h"
#include "nsGlobalWindow.h" #include "nsGlobalWindow.h"
#include "nsIBrowserDOMWindow.h" #include "nsIBrowserDOMWindow.h"
#include "nsIDocument.h" #include "nsIDocument.h"
@ -182,7 +180,7 @@ private:
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
RootedDictionary<ServiceWorkerMessageEventInit> init(aCx); RootedDictionary<MessageEventInit> init(aCx);
nsCOMPtr<nsIPrincipal> principal = aTargetContainer->GetParentObject()->PrincipalOrNull(); nsCOMPtr<nsIPrincipal> principal = aTargetContainer->GetParentObject()->PrincipalOrNull();
NS_WARNING_ASSERTION(principal, "Why is the principal null here?"); NS_WARNING_ASSERTION(principal, "Why is the principal null here?");
@ -212,10 +210,9 @@ private:
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
} }
RefPtr<ServiceWorkerMessageEvent> event = RefPtr<MessageEvent> event =
ServiceWorkerMessageEvent::Constructor(aTargetContainer, MessageEvent::Constructor(aTargetContainer, NS_LITERAL_STRING("message"),
NS_LITERAL_STRING("message"), init);
init);
event->SetTrusted(true); event->SetTrusted(true);
bool status = false; bool status = false;