From d7e78873a0f7cf41bde7526b33b10df6d3c04b2f Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 20 Apr 2018 12:53:17 -0400 Subject: [PATCH] Bug 1455052 part 2. Switch async event dispatcher to working with Event, not nsIDOMEvent. r=masayuki MozReview-Commit-ID: By3duB2tPpl --- dom/events/AsyncEventDispatcher.cpp | 5 ++--- dom/events/AsyncEventDispatcher.h | 9 +++++---- dom/presentation/PresentationConnection.cpp | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dom/events/AsyncEventDispatcher.cpp b/dom/events/AsyncEventDispatcher.cpp index 6d83a6659db5..683d811d48b4 100644 --- a/dom/events/AsyncEventDispatcher.cpp +++ b/dom/events/AsyncEventDispatcher.cpp @@ -7,10 +7,9 @@ #include "mozilla/AsyncEventDispatcher.h" #include "mozilla/BasicEvents.h" #include "mozilla/EventDispatcher.h" -#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent() +#include "mozilla/dom/Event.h" #include "mozilla/dom/EventTarget.h" #include "nsContentUtils.h" -#include "nsIDOMEvent.h" namespace mozilla { @@ -56,7 +55,7 @@ AsyncEventDispatcher::Run() false /* aCancelable */, nullptr /* aDefaultAction */, mOnlyChromeDispatch); } - RefPtr event = mEvent ? mEvent->InternalDOMEvent() : nullptr; + RefPtr event = mEvent; if (!event) { event = NS_NewDOMEvent(mTarget, nullptr, nullptr); event->InitEvent(mEventType, mBubbles, false); diff --git a/dom/events/AsyncEventDispatcher.h b/dom/events/AsyncEventDispatcher.h index 70a623ef2753..fb75fbb586a9 100644 --- a/dom/events/AsyncEventDispatcher.h +++ b/dom/events/AsyncEventDispatcher.h @@ -8,9 +8,10 @@ #define mozilla_AsyncEventDispatcher_h_ #include "mozilla/Attributes.h" +#include "mozilla/RefPtr.h" +#include "mozilla/dom/Event.h" #include "nsCOMPtr.h" #include "nsIDocument.h" -#include "nsIDOMEvent.h" #include "nsString.h" #include "nsThreadUtils.h" @@ -88,7 +89,7 @@ public: MOZ_ASSERT(mEventMessage != eUnidentifiedEvent); } - AsyncEventDispatcher(dom::EventTarget* aTarget, nsIDOMEvent* aEvent) + AsyncEventDispatcher(dom::EventTarget* aTarget, dom::Event* aEvent) : CancelableRunnable("AsyncEventDispatcher") , mTarget(aTarget) , mEvent(aEvent) @@ -109,7 +110,7 @@ public: void RequireNodeInDocument(); nsCOMPtr mTarget; - nsCOMPtr mEvent; + RefPtr mEvent; // If mEventType is set, mEventMessage will be eUnidentifiedEvent. // If mEventMessage is set, mEventType will be void. // They can never both be set at the same time. @@ -136,7 +137,7 @@ public: } } - LoadBlockingAsyncEventDispatcher(nsINode* aEventNode, nsIDOMEvent* aEvent) + LoadBlockingAsyncEventDispatcher(nsINode* aEventNode, dom::Event* aEvent) : AsyncEventDispatcher(aEventNode, aEvent) , mBlockedDoc(aEventNode->OwnerDoc()) { diff --git a/dom/presentation/PresentationConnection.cpp b/dom/presentation/PresentationConnection.cpp index f4a3173d6328..684b93539d16 100644 --- a/dom/presentation/PresentationConnection.cpp +++ b/dom/presentation/PresentationConnection.cpp @@ -621,7 +621,7 @@ PresentationConnection::DispatchConnectionCloseEvent( } RefPtr asyncDispatcher = - new AsyncEventDispatcher(this, static_cast(closedEvent)); + new AsyncEventDispatcher(this, closedEvent); return asyncDispatcher->PostDOMEvent(); } @@ -650,7 +650,7 @@ PresentationConnection::DispatchMessageEvent(JS::Handle aData) messageEvent->SetTrusted(true); RefPtr asyncDispatcher = - new AsyncEventDispatcher(this, static_cast(messageEvent)); + new AsyncEventDispatcher(this, messageEvent); return asyncDispatcher->PostDOMEvent(); }