Bug 1455052 part 8. Stop using nsIDOMEvent in docshell and dom. r=masayuki
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 20 Apr 2018 12:55:30 -0400
changeset 470857 b35aad989a131db1435b0254724f31db025a0e7a
parent 470856 f1ec3420bc84b682259c719846a2a998cb935f8f
child 470858 43abd16157caaffe8f9166be815c09aef8f4b42e
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1455052
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1455052 part 8. Stop using nsIDOMEvent in docshell and dom. r=masayuki MozReview-Commit-ID: ASkuyN3xSwB
docshell/base/nsDocShellTreeOwner.cpp
docshell/base/nsDocShellTreeOwner.h
dom/base/CharacterData.cpp
dom/base/Element.cpp
dom/base/FragmentOrElement.cpp
dom/base/nsContentAreaDragDrop.cpp
dom/base/nsContentUtils.cpp
dom/base/nsContentUtils.h
dom/base/nsGlobalWindowInner.cpp
dom/base/nsGlobalWindowOuter.cpp
dom/base/nsIDroppedLinkHandler.idl
dom/base/nsINode.cpp
dom/base/nsScreen.cpp
dom/base/nsWindowRoot.h
dom/canvas/WebGLContext.cpp
dom/canvas/WebGLContextUtils.cpp
dom/events/DOMEventTargetHelper.cpp
dom/events/DOMEventTargetHelper.h
dom/events/Event.cpp
dom/events/Event.h
dom/events/PaintRequest.h
dom/events/XULCommandEvent.h
dom/events/test/test_bug617528.xul
dom/gamepad/GamepadManager.cpp
dom/html/HTMLButtonElement.cpp
dom/html/HTMLInputElement.cpp
dom/html/HTMLLinkElement.cpp
dom/html/nsGenericHTMLElement.cpp
dom/interfaces/base/nsIDOMChromeWindow.idl
dom/ipc/TabParent.cpp
dom/media/TextTrackList.cpp
dom/media/TextTrackList.h
dom/media/imagecapture/ImageCapture.cpp
dom/offline/nsDOMOfflineResourceList.cpp
dom/serviceworkers/ServiceWorkerEvents.cpp
dom/serviceworkers/ServiceWorkerEvents.h
dom/webidl/MessageEvent.webidl
dom/workers/SharedWorker.cpp
dom/xbl/nsXBLPrototypeHandler.h
dom/xul/nsXULElement.cpp
dom/xul/nsXULElement.h
--- a/docshell/base/nsDocShellTreeOwner.cpp
+++ b/docshell/base/nsDocShellTreeOwner.cpp
@@ -1172,19 +1172,19 @@ ChromeTooltipListener::HandleEvent(Event
 
   NS_ERROR("Unexpected event type");
   return NS_OK;
 }
 
 // If we're a tooltip, fire off a timer to see if a tooltip should be shown. If
 // the timer fires, we cache the node in |mPossibleTooltipNode|.
 nsresult
