Bug 1455055 part 1. Convert nsIDOMEventListener to taking an Event, not an nsIDOMEvent. r=masayuki
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 20 Apr 2018 00:49:29 -0400
changeset 785489 6567a1d09c3923142b3c151cc6c6896cd4a78276
parent 785488 56080ac3f353308b539ac5ef6e7cea55a9483882
child 785490 ee04ee4104b6264c8c28aa33bd2cf01ca01f9c25
push id107236
push userbmo:emilio@crisal.io
push dateFri, 20 Apr 2018 08:31:50 +0000
reviewersmasayuki
bugs1455055
milestone61.0a1
Bug 1455055 part 1. Convert nsIDOMEventListener to taking an Event, not an nsIDOMEvent. r=masayuki This does no cleanup other than what's needed to compile. Cleanup coming up in later patches. MozReview-Commit-ID: 3sOnkj71n09
accessible/base/DocManager.cpp
accessible/generic/RootAccessible.cpp
accessible/generic/RootAccessible.h
browser/components/sessionstore/nsSessionStoreUtils.cpp
docshell/base/nsDocShellTreeOwner.cpp
docshell/base/nsDocShellTreeOwner.h
dom/base/Navigator.cpp
dom/base/ScreenOrientation.cpp
dom/base/nsContentPermissionHelper.cpp
dom/base/nsDocument.cpp
dom/events/EventListenerManager.cpp
dom/events/JSEventHandler.cpp
dom/html/HTMLCanvasElement.cpp
dom/html/ImageDocument.cpp
dom/html/ImageDocument.h
dom/html/TextTrackManager.cpp
dom/html/nsTextEditorState.cpp
dom/interfaces/events/nsIDOMEventListener.idl
dom/ipc/TabChild.cpp
dom/ipc/TabParent.cpp
dom/ipc/TelemetryScrollProbe.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
dom/power/WakeLock.cpp
dom/smil/nsSMILTimeValueSpec.cpp
dom/smil/nsSMILTimeValueSpec.h
dom/webauthn/WebAuthnManagerBase.cpp
dom/xbl/nsXBLEventHandler.cpp
dom/xbl/nsXBLPrototypeHandler.cpp
dom/xbl/nsXBLPrototypeHandler.h
dom/xbl/nsXBLService.cpp
dom/xbl/nsXBLWindowKeyHandler.cpp
dom/xhr/XMLHttpRequestMainThread.h
dom/xhr/XMLHttpRequestWorker.cpp
dom/xul/nsXULPopupListener.cpp
editor/libeditor/EditorEventListener.cpp
editor/libeditor/HTMLEditorObjectResizer.cpp
extensions/spellcheck/src/mozInlineSpellChecker.cpp
image/VectorImage.cpp
layout/base/AccessibleCaret.h
layout/base/MobileViewportManager.cpp
layout/base/ZoomConstraintsClient.cpp
layout/base/nsDocumentViewer.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsFileControlFrame.cpp
layout/forms/nsListControlFrame.cpp
layout/forms/nsRangeFrame.h
layout/generic/ScrollbarActivity.cpp
layout/generic/nsImageMap.cpp
layout/mathml/nsMathMLmactionFrame.cpp
layout/printing/nsPrintPreviewListener.cpp
layout/style/FontFaceSet.cpp
layout/xul/nsButtonBoxFrame.cpp
layout/xul/nsButtonBoxFrame.h
layout/xul/nsMenuBarListener.cpp
layout/xul/nsMenuBarListener.h
layout/xul/nsMenuPopupFrame.cpp
layout/xul/nsSliderFrame.cpp
layout/xul/nsSliderFrame.h
layout/xul/nsSplitterFrame.cpp
layout/xul/nsXULPopupManager.cpp
layout/xul/nsXULTooltipListener.cpp
toolkit/components/satchel/nsFormFillController.cpp
widget/tests/TestAppShellSteadyState.cpp
--- a/accessible/base/DocManager.cpp
+++ b/accessible/base/DocManager.cpp
@@ -16,17 +16,17 @@
 #include "RootAccessibleWrap.h"
 #include "xpcAccessibleDocument.h"
 
 #ifdef A11Y_LOG
 #include "Logging.h"
 #endif
 
 #include "mozilla/EventListenerManager.h"
-#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
+#include "mozilla/dom/Event.h" // for Event
 #include "nsCURILoader.h"
 #include "nsDocShellLoadTypes.h"
 #include "nsIChannel.h"
 #include "nsIDOMDocument.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIWebNavigation.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIWebProgress.h"
