Bug 1455052 part 4. Stop using nsIDOMEvent in xpidl interfaces. r=masayuki
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 20 Apr 2018 12:53:17 -0400
changeset 414772 59a88dd967299117a72c3f8f8ca2bcfe17a99b4b
parent 414771 7f2bdd520f535fa9286aedaabf1f42cea8a4851a
child 414773 6e5bf7b5264b8d79c221704ba50d1ada5bd0bbc4
push id33876
push userdluca@mozilla.com
push dateFri, 20 Apr 2018 23:00:46 +0000
treeherdermozilla-central@39ccabfd7d07 [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 4. Stop using nsIDOMEvent in xpidl interfaces. r=masayuki MozReview-Commit-ID: GIs8DVfduKe
dom/base/TextInputProcessor.cpp
dom/base/nsDOMWindowUtils.cpp
dom/interfaces/base/nsIDOMWindowUtils.idl
dom/interfaces/base/nsITextInputProcessor.idl
toolkit/components/autocomplete/nsAutoCompleteController.cpp
toolkit/components/autocomplete/nsAutoCompleteController.h
toolkit/components/autocomplete/nsIAutoCompleteController.idl
toolkit/components/autocomplete/nsIAutoCompleteInput.idl
toolkit/components/satchel/nsFormFillController.cpp
--- a/dom/base/TextInputProcessor.cpp
+++ b/dom/base/TextInputProcessor.cpp
@@ -13,16 +13,17 @@
 #include "mozilla/widget/IMEData.h"
 #include "mozilla/dom/KeyboardEvent.h"
 #include "nsContentUtils.h"
 #include "nsIDocShell.h"
 #include "nsIWidget.h"
 #include "nsPIDOMWindow.h"
 #include "nsPresContext.h"
 
+using mozilla::dom::Event;
 using mozilla::dom::KeyboardEvent;
 using namespace mozilla::widget;
 
 namespace mozilla {
 
 /******************************************************************************
  * TextInputProcessorNotification
  ******************************************************************************/
@@ -598,28 +599,28 @@ TextInputProcessor::PrepareKeyboardEvent
   if (NS_WARN_IF(!IsValidEventTypeForComposition(*aKeyboardEvent))) {
     return NS_ERROR_INVALID_ARG;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TextInputProcessor::StartComposition(nsIDOMEvent* aDOMKeyEvent,
+TextInputProcessor::StartComposition(Event* aDOMKeyEvent,
                                      uint32_t aKeyFlags,
                                      uint8_t aOptionalArgc,
                                      bool* aSucceeded)
 {
   MOZ_RELEASE_ASSERT(aSucceeded, "aSucceeded must not be nullptr");
   MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
   *aSucceeded = false;
 
   RefPtr<KeyboardEvent> keyEvent;
   if (aDOMKeyEvent) {
-    keyEvent = aDOMKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
+    keyEvent = aDOMKeyEvent->AsKeyboardEvent();
     if (NS_WARN_IF(!keyEvent)) {
       return NS_ERROR_INVALID_ARG;
     }
   }
 
   RefPtr<TextEventDispatcher> kungFuDeathGrip(mDispatcher);
 
   WidgetKeyboardEvent* keyboardEvent;
@@ -696,17 +697,17 @@ TextInputProcessor::SetCaretInPendingCom
   nsresult rv = IsValidStateForComposition();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   return kungFuDeathGrip->SetCaretInPendingComposition(aOffset, 0);
 }
 
 NS_IMETHODIMP
-TextInputProcessor::FlushPendingComposition(nsIDOMEvent* aDOMKeyEvent,
+TextInputProcessor::FlushPendingComposition(Event* aDOMKeyEvent,
                                             uint32_t aKeyFlags,
                                             uint8_t aOptionalArgc,
                                             bool* aSucceeded)
 {
   MOZ_RELEASE_ASSERT(aSucceeded, "aSucceeded must not be nullptr");
   MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
 
   // Even if this doesn't flush pending composition actually, we need to reset
@@ -714,17 +715,17 @@ TextInputProcessor::FlushPendingComposit
   AutoPendingCompositionResetter resetter(this);
 
   *aSucceeded = false;
   RefPtr<TextEventDispatcher> kungFuDeathGrip(mDispatcher);
   bool wasComposing = IsComposing();
 
   RefPtr<KeyboardEvent> keyEvent;
   if (aDOMKeyEvent) {
-    keyEvent = aDOMKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
+    keyEvent = aDOMKeyEvent->AsKeyboardEvent();
     if (NS_WARN_IF(!keyEvent)) {
       return NS_ERROR_INVALID_ARG;
     }
   }
 
   WidgetKeyboardEvent* keyboardEvent;
   nsresult rv =
     PrepareKeyboardEventForComposition(keyEvent, aKeyFlags, aOptionalArgc,
@@ -756,25 +757,25 @@ TextInputProcessor::FlushPendingComposit
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TextInputProcessor::CommitComposition(nsIDOMEvent* aDOMKeyEvent,
+TextInputProcessor::CommitComposition(Event* aDOMKeyEvent,
                                       uint32_t aKeyFlags,
                                       uint8_t aOptionalArgc)
 {
   MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
 
   RefPtr<KeyboardEvent> keyEvent;
   if (aDOMKeyEvent) {
-    keyEvent = aDOMKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
+    keyEvent = aDOMKeyEvent->AsKeyboardEvent();
     if (NS_WARN_IF(!keyEvent)) {
       return NS_ERROR_INVALID_ARG;
     }
   }
 
   WidgetKeyboardEvent* keyboardEvent;
   nsresult rv =
     PrepareKeyboardEventForComposition(keyEvent, aKeyFlags, aOptionalArgc,
@@ -783,27 +784,27 @@ TextInputProcessor::CommitComposition(ns
     return rv;
   }
 
   return CommitCompositionInternal(keyboardEvent, aKeyFlags);
 }
 
 NS_IMETHODIMP
 TextInputProcessor::CommitCompositionWith(const nsAString& aCommitString,
-                                          nsIDOMEvent* aDOMKeyEvent,
+                                          Event* aDOMKeyEvent,
                                           uint32_t aKeyFlags,
                                           uint8_t aOptionalArgc,
                                           bool* aSucceeded)
 {
   MOZ_RELEASE_ASSERT(aSucceeded, "aSucceeded must not be nullptr");
   MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
 
   RefPtr<KeyboardEvent> keyEvent;
   if (aDOMKeyEvent) {
-    keyEvent = aDOMKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
+    keyEvent = aDOMKeyEvent->AsKeyboardEvent();
     if (NS_WARN_IF(!keyEvent)) {
       return NS_ERROR_INVALID_ARG;
     }
   }
 
   WidgetKeyboardEvent* keyboardEvent;
   nsresult rv =
     PrepareKeyboardEventForComposition(keyEvent, aKeyFlags, aOptionalArgc,
@@ -855,25 +856,25 @@ TextInputProcessor::CommitCompositionInt
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TextInputProcessor::CancelComposition(nsIDOMEvent* aDOMKeyEvent,
+TextInputProcessor::CancelComposition(Event* aDOMKeyEvent,
                                       uint32_t aKeyFlags,
                                       uint8_t aOptionalArgc)
 {
   MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
 
   RefPtr<KeyboardEvent> keyEvent;
   if (aDOMKeyEvent) {
-    keyEvent = aDOMKeyEvent->InternalDOMEvent()->AsKeyboardEvent();
+    keyEvent = aDOMKeyEvent->AsKeyboardEvent();
     if (NS_WARN_IF(!keyEvent)) {
       return NS_ERROR_INVALID_ARG;
     }
   }
 
   WidgetKeyboardEvent* keyboardEvent;
   nsresult rv =
     PrepareKeyboardEventForComposition(keyEvent, aKeyFlags, aOptionalArgc,
@@ -1071,31 +1072,31 @@ TextInputProcessor::PrepareKeyboardEvent
   }
 
   aKeyboardEvent.mIsSynthesizedByTIP = (mForTests)? false : true;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TextInputProcessor::Keydown(nsIDOMEvent* aDOMKeyEvent,
+TextInputProcessor::Keydown(Event* aDOMKeyEvent,
                             uint32_t aKeyFlags,
                             uint8_t aOptionalArgc,
                             uint32_t* aConsumedFlags)
 {
   MOZ_RELEASE_ASSERT(aConsumedFlags, "aConsumedFlags must not be nullptr");
   MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
   if (!aOptionalArgc) {
     aKeyFlags = 0;
   }
   if (NS_WARN_IF(!aDOMKeyEvent)) {
     return NS_ERROR_INVALID_ARG;
   }
   WidgetKeyboardEvent* originalKeyEvent =
-    aDOMKeyEvent->InternalDOMEvent()->WidgetEventPtr()->AsKeyboardEvent();
+    aDOMKeyEvent->WidgetEventPtr()->AsKeyboardEvent();
   if (NS_WARN_IF(!originalKeyEvent)) {
     return NS_ERROR_INVALID_ARG;
   }
   return KeydownInternal(*originalKeyEvent, aKeyFlags, true, *aConsumedFlags);
 }
 
 nsresult
 TextInputProcessor::KeydownInternal(const WidgetKeyboardEvent& aKeyboardEvent,
@@ -1164,31 +1165,31 @@ TextInputProcessor::KeydownInternal(cons
       (status == nsEventStatus_eConsumeNoDefault) ? KEYPRESS_IS_CONSUMED :
                                                     KEYEVENT_NOT_CONSUMED;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-TextInputProcessor::Keyup(nsIDOMEvent* aDOMKeyEvent,
+TextInputProcessor::Keyup(Event* aDOMKeyEvent,
                           uint32_t aKeyFlags,
                           uint8_t aOptionalArgc,
                           bool* aDoDefault)
 {
   MOZ_RELEASE_ASSERT(aDoDefault, "aDoDefault must not be nullptr");
   MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
   if (!aOptionalArgc) {
     aKeyFlags = 0;
   }
   if (NS_WARN_IF(!aDOMKeyEvent)) {
     return NS_ERROR_INVALID_ARG;
   }
   WidgetKeyboardEvent* originalKeyEvent =
-    aDOMKeyEvent->InternalDOMEvent()->WidgetEventPtr()->AsKeyboardEvent();
+    aDOMKeyEvent->WidgetEventPtr()->AsKeyboardEvent();
   if (NS_WARN_IF(!originalKeyEvent)) {
     return NS_ERROR_INVALID_ARG;
   }
   return KeyupInternal(*originalKeyEvent, aKeyFlags, *aDoDefault);
 }
 
 nsresult
 TextInputProcessor::KeyupInternal(const WidgetKeyboardEvent& aKeyboardEvent,
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -5,25 +5,25 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsDOMWindowUtils.h"
 
 #include "mozilla/layers/CompositorBridgeChild.h"
 #include "mozilla/layers/LayerTransactionChild.h"
 #include "nsPresContext.h"
 #include "nsError.h"
-#include "nsIDOMEvent.h"
 #include "nsQueryContentEventResult.h"
 #include "nsGlobalWindow.h"
 #include "nsIDocument.h"
 #include "nsFocusManager.h"
 #include "nsFrameManager.h"
 #include "nsRefreshDriver.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/dom/BlobBinding.h"
+#include "mozilla/dom/Event.h"
 #include "mozilla/dom/Touch.h"
 #include "mozilla/PendingAnimationTracker.h"
 #include "nsIObjectLoadingContent.h"
 #include "nsFrame.h"
 #include "mozilla/layers/ShadowLayers.h"
 #include "mozilla/layers/APZCCallbackHelper.h"
 #include "ClientLayerManager.h"
 #include "nsQueryObject.h"
@@ -1846,17 +1846,17 @@ nsDOMWindowUtils::GetFullZoom(float* aFu
 
   *aFullZoom = presContext->DeviceContext()->GetFullZoom();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMWindowUtils::DispatchDOMEventViaPresShell(nsIDOMNode* aTarget,
-                                               nsIDOMEvent* aEvent,
+                                               Event* aEvent,
                                                bool aTrusted,
                                                bool* aRetVal)
 {
   NS_ENSURE_STATE(aEvent);
   aEvent->SetTrusted(aTrusted);
   WidgetEvent* internalEvent = aEvent->WidgetEventPtr();
   NS_ENSURE_STATE(internalEvent);
   nsCOMPtr<nsIContent> content = do_QueryInterface(aTarget);
@@ -3701,24 +3701,24 @@ nsDOMWindowUtils::GetPaintFlashing(bool*
   if (presContext) {
     *aRetVal = presContext->GetPaintFlashing();
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMWindowUtils::DispatchEventToChromeOnly(EventTarget* aTarget,
-                                            nsIDOMEvent* aEvent,
+                                            Event* aEvent,
                                             bool* aRetVal)
 {
   *aRetVal = false;
   NS_ENSURE_STATE(aTarget && aEvent);
   aEvent->WidgetEventPtr()->mFlags.mOnlyChromeDispatch = true;
   *aRetVal = aTarget->
-    DispatchEvent(*aEvent->InternalDOMEvent(), CallerType::System, IgnoreErrors());
+    DispatchEvent(*aEvent, CallerType::System, IgnoreErrors());
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMWindowUtils::RequestCompositorProperty(const nsAString& property,
                                             float* aResult)
 {
   if (nsIWidget* widget = GetWidget()) {
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -29,32 +29,32 @@ struct nsRect;
 native nscolor(nscolor);
 [ptr] native gfxContext(gfxContext);
 
 interface nsIArray;
 interface nsICycleCollectorListener;
 interface nsIDOMNode;
 interface nsIDOMNodeList;
 interface nsIDOMElement;
-interface nsIDOMEvent;
 interface nsIPreloadedStyleSheet;
 interface nsITransferable;
 interface nsIQueryContentEventResult;
 interface nsIDOMWindow;
 interface nsIFile;
 interface nsIURI;
 interface nsIRunnable;
 interface nsITranslationNodeList;
 interface nsIJSRAIIHelper;
 interface nsIContentPermissionRequest;
 interface nsIObserver;
 interface nsIDOMStorage;
 
 webidl DOMRect;
 webidl EventTarget;
+webidl Event;
 
 [scriptable, uuid(4d6732ca-9da7-4176-b8a1-8dde15cd0bf9)]
 interface nsIDOMWindowUtils : nsISupports {
 
   /**
    * Image animation mode of the window. When this attribute's value
    * is changed, the implementation should set all images in the window
    * to the given value. That is, when set to kDontAnimMode, all images
@@ -313,17 +313,17 @@ interface nsIDOMWindowUtils : nsISupport
    * @param aButton button to synthesize
    * @param aClickCount number of clicks that have been performed
    * @param aModifiers modifiers pressed, using constants defined as MODIFIER_*
    * @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds
    *                           during dispatch
    * @param aPressure touch input pressure: 0.0 -> 1.0
    * @param aInputSourceArg input source, see MouseEvent for values,
    *        defaults to mouse input.
-   * @param aIsDOMEventSynthesized controls nsIDOMEvent.isSynthesized value
+   * @param aIsDOMEventSynthesized controls Event.isSynthesized value
    *                               that helps identifying test related events,
    *                               defaults to true
    * @param aIsWidgetEventSynthesized controls WidgetMouseEvent.mReason value
    *                                  defaults to false (WidgetMouseEvent::eReal)
    * @param aIdentifier A unique identifier for the pointer causing the event,
    *                    defaulting to nsIDOMWindowUtils::DEFAULT_MOUSE_POINTER_ID.
    *
    * returns true if the page called prevent default on this event
@@ -932,27 +932,27 @@ interface nsIDOMWindowUtils : nsISupport
    * Cannot be accessed from unprivileged context (not
    * content-accessible) Will throw a DOM security error if called
    * without chrome privileges.
    *
    * @note Event handlers won't get aEvent as parameter, but a similar event.
    *       Also, aEvent should not be reused.
    */
   boolean dispatchDOMEventViaPresShell(in nsIDOMNode aTarget,
-                                       in nsIDOMEvent aEvent,
+                                       in Event aEvent,
                                        in boolean aTrusted);
 
   /**
    * Sets WidgetEvent::mFlags::mOnlyChromeDispatch to true to ensure that
    * the event is propagated only to chrome.
    * Event's .target property will be aTarget.
    * Returns the same value as what EventTarget.dispatchEvent does.
    */
   boolean dispatchEventToChromeOnly(in EventTarget aTarget,
-                                    in nsIDOMEvent aEvent);
+                                    in Event aEvent);
 
   /**
    * Returns the real classname (possibly of the mostly-transparent security
    * wrapper) of aObj.
    */
   [implicit_jscontext] string getClassName(in jsval aObject);
 
   /**
--- a/dom/interfaces/base/nsITextInputProcessor.idl
+++ b/dom/interfaces/base/nsITextInputProcessor.idl
@@ -1,19 +1,20 @@
 /* -*- 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 "nsISupports.idl"
 
-interface nsIDOMEvent;
 interface mozIDOMWindow;
 interface nsITextInputProcessorCallback;
 
+webidl Event;
+
 /**
  * An nsITextInputProcessor instance is associated with a top level widget which
  * handles native IME.  It's associated by calling beginInputTransaction() or
  * beginInputTransactionForTests().  While an instance has composition, nobody
  * can steal the rights to make composition on the top level widget.  In other
  * words, if another instance is composing on a top level widget, either
  * beginInputTransaction() or beginInputTransactionForTests() returns false
  * (i.e., not throws an exception).
@@ -310,17 +311,17 @@ interface nsITextInputProcessor : nsISup
    *                        automatically.  You can prevent this behavior
    *                        with KEY_DONT_MARK_KEYDOWN_AS_PROCESSED.
    * @param aKeyFlags       See KEY_* constants.
    * @return                Returns true if composition starts normally.
    *                        Otherwise, returns false because it might be
    *                        canceled by the web application.
    */
   [optional_argc]
-    boolean startComposition([optional] in nsIDOMEvent aKeyboardEvent,
+    boolean startComposition([optional] in Event aKeyboardEvent,
                              [optional] in unsigned long aKeyFlags);
 
   /**
    * Set new composition string.  Pending composition will be flushed by
    * a call of flushPendingComposition().  However, if the new composition
    * string isn't empty, you need to call appendClauseToPendingComposition() to
    * fill all characters of aString with one or more clauses before flushing.
    * Note that if you need to commit or cancel composition, use
@@ -405,17 +406,17 @@ interface nsITextInputProcessor : nsISup
    * @return                Returns true if there is a composition already or
    *                        starting composition automatically.
    *                        Otherwise, i.e., if it cannot start composition
    *                        automatically, e.g., canceled by web apps, returns
    *                        false.
    */
   [optional_argc]
     boolean flushPendingComposition(
-      [optional] in nsIDOMEvent aKeyboardEvent,
+      [optional] in Event aKeyboardEvent,
       [optional] in unsigned long aKeyFlags);
 
   /**
    * commitComposition() will commit composition with the last composition
    * string.  If there is no composition, this will throw an exception.
    *
    * @param aKeyboardEvent  Key event which causes the commit composition.
    *                        If its type value is "keydown", this method
@@ -423,17 +424,17 @@ interface nsITextInputProcessor : nsISup
    *                        dispatches keydown first and keyup at last.
    *                        key value and keyCode values of keydown event
    *                        are set to "Process" and DOM_VK_PROCESSKEY
    *                        automatically.  You can prevent this behavior
    *                        with KEY_DONT_MARK_KEYDOWN_AS_PROCESSED.
    * @param aKeyFlags       See KEY_* constants.
    */
   [optional_argc]
-    void commitComposition([optional] in nsIDOMEvent aKeyboardEvent,
+    void commitComposition([optional] in Event aKeyboardEvent,
                            [optional] in unsigned long aKeyFlags);
 
   /**
    * commitCompositionWith() will commit composition with the specific string.
    * If there is no composition, this will start composition and commit it
    * with the specified string.
    *
    * @param aCommitString   The string to be committed.
@@ -449,17 +450,17 @@ interface nsITextInputProcessor : nsISup
    * @return                Returns true if there is a composition already or
    *                        starting composition automatically.
    *                        Otherwise, i.e., if it cannot start composition
    *                        automatically, e.g., canceled by web apps, returns
    *                        false.
    */
   [optional_argc]
     boolean commitCompositionWith(in DOMString aCommitString,
-                                  [optional] in nsIDOMEvent aKeyboardEvent,
+                                  [optional] in Event aKeyboardEvent,
                                   [optional] in unsigned long aKeyFlags);
 
   /**
    * cancelComposition() will cancel composition.  This is for now the same as
    * calling commitComposition("").  However, in the future, this might work
    * better.  If your IME needs to cancel composition, use this instead of
    * commitComposition().
    *
@@ -472,17 +473,17 @@ interface nsITextInputProcessor : nsISup
    *                        dispatches keydown first and keyup at last.
    *                        key value and keyCode values of keydown event
    *                        are set to "Process" and DOM_VK_PROCESSKEY
    *                        automatically.  You can prevent this behavior
    *                        with KEY_DONT_MARK_KEYDOWN_AS_PROCESSED.
    * @param aKeyFlags       See KEY_* constants.
    */
   [optional_argc]
-    void cancelComposition([optional] in nsIDOMEvent aKeyboardEvent,
+    void cancelComposition([optional] in Event aKeyboardEvent,
                            [optional] in unsigned long aKeyFlags);
 
   // Specifying KEY_DEFAULT_PREVENTED can dispatch key events whose
   // defaultPrevented are true.  Note that if this is specified, keypress event
   // won't be fired.
   const unsigned long KEY_DEFAULT_PREVENTED                        = 0x00000001;
   // If KEY_NON_PRINTABLE_KEY is specified and the .key value isn't valid
   // key name, the methods will throws an exception.  In other words, this
@@ -568,24 +569,24 @@ interface nsITextInputProcessor : nsISup
    *                        this case.
    *                        KEYPRESS_IS_CONSUMED, if the keypress event(s) is
    *                        consumed when dispatched.
    *                        Note that keypress event is always consumed by
    *                        native code for the printable keys (indicating the
    *                        default action has been taken).
    */
   [optional_argc]
-    unsigned long keydown(in nsIDOMEvent aKeyboardEvent,
+    unsigned long keydown(in Event aKeyboardEvent,
                           [optional] in unsigned long aKeyFlags);
 
   /**
    * Similar to keydown(), but this dispatches only a keyup event.
    */
   [optional_argc]
-    boolean keyup(in nsIDOMEvent aKeyboardEvent,
+    boolean keyup(in Event aKeyboardEvent,
                   [optional] in unsigned long aKeyFlags);
 
   /**
    * getModifierState() returns modifier state managed by this instance.
    *
    * @param aModifier       One of modifier key names.  This doesn't support
    *                        virtual modifiers like "Accel".
    * @return                true if the modifier key is active.  Otherwise,
--- a/toolkit/components/autocomplete/nsAutoCompleteController.cpp
+++ b/toolkit/components/autocomplete/nsAutoCompleteController.cpp
@@ -14,16 +14,17 @@
 #include "nsReadableUtils.h"
 #include "nsUnicharUtils.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIObserverService.h"
 #include "mozilla/Services.h"
 #include "mozilla/ModuleUtils.h"
 #include "mozilla/Unused.h"
 #include "mozilla/dom/KeyboardEventBinding.h"
+#include "mozilla/dom/Event.h"
 
 static const char *kAutoCompleteSearchCID = "@mozilla.org/autocomplete/search;1?name=";
 
 using namespace mozilla;
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsAutoCompleteController)
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsAutoCompleteController)
@@ -294,17 +295,17 @@ nsAutoCompleteController::HandleText(boo
   *_retval = true;
   StartSearches();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::HandleEnter(bool aIsPopupSelection,
-                                      nsIDOMEvent *aEvent,
+                                      dom::Event* aEvent,
                                       bool *_retval)
 {
   *_retval = false;
   if (!mInput)
     return NS_OK;
 
   nsCOMPtr<nsIAutoCompleteInput> input(mInput);
 
@@ -1178,17 +1179,17 @@ nsAutoCompleteController::ClearSearchTim
     mTimer->Cancel();
     mTimer = nullptr;
   }
   return NS_OK;
 }
 
 nsresult
 nsAutoCompleteController::EnterMatch(bool aIsPopupSelection,
-                                     nsIDOMEvent *aEvent)
+                                     dom::Event* aEvent)
 {
   nsCOMPtr<nsIAutoCompleteInput> input(mInput);
   nsCOMPtr<nsIAutoCompletePopup> popup;
   input->GetPopup(getter_AddRefs(popup));
   NS_ENSURE_TRUE(popup != nullptr, NS_ERROR_FAILURE);
 
   bool forceComplete;
   input->GetForceComplete(&forceComplete);
--- a/toolkit/components/autocomplete/nsAutoCompleteController.h
+++ b/toolkit/components/autocomplete/nsAutoCompleteController.h
@@ -63,17 +63,17 @@ protected:
   void AfterSearches();
   nsresult ClearSearchTimer();
   void MaybeCompletePlaceholder();
 
   nsresult ProcessResult(int32_t aSearchIndex, nsIAutoCompleteResult *aResult);
   nsresult PostSearchCleanup();
 
   nsresult EnterMatch(bool aIsPopupSelection,
-                      nsIDOMEvent *aEvent);
+                      mozilla::dom::Event* aEvent);
   nsresult RevertTextValue();
 
   nsresult CompleteDefaultIndex(int32_t aResultIndex);
   nsresult CompleteValue(nsString &aValue);
 
   nsresult GetResultAt(int32_t aIndex, nsIAutoCompleteResult** aResult,
                        int32_t* aMatchIndex);
   nsresult GetResultValueAt(int32_t aIndex, bool aGetFinalValue,
--- a/toolkit/components/autocomplete/nsIAutoCompleteController.idl
+++ b/toolkit/components/autocomplete/nsIAutoCompleteController.idl
@@ -1,16 +1,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 "nsISupports.idl"
 
 interface nsIAutoCompleteInput;
-interface nsIDOMEvent;
+
+webidl Event;
 
 [scriptable, uuid(ff9f8465-204a-47a6-b3c9-0628b3856684)]
 interface nsIAutoCompleteController : nsISupports
 {
   /*
    * Possible values for the searchStatus attribute
    */
   const unsigned short STATUS_NONE = 1;
@@ -71,17 +72,17 @@ interface nsIAutoCompleteController : ns
    * @param aEvent
    *        The event that triggered the enter, like a key event if the user
    *        pressed the Return key or a click event if the user clicked a popup
    *        item.
    * @return Whether the controller wishes to prevent event propagation and
    *         default event.
    */
   boolean handleEnter(in boolean aIsPopupSelection,
-                      [optional] in nsIDOMEvent aEvent);
+                      [optional] in Event aEvent);
 
   /*
    * Notify the controller that the user wishes to revert autocomplete
    *
    * @return Whether the controller wishes to prevent event propagation and
    *         default event.
    */
   boolean handleEscape();
--- a/toolkit/components/autocomplete/nsIAutoCompleteInput.idl
+++ b/toolkit/components/autocomplete/nsIAutoCompleteInput.idl
@@ -2,16 +2,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 "nsISupports.idl"
 #include "nsIAutoCompleteController.idl"
 
 interface nsIAutoCompletePopup;
 
+webidl Event;
+
 [scriptable, uuid(B068E70F-F82C-4C12-AD87-82E271C5C180)]
 interface nsIAutoCompleteInput : nsISupports
 {
   /*
    * The result view that will be used to display results
    */
   readonly attribute nsIAutoCompletePopup popup;
 
@@ -130,17 +132,17 @@ interface nsIAutoCompleteInput : nsISupp
 
   /*
    * Notification that the user selected and entered a result item
    *
    * @param aEvent
    *        The event that triggered the enter.
    * @return True if the user wishes to prevent the enter
    */
-  boolean onTextEntered([optional] in nsIDOMEvent aEvent);
+  boolean onTextEntered([optional] in Event aEvent);
 
   /*
    * Notification that the user cancelled the autocomplete session
    *
    * @return True if the user wishes to prevent the revert
    */
   boolean onTextReverted();
 
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -639,17 +639,17 @@ nsFormFillController::OnSearchBegin()
 
 NS_IMETHODIMP
 nsFormFillController::OnSearchComplete()
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsFormFillController::OnTextEntered(nsIDOMEvent* aEvent,
+nsFormFillController::OnTextEntered(Event* aEvent,
                                     bool* aPrevent)
 {
   NS_ENSURE_ARG(aPrevent);
   NS_ENSURE_TRUE(mFocusedInput, NS_OK);
   // Fire off a DOMAutoComplete event
 
   IgnoredErrorResult ignored;
   RefPtr<Event> event = mFocusedInput->OwnerDoc()->