-ChromeTooltipListener::MouseMove(nsIDOMEvent* aMouseEvent)
+ChromeTooltipListener::MouseMove(Event* aMouseEvent)
 {
-  MouseEvent* mouseEvent = aMouseEvent->InternalDOMEvent()->AsMouseEvent();
+  MouseEvent* mouseEvent = aMouseEvent->AsMouseEvent();
   if (!mouseEvent) {
     return NS_OK;
   }
 
   // stash the coordinates of the event so that we can still get back to it from
   // within the timer callback. On win32, we'll get a MouseMove event even when
   // a popup goes away -- even when the mouse doesn't change position! To get
   // around this, we make sure the mouse has really moved before proceeding.
@@ -1208,18 +1208,17 @@ ChromeTooltipListener::MouseMove(nsIDOME
 
   if (mTooltipTimer) {
     mTooltipTimer->Cancel();
   }
 
   if (!mShowingTooltip && !mTooltipShownOnce) {
     nsIEventTarget* target = nullptr;
 
-    nsCOMPtr<EventTarget> eventTarget =
-      aMouseEvent->InternalDOMEvent()->GetTarget();
+    nsCOMPtr<EventTarget> eventTarget = aMouseEvent->GetTarget();
     if (eventTarget) {
       mPossibleTooltipNode = do_QueryInterface(eventTarget);
       nsCOMPtr<nsIGlobalObject> global(eventTarget->GetOwnerGlobal());
       if (global) {
         target = global->EventTargetFor(TaskCategory::UI);
       }
     }
 
--- a/docshell/base/nsDocShellTreeOwner.h
+++ b/docshell/base/nsDocShellTreeOwner.h
@@ -26,16 +26,17 @@
 #include "nsIAuthPrompt.h"
 #include "nsITooltipListener.h"
 #include "nsITooltipTextProvider.h"
 #include "nsCTooltipTextProvider.h"
 #include "nsIDroppedLinkHandler.h"
 
 namespace mozilla {
 namespace dom {
+class Event;
 class EventTarget;
 } // namespace dom
 } // namespace mozilla
 
 class nsWebBrowser;
 class ChromeTooltipListener;
 
 // {6D10C180-6888-11d4-952B-0020183BF181}
@@ -137,17 +138,17 @@ protected:
   virtual ~ChromeTooltipListener();
 
 public:
   NS_DECL_ISUPPORTS
 
   ChromeTooltipListener(nsWebBrowser* aInBrowser, nsIWebBrowserChrome* aInChrome);
 
   NS_DECL_NSIDOMEVENTLISTENER
-  NS_IMETHOD MouseMove(nsIDOMEvent* aMouseEvent);
+  NS_IMETHOD MouseMove(mozilla::dom::Event* aMouseEvent);
 
   // Add/remove the relevant listeners, based on what interfaces the embedding
   // chrome implements.
   NS_IMETHOD AddChromeListeners();
   NS_IMETHOD RemoveChromeListeners();
 
 private:
   // various delays for tooltips
--- a/dom/base/CharacterData.cpp
+++ b/dom/base/CharacterData.cpp
@@ -18,17 +18,16 @@
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/HTMLSlotElement.h"
 #include "mozilla/dom/ShadowRoot.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
 #include "nsReadableUtils.h"
 #include "mozilla/InternalMutationEvent.h"
 #include "nsIURI.h"
-#include "nsIDOMEvent.h"
 #include "nsCOMPtr.h"
 #include "nsDOMString.h"
 #include "nsChangeHint.h"
 #include "nsCOMArray.h"
 #include "nsNodeUtils.h"
 #include "mozilla/dom/DirectionalityUtils.h"
 #include "nsBindingManager.h"
 #include "nsCCUncollectableMarker.h"
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -36,17 +36,16 @@
 #include "nsIURL.h"
 #include "nsContainerFrame.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsIPresShell.h"
 #include "nsPresContext.h"
 #include "nsStyleConsts.h"
 #include "nsString.h"
 #include "nsUnicharUtils.h"
-#include "nsIDOMEvent.h"
 #include "nsDOMCID.h"
 #include "nsIServiceManager.h"
 #include "nsDOMCSSAttrDeclaration.h"
 #include "nsNameSpaceManager.h"
 #include "nsContentList.h"
 #include "nsVariant.h"
 #include "nsDOMTokenList.h"
 #include "nsXBLPrototypeBinding.h"
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -43,17 +43,16 @@
 #include "nsNetUtil.h"
 #include "nsIFrame.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsIPresShell.h"
 #include "nsPresContext.h"
 #include "nsStyleConsts.h"
 #include "nsString.h"
 #include "nsUnicharUtils.h"
-#include "nsIDOMEvent.h"
 #include "nsDOMCID.h"
 #include "nsIServiceManager.h"
 #include "nsDOMCSSAttrDeclaration.h"
 #include "nsNameSpaceManager.h"
 #include "nsContentList.h"
 #include "nsDOMTokenList.h"
 #include "nsXBLPrototypeBinding.h"
 #include "nsError.h"
--- a/dom/base/nsContentAreaDragDrop.cpp
+++ b/dom/base/nsContentAreaDragDrop.cpp
@@ -13,17 +13,16 @@
 #include "nsString.h"
 
 // Interfaces needed to be included
 #include "nsCopySupport.h"
 #include "nsISelection.h"
 #include "nsISelectionController.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
-#include "nsIDOMEvent.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMRange.h"
 #include "nsIFormControl.h"
 #include "nsITransferable.h"
 #include "nsComponentManagerUtils.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 #include "nsServiceManagerUtils.h"
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -6517,17 +6517,17 @@ bool
 nsContentUtils::CanAccessNativeAnon()
 {
   return LegacyIsCallerChromeOrNativeCode() || IsCallerContentXBL();
 }
 
 /* static */ nsresult
 nsContentUtils::DispatchXULCommand(nsIContent* aTarget,
                                    bool aTrusted,
-                                   nsIDOMEvent* aSourceEvent,
+                                   Event* aSourceEvent,
                                    nsIPresShell* aShell,
                                    bool aCtrl,
                                    bool aAlt,
                                    bool aShift,
                                    bool aMeta,
                                    uint16_t aInputSource)
 {
   NS_ENSURE_STATE(aTarget);
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -65,17 +65,16 @@ class nsAtom;
 class nsIChannel;
 class nsIConsoleService;
 class nsIContent;
 class nsIContentPolicy;
 class nsIContentSecurityPolicy;
 class nsIDocShellTreeItem;
 class nsIDocumentLoaderFactory;
 class nsIDOMDocument;
-class nsIDOMEvent;
 class nsIDOMNode;
 class nsIDragSession;
 class nsIEventTarget;
 class nsIFragmentContentSink;
 class nsIFrame;
 class nsIImageLoadingContent;
 class nsIInterfaceRequestor;
 class nsIIOService;
@@ -126,16 +125,17 @@ class ErrorResult;
 class EventListenerManager;
 class HTMLEditor;
 
 namespace dom {
 class ChromeMessageBroadcaster;
 struct CustomElementDefinition;
 class DocumentFragment;
 class Element;
+class Event;
 class EventTarget;
 class HTMLInputElement;
 class IPCDataTransfer;
 class IPCDataTransferItem;
 struct LifecycleCallbackArgs;
 struct LifecycleAdoptedCallbackArgs;
 class NodeInfo;
 class nsIContentChild;
@@ -2099,17 +2099,17 @@ public:
   /**
    * This method creates and dispatches "command" event, which implements
    * XULCommandEvent.
    * If aShell is not null, dispatching goes via
    * nsIPresShell::HandleDOMEventWithTarget.
    */
   static nsresult DispatchXULCommand(nsIContent* aTarget,
                                      bool aTrusted,
-                                     nsIDOMEvent* aSourceEvent = nullptr,
+                                     mozilla::dom::Event* aSourceEvent = nullptr,
                                      nsIPresShell* aShell = nullptr,
                                      bool aCtrl = false,
                                      bool aAlt = false,
                                      bool aShift = false,
                                      bool aMeta = false,
                                      // Including MouseEventBinding here leads
                                      // to incude loops, unfortunately.
                                      uint16_t inputSource = 0 /* MouseEventBinding::MOZ_SOURCE_UNKNOWN */);
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -107,17 +107,16 @@
 #include "nsIBaseWindow.h"
 #include "nsIDeviceSensors.h"
 #include "nsIContent.h"
 #include "nsIDocShell.h"
 #include "nsIDocument.h"
 #include "Crypto.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMElement.h"
-#include "nsIDOMEvent.h"
 #include "nsIDOMOfflineResourceList.h"
 #include "nsDOMString.h"
 #include "nsIEmbeddingSiteWindow.h"
 #include "nsThreadUtils.h"
 #include "nsILoadContext.h"
 #include "nsIPresShell.h"
 #include "nsIScrollableFrame.h"
 #include "nsView.h"
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -104,17 +104,16 @@
 #include "nsIBaseWindow.h"
 #include "nsIDeviceSensors.h"
 #include "nsIContent.h"
 #include "nsIDocShell.h"
 #include "nsIDocument.h"
 #include "Crypto.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMElement.h"
-#include "nsIDOMEvent.h"
 #include "nsIDOMOfflineResourceList.h"
 #include "nsDOMString.h"
 #include "nsIEmbeddingSiteWindow.h"
 #include "nsThreadUtils.h"
 #include "nsILoadContext.h"
 #include "nsIPresShell.h"
 #include "nsIScrollableFrame.h"
 #include "nsView.h"
--- a/dom/base/nsIDroppedLinkHandler.idl
+++ b/dom/base/nsIDroppedLinkHandler.idl
@@ -1,17 +1,15 @@
 /* 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 "nsISupports.idl"
 #include "nsIPrincipal.idl"
 
-interface nsIDOMEvent;
-
 webidl DragEvent;
 webidl DataTransfer;
 
 [scriptable, uuid(69E14F91-2E09-4CA6-A511-A715C99A2804)]
 interface nsIDroppedLinkItem : nsISupports
 {
   /**
    * Returns the URL of the link.
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -56,17 +56,16 @@
 #include "nsIAnonymousContentCreator.h"
 #include "nsAtom.h"
 #include "nsIBaseWindow.h"
 #include "nsICategoryManager.h"
 #include "nsIContentIterator.h"
 #include "nsIControllers.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
-#include "nsIDOMEvent.h"
 #include "nsIDOMEventListener.h"
 #include "nsIDOMNodeList.h"
 #include "nsILinkHandler.h"
 #include "mozilla/dom/NodeInfo.h"
 #include "mozilla/dom/NodeInfoInlines.h"
 #include "nsIPresShell.h"
 #include "nsIScriptError.h"
 #include "nsIScriptGlobalObject.h"
--- a/dom/base/nsScreen.cpp
+++ b/dom/base/nsScreen.cpp
@@ -1,15 +1,14 @@
 /* -*- 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/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
 #include "mozilla/dom/ScreenBinding.h"
 #include "nsContentUtils.h"
 #include "nsScreen.h"
 #include "nsIDocument.h"
 #include "nsIDocShell.h"
 #include "nsIDocument.h"
 #include "nsPresContext.h"
 #include "nsCOMPtr.h"
--- a/dom/base/nsWindowRoot.h
+++ b/dom/base/nsWindowRoot.h
@@ -2,17 +2,16 @@
 /* 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/. */
 
 #ifndef nsWindowRoot_h__
 #define nsWindowRoot_h__
 
-class nsIDOMEvent;
 class nsIGlobalObject;
 
 #include "mozilla/Attributes.h"
 #include "mozilla/EventListenerManager.h"
 #include "nsIWeakReferenceUtils.h"
 #include "nsPIWindowRoot.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsTHashtable.h"
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -35,17 +35,16 @@
 #include "mozilla/ScopeExit.h"
 #include "mozilla/Services.h"
 #include "mozilla/Telemetry.h"
 #include "nsContentUtils.h"
 #include "nsDisplayList.h"
 #include "nsError.h"
 #include "nsIClassInfoImpl.h"
 #include "nsIConsoleService.h"
-#include "nsIDOMEvent.h"
 #include "nsIGfxInfo.h"
 #include "nsIObserverService.h"
 #include "nsIVariant.h"
 #include "nsIWidget.h"
 #include "nsIXPConnect.h"
 #include "nsServiceManagerUtils.h"
 #include "SVGObserverUtils.h"
 #include "prenv.h"
--- a/dom/canvas/WebGLContextUtils.cpp
+++ b/dom/canvas/WebGLContextUtils.cpp
@@ -7,17 +7,16 @@
 #include "WebGLContext.h"
 
 #include "GLContext.h"
 #include "jsapi.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/gfx/Logging.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Sprintf.h"
-#include "nsIDOMEvent.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIVariant.h"
 #include "nsPrintfCString.h"
 #include "nsServiceManagerUtils.h"
 #include <stdarg.h>
 #include "WebGLBuffer.h"
 #include "WebGLExtensions.h"
 #include "WebGLFramebuffer.h"
--- a/dom/events/DOMEventTargetHelper.cpp
+++ b/dom/events/DOMEventTargetHelper.cpp
@@ -3,16 +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 "nsContentUtils.h"
 #include "nsIDocument.h"
 #include "mozilla/Sprintf.h"
 #include "nsGlobalWindow.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/DOMEventTargetHelper.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/Likely.h"
 
 namespace mozilla {
 
@@ -194,22 +195,22 @@ DOMEventTargetHelper::DispatchTrustedEve
 {
   RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
   event->InitEvent(aEventName, false, false);
 
   return DispatchTrustedEvent(event);
 }
 
 nsresult
-DOMEventTargetHelper::DispatchTrustedEvent(nsIDOMEvent* event)
+DOMEventTargetHelper::DispatchTrustedEvent(Event* event)
 {
   event->SetTrusted(true);
 
   ErrorResult rv;
-  DispatchEvent(*event->InternalDOMEvent(), rv);
+  DispatchEvent(*event, rv);
   return rv.StealNSResult();
 }
 
 void
 DOMEventTargetHelper::GetEventTargetParent(EventChainPreVisitor& aVisitor)
 {
   aVisitor.mCanHandle = true;
   aVisitor.SetParentTarget(nullptr, false);
--- a/dom/events/DOMEventTargetHelper.h
+++ b/dom/events/DOMEventTargetHelper.h
@@ -21,16 +21,20 @@
 
 struct JSCompartment;
 class nsIDocument;
 
 namespace mozilla {
 
 class ErrorResult;
 
+namespace dom {
+class Event;
+} // namespace dom
+
 #define NS_DOMEVENTTARGETHELPER_IID \
 { 0xa28385c6, 0x9451, 0x4d7e, \
   { 0xa3, 0xdd, 0xf4, 0xb6, 0x87, 0x2f, 0xa4, 0x76 } }
 
 class DOMEventTargetHelper : public dom::EventTarget
 {
 public:
   DOMEventTargetHelper()
@@ -195,17 +199,17 @@ protected:
   // NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN macro.
   virtual bool IsCertainlyAliveForCC() const
   {
     return mIsKeptAlive;
   }
 
   RefPtr<EventListenerManager> mListenerManager;
   // Make |event| trusted and dispatch |aEvent| to |this|.
-  nsresult DispatchTrustedEvent(nsIDOMEvent* aEvent);
+  nsresult DispatchTrustedEvent(dom::Event* aEvent);
 
   virtual void LastRelease() {}
 
   void KeepAliveIfHasListenersFor(const nsAString& aType);
   void KeepAliveIfHasListenersFor(nsAtom* aType);
 
   void IgnoreKeepAliveIfHasListenersFor(const nsAString& aType);
   void IgnoreKeepAliveIfHasListenersFor(nsAtom* aType);
--- a/dom/events/Event.cpp
+++ b/dom/events/Event.cpp
@@ -365,25 +365,25 @@ Event::Constructor(EventTarget* aEventTa
 uint16_t
 Event::EventPhase() const
 {
   // Note, remember to check that this works also
   // if or when Bug 235441 is fixed.
   if ((mEvent->mCurrentTarget &&
        mEvent->mCurrentTarget == mEvent->mTarget) ||
        mEvent->mFlags.InTargetPhase()) {
-    return nsIDOMEvent::AT_TARGET;
+    return EventBinding::AT_TARGET;
   }
   if (mEvent->mFlags.mInCapturePhase) {
-    return nsIDOMEvent::CAPTURING_PHASE;
+    return EventBinding::CAPTURING_PHASE;
   }
   if (mEvent->mFlags.mInBubblingPhase) {
-    return nsIDOMEvent::BUBBLING_PHASE;
+    return EventBinding::BUBBLING_PHASE;
   }
-  return nsIDOMEvent::NONE;
+  return EventBinding::NONE;
 }
 
 NS_IMETHODIMP
 Event::GetEventPhase(uint16_t* aEventPhase)
 {
   *aEventPhase = EventPhase();
   return NS_OK;
 }
--- a/dom/events/Event.h
+++ b/dom/events/Event.h
@@ -59,34 +59,16 @@ protected:
   virtual ~Event();
 
 private:
   void ConstructorInit(EventTarget* aOwner,
                        nsPresContext* aPresContext,
                        WidgetEvent* aEvent);
 
 public:
-  static Event* FromSupports(nsISupports* aSupports)
-  {
-    nsIDOMEvent* event =
-      static_cast<nsIDOMEvent*>(aSupports);
-#ifdef DEBUG
-    {
-      nsCOMPtr<nsIDOMEvent> target_qi =
-        do_QueryInterface(aSupports);
-
-      // If this assertion fires the QI implementation for the object in
-      // question doesn't use the nsIDOMEvent pointer as the
-      // nsISupports pointer. That must be fixed, or we'll crash...
-      MOZ_ASSERT(target_qi == event, "Uh, fix QI!");
-    }
-#endif
-    return static_cast<Event*>(event);
-  }
-
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Event)
 
   nsIGlobalObject* GetParentObject()
   {
     return mOwner;
   }
 
@@ -352,24 +334,24 @@ protected:
 /**
  * RAII helper-class to override an event's message (i.e. its DOM-exposed
  * type), for as long as the object is alive.  Restores the original
  * EventMessage when destructed.
  *
  * Notable requirements:
  *  - The original & overriding messages must be known (not eUnidentifiedEvent).
  *  - The original & overriding messages must be different.
- *  - The passed-in nsIDOMEvent must outlive this RAII helper.
+ *  - The passed-in Event must outlive this RAII helper.
  */
 class MOZ_RAII EventMessageAutoOverride
 {
 public:
-  explicit EventMessageAutoOverride(nsIDOMEvent* aEvent,
+  explicit EventMessageAutoOverride(Event* aEvent,
                                     EventMessage aOverridingMessage)
-    : mEvent(aEvent->InternalDOMEvent()),
+    : mEvent(aEvent),
       mOrigMessage(mEvent->mEvent->mMessage)
   {
     MOZ_ASSERT(aOverridingMessage != mOrigMessage,
                "Don't use this class if you're not actually overriding");
     MOZ_ASSERT(aOverridingMessage != eUnidentifiedEvent,
                "Only use this class with a valid overriding EventMessage");
     MOZ_ASSERT(mOrigMessage != eUnidentifiedEvent &&
                mEvent->mEvent->mSpecifiedEventTypeString.IsEmpty(),
@@ -389,18 +371,18 @@ protected:
   // with limited lifetime. Whoever creates us should keep mEvent alive.
   Event* const MOZ_NON_OWNING_REF mEvent;
   const EventMessage mOrigMessage;
 };
 
 class MOZ_STACK_CLASS WantsPopupControlCheck
 {
 public:
-  explicit WantsPopupControlCheck(nsIDOMEvent* aEvent) :
-    mEvent(aEvent->InternalDOMEvent())
+  explicit WantsPopupControlCheck(Event* aEvent) :
+    mEvent(aEvent)
   {
     mOriginalWantsPopupControlCheck = mEvent->GetWantsPopupControlCheck();
     mEvent->SetWantsPopupControlCheck(mEvent->IsTrusted());
   }
 
   ~WantsPopupControlCheck()
   {
     mEvent->SetWantsPopupControlCheck(mOriginalWantsPopupControlCheck);
--- a/dom/events/PaintRequest.h
+++ b/dom/events/PaintRequest.h
@@ -3,65 +3,66 @@
 /* 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/. */
 
 #ifndef mozilla_dom_PaintRequest_h_
 #define mozilla_dom_PaintRequest_h_
 
 #include "nsPresContext.h"
-#include "nsIDOMEvent.h"
 #include "mozilla/Attributes.h"
+#include "mozilla/RefPtr.h"
+#include "mozilla/dom/Event.h"
 #include "nsWrapperCache.h"
 
 namespace mozilla {
 namespace dom {
 
 class DOMRect;
 
 class PaintRequest final : public nsISupports
                          , public nsWrapperCache
 {
 public:
-  explicit PaintRequest(nsIDOMEvent* aParent)
+  explicit PaintRequest(Event* aParent)
     : mParent(aParent)
   {
   }
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PaintRequest)
 
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
-  nsIDOMEvent* GetParentObject() const
+  Event* GetParentObject() const
   {
     return mParent;
   }
 
   already_AddRefed<DOMRect> ClientRect();
   void GetReason(nsAString& aResult) const
   {
     aResult.AssignLiteral("repaint");
   }
 
   void SetRequest(const nsRect& aRequest)
   { mRequest = aRequest; }
 
 private:
   ~PaintRequest() {}
 
-  nsCOMPtr<nsIDOMEvent> mParent;
+  RefPtr<Event> mParent;
   nsRect mRequest;
 };
 
 class PaintRequestList final : public nsISupports,
                                public nsWrapperCache
 {
 public:
-  explicit PaintRequestList(nsIDOMEvent *aParent) : mParent(aParent)
+  explicit PaintRequestList(Event *aParent) : mParent(aParent)
   {
   }
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PaintRequestList)
 
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
   nsISupports* GetParentObject()
@@ -91,15 +92,15 @@ public:
     }
     return mArray.ElementAt(aIndex);
   }
 
 private:
   ~PaintRequestList() {}
 
   nsTArray< RefPtr<PaintRequest> > mArray;
-  nsCOMPtr<nsIDOMEvent> mParent;
+  RefPtr<Event> mParent;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_PaintRequest_h_
--- a/dom/events/XULCommandEvent.h
+++ b/dom/events/XULCommandEvent.h
@@ -4,16 +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/. */
 
 // This class implements a XUL "command" event.  See XULCommandEvent.webidl
 
 #ifndef mozilla_dom_XULCommandEvent_h_
 #define mozilla_dom_XULCommandEvent_h_
 
+#include "mozilla/RefPtr.h"
 #include "mozilla/dom/UIEvent.h"
 #include "mozilla/dom/XULCommandEventBinding.h"
 
 namespace mozilla {
 namespace dom {
 
 class XULCommandEvent : public UIEvent
 {
@@ -38,35 +39,34 @@ public:
   bool AltKey();
   bool CtrlKey();
   bool ShiftKey();
   bool MetaKey();
   uint16_t InputSource();
 
   already_AddRefed<Event> GetSourceEvent()
   {
-    RefPtr<Event> e =
-      mSourceEvent ? mSourceEvent->InternalDOMEvent() : nullptr;
+    RefPtr<Event> e = mSourceEvent;
     return e.forget();
   }
 
   void InitCommandEvent(const nsAString& aType,
                         bool aCanBubble, bool aCancelable,
                         nsGlobalWindowInner* aView,
                         int32_t aDetail,
                         bool aCtrlKey, bool aAltKey,
                         bool aShiftKey, bool aMetaKey,
                         Event* aSourceEvent,
                         uint16_t aInputSource,
                         ErrorResult& aRv);
 
 protected:
   ~XULCommandEvent() {}
 
-  nsCOMPtr<nsIDOMEvent> mSourceEvent;
+  RefPtr<Event> mSourceEvent;
   uint16_t mInputSource;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 already_AddRefed<mozilla::dom::XULCommandEvent>
 NS_NewDOMXULCommandEvent(mozilla::dom::EventTarget* aOwner,
--- a/dom/events/test/test_bug617528.xul
+++ b/dom/events/test/test_bug617528.xul
@@ -76,17 +76,17 @@ https://bugzilla.mozilla.org/show_bug.cg
       var wu = win.QueryInterface(Ci.nsIInterfaceRequestor)
         .getInterface(Ci.nsIDOMWindowUtils);
 
       browser.addEventListener("contextmenu", onContextMenu1, false);
       wu.sendMouseEvent("contextmenu", left, top, 2, 1, 0);
       browser.removeEventListener("contextmenu", onContextMenu1, false);
 
       browser.addEventListener("contextmenu", onContextMenu2, false);
-      var shiftMask = Ci.nsIDOMEvent.SHIFT_MASK;
+      var shiftMask = Event.SHIFT_MASK;
       wu.sendMouseEvent("contextmenu", left, top, 2, 1, shiftMask);
       browser.removeEventListener("contextmenu", onContextMenu2, false);
 
       _window.close();
       SimpleTest.finish();
     }
 
     addLoadEvent(start);
--- a/dom/gamepad/GamepadManager.cpp
+++ b/dom/gamepad/GamepadManager.cpp
@@ -17,17 +17,16 @@
 #include "mozilla/ipc/PBackgroundChild.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/StaticPtr.h"
 
 #include "nsAutoPtr.h"
 #include "nsContentUtils.h"
 #include "nsGlobalWindow.h"
-#include "nsIDOMEvent.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMWindow.h"
 #include "nsIObserver.h"
 #include "nsIObserverService.h"
 #include "nsIServiceManager.h"
 #include "nsThreadUtils.h"
 #include "VRManagerChild.h"
 #include "mozilla/Services.h"
--- a/dom/html/HTMLButtonElement.cpp
+++ b/dom/html/HTMLButtonElement.cpp
@@ -13,17 +13,16 @@
 #include "nsGkAtoms.h"
 #include "nsIPresShell.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsIFormControl.h"
 #include "nsIURL.h"
 #include "nsIFrame.h"
 #include "nsIFormControlFrame.h"
-#include "nsIDOMEvent.h"
 #include "nsIDocument.h"
 #include "mozilla/ContentEvents.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventStateManager.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/TextEvents.h"
 #include "nsUnicharUtils.h"
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -50,17 +50,16 @@
 #include "nsIServiceManager.h"
 #include "nsError.h"
 #include "nsIEditor.h"
 #include "nsDocument.h"
 #include "nsAttrValueOrString.h"
 #include "nsDateTimeControlFrame.h"
 
 #include "mozilla/PresState.h"
-#include "nsIDOMEvent.h"
 #include "nsIDOMNodeList.h"
 #include "nsLinebreakConverter.h" //to strip out carriage returns
 #include "nsReadableUtils.h"
 #include "nsUnicharUtils.h"
 #include "nsLayoutUtils.h"
 #include "nsVariant.h"
 
 #include "mozilla/ContentEvents.h"
--- a/dom/html/HTMLLinkElement.cpp
+++ b/dom/html/HTMLLinkElement.cpp
@@ -14,17 +14,16 @@
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/HTMLLinkElementBinding.h"
 #include "nsContentUtils.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsDOMTokenList.h"
 #include "nsIContentInlines.h"
 #include "nsIDocument.h"
-#include "nsIDOMEvent.h"
 #include "nsINode.h"
 #include "nsIStyleSheetLinkingElement.h"
 #include "nsIURL.h"
 #include "nsPIDOMWindow.h"
 #include "nsReadableUtils.h"
 #include "nsStyleConsts.h"
 #include "nsStyleLinkElement.h"
 #include "nsUnicharUtils.h"
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -52,17 +52,16 @@
 #include "nsILayoutHistoryState.h"
 
 #include "nsHTMLParts.h"
 #include "nsContentUtils.h"
 #include "mozilla/dom/DirectionalityUtils.h"
 #include "nsString.h"
 #include "nsUnicharUtils.h"
 #include "nsGkAtoms.h"
-#include "nsIDOMEvent.h"
 #include "nsDOMCSSDeclaration.h"
 #include "nsITextControlFrame.h"
 #include "nsIForm.h"
 #include "nsIFormControl.h"
 #include "mozilla/dom/HTMLFormElement.h"
 #include "nsFocusManager.h"
 #include "nsAttrValueOrString.h"
 
--- a/dom/interfaces/base/nsIDOMChromeWindow.idl
+++ b/dom/interfaces/base/nsIDOMChromeWindow.idl
@@ -2,17 +2,16 @@
 /* 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"
 
 interface nsIBrowserDOMWindow;
 interface nsIDOMElement;
-interface nsIDOMEvent;
 interface mozIDOMWindowProxy;
 
 // Scriptable only so Components.interfaces.nsIDOMChromeWindow works.
 [scriptable, builtinclass, uuid(78bdcb41-1efa-409f-aaba-70842213f80f)]
 interface nsIDOMChromeWindow : nsISupports
 {
   /**
    * browserDOMWindow provides access to yet another layer of
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -2146,17 +2146,17 @@ TabParent::GetClientOffset()
 mozilla::ipc::IPCResult
 TabParent::RecvReplyKeyEvent(const WidgetKeyboardEvent& aEvent)
 {
   NS_ENSURE_TRUE(mFrameElement, IPC_OK());
 
   WidgetKeyboardEvent localEvent(aEvent);
   localEvent.MarkAsHandledInRemoteProcess();
 
-  // Here we convert the WidgetEvent that we received to an nsIDOMEvent
+  // Here we convert the WidgetEvent that we received to an Event
   // to be able to dispatch it to the <browser> element as the target element.
   nsIDocument* doc = mFrameElement->OwnerDoc();
   nsPresContext* presContext = doc->GetPresContext();
   NS_ENSURE_TRUE(presContext, IPC_OK());
 
   AutoHandlingUserInputStatePusher userInpStatePusher(localEvent.IsTrusted(),
                                                       &localEvent, doc);
 
@@ -2202,17 +2202,17 @@ TabParent::RecvAccessKeyNotHandled(const
   //     twice or more for a keyboard event, that must be a bug.  But how to
   //     detect if received event has already been handled?
 
   MOZ_ASSERT(aEvent.mMessage == eKeyPress);
   WidgetKeyboardEvent localEvent(aEvent);
   localEvent.MarkAsHandledInRemoteProcess();
   localEvent.mMessage = eAccessKeyNotFound;
 
-  // Here we convert the WidgetEvent that we received to an nsIDOMEvent
+  // Here we convert the WidgetEvent that we received to an Event
   // to be able to dispatch it to the <browser> element as the target element.
   nsIDocument* doc = mFrameElement->OwnerDoc();
   nsIPresShell* presShell = doc->GetShell();
   NS_ENSURE_TRUE(presShell, IPC_OK());
 
   if (presShell->CanDispatchEvent()) {
     nsPresContext* presContext = presShell->GetPresContext();
     NS_ENSURE_TRUE(presContext, IPC_OK());
--- a/dom/media/TextTrackList.cpp
+++ b/dom/media/TextTrackList.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; 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 "mozilla/dom/TextTrackList.h"
 
 #include "mozilla/DebugOnly.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/TextTrackListBinding.h"
 #include "mozilla/dom/TrackEvent.h"
 #include "nsThreadUtils.h"
 #include "nsGlobalWindow.h"
 #include "mozilla/dom/TextTrackCue.h"
 #include "mozilla/dom/TextTrackManager.h"
 
 namespace mozilla {
@@ -135,48 +136,48 @@ TextTrackList::DidSeek()
   for (uint32_t i = 0; i < mTextTracks.Length(); i++) {
     mTextTracks[i]->SetDirty();
   }
 }
 
 class TrackEventRunner : public Runnable
 {
 public:
-  TrackEventRunner(TextTrackList* aList, nsIDOMEvent* aEvent)
+  TrackEventRunner(TextTrackList* aList, Event* aEvent)
     : Runnable("dom::TrackEventRunner")
     , mList(aList)
     , mEvent(aEvent)
   {}
 
   NS_IMETHOD Run() override
   {
     return mList->DispatchTrackEvent(mEvent);
   }
 
   RefPtr<TextTrackList> mList;
 private:
-  RefPtr<nsIDOMEvent> mEvent;
+  RefPtr<Event> mEvent;
 };
 
 class ChangeEventRunner final : public TrackEventRunner
 {
 public:
-  ChangeEventRunner(TextTrackList* aList, nsIDOMEvent* aEvent)
+  ChangeEventRunner(TextTrackList* aList, Event* aEvent)
     : TrackEventRunner(aList, aEvent)
   {}
 
   NS_IMETHOD Run() override
   {
     mList->mPendingTextTrackChange = false;
     return TrackEventRunner::Run();
   }
 };
 
 nsresult
-TextTrackList::DispatchTrackEvent(nsIDOMEvent* aEvent)
+TextTrackList::DispatchTrackEvent(Event* aEvent)
 {
   return DispatchTrustedEvent(aEvent);
 }
 
 void
 TextTrackList::CreateAndDispatchChangeEvent()
 {
   MOZ_ASSERT(NS_IsMainThread());
--- a/dom/media/TextTrackList.h
+++ b/dom/media/TextTrackList.h
@@ -9,16 +9,17 @@
 
 #include "mozilla/DOMEventTargetHelper.h"
 #include "mozilla/dom/TextTrack.h"
 #include "nsCycleCollectionParticipant.h"
 
 namespace mozilla {
 namespace dom {
 
+class Event;
 class HTMLMediaElement;
 class TextTrackManager;
 class CompareTextTracks;
 class TrackEvent;
 class TrackEventRunner;
 
 class TextTrackList final : public DOMEventTargetHelper
 {
@@ -54,17 +55,17 @@ public:
   void AddTextTrack(TextTrack* aTextTrack, const CompareTextTracks& aCompareTT);
 
   void RemoveTextTrack(TextTrack* aTrack);
   void DidSeek();
 
   HTMLMediaElement* GetMediaElement();
   void SetTextTrackManager(TextTrackManager* aTextTrackManager);
 
-  nsresult DispatchTrackEvent(nsIDOMEvent* aEvent);
+  nsresult DispatchTrackEvent(Event* aEvent);
   void CreateAndDispatchChangeEvent();
   void SetCuesInactive();
 
   bool AreTextTracksLoaded();
   nsTArray<RefPtr<TextTrack>>& GetTextTrackArray();
 
   IMPL_EVENT_HANDLER(change)
   IMPL_EVENT_HANDLER(addtrack)
--- a/dom/media/imagecapture/ImageCapture.cpp
+++ b/dom/media/imagecapture/ImageCapture.cpp
@@ -2,16 +2,17 @@
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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 "ImageCapture.h"
 #include "mozilla/dom/BlobEvent.h"
 #include "mozilla/dom/DOMException.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/dom/ImageCaptureError.h"
 #include "mozilla/dom/ImageCaptureErrorEvent.h"
 #include "mozilla/dom/ImageCaptureErrorEventBinding.h"
 #include "mozilla/dom/VideoStreamTrack.h"
 #include "nsIDocument.h"
 #include "CaptureTask.h"
 #include "MediaEngineSource.h"
@@ -194,17 +195,17 @@ ImageCapture::PostErrorEvent(uint16_t aE
   RefPtr<ImageCaptureError> error =
     new ImageCaptureError(this, aErrorCode, errorMsg);
 
   ImageCaptureErrorEventInit init;
   init.mBubbles = false;
   init.mCancelable = false;
   init.mImageCaptureError = error;
 
-  nsCOMPtr<nsIDOMEvent> event =
+  RefPtr<Event> event =
     ImageCaptureErrorEvent::Constructor(this, NS_LITERAL_STRING("error"), init);
 
   return DispatchTrustedEvent(event);
 }
 
 bool
 ImageCapture::CheckPrincipal()
 {
--- a/dom/offline/nsDOMOfflineResourceList.cpp
+++ b/dom/offline/nsDOMOfflineResourceList.cpp
@@ -1,16 +1,15 @@
 /* -*- 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 "nsDOMOfflineResourceList.h"
-#include "nsIDOMEvent.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsError.h"
 #include "mozilla/dom/DOMStringList.h"
 #include "nsIPrefetchService.h"
 #include "nsCPrefetchService.h"
 #include "nsMemory.h"
 #include "nsNetUtil.h"
 #include "nsNetCID.h"
--- a/dom/serviceworkers/ServiceWorkerEvents.cpp
+++ b/dom/serviceworkers/ServiceWorkerEvents.cpp
@@ -28,16 +28,17 @@
 #include "ServiceWorkerManager.h"
 
 #include "mozilla/ErrorResult.h"
 #include "mozilla/LoadInfo.h"
 #include "mozilla/Move.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/BodyUtil.h"
 #include "mozilla/dom/Client.h"
+#include "mozilla/dom/EventBinding.h"
 #include "mozilla/dom/FetchEventBinding.h"
 #include "mozilla/dom/MessagePort.h"
 #include "mozilla/dom/PromiseNativeHandler.h"
 #include "mozilla/dom/PushEventBinding.h"
 #include "mozilla/dom/PushMessageDataBinding.h"
 #include "mozilla/dom/PushUtil.h"
 #include "mozilla/dom/Request.h"
 #include "mozilla/dom/TypedArray.h"
@@ -797,17 +798,17 @@ RespondWithHandler::CancelRequest(nsresu
   mRequestWasHandled = true;
 }
 
 } // namespace
 
 void
 FetchEvent::RespondWith(JSContext* aCx, Promise& aArg, ErrorResult& aRv)
 {
-  if (EventPhase() == nsIDOMEvent::NONE || mWaitToRespond) {
+  if (EventPhase() == EventBinding::NONE || mWaitToRespond) {
     aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
     return;
   }
 
 
   // Record where respondWith() was called in the script so we can include the
   // information in any error reporting.  We should be guaranteed not to get
   // a file:// string here because service workers require http/https.
--- a/dom/serviceworkers/ServiceWorkerEvents.h
+++ b/dom/serviceworkers/ServiceWorkerEvents.h
@@ -179,17 +179,17 @@ public:
   RespondWith(JSContext* aCx, Promise& aArg, ErrorResult& aRv);
 
   already_AddRefed<Promise>
   ForwardTo(const nsAString& aUrl);
 
   already_AddRefed<Promise>
   Default();
 
-  // Pull in the nsIDOMEvent version of PreventDefault so we don't get
+  // Pull in the Event version of PreventDefault so we don't get
   // shadowing warnings.
   using Event::PreventDefault;
   void
   PreventDefault(JSContext* aCx, CallerType aCallerType) override;
 
   void
   ReportCanceled();
 };
--- a/dom/webidl/MessageEvent.webidl
+++ b/dom/webidl/MessageEvent.webidl
@@ -30,24 +30,24 @@ interface MessageEvent : Event {
    */
   readonly attribute DOMString lastEventId;
 
   /**
    * The window or port which originated this event.
    */
   readonly attribute MessageEventSource? source;
 
-  /**
-   * Initializes this event with the given data, in a manner analogous to
-   * the similarly-named method on the nsIDOMEvent interface, also setting the
-   * data, origin, source, and lastEventId attributes of this appropriately.
-   */
   [Pure, Cached, Frozen]
   readonly attribute sequence<MessagePort> ports;
 
+  /**
+   * Initializes this event with the given data, in a manner analogous to
+   * the similarly-named method on the Event interface, also setting the
+   * data, origin, source, and lastEventId attributes of this appropriately.
+   */
   void initMessageEvent(DOMString type,
                         optional boolean bubbles = false,
                         optional boolean cancelable = false,
                         optional any data = null,
                         optional DOMString origin = "",
                         optional DOMString lastEventId = "",
                         optional MessageEventSource? source = null,
                         optional sequence<MessagePort> ports = []);
--- a/dom/workers/SharedWorker.cpp
+++ b/dom/workers/SharedWorker.cpp
@@ -188,24 +188,24 @@ SharedWorker::WrapObject(JSContext* aCx,
 }
 
 void
 SharedWorker::GetEventTargetParent(EventChainPreVisitor& aVisitor)
 {
   AssertIsOnMainThread();
 
   if (IsFrozen()) {
-    nsCOMPtr<nsIDOMEvent> event = aVisitor.mDOMEvent;
+    RefPtr<Event> event = aVisitor.mDOMEvent;
     if (!event) {
       event = EventDispatcher::CreateEvent(aVisitor.mEvent->mOriginalTarget,
                                            aVisitor.mPresContext,
                                            aVisitor.mEvent, EmptyString());
     }
 
-    QueueEvent(event->InternalDOMEvent());
+    QueueEvent(event);
 
     aVisitor.mCanHandle = false;
     aVisitor.SetParentTarget(nullptr, false);
     return;
   }
 
   DOMEventTargetHelper::GetEventTargetParent(aVisitor);
 }
--- a/dom/xbl/nsXBLPrototypeHandler.h
+++ b/dom/xbl/nsXBLPrototypeHandler.h
@@ -46,17 +46,17 @@ class KeyboardShortcut;
 #define NS_HANDLER_TYPE_XBL_JS              (1 << 0)
 #define NS_HANDLER_TYPE_XBL_COMMAND         (1 << 1)
 #define NS_HANDLER_TYPE_XUL                 (1 << 2)
 #define NS_HANDLER_HAS_ALLOW_UNTRUSTED_ATTR (1 << 4)
 #define NS_HANDLER_ALLOW_UNTRUSTED          (1 << 5)
 #define NS_HANDLER_TYPE_SYSTEM              (1 << 6)
 #define NS_HANDLER_TYPE_PREVENTDEFAULT      (1 << 7)
 
-// XXX Use nsIDOMEvent:: codes?
+// XXX Use EventBinding:: codes?
 #define NS_PHASE_CAPTURING          1
 #define NS_PHASE_TARGET             2
 #define NS_PHASE_BUBBLING           3
 
 // Values of the reserved attribute. When unset, the default value depends on
 // the permissions.default.shortcuts preference.
 enum XBLReservedKey : uint8_t
 {
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -2,17 +2,16 @@
 /* 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 "nsDOMCID.h"
 #include "nsError.h"
 #include "nsDOMString.h"
-#include "nsIDOMEvent.h"
 #include "nsAtom.h"
 #include "nsIBaseWindow.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMEventListener.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMXULCommandDispatcher.h"
 #include "nsIDOMXULSelectCntrlItemEl.h"
@@ -1295,28 +1294,26 @@ nsXULElement::DispatchXULCommand(const E
     nsCOMPtr<nsIDocument> doc = GetUncomposedDoc();
     NS_ENSURE_STATE(doc);
     RefPtr<Element> commandElt = doc->GetElementById(aCommand);
     if (commandElt) {
         // Create a new command event to dispatch to the element
         // pointed to by the command attribute. The new event's
         // sourceEvent will be the original command event that we're
         // handling.
-        nsCOMPtr<nsIDOMEvent> domEvent = aVisitor.mDOMEvent;
+        RefPtr<Event> event = aVisitor.mDOMEvent;
         uint16_t inputSource = MouseEventBinding::MOZ_SOURCE_UNKNOWN;
-        while (domEvent) {
-            Event* event = domEvent->InternalDOMEvent();
-            NS_ENSURE_STATE(!SameCOMIdentity(event->GetOriginalTarget(),
-                                             commandElt));
+        while (event) {
+            NS_ENSURE_STATE(event->GetOriginalTarget() != commandElt);
             RefPtr<XULCommandEvent> commandEvent = event->AsXULCommandEvent();
             if (commandEvent) {
-                domEvent = commandEvent->GetSourceEvent();
+                event = commandEvent->GetSourceEvent();
                 inputSource = commandEvent->InputSource();
             } else {
-                domEvent = nullptr;
+                event = nullptr;
             }
         }
         WidgetInputEvent* orig = aVisitor.mEvent->AsInputEvent();
         nsContentUtils::DispatchXULCommand(
           commandElt,
           orig->IsTrusted(),
           aVisitor.mDOMEvent,
           nullptr,
--- a/dom/xul/nsXULElement.h
+++ b/dom/xul/nsXULElement.h
@@ -9,17 +9,16 @@
 
 */
 
 #ifndef nsXULElement_h__
 #define nsXULElement_h__
 
 #include "js/TracingAPI.h"
 #include "mozilla/Attributes.h"
-#include "nsIDOMEvent.h"
 #include "nsIServiceManager.h"
 #include "nsAtom.h"
 #include "mozilla/dom/NodeInfo.h"
 #include "nsIControllers.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMXULMultSelectCntrlEl.h"
 #include "nsIURI.h"
 #include "nsLayoutCID.h"