@@ -349,17 +349,17 @@ DocManager::OnSecurityChange(nsIWebProgr
   NS_NOTREACHED("notification excluded in AddProgressListener(...)");
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIDOMEventListener
 
 NS_IMETHODIMP
-DocManager::HandleEvent(nsIDOMEvent* aEvent)
+DocManager::HandleEvent(Event* aEvent)
 {
   nsAutoString type;
   aEvent->GetType(type);
 
   nsCOMPtr<nsIDocument> document =
     do_QueryInterface(aEvent->InternalDOMEvent()->GetTarget());
   NS_ASSERTION(document, "pagehide or DOMContentLoaded for non document!");
   if (!document)
--- a/accessible/generic/RootAccessible.cpp
+++ b/accessible/generic/RootAccessible.cpp
@@ -225,17 +225,17 @@ void
 RootAccessible::DocumentActivated(DocAccessible* aDocument)
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIDOMEventListener
 
 NS_IMETHODIMP
-RootAccessible::HandleEvent(nsIDOMEvent* aDOMEvent)
+RootAccessible::HandleEvent(Event* aDOMEvent)
 {
   MOZ_ASSERT(aDOMEvent);
   Event* event = aDOMEvent->InternalDOMEvent();
   nsCOMPtr<nsINode> origTargetNode = do_QueryInterface(event->GetOriginalTarget());
   if (!origTargetNode)
     return NS_OK;
 
 #ifdef A11Y_LOG
--- a/accessible/generic/RootAccessible.h
+++ b/accessible/generic/RootAccessible.h
@@ -20,17 +20,17 @@ class RootAccessible : public DocAccessi
                        public nsIDOMEventListener
 {
   NS_DECL_ISUPPORTS_INHERITED
 
 public:
   RootAccessible(nsIDocument* aDocument, nsIPresShell* aPresShell);
 
   // nsIDOMEventListener
-  NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) override;
+  NS_DECL_NSIDOMEVENTLISTENER
 
   // Accessible
   virtual void Shutdown() override;
   virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) override;
   virtual Relation RelationByType(RelationType aType) override;
   virtual mozilla::a11y::role NativeRole() override;
   virtual uint64_t NativeState() override;
 
--- a/browser/components/sessionstore/nsSessionStoreUtils.cpp
+++ b/browser/components/sessionstore/nsSessionStoreUtils.cpp
@@ -20,17 +20,17 @@ class DynamicFrameEventFilter final : pu
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS(DynamicFrameEventFilter)
 
   explicit DynamicFrameEventFilter(EventListener* aListener)
     : mListener(aListener)
   { }
 
-  NS_IMETHODIMP HandleEvent(nsIDOMEvent* aEvent) override
+  NS_IMETHODIMP HandleEvent(Event* aEvent) override
   {
     if (mListener && TargetInNonDynamicDocShell(aEvent)) {
       mListener->HandleEvent(*aEvent->InternalDOMEvent());
     }
 
     return NS_OK;
   }
 
--- a/docshell/base/nsDocShellTreeOwner.cpp
+++ b/docshell/base/nsDocShellTreeOwner.cpp
@@ -27,17 +27,16 @@
 #include "nsITooltipListener.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMElement.h"
 #include "Link.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/MouseEvent.h"
 #include "mozilla/dom/SVGTitleElement.h"
-#include "nsIDOMEvent.h"
 #include "nsIFormControl.h"
 #include "nsIImageLoadingContent.h"
 #include "nsIWebNavigation.h"
 #include "nsIPresShell.h"
 #include "nsIStringBundle.h"
 #include "nsPIDOMWindow.h"
 #include "nsPIWindowRoot.h"
 #include "nsIDOMWindowCollection.h"
@@ -52,17 +51,17 @@
 #include "imgIContainer.h"
 #include "nsPresContext.h"
 #include "nsViewManager.h"
 #include "nsView.h"
 #include "nsIConstraintValidation.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/dom/DragEvent.h"
-#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
+#include "mozilla/dom/Event.h" // for Event
 #include "mozilla/dom/File.h" // for input type=file
 #include "mozilla/dom/FileList.h" // for input type=file
 #include "mozilla/TextEvents.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 // A helper routine that navigates the tricky path from a |nsWebBrowser| to
@@ -920,17 +919,17 @@ nsDocShellTreeOwner::RemoveChromeListene
     elmP->RemoveEventListenerByType(this, NS_LITERAL_STRING("drop"),
                                     TrustedEventsAtSystemGroupBubble());
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocShellTreeOwner::HandleEvent(nsIDOMEvent* aEvent)
+nsDocShellTreeOwner::HandleEvent(Event* aEvent)
 {
   DragEvent* dragEvent =
     aEvent ? aEvent->InternalDOMEvent()->AsDragEvent() : nullptr;
   if (NS_WARN_IF(!dragEvent)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   if (dragEvent->DefaultPrevented()) {
@@ -1145,17 +1144,17 @@ ChromeTooltipListener::RemoveTooltipList
                                             this, false);
     mTooltipListenerInstalled = false;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-ChromeTooltipListener::HandleEvent(nsIDOMEvent* aEvent)
+ChromeTooltipListener::HandleEvent(Event* aEvent)
 {
   nsAutoString eventType;
   aEvent->GetType(eventType);
 
   if (eventType.EqualsLiteral("mousedown")) {
     return HideTooltip();
   } else if (eventType.EqualsLiteral("keydown")) {
     WidgetKeyboardEvent* keyEvent = aEvent->WidgetEventPtr()->AsKeyboardEvent();
--- a/docshell/base/nsDocShellTreeOwner.h
+++ b/docshell/base/nsDocShellTreeOwner.h
@@ -136,17 +136,17 @@ class ChromeTooltipListener final : publ
 protected:
   virtual ~ChromeTooltipListener();
 
 public:
   NS_DECL_ISUPPORTS
 
   ChromeTooltipListener(nsWebBrowser* aInBrowser, nsIWebBrowserChrome* aInChrome);
 
-  NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) override;
+  NS_DECL_NSIDOMEVENTLISTENER
   NS_IMETHOD MouseMove(nsIDOMEvent* aMouseEvent);
 
   // Add/remove the relevant listeners, based on what interfaces the embedding
   // chrome implements.
   NS_IMETHOD AddChromeListeners();
   NS_IMETHOD RemoveChromeListeners();
 
 private:
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -47,17 +47,17 @@
 #include "mozilla/dom/VRDisplay.h"
 #include "mozilla/dom/VRDisplayEvent.h"
 #include "mozilla/dom/VRServiceTest.h"
 #include "mozilla/dom/workerinternals/RuntimeService.h"
 #include "mozilla/Hal.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/StaticPtr.h"
 #include "Connection.h"
-#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
+#include "mozilla/dom/Event.h" // for Event
 #include "nsGlobalWindow.h"
 #include "nsIIdleObserver.h"
 #include "nsIPermissionManager.h"
 #include "nsMimeTypes.h"
 #include "nsNetUtil.h"
 #include "nsRFPService.h"
 #include "nsStringStream.h"
 #include "nsComponentManagerUtils.h"
@@ -697,17 +697,17 @@ StaticRefPtr<VibrateWindowListener> gVib
 
 static bool
 MayVibrate(nsIDocument* doc) {
   // Hidden documents cannot start or stop a vibration.
   return (doc && !doc->Hidden());
 }
 
 NS_IMETHODIMP
-VibrateWindowListener::HandleEvent(nsIDOMEvent* aEvent)
+VibrateWindowListener::HandleEvent(Event* aEvent)
 {
   nsCOMPtr<nsIDocument> doc =
     do_QueryInterface(aEvent->InternalDOMEvent()->GetTarget());
 
   if (!MayVibrate(doc)) {
     // It's important that we call CancelVibrate(), not Vibrate() with an
     // empty list, because Vibrate() will fail if we're no longer focused, but
     // CancelVibrate() will succeed, so long as nobody else has started a new
--- a/dom/base/ScreenOrientation.cpp
+++ b/dom/base/ScreenOrientation.cpp
@@ -11,16 +11,17 @@
 #include "nsGlobalWindow.h"
 #include "nsSandboxFlags.h"
 #include "nsScreen.h"
 
 #include "mozilla/DOMEventTargetHelper.h"
 #include "mozilla/Hal.h"
 #include "mozilla/Preferences.h"
 
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/Promise.h"
 #include "nsContentUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(ScreenOrientation,
                                    DOMEventTargetHelper,
@@ -594,17 +595,17 @@ ScreenOrientation::ShouldResistFingerpri
     resist = nsContentUtils::ShouldResistFingerprinting(owner->GetDocShell());
   }
   return resist;
 }
 
 NS_IMPL_ISUPPORTS(ScreenOrientation::VisibleEventListener, nsIDOMEventListener)
 
 NS_IMETHODIMP
-ScreenOrientation::VisibleEventListener::HandleEvent(nsIDOMEvent* aEvent)
+ScreenOrientation::VisibleEventListener::HandleEvent(Event* aEvent)
 {
   // Document may have become visible, if the page is visible, run the steps
   // following the "now visible algorithm" as specified.
   nsCOMPtr<EventTarget> target = aEvent->InternalDOMEvent()->GetCurrentTarget();
   MOZ_ASSERT(target);
 
   nsCOMPtr<nsIDocument> doc = do_QueryInterface(target);
   if (!doc || doc->Hidden()) {
@@ -650,17 +651,17 @@ ScreenOrientation::VisibleEventListener:
   }
 
   return NS_OK;
 }
 
 NS_IMPL_ISUPPORTS(ScreenOrientation::FullScreenEventListener, nsIDOMEventListener)
 
 NS_IMETHODIMP
-ScreenOrientation::FullScreenEventListener::HandleEvent(nsIDOMEvent* aEvent)
+ScreenOrientation::FullScreenEventListener::HandleEvent(Event* aEvent)
 {
 #ifdef DEBUG
   nsAutoString eventType;
   aEvent->GetType(eventType);
 
   MOZ_ASSERT(eventType.EqualsLiteral("fullscreenchange"));
 #endif
 
--- a/dom/base/nsContentPermissionHelper.cpp
+++ b/dom/base/nsContentPermissionHelper.cpp
@@ -23,17 +23,16 @@
 #include "nsComponentManagerUtils.h"
 #include "nsArrayUtils.h"
 #include "nsIMutableArray.h"
 #include "nsContentPermissionHelper.h"
 #include "nsJSUtils.h"
 #include "nsISupportsPrimitives.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIDocument.h"
-#include "nsIDOMEvent.h"
 #include "nsWeakPtr.h"
 
 using mozilla::Unused;          // <snicker>
 using namespace mozilla::dom;
 using namespace mozilla;
 
 #define kVisibilityChange "visibilitychange"
 
@@ -69,17 +68,17 @@ VisibilityChangeListener::VisibilityChan
                                 /* listener */ this,
                                 /* use capture */ true,
                                 /* wants untrusted */ false);
   }
 
 }
 
 NS_IMETHODIMP
-VisibilityChangeListener::HandleEvent(nsIDOMEvent* aEvent)
+VisibilityChangeListener::HandleEvent(Event* aEvent)
 {
   nsAutoString type;
   aEvent->GetType(type);
   if (!type.EqualsLiteral(kVisibilityChange)) {
     return NS_ERROR_FAILURE;
   }
 
   nsCOMPtr<nsIDocument> doc =
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -55,16 +55,17 @@
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/BasicEvents.h"
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/EventStateManager.h"
 
 #include "mozilla/dom/Attr.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/dom/Element.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/FramingChecker.h"
 #include "mozilla/dom/HTMLSharedElement.h"
 #include "nsGenericHTMLElement.h"
 #include "mozilla/dom/CDATASection.h"
 #include "mozilla/dom/ProcessingInstruction.h"
 #include "nsDOMString.h"
 #include "nsNodeUtils.h"
 #include "nsLayoutUtils.h" // for GetFrameForPoint
--- a/dom/events/EventListenerManager.cpp
+++ b/dom/events/EventListenerManager.cpp
@@ -1113,17 +1113,18 @@ EventListenerManager::HandleEventSubType
 
     // nsIDOMEvent::currentTarget is set in EventDispatcher.
     if (listenerHolder.HasWebIDLCallback()) {
       ErrorResult rv;
       listenerHolder.GetWebIDLCallback()->
         HandleEvent(aCurrentTarget, *(aDOMEvent->InternalDOMEvent()), rv);
       result = rv.StealNSResult();
     } else {
-      result = listenerHolder.GetXPCOMCallback()->HandleEvent(aDOMEvent);
+      result = listenerHolder.GetXPCOMCallback()->
+        HandleEvent(aDOMEvent->InternalDOMEvent());
     }
   }
 
   return result;
 }
 
 EventMessage
 EventListenerManager::GetLegacyEventMessage(EventMessage aEventMessage) const
--- a/dom/events/JSEventHandler.cpp
+++ b/dom/events/JSEventHandler.cpp
@@ -106,17 +106,17 @@ JSEventHandler::IsBlackForCC()
 {
   // We can claim to be black if all the things we reference are
   // effectively black already.
   return !mTypedHandler.HasEventHandler() ||
          !mTypedHandler.Ptr()->HasGrayCallable();
 }
 
 nsresult
-JSEventHandler::HandleEvent(nsIDOMEvent* aEvent)
+JSEventHandler::HandleEvent(Event* aEvent)
 {
   nsCOMPtr<EventTarget> target = do_QueryInterface(mTarget);
   if (!target || !mTypedHandler.HasEventHandler() ||
       !GetTypedEventHandler().Ptr()->CallbackPreserveColor()) {
     return NS_ERROR_FAILURE;
   }
 
   Event* event = aEvent->InternalDOMEvent();
--- a/dom/html/HTMLCanvasElement.cpp
+++ b/dom/html/HTMLCanvasElement.cpp
@@ -12,16 +12,17 @@
 #include "jsfriendapi.h"
 #include "Layers.h"
 #include "MediaSegment.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/Base64.h"
 #include "mozilla/CheckedInt.h"
 #include "mozilla/dom/CanvasCaptureMediaStream.h"
 #include "mozilla/dom/CanvasRenderingContext2D.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/HTMLCanvasElementBinding.h"
 #include "mozilla/dom/MediaStreamTrack.h"
 #include "mozilla/dom/MouseEvent.h"
 #include "mozilla/dom/OffscreenCanvas.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/gfx/Rect.h"
 #include "mozilla/layers/AsyncCanvasRenderer.h"
@@ -370,17 +371,17 @@ HTMLCanvasElementObserver::Observe(nsISu
   }
 
   mElement->OnMemoryPressure();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-HTMLCanvasElementObserver::HandleEvent(nsIDOMEvent* aEvent)
+HTMLCanvasElementObserver::HandleEvent(Event* aEvent)
 {
   nsAutoString type;
   aEvent->GetType(type);
   if (!mElement || !type.EqualsLiteral("visibilitychange")) {
     return NS_OK;
   }
 
   mElement->OnVisibilityChange();
--- a/dom/html/ImageDocument.cpp
+++ b/dom/html/ImageDocument.cpp
@@ -3,26 +3,26 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ImageDocument.h"
 #include "mozilla/ComputedStyle.h"
 #include "mozilla/dom/DOMPrefs.h"
 #include "mozilla/dom/Element.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/ImageDocumentBinding.h"
 #include "mozilla/dom/HTMLImageElement.h"
 #include "mozilla/dom/MouseEvent.h"
 #include "nsRect.h"
 #include "nsIImageLoadingContent.h"
 #include "nsGenericHTMLElement.h"
 #include "nsDocShell.h"
 #include "nsIDocumentInlines.h"
 #include "nsDOMTokenList.h"
-#include "nsIDOMEvent.h"
 #include "nsIDOMEventListener.h"
 #include "nsIFrame.h"
 #include "nsGkAtoms.h"
 #include "imgIRequest.h"
 #include "imgILoader.h"
 #include "imgIContainer.h"
 #include "imgINotificationObserver.h"
 #include "nsIPresShell.h"
@@ -627,17 +627,17 @@ ImageDocument::OnLoadComplete(imgIReques
 
     mImageContent->SetAttr(kNameSpaceID_None, nsGkAtoms::alt, errorMsg, false);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-ImageDocument::HandleEvent(nsIDOMEvent* aEvent)
+ImageDocument::HandleEvent(Event* aEvent)
 {
   nsAutoString eventType;
   aEvent->GetType(eventType);
   if (eventType.EqualsLiteral("resize")) {
     CheckOverflowing(false);
   }
   else if (eventType.EqualsLiteral("click") && mClickResizingEnabled) {
     ResetZoomLevel();
--- a/dom/html/ImageDocument.h
+++ b/dom/html/ImageDocument.h
@@ -39,17 +39,17 @@ public:
   virtual void Destroy() override;
   virtual void OnPageShow(bool aPersisted,
                           EventTarget* aDispatchStartTarget) override;
 
   NS_DECL_NSIIMAGEDOCUMENT
   NS_DECL_IMGINOTIFICATIONOBSERVER
 
   // nsIDOMEventListener
-  NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) override;
+  NS_DECL_NSIDOMEVENTLISTENER
 
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ImageDocument, MediaDocument)
 
   friend class ImageListener;
 
   void DefaultCheckOverflowing() { CheckOverflowing(mResizeImageByDefault); }
 
   // WebIDL API
--- a/dom/html/TextTrackManager.cpp
+++ b/dom/html/TextTrackManager.cpp
@@ -455,17 +455,17 @@ TextTrackManager::GetTextTracksOfKind(Te
     TextTrack* textTrack = (*mTextTracks)[i];
     if (textTrack->Kind() == aTextTrackKind) {
       aTextTracks.AppendElement(textTrack);
     }
   }
 }
 
 NS_IMETHODIMP
-TextTrackManager::HandleEvent(nsIDOMEvent* aEvent)
+TextTrackManager::HandleEvent(Event* aEvent)
 {
   if (!mTextTracks) {
     return NS_OK;
   }
 
   nsAutoString type;
   aEvent->GetType(type);
   if (type.EqualsLiteral("resizevideocontrols") ||
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -34,16 +34,17 @@
 #include "mozilla/TextEditRules.h"
 #include "mozilla/EventListenerManager.h"
 #include "nsContentUtils.h"
 #include "mozilla/Preferences.h"
 #include "nsTextNode.h"
 #include "nsIController.h"
 #include "mozilla/AutoRestore.h"
 #include "mozilla/TextEvents.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/dom/HTMLTextAreaElement.h"
 #include "mozilla/dom/Text.h"
 #include "nsNumberControlFrame.h"
 #include "nsFrameSelection.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/Telemetry.h"
@@ -919,17 +920,17 @@ DoCommandCallback(Command aCommand, void
   nsresult rv = controller->IsCommandEnabled(commandStr, &commandEnabled);
   NS_ENSURE_SUCCESS_VOID(rv);
   if (commandEnabled) {
     controller->DoCommand(commandStr);
   }
 }
 
 NS_IMETHODIMP
-TextInputListener::HandleEvent(nsIDOMEvent* aEvent)
+TextInputListener::HandleEvent(Event* aEvent)
 {
   bool defaultPrevented = false;
   nsresult rv = aEvent->GetDefaultPrevented(&defaultPrevented);
   NS_ENSURE_SUCCESS(rv, rv);
   if (defaultPrevented) {
     return NS_OK;
   }
 
--- a/dom/interfaces/events/nsIDOMEventListener.idl
+++ b/dom/interfaces/events/nsIDOMEventListener.idl
@@ -1,15 +1,17 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "domstubs.idl"
 
+webidl Event;
+
 /**
  * The nsIDOMEventListener interface is a callback interface for
  * listening to events in the Document Object Model.
  *
  * For more information on this interface please see 
  * http://www.w3.org/TR/DOM-Level-2-Events/
  */
 
@@ -20,10 +22,10 @@ interface nsIDOMEventListener : nsISuppo
    * This method is called whenever an event occurs of the type for which 
    * the EventListener interface was registered.
    *
    * @param   evt The Event contains contextual information about the 
    *              event. It also contains the stopPropagation and 
    *              preventDefault methods which are used in determining the 
    *              event's flow and default action.
    */
-  void                      handleEvent(in nsIDOMEvent event);
+  void                      handleEvent(in Event event);
 };
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -15,16 +15,17 @@
 #include "Layers.h"
 #include "ContentChild.h"
 #include "TabParent.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/BrowserElementParent.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/dom/DataTransfer.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/indexedDB/PIndexedDBPermissionRequestChild.h"
 #include "mozilla/dom/MessageManagerBinding.h"
 #include "mozilla/dom/MouseEventBinding.h"
 #include "mozilla/dom/PaymentRequestChild.h"
 #include "mozilla/dom/TelemetryScrollProbe.h"
 #include "mozilla/IMEStateManager.h"
 #include "mozilla/ipc/URIUtils.h"
 #include "mozilla/layers/APZChild.h"
@@ -65,17 +66,16 @@
 #include "mozilla/dom/Element.h"
 #include "nsGlobalWindow.h"
 #include "nsIBaseWindow.h"
 #include "nsIBrowserDOMWindow.h"
 #include "nsIDocumentInlines.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIDOMChromeWindow.h"
 #include "nsIDOMDocument.h"
-#include "nsIDOMEvent.h"
 #include "nsIDOMWindow.h"
 #include "nsIDOMWindowUtils.h"
 #include "nsFocusManager.h"
 #include "EventStateManager.h"
 #include "nsIDocShell.h"
 #include "nsIFrame.h"
 #include "nsIURI.h"
 #include "nsIURIFixup.h"
@@ -277,17 +277,17 @@ TabChildBase::ProcessUpdateFrame(const F
         return;
     }
 
     FrameMetrics newMetrics = aFrameMetrics;
     APZCCallbackHelper::UpdateRootFrame(newMetrics);
 }
 
 NS_IMETHODIMP
-ContentListener::HandleEvent(nsIDOMEvent* aEvent)
+ContentListener::HandleEvent(Event* aEvent)
 {
   RemoteDOMEvent remoteEvent;
   remoteEvent.mEvent = do_QueryInterface(aEvent);
   NS_ENSURE_STATE(remoteEvent.mEvent);
   mTabChild->SendEvent(remoteEvent);
   return NS_OK;
 }
 
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -50,17 +50,16 @@
 #include "nsFrameLoader.h"
 #include "nsFrameManager.h"
 #include "nsIBaseWindow.h"
 #include "nsIBrowser.h"
 #include "nsIContent.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIDOMElement.h"
-#include "nsIDOMEvent.h"
 #include "nsIDOMWindow.h"
 #include "nsIDOMWindowUtils.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsILoadInfo.h"
 #include "nsIPromptFactory.h"
 #include "nsIURI.h"
 #include "nsIWindowWatcher.h"
 #include "nsIWebBrowserChrome.h"
@@ -3136,17 +3135,17 @@ bool
 TabParent::DeallocPPaymentRequestParent(PPaymentRequestParent* aActor)
 {
   RefPtr<PaymentRequestParent> actor =
     dont_AddRef(static_cast<PaymentRequestParent*>(aActor));
   return true;
 }
 
 nsresult
-TabParent::HandleEvent(nsIDOMEvent* aEvent)
+TabParent::HandleEvent(Event* aEvent)
 {
   nsAutoString eventType;
   aEvent->GetType(eventType);
 
   if (eventType.EqualsLiteral("MozUpdateWindowPos") && !mIsDestroyed) {
     // This event is sent when the widget moved.  Therefore we only update
     // the position.
     return UpdatePosition();
--- a/dom/ipc/TelemetryScrollProbe.cpp
+++ b/dom/ipc/TelemetryScrollProbe.cpp
@@ -2,20 +2,20 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "TelemetryScrollProbe.h"
 
 #include "nsIDOMDocument.h"     // for nsIDOMDocument
-#include "nsIDOMEvent.h"        // for nsIDOMEvent
 #include "nsIURI.h"             // for nsIURI
 #include "TabChild.h"           // for TabChildGlobal, TabChildBase
 #include "mozilla/Telemetry.h"  // for mozilla::Telemetry
+#include "mozilla/dom/Event.h"  // for Event
 
 namespace mozilla {
 namespace dom {
 
 /* static */ void
 TelemetryScrollProbe::Create(TabChildGlobal* aWebFrame)
 {
   nsWeakPtr webNav = do_GetWeakReference(aWebFrame->mTabChild->WebNavigation());
@@ -62,17 +62,17 @@ TelemetryScrollProbe::ShouldIgnore(nsIDO
   RefPtr<nsIDocument> document = GetDocument();
 
   return !document || targetDocument != document || nsContentUtils::IsSystemPrincipal(document->NodePrincipal());
 }
 
 NS_IMPL_ISUPPORTS(TelemetryScrollProbe, nsIDOMEventListener)
 
 NS_IMETHODIMP
-TelemetryScrollProbe::HandleEvent(nsIDOMEvent* aEvent)
+TelemetryScrollProbe::HandleEvent(Event* aEvent)
 {
   RefPtr<nsIPresShell> presShell = GetPresShell();
 
   if (!presShell || ShouldIgnore(aEvent)) {
     return NS_OK;
   }
 
   RefPtr<nsPresContext> presContext = presShell->GetPresContext();
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -1699,17 +1699,17 @@ nsPluginInstanceOwner::DispatchCompositi
 
     HandleNoConsumedCompositionMessage(compositionEvent, pPluginEvent);
   }
 #endif // #ifdef XP_WIN
   return NS_OK;
 }
 
 nsresult
-nsPluginInstanceOwner::HandleEvent(nsIDOMEvent* aEvent)
+nsPluginInstanceOwner::HandleEvent(Event* aEvent)
 {
   NS_ASSERTION(mInstance, "Should have a valid plugin instance or not receive events.");
 
   nsAutoString eventType;
   aEvent->GetType(eventType);
 
 #ifdef XP_MACOSX
   if (eventType.EqualsLiteral("activate") ||
@@ -3381,17 +3381,17 @@ nsPluginDOMContextMenuListener::nsPlugin
 nsPluginDOMContextMenuListener::~nsPluginDOMContextMenuListener()
 {
 }
 
 NS_IMPL_ISUPPORTS(nsPluginDOMContextMenuListener,
                   nsIDOMEventListener)
 
 NS_IMETHODIMP
-nsPluginDOMContextMenuListener::HandleEvent(nsIDOMEvent* aEvent)
+nsPluginDOMContextMenuListener::HandleEvent(Event* aEvent)
 {
   aEvent->PreventDefault(); // consume event
 
   return NS_OK;
 }
 
 void nsPluginDOMContextMenuListener::Destroy(nsIContent* aContent)
 {
--- a/dom/power/WakeLock.cpp
+++ b/dom/power/WakeLock.cpp
@@ -1,23 +1,22 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "WakeLock.h"
 #include "mozilla/dom/ContentParent.h"
-#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
+#include "mozilla/dom/Event.h" // for Event
 #include "mozilla/Hal.h"
 #include "mozilla/HalWakeLock.h"
 #include "nsError.h"
 #include "nsIDocument.h"
 #include "nsIDOMWindow.h"
-#include "nsIDOMEvent.h"
 #include "nsPIDOMWindow.h"
 #include "nsIPropertyBag2.h"
 
 using namespace mozilla::hal;
 
 namespace mozilla {
 namespace dom {
 
@@ -219,17 +218,17 @@ WakeLock::Unlock(ErrorResult& aRv)
 
 void
 WakeLock::GetTopic(nsAString &aTopic)
 {
   aTopic.Assign(mTopic);
 }
 
 NS_IMETHODIMP
-WakeLock::HandleEvent(nsIDOMEvent *aEvent)
+WakeLock::HandleEvent(Event *aEvent)
 {
   nsAutoString type;
   aEvent->GetType(type);
 
   if (type.EqualsLiteral("visibilitychange")) {
     nsCOMPtr<nsIDocument> doc =
       do_QueryInterface(aEvent->InternalDOMEvent()->GetTarget());
     NS_ENSURE_STATE(doc);
--- a/dom/smil/nsSMILTimeValueSpec.cpp
+++ b/dom/smil/nsSMILTimeValueSpec.cpp
@@ -1,15 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/EventListenerManager.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/SVGAnimationElement.h"
 #include "mozilla/dom/TimeEvent.h"
 #include "nsSMILTimeValueSpec.h"
 #include "nsSMILInterval.h"
 #include "nsSMILTimeContainer.h"
 #include "nsSMILTimeValue.h"
 #include "nsSMILTimedElement.h"
 #include "nsSMILInstanceTime.h"
@@ -21,17 +22,17 @@ using namespace mozilla;
 using namespace mozilla::dom;
 
 //----------------------------------------------------------------------
 // Nested class: EventListener
 
 NS_IMPL_ISUPPORTS(nsSMILTimeValueSpec::EventListener, nsIDOMEventListener)
 
 NS_IMETHODIMP
-nsSMILTimeValueSpec::EventListener::HandleEvent(nsIDOMEvent* aEvent)
+nsSMILTimeValueSpec::EventListener::HandleEvent(Event* aEvent)
 {
   if (mSpec) {
     mSpec->HandleEvent(aEvent);
   }
   return NS_OK;
 }
 
 //----------------------------------------------------------------------
@@ -332,17 +333,17 @@ nsSMILTimeValueSpec::UnregisterEventList
   }
 
   elm->RemoveEventListenerByType(mEventListener,
                                  nsDependentAtomString(mParams.mEventSymbol),
                                  AllEventsAtSystemGroupBubble());
 }
 
 void
-nsSMILTimeValueSpec::HandleEvent(nsIDOMEvent* aEvent)
+nsSMILTimeValueSpec::HandleEvent(Event* aEvent)
 {
   MOZ_ASSERT(mEventListener, "Got event without an event listener");
   MOZ_ASSERT(IsEventBased(),
              "Got event for non-event nsSMILTimeValueSpec");
   MOZ_ASSERT(aEvent, "No event supplied");
 
   // XXX In the long run we should get the time from the event itself which will
   // store the time in global document time which we'll need to convert to our
--- a/dom/smil/nsSMILTimeValueSpec.h
+++ b/dom/smil/nsSMILTimeValueSpec.h
@@ -15,16 +15,20 @@
 
 class nsSMILTimeValue;
 class nsSMILTimedElement;
 class nsSMILTimeContainer;
 class nsSMILInstanceTime;
 class nsSMILInterval;
 
 namespace mozilla {
+namespace dom {
+class Event;
+} // namespace dom
+
 class EventListenerManager;
 } // namespace mozilla
 
 //----------------------------------------------------------------------
 // nsSMILTimeValueSpec class
 //
 // An individual element of a 'begin' or 'end' attribute, e.g. '5s', 'a.end'.
 // This class handles the parsing of such specifications and performs the
@@ -33,16 +37,17 @@ class EventListenerManager;
 //
 // For an overview of how this class is related to other SMIL time classes see
 // the documentation in nsSMILTimeValue.h
 
 class nsSMILTimeValueSpec
 {
 public:
   typedef mozilla::dom::Element Element;
+  typedef mozilla::dom::Event Event;
   typedef mozilla::dom::IDTracker IDTracker;
 
   nsSMILTimeValueSpec(nsSMILTimedElement& aOwner, bool aIsBegin);
   ~nsSMILTimeValueSpec();
 
   nsresult SetSpec(const nsAString& aStringSpec, Element* aContextNode);
   void     ResolveReferences(nsIContent* aContextNode);
   bool     IsEventBased() const;
@@ -65,17 +70,17 @@ public:
 
 protected:
   void UpdateReferencedElement(Element* aFrom, Element* aTo);
   void UnregisterFromReferencedElement(Element* aElement);
   nsSMILTimedElement* GetTimedElement(Element* aElement);
   bool IsWhitelistedEvent();
   void RegisterEventListener(Element* aElement);
   void UnregisterEventListener(Element* aElement);
-  void HandleEvent(nsIDOMEvent* aEvent);
+  void HandleEvent(Event* aEvent);
   bool CheckRepeatEventDetail(nsIDOMEvent* aEvent);
   nsSMILTimeValue ConvertBetweenTimeContainers(const nsSMILTimeValue& aSrcTime,
                                       const nsSMILTimeContainer* aSrcContainer);
   bool ApplyOffset(nsSMILTimeValue& aTime) const;
 
   nsSMILTimedElement*           mOwner;
   bool                          mIsBegin; // Indicates if *we* are a begin spec,
                                           // not to be confused with
--- a/dom/webauthn/WebAuthnManagerBase.cpp
+++ b/dom/webauthn/WebAuthnManagerBase.cpp
@@ -114,17 +114,17 @@ WebAuthnManagerBase::StopListeningForVis
 
   windowRoot->RemoveEventListener(kDeactivateEvent, this,
                                   /* use capture */ true);
   windowRoot->RemoveEventListener(kVisibilityChange, this,
                                   /* use capture */ true);
 }
 
 NS_IMETHODIMP
-WebAuthnManagerBase::HandleEvent(nsIDOMEvent* aEvent)
+WebAuthnManagerBase::HandleEvent(Event* aEvent)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aEvent);
 
   nsAutoString type;
   aEvent->GetType(type);
   if (!type.Equals(kDeactivateEvent) && !type.Equals(kVisibilityChange)) {
     return NS_ERROR_FAILURE;
--- a/dom/xbl/nsXBLEventHandler.cpp
+++ b/dom/xbl/nsXBLEventHandler.cpp
@@ -4,17 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsCOMPtr.h"
 #include "nsAtom.h"
 #include "nsIDOMEventListener.h"
 #include "nsXBLPrototypeHandler.h"
 #include "nsContentUtils.h"
-#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
+#include "mozilla/dom/Event.h" // for Event
 #include "mozilla/dom/EventTarget.h"
 #include "mozilla/dom/KeyboardEvent.h"
 #include "mozilla/TextEvents.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 nsXBLEventHandler::nsXBLEventHandler(nsXBLPrototypeHandler* aHandler)
@@ -24,17 +24,17 @@ nsXBLEventHandler::nsXBLEventHandler(nsX
 
 nsXBLEventHandler::~nsXBLEventHandler()
 {
 }
 
 NS_IMPL_ISUPPORTS(nsXBLEventHandler, nsIDOMEventListener)
 
 NS_IMETHODIMP
-nsXBLEventHandler::HandleEvent(nsIDOMEvent* aEvent)
+nsXBLEventHandler::HandleEvent(Event* aEvent)
 {
   if (!mProtoHandler)
     return NS_ERROR_FAILURE;
 
   uint8_t phase = mProtoHandler->GetPhase();
   if (phase == NS_PHASE_TARGET) {
     uint16_t eventPhase;
     aEvent->GetEventPhase(&eventPhase);
@@ -117,17 +117,17 @@ nsXBLKeyEventHandler::ExecuteMatchedHand
       return ExecuteMatchedHandlers(aKeyEvent, aCharCode, ignoreModifierState);
     }
   }
 #endif
   return executed;
 }
 
 NS_IMETHODIMP
-nsXBLKeyEventHandler::HandleEvent(nsIDOMEvent* aEvent)
+nsXBLKeyEventHandler::HandleEvent(Event* aEvent)
 {
   uint32_t count = mProtoHandlers.Length();
   if (count == 0)
     return NS_ERROR_FAILURE;
 
   if (mPhase == NS_PHASE_TARGET) {
     uint16_t eventPhase;
     aEvent->GetEventPhase(&eventPhase);
--- a/dom/xbl/nsXBLPrototypeHandler.cpp
+++ b/dom/xbl/nsXBLPrototypeHandler.cpp
@@ -39,16 +39,17 @@
 #include "nsXBLEventHandler.h"
 #include "nsXBLSerialize.h"
 #include "nsJSUtils.h"
 #include "mozilla/BasicEvents.h"
 #include "mozilla/JSEventHandler.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/dom/Element.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/EventHandlerBinding.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/dom/HTMLTextAreaElement.h"
 #include "mozilla/dom/KeyboardEvent.h"
 #include "mozilla/dom/KeyboardEventBinding.h"
 #include "mozilla/dom/MouseEvent.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/layers/KeyboardMap.h"
@@ -245,17 +246,17 @@ nsXBLPrototypeHandler::InitAccessKeys()
 
   // Get the menu access key value from prefs, overriding the default:
   kMenuAccessKey =
     Preferences::GetInt("ui.key.menuAccessKey", kMenuAccessKey);
 }
 
 nsresult
 nsXBLPrototypeHandler::ExecuteHandler(EventTarget* aTarget,
-                                      nsIDOMEvent* aEvent)
+                                      Event* aEvent)
 {
   nsresult rv = NS_ERROR_FAILURE;
 
   // Prevent default action?
   if (mType & NS_HANDLER_TYPE_PREVENTDEFAULT) {
     aEvent->PreventDefault();
     // If we prevent default, then it's okay for
     // mHandlerElement and mHandlerText to be null
--- a/dom/xbl/nsXBLPrototypeHandler.h
+++ b/dom/xbl/nsXBLPrototypeHandler.h
@@ -63,16 +63,17 @@ enum XBLReservedKey : uint8_t
   XBLReservedKey_False = 0,
   XBLReservedKey_True = 1,
   XBLReservedKey_Unset = 2,
 };
 
 namespace mozilla {
 namespace dom {
 class Element;
+class Event;
 }
 }
 
 class nsXBLPrototypeHandler
 {
   typedef mozilla::IgnoreModifierState IgnoreModifierState;
   typedef mozilla::layers::KeyboardShortcut KeyboardShortcut;
   typedef mozilla::Modifiers Modifiers;
@@ -126,17 +127,18 @@ public:
 
   uint8_t GetPhase() { return mPhase; }
   uint8_t GetType() { return mType; }
   XBLReservedKey GetIsReserved() { return mReserved; }
 
   nsXBLPrototypeHandler* GetNextHandler() { return mNextHandler; }
   void SetNextHandler(nsXBLPrototypeHandler* aHandler) { mNextHandler = aHandler; }
 
-  nsresult ExecuteHandler(mozilla::dom::EventTarget* aTarget, nsIDOMEvent* aEvent);
+  nsresult ExecuteHandler(mozilla::dom::EventTarget* aTarget,
+                          mozilla::dom::Event* aEvent);
 
   already_AddRefed<nsAtom> GetEventName();
   void SetEventName(nsAtom* aName) { mEventName = aName; }
 
   nsXBLEventHandler* GetEventHandler()
   {
     if (!mHandler) {
       mHandler = NS_NewXBLEventHandler(this, mEventName);
--- a/dom/xbl/nsXBLService.cpp
+++ b/dom/xbl/nsXBLService.cpp
@@ -261,17 +261,17 @@ nsXBLStreamListener::HasRequest(nsIURI* 
         NS_SUCCEEDED(req->mBindingURI->Equals(aURI, &eq)) && eq)
       return true;
   }
 
   return false;
 }
 
 nsresult
-nsXBLStreamListener::HandleEvent(nsIDOMEvent* aEvent)
+nsXBLStreamListener::HandleEvent(Event* aEvent)
 {
   nsresult rv = NS_OK;
   uint32_t i;
   uint32_t count = mBindingRequests.Length();
 
   // Get the binding document; note that we don't hold onto it in this object
   // to avoid creating a cycle
   Event* event = aEvent->InternalDOMEvent();
--- a/dom/xbl/nsXBLWindowKeyHandler.cpp
+++ b/dom/xbl/nsXBLWindowKeyHandler.cpp
@@ -481,17 +481,17 @@ nsXBLWindowKeyHandler::ConvertEventToDOM
     return nsGkAtoms::keypress;
   }
   MOZ_ASSERT_UNREACHABLE(
     "All event messages which this instance listens to should be handled");
   return nullptr;
 }
 
 NS_IMETHODIMP
-nsXBLWindowKeyHandler::HandleEvent(nsIDOMEvent* aEvent)
+nsXBLWindowKeyHandler::HandleEvent(Event* aEvent)
 {
   RefPtr<KeyboardEvent> keyEvent =
     aEvent->InternalDOMEvent()->AsKeyboardEvent();
   NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG);
 
   uint16_t eventPhase;
   aEvent->GetEventPhase(&eventPhase);
   if (eventPhase == nsIDOMEvent::CAPTURING_PHASE) {
--- a/dom/xhr/XMLHttpRequestMainThread.h
+++ b/dom/xhr/XMLHttpRequestMainThread.h
@@ -848,17 +848,17 @@ public:
 private:
   RefPtr<XMLHttpRequestMainThread> mXHR;
 };
 
 class nsXHRParseEndListener : public nsIDOMEventListener
 {
 public:
   NS_DECL_ISUPPORTS
-  NS_IMETHOD HandleEvent(nsIDOMEvent *event) override
+  NS_IMETHOD HandleEvent(Event *event) override
   {
     if (mXHR) {
       mXHR->OnBodyParseEnd();
     }
     mXHR = nullptr;
     return NS_OK;
   }
 
--- a/dom/xhr/XMLHttpRequestWorker.cpp
+++ b/dom/xhr/XMLHttpRequestWorker.cpp
@@ -1,26 +1,26 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "XMLHttpRequestWorker.h"
 
-#include "nsIDOMEvent.h"
 #include "nsIDOMEventListener.h"
 #include "nsIRunnable.h"
 #include "nsIXPConnect.h"
 
 #include "jsfriendapi.h"
 #include "js/TracingAPI.h"
 #include "js/GCPolicyAPI.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/dom/Exceptions.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/FormData.h"
 #include "mozilla/dom/ProgressEvent.h"
 #include "mozilla/dom/StructuredCloneHolder.h"
 #include "mozilla/dom/UnionConversions.h"
 #include "mozilla/dom/URLSearchParams.h"
 #include "mozilla/dom/WorkerScope.h"
 #include "mozilla/dom/WorkerPrivate.h"
@@ -973,17 +973,17 @@ Proxy::AddRemoveEventListeners(bool aUpl
   }
 
   return true;
 }
 
 NS_IMPL_ISUPPORTS(Proxy, nsIDOMEventListener)
 
 NS_IMETHODIMP
-Proxy::HandleEvent(nsIDOMEvent* aEvent)
+Proxy::HandleEvent(Event* aEvent)
 {
   AssertIsOnMainThread();
 
   if (!mWorkerPrivate || !mXMLHttpRequestPrivate) {
     NS_ERROR("Shouldn't get here!");
     return NS_OK;
   }
 
@@ -1082,17 +1082,17 @@ LoadStartDetectionRunnable::Run()
 
   mProxy = nullptr;
   mXHR = nullptr;
   mXMLHttpRequestPrivate = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-LoadStartDetectionRunnable::HandleEvent(nsIDOMEvent* aEvent)
+LoadStartDetectionRunnable::HandleEvent(Event* aEvent)
 {
   AssertIsOnMainThread();
 
 #ifdef DEBUG
   {
     nsString type;
     if (NS_SUCCEEDED(aEvent->GetType(type))) {
       MOZ_ASSERT(type == mEventType);
--- a/dom/xul/nsXULPopupListener.cpp
+++ b/dom/xul/nsXULPopupListener.cpp
@@ -21,17 +21,17 @@
 #include "nsIPrincipal.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsLayoutUtils.h"
 #include "mozilla/ReflowInput.h"
 #include "nsIObjectLoadingContent.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/Preferences.h"
-#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
+#include "mozilla/dom/Event.h" // for Event
 #include "mozilla/dom/EventTarget.h"
 #include "mozilla/dom/FragmentOrElement.h"
 #include "mozilla/dom/MouseEvent.h"
 #include "mozilla/dom/MouseEventBinding.h"
 
 // for event firing in context menus
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
@@ -88,17 +88,17 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
   NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 ////////////////////////////////////////////////////////////////
 // nsIDOMEventListener
 
 nsresult
-nsXULPopupListener::HandleEvent(nsIDOMEvent* aEvent)
+nsXULPopupListener::HandleEvent(Event* aEvent)
 {
   nsAutoString eventType;
   aEvent->GetType(eventType);
 
   if(!((eventType.EqualsLiteral("mousedown") && !mIsContext) ||
        (eventType.EqualsLiteral("contextmenu") && mIsContext)))
     return NS_OK;
 
--- a/editor/libeditor/EditorEventListener.cpp
+++ b/editor/libeditor/EditorEventListener.cpp
@@ -27,17 +27,16 @@
 #include "nsGkAtoms.h"                  // for nsGkAtoms, nsGkAtoms::input
 #include "nsIClipboard.h"               // for nsIClipboard, etc.
 #include "nsIContent.h"                 // for nsIContent
 #include "nsIController.h"              // for nsIController
 #include "nsID.h"
 #include "mozilla/dom/DOMStringList.h"
 #include "mozilla/dom/DataTransfer.h"
 #include "mozilla/dom/DragEvent.h"
-#include "nsIDOMEvent.h"                // for nsIDOMEvent
 #include "nsIDOMEventTarget.h"          // for nsIDOMEventTarget
 #include "nsIDocument.h"                // for nsIDocument
 #include "nsIFocusManager.h"            // for nsIFocusManager
 #include "nsIFormControl.h"             // for nsIFormControl, etc.
 #include "nsINode.h"                    // for nsINode, ::NODE_IS_EDITABLE, etc.
 #include "nsIPlaintextEditor.h"         // for nsIPlaintextEditor, etc.
 #include "nsIPresShell.h"               // for nsIPresShell
 #include "nsISelectionController.h"     // for nsISelectionController, etc.
@@ -361,17 +360,17 @@ EditorEventListener::EnsureCommitCompois
 {
   MOZ_ASSERT(!DetachedFromEditor());
   RefPtr<EditorBase> editorBase(mEditorBase);
   editorBase->CommitComposition();
   return !DetachedFromEditor();
 }
 
 NS_IMETHODIMP
-EditorEventListener::HandleEvent(nsIDOMEvent* aEvent)
+EditorEventListener::HandleEvent(Event* aEvent)
 {
   // Let's handle each event with the message of the internal event of the
   // coming event.  If the DOM event was created with improper interface,
   // e.g., keydown event is created with |new MouseEvent("keydown", {});|,
   // its message is always 0.  Therefore, we can ban such strange event easy.
   // However, we need to handle strange "focus" and "blur" event.  See the
   // following code of this switch statement.
   // NOTE: Each event handler may require specific event interface.  Before
--- a/editor/libeditor/HTMLEditorObjectResizer.cpp
+++ b/editor/libeditor/HTMLEditorObjectResizer.cpp
@@ -8,29 +8,29 @@
 
 #include "HTMLEditUtils.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/EditorUtils.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/mozalloc.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/MouseEvent.h"
 #include "mozilla/dom/EventTarget.h"
 #include "nsAString.h"
 #include "nsAlgorithm.h"
 #include "nsCOMPtr.h"
 #include "nsDebug.h"
 #include "nsError.h"
 #include "nsGkAtoms.h"
 #include "nsAtom.h"
 #include "nsIContent.h"
 #include "nsID.h"
 #include "nsIDOMElement.h"
-#include "nsIDOMEvent.h"
 #include "nsIDocument.h"
 #include "nsIPresShell.h"
 #include "nsISupportsUtils.h"
 #include "nsPIDOMWindow.h"
 #include "nsReadableUtils.h"
 #include "nsString.h"
 #include "nsStringFwd.h"
 #include "nscore.h"
@@ -50,17 +50,17 @@ NS_IMPL_ISUPPORTS(DocumentResizeEventLis
 
 DocumentResizeEventListener::DocumentResizeEventListener(
                                HTMLEditor& aHTMLEditor)
   : mHTMLEditorWeak(&aHTMLEditor)
 {
 }
 
 NS_IMETHODIMP
-DocumentResizeEventListener::HandleEvent(nsIDOMEvent* aMouseEvent)
+DocumentResizeEventListener::HandleEvent(Event* aMouseEvent)
 {
   RefPtr<HTMLEditor> htmlEditor = mHTMLEditorWeak.get();
   if (htmlEditor) {
     return htmlEditor->RefreshResizers();
   }
   return NS_OK;
 }
 
@@ -71,17 +71,17 @@ DocumentResizeEventListener::HandleEvent
 NS_IMPL_ISUPPORTS(ResizerMouseMotionListener, nsIDOMEventListener)
 
 ResizerMouseMotionListener::ResizerMouseMotionListener(HTMLEditor& aHTMLEditor)
   : mHTMLEditorWeak(&aHTMLEditor)
 {
 }
 
 NS_IMETHODIMP
-ResizerMouseMotionListener::HandleEvent(nsIDOMEvent* aMouseEvent)
+ResizerMouseMotionListener::HandleEvent(Event* aMouseEvent)
 {
   MouseEvent* mouseEvent = aMouseEvent->InternalDOMEvent()->AsMouseEvent();
   if (!mouseEvent) {
     //non-ui event passed in.  bad things.
     return NS_OK;
   }
 
   // Don't do anything special if not an HTML object resizer editor
--- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp
@@ -34,31 +34,31 @@
 
 #include "mozInlineSpellChecker.h"
 
 #include "mozilla/EditAction.h"
 #include "mozilla/EditorSpellCheck.h"
 #include "mozilla/EditorUtils.h"
 #include "mozilla/Services.h"
 #include "mozilla/TextEditor.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/KeyboardEvent.h"
 #include "mozilla/dom/KeyboardEventBinding.h"
 #include "mozilla/dom/MouseEvent.h"
 #include "mozilla/dom/Selection.h"
 #include "mozInlineSpellWordUtil.h"
 #include "mozISpellI18NManager.h"
 #include "mozISpellI18NUtil.h"
 #include "nsCOMPtr.h"
 #include "nsCRT.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
-#include "nsIDOMEvent.h"
 #include "nsGenericHTMLElement.h"
 #include "nsRange.h"
 #include "nsIPlaintextEditor.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "nsIRunnable.h"
 #include "nsISelection.h"
 #include "nsISelectionPrivate.h"
@@ -1829,17 +1829,17 @@ mozInlineSpellChecker::HandleNavigationE
     rv = ScheduleSpellCheck(Move(status));
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-mozInlineSpellChecker::HandleEvent(nsIDOMEvent* aEvent)
+mozInlineSpellChecker::HandleEvent(Event* aEvent)
 {
   nsAutoString eventType;
   aEvent->GetType(eventType);
 
   if (eventType.EqualsLiteral("blur")) {
     return OnBlur(aEvent);
   }
   if (eventType.EqualsLiteral("click")) {
--- a/image/VectorImage.cpp
+++ b/image/VectorImage.cpp
@@ -8,21 +8,21 @@
 #include "gfx2DGlue.h"
 #include "gfxContext.h"
 #include "gfxDrawable.h"
 #include "gfxPlatform.h"
 #include "gfxUtils.h"
 #include "imgFrame.h"
 #include "mozilla/AutoRestore.h"
 #include "mozilla/MemoryReporting.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/SVGSVGElement.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/Tuple.h"
-#include "nsIDOMEvent.h"
 #include "nsIPresShell.h"
 #include "nsIStreamListener.h"
 #include "nsMimeTypes.h"
 #include "nsPresContext.h"
 #include "nsRect.h"
 #include "nsString.h"
 #include "nsStubDocumentObserver.h"
 #include "SVGObserverUtils.h" // for nsSVGRenderingObserver
@@ -204,17 +204,17 @@ private:
       // The document must have been destroyed before we got our event.
       // Otherwise this can't happen, since documents hold strong references to
       // their observers.
       Cancel();
     }
   }
 
 public:
-  NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) override
+  NS_IMETHOD HandleEvent(Event* aEvent) override
   {
     MOZ_ASSERT(mDocument, "Need an SVG document. Received multiple events?");
 
     // OnSVGDocumentLoaded/OnSVGDocumentError will release our owner's reference
     // to us, so ensure we stick around long enough to complete our work.
     RefPtr<SVGLoadEventListener> kungFuDeathGrip(this);
 
     nsAutoString eventType;
--- a/layout/base/AccessibleCaret.h
+++ b/layout/base/AccessibleCaret.h
@@ -21,16 +21,20 @@
 
 class nsIDocument;
 class nsIFrame;
 class nsIPresShell;
 struct nsPoint;
 
 namespace mozilla {
 
+namespace dom {
+class Event;
+} // namespace dom
+
 // -----------------------------------------------------------------------------
 // Upon the creation of AccessibleCaret, it will insert DOM Element as an
 // anonymous content containing the caret image. The caret appearance and
 // position can be controlled by SetAppearance() and SetPosition().
 //
 // All the rect or point are relative to root frame except being specified
 // explicitly.
 //
@@ -198,17 +202,17 @@ protected:
   {
     return aRect.TopLeft() + nsPoint(aRect.width / 2, 0);
   }
 
   class DummyTouchListener final : public nsIDOMEventListener
   {
   public:
     NS_DECL_ISUPPORTS
-    NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) override
+    NS_IMETHOD HandleEvent(mozilla::dom::Event* aEvent) override
     {
       return NS_OK;
     }
 
   private:
     virtual ~DummyTouchListener() {};
   };
 
--- a/layout/base/MobileViewportManager.cpp
+++ b/layout/base/MobileViewportManager.cpp
@@ -4,18 +4,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "MobileViewportManager.h"
 
 #include "gfxPrefs.h"
 #include "LayersLogging.h"
 #include "mozilla/PresShell.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/EventTarget.h"
-#include "nsIDOMEvent.h"
 #include "nsIFrame.h"
 #include "nsLayoutUtils.h"
 #include "nsViewManager.h"
 #include "nsViewportInfo.h"
 #include "UnitTransforms.h"
 #include "nsIDocument.h"
 
 #define MVM_LOG(...)
@@ -117,17 +117,17 @@ MobileViewportManager::ResolutionUpdated
     // Save the value, so our default zoom calculation
     // can take it into account later on.
     SetRestoreResolution(mPresShell->GetResolution());
   }
   RefreshSPCSPS();
 }
 
 NS_IMETHODIMP
-MobileViewportManager::HandleEvent(nsIDOMEvent* event)
+MobileViewportManager::HandleEvent(dom::Event* event)
 {
   nsAutoString type;
   event->GetType(type);
 
   if (type.Equals(DOM_META_ADDED)) {
     MVM_LOG("%p: got a dom-meta-added event\n", this);
     RefreshViewportSize(mPainted);
   } else if (type.Equals(DOM_META_CHANGED)) {
--- a/layout/base/ZoomConstraintsClient.cpp
+++ b/layout/base/ZoomConstraintsClient.cpp
@@ -124,17 +124,17 @@ ZoomConstraintsClient::Init(nsIPresShell
   if (observerService) {
     observerService->AddObserver(this, BEFORE_FIRST_PAINT.Data(), false);
   }
 
   Preferences::AddStrongObserver(this, "browser.ui.zoom.force-user-scalable");
 }
 
 NS_IMETHODIMP
-ZoomConstraintsClient::HandleEvent(nsIDOMEvent* event)
+ZoomConstraintsClient::HandleEvent(dom::Event* event)
 {
   nsAutoString type;
   event->GetType(type);
 
   if (type.Equals(DOM_META_ADDED)) {
     ZCC_LOG("Got a dom-meta-added event in %p\n", this);
     RefreshZoomConstraints();
   } else if (type.Equals(DOM_META_CHANGED)) {
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -114,16 +114,17 @@
 #include "nsISHistoryInternal.h"
 #include "nsIWebNavigation.h"
 #include "mozilla/dom/XMLHttpRequestMainThread.h"
 
 //paint forcing
 #include <stdio.h>
 
 #include "mozilla/dom/Element.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/dom/ScriptLoader.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 #define BEFOREUNLOAD_DISABLED_PREFNAME "dom.disable_beforeunload"
 #define BEFOREUNLOAD_REQUIRES_INTERACTION_PREFNAME "dom.require_user_interaction_for_beforeunload"
@@ -3700,17 +3701,17 @@ NS_IMPL_ISUPPORTS(nsDocViewerFocusListen
 nsDocViewerFocusListener::nsDocViewerFocusListener()
 :mDocViewer(nullptr)
 {
 }
 
 nsDocViewerFocusListener::~nsDocViewerFocusListener(){}
 
 nsresult
-nsDocViewerFocusListener::HandleEvent(nsIDOMEvent* aEvent)
+nsDocViewerFocusListener::HandleEvent(Event* aEvent)
 {
   NS_ENSURE_STATE(mDocViewer);
 
   nsCOMPtr<nsIPresShell> shell;
   mDocViewer->GetPresShell(getter_AddRefs(shell));
   NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsISelectionController> selCon = do_QueryInterface(shell);
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -24,16 +24,17 @@
 #include "mozilla/PresState.h"
 #include "nsView.h"
 #include "nsViewManager.h"
 #include "nsIContentInlines.h"
 #include "nsIDOMEventListener.h"
 #include "nsIDOMNode.h"
 #include "nsISelectControlFrame.h"
 #include "nsContentUtils.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/HTMLSelectElement.h"
 #include "nsIDocument.h"
 #include "nsIScrollableFrame.h"
 #include "nsListControlFrame.h"
 #include "mozilla/ServoStyleSet.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsLayoutUtils.h"
@@ -92,17 +93,17 @@ nsComboboxControlFrame::RedisplayTextEve
 class nsComboButtonListener : public nsIDOMEventListener
 {
 private:
   virtual ~nsComboButtonListener() {}
 
 public:
   NS_DECL_ISUPPORTS
 
-  NS_IMETHOD HandleEvent(nsIDOMEvent*) override
+  NS_IMETHOD HandleEvent(dom::Event*) override
   {
     mComboBox->ShowDropDown(!mComboBox->IsDroppedDown());
     return NS_OK;
   }
 
   explicit nsComboButtonListener(nsComboboxControlFrame* aCombobox)
   {
     mComboBox = aCombobox;
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -11,16 +11,17 @@
 #include "nsIDocument.h"
 #include "mozilla/dom/NodeInfo.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/DOMPrefs.h"
 #include "mozilla/dom/DOMStringList.h"
 #include "mozilla/dom/DataTransfer.h"
 #include "mozilla/dom/Directory.h"
 #include "mozilla/dom/DragEvent.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/FileList.h"
 #include "mozilla/dom/HTMLButtonElement.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/dom/MutationEventBinding.h"
 #include "mozilla/Preferences.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsContentUtils.h"
@@ -228,17 +229,17 @@ AppendBlobImplAsDirectory(nsTArray<Ownin
   OwningFileOrDirectory* element = aArray.AppendElement();
   element->SetAsDirectory() = directory;
 }
 
 /**
  * This is called when we receive a drop or a dragover.
  */
 NS_IMETHODIMP
-nsFileControlFrame::DnDListener::HandleEvent(nsIDOMEvent* aEvent)
+nsFileControlFrame::DnDListener::HandleEvent(Event* aEvent)
 {
   NS_ASSERTION(mFrame, "We should have been unregistered");
 
   Event* event = aEvent->InternalDOMEvent();
   if (event->DefaultPrevented()) {
     return NS_OK;
   }
 
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -16,16 +16,17 @@
 #include "nsFontMetrics.h"
 #include "nsIScrollableFrame.h"
 #include "nsCSSRendering.h"
 #include "nsIDOMEventListener.h"
 #include "nsLayoutUtils.h"
 #include "nsDisplayList.h"
 #include "nsContentUtils.h"
 #include "mozilla/Attributes.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/HTMLOptGroupElement.h"
 #include "mozilla/dom/HTMLOptionsCollection.h"
 #include "mozilla/dom/HTMLSelectElement.h"
 #include "mozilla/dom/MouseEvent.h"
 #include "mozilla/dom/MouseEventBinding.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/LookAndFeel.h"
@@ -2518,17 +2519,17 @@ nsListControlFrame::PostHandleKeyEvent(i
 
 /******************************************************************************
  * nsListEventListener
  *****************************************************************************/
 
 NS_IMPL_ISUPPORTS(nsListEventListener, nsIDOMEventListener)
 
 NS_IMETHODIMP
-nsListEventListener::HandleEvent(nsIDOMEvent* aEvent)
+nsListEventListener::HandleEvent(dom::Event* aEvent)
 {
   if (!mFrame)
     return NS_OK;
 
   nsAutoString eventType;
   aEvent->GetType(eventType);
   if (eventType.EqualsLiteral("keydown")) {
     return mFrame->nsListControlFrame::KeyDown(aEvent);
--- a/layout/forms/nsRangeFrame.h
+++ b/layout/forms/nsRangeFrame.h
@@ -12,16 +12,22 @@
 #include "mozilla/EventForwards.h"
 #include "nsContainerFrame.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsIDOMEventListener.h"
 #include "nsCOMPtr.h"
 
 class nsDisplayRangeFocusRing;
 
+namespace mozilla {
+namespace dom {
+class Event;
+} // namespace mozilla
+} // namespace dom
+
 class nsRangeFrame final : public nsContainerFrame,
                            public nsIAnonymousContentCreator
 {
   friend nsIFrame*
   NS_NewRangeFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
 
   friend class nsDisplayRangeFocusRing;
 
@@ -190,17 +196,17 @@ private:
   class DummyTouchListener final : public nsIDOMEventListener
   {
   private:
     ~DummyTouchListener() {}
 
   public:
     NS_DECL_ISUPPORTS
 
-    NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) override
+    NS_IMETHOD HandleEvent(mozilla::dom::Event* aEvent) override
     {
       return NS_OK;
     }
   };
 
   /**
    * A no-op touch-listener used for APZ purposes (see nsRangeFrame::Init).
    */
--- a/layout/generic/ScrollbarActivity.cpp
+++ b/layout/generic/ScrollbarActivity.cpp
@@ -3,24 +3,24 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ScrollbarActivity.h"
 #include "nsIScrollbarMediator.h"
 #include "nsIContent.h"
 #include "nsICSSDeclaration.h"
-#include "nsIDOMEvent.h"
 #include "nsIFrame.h"
 #include "nsContentUtils.h"
 #include "nsAString.h"
 #include "nsQueryFrame.h"
 #include "nsComponentManagerUtils.h"
 #include "nsStyledElement.h"
 #include "mozilla/dom/Element.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/Preferences.h"
 
 namespace mozilla {
 namespace layout {
 
 NS_IMPL_ISUPPORTS(ScrollbarActivity, nsIDOMEventListener)
 
@@ -102,17 +102,17 @@ ScrollbarActivity::ActivityStopped()
     StartFadeBeginTimer();
 
     NS_ASSERTION(mIsActive, "need to be active right after activity");
     NS_ASSERTION(!mIsFading, "must not be fading right after activity");
   }
 }
 
 NS_IMETHODIMP
-ScrollbarActivity::HandleEvent(nsIDOMEvent* aEvent)
+ScrollbarActivity::HandleEvent(dom::Event* aEvent)
 {
   if (!mDisplayOnMouseMove && !mIsActive)
     return NS_OK;
 
   nsAutoString type;
   aEvent->GetType(type);
 
   if (type.EqualsLiteral("mousemove")) {
--- a/layout/generic/nsImageMap.cpp
+++ b/layout/generic/nsImageMap.cpp
@@ -4,17 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* code for HTML client-side image maps */
 
 #include "nsImageMap.h"
 
 #include "mozilla/dom/Element.h"
-#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
+#include "mozilla/dom/Event.h" // for Event
 #include "mozilla/dom/HTMLAreaElement.h"
 #include "mozilla/gfx/PathHelpers.h"
 #include "mozilla/UniquePtr.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsPresContext.h"
 #include "nsNameSpaceManager.h"
 #include "nsGkAtoms.h"
@@ -972,17 +972,17 @@ nsImageMap::ParentChainChanged(nsIConten
   NS_ASSERTION(aContent == mMap,
                "Unexpected ParentChainChanged notification!");
   if (mImageFrame) {
     mImageFrame->DisconnectMap();
   }
 }
 
 nsresult
-nsImageMap::HandleEvent(nsIDOMEvent* aEvent)
+nsImageMap::HandleEvent(Event* aEvent)
 {
   nsAutoString eventType;
   aEvent->GetType(eventType);
   bool focus = eventType.EqualsLiteral("focus");
   MOZ_ASSERT(focus == !eventType.EqualsLiteral("blur"),
              "Unexpected event type");
 
   //Set which one of our areas changed focus
--- a/layout/mathml/nsMathMLmactionFrame.cpp
+++ b/layout/mathml/nsMathMLmactionFrame.cpp
@@ -8,18 +8,20 @@
 #include "nsCOMPtr.h"
 #include "nsPresContext.h"
 #include "nsNameSpaceManager.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIWebBrowserChrome.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsTextFragment.h"
-#include "nsIDOMEvent.h"
 #include "mozilla/gfx/2D.h"
+#include "mozilla/dom/Event.h"
+
+using mozilla::dom::Event;
 
 //
 // <maction> -- bind actions to a subexpression - implementation
 //
 
 enum nsMactionActionTypes {
   NS_MATHML_ACTION_TYPE_CLASS_ERROR            = 0x10,
   NS_MATHML_ACTION_TYPE_CLASS_USE_SELECTION    = 0x20,
@@ -258,17 +260,17 @@ ShowStatus(nsPresContext* aPresContext, 
       if (browserChrome) {
         browserChrome->SetStatus(nsIWebBrowserChrome::STATUS_LINK, aStatusMsg.get());
       }
     }
   }
 }
 
 NS_IMETHODIMP
-nsMathMLmactionFrame::MouseListener::HandleEvent(nsIDOMEvent* aEvent)
+nsMathMLmactionFrame::MouseListener::HandleEvent(Event* aEvent)
 {
   nsAutoString eventType;
   aEvent->GetType(eventType);
   if (eventType.EqualsLiteral("mouseover")) {
     mOwner->MouseOver();
   }
   else if (eventType.EqualsLiteral("click")) {
     mOwner->MouseClick();
--- a/layout/printing/nsPrintPreviewListener.cpp
+++ b/layout/printing/nsPrintPreviewListener.cpp
@@ -3,17 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsPrintPreviewListener.h"
 
 #include "mozilla/TextEvents.h"
 #include "mozilla/dom/Element.h"
-#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
+#include "mozilla/dom/Event.h" // for Event
 #include "nsIDOMWindow.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMEvent.h"
 #include "nsIDocument.h"
 #include "nsIDocShell.h"
 #include "nsPresContext.h"
 #include "nsFocusManager.h"
@@ -152,17 +152,17 @@ GetActionForEvent(nsIDOMEvent* aEvent)
       return eEventAction_Propagate;
     }
   }
 
   return eEventAction_Suppress;
 }
 
 NS_IMETHODIMP
-nsPrintPreviewListener::HandleEvent(nsIDOMEvent* aEvent)
+nsPrintPreviewListener::HandleEvent(Event* aEvent)
 {
   nsCOMPtr<nsIContent> content = do_QueryInterface(
     aEvent ? aEvent->InternalDOMEvent()->GetOriginalTarget() : nullptr);
   if (content && !content->IsXULElement()) {
     eEventAction action = ::GetActionForEvent(aEvent);
     switch (action) {
       case eEventAction_Tab:
       case eEventAction_ShiftTab:
--- a/layout/style/FontFaceSet.cpp
+++ b/layout/style/FontFaceSet.cpp
@@ -5,16 +5,17 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "FontFaceSet.h"
 
 #include "gfxFontConstants.h"
 #include "gfxFontSrcPrincipal.h"
 #include "gfxFontSrcURI.h"
 #include "mozilla/css/Loader.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/FontFaceSetBinding.h"
 #include "mozilla/dom/FontFaceSetIterator.h"
 #include "mozilla/dom/FontFaceSetLoadEvent.h"
 #include "mozilla/dom/FontFaceSetLoadEventBinding.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/FontPropertyTypes.h"
 #include "mozilla/net/ReferrerPolicy.h"
 #include "mozilla/AsyncEventDispatcher.h"
@@ -1749,17 +1750,17 @@ FontFaceSet::DispatchLoadingFinishedEven
   RefPtr<FontFaceSetLoadEvent> event =
     FontFaceSetLoadEvent::Constructor(this, aType, init);
   (new AsyncEventDispatcher(this, event))->PostDOMEvent();
 }
 
 // nsIDOMEventListener
 
 NS_IMETHODIMP
-FontFaceSet::HandleEvent(nsIDOMEvent* aEvent)
+FontFaceSet::HandleEvent(Event* aEvent)
 {
   nsString type;
   aEvent->GetType(type);
 
   if (!type.EqualsLiteral("DOMContentLoaded")) {
     return NS_ERROR_FAILURE;
   }
 
--- a/layout/xul/nsButtonBoxFrame.cpp
+++ b/layout/xul/nsButtonBoxFrame.cpp
@@ -1,40 +1,40 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #include "nsCOMPtr.h"
 #include "nsButtonBoxFrame.h"
 #include "nsIContent.h"
-#include "nsIDOMEvent.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMXULButtonElement.h"
 #include "nsGkAtoms.h"
 #include "nsNameSpaceManager.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsIDOMElement.h"
 #include "nsDisplayList.h"
 #include "nsContentUtils.h"
 #include "mozilla/dom/Element.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/MouseEventBinding.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/TextEvents.h"
 
 using namespace mozilla;
 
 
 NS_IMPL_ISUPPORTS(nsButtonBoxFrame::nsButtonBoxListener, nsIDOMEventListener)
 
 nsresult
-nsButtonBoxFrame::nsButtonBoxListener::HandleEvent(nsIDOMEvent* aEvent)
+nsButtonBoxFrame::nsButtonBoxListener::HandleEvent(dom::Event* aEvent)
 {
   if (!mButtonBoxFrame) {
     return NS_OK;
   }
 
   nsAutoString eventType;
   aEvent->GetType(eventType);
 
--- a/layout/xul/nsButtonBoxFrame.h
+++ b/layout/xul/nsButtonBoxFrame.h
@@ -53,17 +53,17 @@ public:
 private:
   class nsButtonBoxListener final : public nsIDOMEventListener
   {
   public:
     explicit nsButtonBoxListener(nsButtonBoxFrame* aButtonBoxFrame) :
       mButtonBoxFrame(aButtonBoxFrame)
       { }
 
-    NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) override;
+    NS_DECL_NSIDOMEVENTLISTENER
 
     NS_DECL_ISUPPORTS
 
   private:
     friend class nsButtonBoxFrame;
     virtual ~nsButtonBoxListener() { }
     nsButtonBoxFrame* mButtonBoxFrame;
   };
--- a/layout/xul/nsMenuBarListener.cpp
+++ b/layout/xul/nsMenuBarListener.cpp
@@ -2,35 +2,36 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsMenuBarListener.h"
 #include "nsMenuBarFrame.h"
 #include "nsMenuPopupFrame.h"
-#include "nsIDOMEvent.h"
 #include "nsPIWindowRoot.h"
 
 // Drag & Drop, Clipboard
 #include "nsIServiceManager.h"
 #include "nsWidgetsCID.h"
 #include "nsCOMPtr.h"
 #include "nsIContent.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMElement.h"
 
 #include "nsContentUtils.h"
 #include "mozilla/BasicEvents.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/TextEvents.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/KeyboardEvent.h"
 #include "mozilla/dom/KeyboardEventBinding.h"
 
 using namespace mozilla;
+using mozilla::dom::Event;
 using mozilla::dom::KeyboardEvent;
 
 /*
  * nsMenuBarListener implementation
  */
 
 NS_IMPL_ISUPPORTS(nsMenuBarListener, nsIDOMEventListener)
 
@@ -568,17 +569,17 @@ nsMenuBarListener::Fullscreen(nsIDOMEven
   if (mMenuBarFrame->IsActive()) {
     ToggleMenuActiveState();
   }
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////
 nsresult
-nsMenuBarListener::HandleEvent(nsIDOMEvent* aEvent)
+nsMenuBarListener::HandleEvent(Event* aEvent)
 {
   // If the menu bar is collapsed, don't do anything.
   if (!mMenuBarFrame->StyleVisibility()->IsVisible()) {
     return NS_OK;
   }
 
   nsAutoString eventType;
   aEvent->GetType(eventType);
--- a/layout/xul/nsMenuBarListener.h
+++ b/layout/xul/nsMenuBarListener.h
@@ -34,17 +34,17 @@ public:
   explicit nsMenuBarListener(nsMenuBarFrame* aMenuBarFrame,
                              nsIContent* aMenuBarContent);
 
   NS_DECL_ISUPPORTS
 
   /**
    * nsIDOMEventListener interface method.
    */
-  NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) override;
+  NS_DECL_NSIDOMEVENTLISTENER
 
   /**
    * When mMenuBarFrame is being destroyed, this should be called.
    */
   void OnDestroyMenuBarFrame();
 
   static void InitializeStatics();
 
--- a/layout/xul/nsMenuPopupFrame.cpp
+++ b/layout/xul/nsMenuPopupFrame.cpp
@@ -13,17 +13,16 @@
 #include "nsCSSRendering.h"
 #include "nsNameSpaceManager.h"
 #include "nsViewManager.h"
 #include "nsWidgetsCID.h"
 #include "nsMenuFrame.h"
 #include "nsMenuBarFrame.h"
 #include "nsPopupSetFrame.h"
 #include "nsPIDOMWindow.h"
-#include "nsIDOMEvent.h"
 #include "nsIDOMXULMenuListElement.h"
 #include "nsIPresShell.h"
 #include "nsFrameManager.h"
 #include "nsIDocument.h"
 #include "nsRect.h"
 #include "nsIComponentManager.h"
 #include "nsBoxLayoutState.h"
 #include "nsIScrollableFrame.h"
@@ -55,16 +54,17 @@
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/KeyboardEvent.h"
 #include "mozilla/dom/KeyboardEventBinding.h"
 #include <algorithm>
 
 using namespace mozilla;
 using mozilla::dom::KeyboardEvent;
+using mozilla::dom::Event;
 
 int8_t nsMenuPopupFrame::sDefaultLevelIsTop = -1;
 
 DOMTimeStamp nsMenuPopupFrame::sLastKeyTime = 0;
 
 // XXX, kyle.yuan@sun.com, there are 4 definitions for the same purpose:
 //  nsMenuPopupFrame.h, nsListControlFrame.cpp, listbox.xml, tree.xml
 //  need to find a good place to put them together.
@@ -386,17 +386,17 @@ NS_IMETHODIMP nsXULPopupShownEvent::Run(
     popup->SetPopupState(ePopupShown);
   }
 
   WidgetMouseEvent event(true, eXULPopupShown, nullptr,
                          WidgetMouseEvent::eReal);
   return EventDispatcher::Dispatch(mPopup, mPresContext, &event);
 }
 
-NS_IMETHODIMP nsXULPopupShownEvent::HandleEvent(nsIDOMEvent* aEvent)
+NS_IMETHODIMP nsXULPopupShownEvent::HandleEvent(Event* aEvent)
 {
   nsMenuPopupFrame* popup = do_QueryFrame(mPopup->GetPrimaryFrame());
   nsCOMPtr<nsIDOMEventTarget> eventTarget;
   aEvent->GetTarget(getter_AddRefs(eventTarget));
   // Ignore events not targeted at the popup itself (ie targeted at
   // descendants):
   if (!SameCOMIdentity(mPopup, eventTarget)) {
     return NS_OK;
--- a/layout/xul/nsSliderFrame.cpp
+++ b/layout/xul/nsSliderFrame.cpp
@@ -18,17 +18,16 @@
 #include "nsPresContext.h"
 #include "nsIContent.h"
 #include "nsCOMPtr.h"
 #include "nsNameSpaceManager.h"
 #include "nsGkAtoms.h"
 #include "nsHTMLParts.h"
 #include "nsIPresShell.h"
 #include "nsCSSRendering.h"
-#include "nsIDOMEvent.h"
 #include "nsScrollbarButtonFrame.h"
 #include "nsISliderListener.h"
 #include "nsIScrollableFrame.h"
 #include "nsIScrollbarMediator.h"
 #include "nsISupportsImpl.h"
 #include "nsScrollbarFrame.h"
 #include "nsRepeatService.h"
 #include "nsBoxLayoutState.h"
@@ -39,16 +38,17 @@
 #include "nsDisplayList.h"
 #include "nsRefreshDriver.h"            // for nsAPostRefreshObserver
 #include "nsSVGIntegrationUtils.h"
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT
 #include "mozilla/Preferences.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/Telemetry.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/layers/APZCCallbackHelper.h"
 #include "mozilla/layers/AsyncDragMetrics.h"
 #include "mozilla/layers/InputAPZContext.h"
 #include <algorithm>
 
 using namespace mozilla;
 using mozilla::layers::APZCCallbackHelper;
 using mozilla::layers::AsyncDragMetrics;
@@ -997,17 +997,17 @@ nsSliderFrame::SetInitialChildList(Child
 {
   nsBoxFrame::SetInitialChildList(aListID, aChildList);
   if (aListID == kPrincipalList) {
     AddListener();
   }
 }
 
 nsresult
-nsSliderMediator::HandleEvent(nsIDOMEvent* aEvent)
+nsSliderMediator::HandleEvent(dom::Event* aEvent)
 {
   // Only process the event if the thumb is not being dragged.
   if (mSlider && !mSlider->isDraggingThumb())
     return mSlider->StartDrag(aEvent);
 
   return NS_OK;
 }
 
--- a/layout/xul/nsSliderFrame.h
+++ b/layout/xul/nsSliderFrame.h
@@ -27,17 +27,17 @@ public:
   NS_DECL_ISUPPORTS
 
   nsSliderFrame* mSlider;
 
   explicit nsSliderMediator(nsSliderFrame* aSlider) {  mSlider = aSlider; }
 
   virtual void SetSlider(nsSliderFrame* aSlider) { mSlider = aSlider; }
 
-  NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) override;
+  NS_DECL_NSIDOMEVENTLISTENER
 
 protected:
   virtual ~nsSliderMediator() {}
 };
 
 class nsSliderFrame final : public nsBoxFrame
 {
 public:
--- a/layout/xul/nsSplitterFrame.cpp
+++ b/layout/xul/nsSplitterFrame.cpp
@@ -562,17 +562,17 @@ nsSplitterFrameInner::RemoveListener()
     RemoveEventListener(NS_LITERAL_STRING("mousedown"), this, false);
   mOuter->GetContent()->
     RemoveEventListener(NS_LITERAL_STRING("mousemove"), this, false);
   mOuter->GetContent()->
     RemoveEventListener(NS_LITERAL_STRING("mouseout"), this, false);
 }
 
 nsresult
-nsSplitterFrameInner::HandleEvent(nsIDOMEvent* aEvent)
+nsSplitterFrameInner::HandleEvent(dom::Event* aEvent)
 {
   nsAutoString eventType;
   aEvent->GetType(eventType);
   if (eventType.EqualsLiteral("mouseup"))
     return MouseUp(aEvent);
   if (eventType.EqualsLiteral("mousedown"))
     return MouseDown(aEvent);
   if (eventType.EqualsLiteral("mousemove") ||
--- a/layout/xul/nsXULPopupManager.cpp
+++ b/layout/xul/nsXULPopupManager.cpp
@@ -7,17 +7,16 @@
 #include "nsGkAtoms.h"
 #include "nsXULPopupManager.h"
 #include "nsMenuFrame.h"
 #include "nsMenuPopupFrame.h"
 #include "nsMenuBarFrame.h"
 #include "nsMenuBarListener.h"
 #include "nsContentUtils.h"
 #include "nsIDOMDocument.h"
-#include "nsIDOMEvent.h"
 #include "nsXULElement.h"
 #include "nsIDOMXULMenuListElement.h"
 #include "nsIDOMXULCommandDispatcher.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsGlobalWindow.h"
 #include "nsLayoutUtils.h"
 #include "nsViewManager.h"
 #include "nsIComponentManager.h"
@@ -29,17 +28,17 @@
 #include "nsIBaseWindow.h"
 #include "nsCaret.h"
 #include "nsIDocument.h"
 #include "nsPIWindowRoot.h"
 #include "nsFrameManager.h"
 #include "nsIObserverService.h"
 #include "XULDocument.h"
 #include "mozilla/dom/Element.h"
-#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
+#include "mozilla/dom/Event.h" // for Event
 #include "mozilla/dom/KeyboardEvent.h"
 #include "mozilla/dom/KeyboardEventBinding.h"
 #include "mozilla/dom/MouseEvent.h"
 #include "mozilla/dom/UIEvent.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/MouseEvents.h"
@@ -1108,17 +1107,17 @@ public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS(TransitionEnder)
 
   TransitionEnder(nsIContent* aContent, bool aDeselectMenu)
     : mContent(aContent), mDeselectMenu(aDeselectMenu)
   {
   }
 
-  NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) override
+  NS_IMETHOD HandleEvent(Event* aEvent) override
   {
     mContent->RemoveSystemEventListener(NS_LITERAL_STRING("transitionend"), this, false);
 
     nsMenuPopupFrame* popupFrame = do_QueryFrame(mContent->GetPrimaryFrame());
 
     // Now hide the popup. There could be other properties transitioning, but
     // we'll assume they all end at the same time and just hide the popup upon
     // the first one ending.
@@ -2607,17 +2606,17 @@ nsXULPopupManager::IsValidMenuItem(nsICo
 
   return !(skipNavigatingDisabledMenuItem &&
     aContent->IsElement() &&
     aContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
                                        nsGkAtoms::_true, eCaseMatters));
 }
 
 nsresult
-nsXULPopupManager::HandleEvent(nsIDOMEvent* aEvent)
+nsXULPopupManager::HandleEvent(Event* aEvent)
 {
   RefPtr<KeyboardEvent> keyEvent =
     aEvent->InternalDOMEvent()->AsKeyboardEvent();
   NS_ENSURE_TRUE(keyEvent, NS_ERROR_UNEXPECTED);
 
   //handlers shouldn't be triggered by non-trusted events.
   if (!keyEvent->IsTrusted()) {
     return NS_OK;
--- a/layout/xul/nsXULTooltipListener.cpp
+++ b/layout/xul/nsXULTooltipListener.cpp
@@ -22,17 +22,17 @@
 #include "nsXULPopupManager.h"
 #endif
 #include "nsIRootBox.h"
 #include "nsIBoxObject.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/dom/Element.h"
-#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
+#include "mozilla/dom/Event.h" // for Event
 #include "mozilla/dom/BoxObject.h"
 #include "mozilla/dom/MouseEvent.h"
 #include "mozilla/TextEvents.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 nsXULTooltipListener* nsXULTooltipListener::sInstance = nullptr;
@@ -219,17 +219,17 @@ nsXULTooltipListener::MouseMove(nsIDOMEv
 
   HideTooltip();
   // set a flag so that the tooltip is only displayed once until the mouse
   // leaves the node
   mTooltipShownOnce = true;
 }
 
 NS_IMETHODIMP
-nsXULTooltipListener::HandleEvent(nsIDOMEvent* aEvent)
+nsXULTooltipListener::HandleEvent(Event* aEvent)
 {
   nsAutoString type;
   aEvent->GetType(type);
   if (type.EqualsLiteral("DOMMouseScroll") ||
       type.EqualsLiteral("mousedown") ||
       type.EqualsLiteral("mouseup") ||
       type.EqualsLiteral("dragstart")) {
     HideTooltip();
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsFormFillController.h"
 
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/dom/Element.h"
-#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
+#include "mozilla/dom/Event.h" // for Event
 #include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/dom/KeyboardEvent.h"
 #include "mozilla/dom/KeyboardEventBinding.h"
 #include "mozilla/dom/MouseEvent.h"
 #include "mozilla/dom/PageTransitionEvent.h"
 #include "mozilla/Logging.h"
 #include "nsIFormAutoComplete.h"
 #include "nsIInputListAutoComplete.h"
@@ -862,17 +862,17 @@ nsFormFillController::OnSearchCompletion
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////
 //// nsIDOMEventListener
 
 NS_IMETHODIMP
-nsFormFillController::HandleEvent(nsIDOMEvent* aEvent)
+nsFormFillController::HandleEvent(Event* aEvent)
 {
   WidgetEvent* internalEvent = aEvent->WidgetEventPtr();
   NS_ENSURE_STATE(internalEvent);
 
   switch (internalEvent->mMessage) {
   case eFocus:
     return Focus(aEvent);
   case eMouseDown:
--- a/widget/tests/TestAppShellSteadyState.cpp
+++ b/widget/tests/TestAppShellSteadyState.cpp
@@ -19,16 +19,17 @@
 #include "nsIWebBrowserChrome.h"
 #include "nsIXULWindow.h"
 
 #include "nsAppShellCID.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsNetUtil.h"
 #include "nsThreadUtils.h"
 #include "mozilla/Attributes.h"
+#include "mozilla/dom/Event.h"
 
 #ifdef XP_WIN
 #include <windows.h>
 #endif
 
 using namespace mozilla;
 
 typedef void (*TestFunc)(nsIAppShell*);
@@ -171,17 +172,17 @@ class EventListener final : public nsIDO
 public:
   NS_DECL_ISUPPORTS
 
   explicit EventListener(nsIAppShell* aAppShell)
   : mAppShell(aAppShell)
   { }
 
   NS_IMETHOD
-  HandleEvent(nsIDOMEvent* aEvent) override
+  HandleEvent(dom::Event* aEvent) override
   {
     nsString type;
     if (NS_FAILED(aEvent->GetType(type))) {
       fail("Failed to get event type");
       return NS_ERROR_FAILURE;
     }
 
     if (type.EqualsLiteral("load")) {