1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_EventListenerManager_h_
8 #define mozilla_EventListenerManager_h_
10 #include "mozilla/BasicEvents.h"
11 #include "mozilla/JSEventHandler.h"
12 #include "mozilla/MemoryReporting.h"
13 #include "mozilla/dom/AbortFollower.h"
14 #include "mozilla/dom/EventListenerBinding.h"
16 #include "nsCycleCollectionParticipant.h"
17 #include "nsGkAtoms.h"
18 #include "nsIDOMEventListener.h"
20 #include "nsTObserverArray.h"
22 class nsIEventListenerInfo
;
23 class nsPIDOMWindowInner
;
30 class ELMCreationDetector
;
31 class EventListenerManager
;
32 class ListenerSignalFollower
;
40 using EventListenerHolder
=
41 dom::CallbackObjectHolder
<dom::EventListener
, nsIDOMEventListener
>;
43 struct EventListenerFlags
{
44 friend class EventListenerManager
;
47 // If mListenerIsJSListener is true, the listener is implemented by JS.
48 // Otherwise, it's implemented by native code or JS but it's wrapped.
49 bool mListenerIsJSListener
: 1;
52 // If mCapture is true, it means the listener captures the event. Otherwise,
53 // it's listening at bubbling phase.
55 // If mInSystemGroup is true, the listener is listening to the events in the
57 bool mInSystemGroup
: 1;
58 // If mAllowUntrustedEvents is true, the listener is listening to the
59 // untrusted events too.
60 bool mAllowUntrustedEvents
: 1;
61 // If mPassive is true, the listener will not be calling preventDefault on the
62 // event. (If it does call preventDefault, we should ignore it).
64 // If mOnce is true, the listener will be removed from the manager before it
65 // is invoked, so that it would only be invoked once.
69 : mListenerIsJSListener(false),
71 mInSystemGroup(false),
72 mAllowUntrustedEvents(false),
76 bool EqualsForAddition(const EventListenerFlags
& aOther
) const {
77 return (mCapture
== aOther
.mCapture
&&
78 mInSystemGroup
== aOther
.mInSystemGroup
&&
79 mListenerIsJSListener
== aOther
.mListenerIsJSListener
&&
80 mAllowUntrustedEvents
== aOther
.mAllowUntrustedEvents
);
81 // Don't compare mPassive or mOnce
84 bool EqualsForRemoval(const EventListenerFlags
& aOther
) const {
85 return (mCapture
== aOther
.mCapture
&&
86 mInSystemGroup
== aOther
.mInSystemGroup
&&
87 mListenerIsJSListener
== aOther
.mListenerIsJSListener
);
88 // Don't compare mAllowUntrustedEvents, mPassive, or mOnce
92 inline EventListenerFlags
TrustedEventsAtBubble() {
93 EventListenerFlags flags
;
97 inline EventListenerFlags
TrustedEventsAtCapture() {
98 EventListenerFlags flags
;
99 flags
.mCapture
= true;
103 inline EventListenerFlags
AllEventsAtBubble() {
104 EventListenerFlags flags
;
105 flags
.mAllowUntrustedEvents
= true;
109 inline EventListenerFlags
AllEventsAtCapture() {
110 EventListenerFlags flags
;
111 flags
.mCapture
= true;
112 flags
.mAllowUntrustedEvents
= true;
116 inline EventListenerFlags
TrustedEventsAtSystemGroupBubble() {
117 EventListenerFlags flags
;
118 flags
.mInSystemGroup
= true;
122 inline EventListenerFlags
TrustedEventsAtSystemGroupCapture() {
123 EventListenerFlags flags
;
124 flags
.mCapture
= true;
125 flags
.mInSystemGroup
= true;
129 inline EventListenerFlags
AllEventsAtSystemGroupBubble() {
130 EventListenerFlags flags
;
131 flags
.mInSystemGroup
= true;
132 flags
.mAllowUntrustedEvents
= true;
136 inline EventListenerFlags
AllEventsAtSystemGroupCapture() {
137 EventListenerFlags flags
;
138 flags
.mCapture
= true;
139 flags
.mInSystemGroup
= true;
140 flags
.mAllowUntrustedEvents
= true;
144 class EventListenerManagerBase
{
146 EventListenerManagerBase();
148 void ClearNoListenersForEvents() {
149 mNoListenerForEvents
[0] = eVoidEvent
;
150 mNoListenerForEvents
[1] = eVoidEvent
;
151 mNoListenerForEvents
[2] = eVoidEvent
;
154 EventMessage mNoListenerForEvents
[3];
155 uint16_t mMayHavePaintEventListener
: 1;
156 uint16_t mMayHaveMutationListeners
: 1;
157 uint16_t mMayHaveCapturingListeners
: 1;
158 uint16_t mMayHaveSystemGroupListeners
: 1;
159 uint16_t mMayHaveTouchEventListener
: 1;
160 uint16_t mMayHaveMouseEnterLeaveEventListener
: 1;
161 uint16_t mMayHavePointerEnterLeaveEventListener
: 1;
162 uint16_t mMayHaveSelectionChangeEventListener
: 1;
163 uint16_t mMayHaveFormSelectEventListener
: 1;
164 uint16_t mMayHaveTransitionEventListener
: 1;
165 uint16_t mClearingListeners
: 1;
166 uint16_t mIsMainThreadELM
: 1;
167 uint16_t mMayHaveListenersForUntrustedEvents
: 1;
172 * Event listener manager
175 class EventListenerManager final
: public EventListenerManagerBase
{
176 ~EventListenerManager();
180 class ListenerSignalFollower
: public dom::AbortFollower
{
182 explicit ListenerSignalFollower(EventListenerManager
* aListenerManager
,
183 Listener
* aListener
);
185 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
186 NS_DECL_CYCLE_COLLECTION_CLASS(ListenerSignalFollower
)
188 void RunAbortAlgorithm() override
;
191 mListenerManager
= nullptr;
197 ~ListenerSignalFollower() = default;
199 EventListenerManager
* mListenerManager
;
200 EventListenerHolder mListener
;
201 RefPtr
<nsAtom
> mTypeAtom
;
202 EventMessage mEventMessage
;
204 EventListenerFlags mFlags
;
208 RefPtr
<ListenerSignalFollower
> mSignalFollower
;
209 EventListenerHolder mListener
;
210 RefPtr
<nsAtom
> mTypeAtom
;
211 EventMessage mEventMessage
;
213 enum ListenerType
: uint8_t {
216 // A generic C++ implementation of nsIDOMEventListener.
218 // An event handler attribute using JSEventHandler.
220 // A scripted EventListener.
223 ListenerType mListenerType
;
225 bool mListenerIsHandler
: 1;
226 bool mHandlerIsString
: 1;
230 EventListenerFlags mFlags
;
232 JSEventHandler
* GetJSEventHandler() const {
233 return (mListenerType
== eJSEventListener
)
234 ? static_cast<JSEventHandler
*>(mListener
.GetXPCOMCallback())
239 : mEventMessage(eVoidEvent
),
240 mListenerType(eNoListener
),
241 mListenerIsHandler(false),
242 mHandlerIsString(false),
246 Listener(Listener
&& aOther
)
247 : mSignalFollower(std::move(aOther
.mSignalFollower
)),
248 mListener(std::move(aOther
.mListener
)),
249 mTypeAtom(std::move(aOther
.mTypeAtom
)),
250 mEventMessage(aOther
.mEventMessage
),
251 mListenerType(aOther
.mListenerType
),
252 mListenerIsHandler(aOther
.mListenerIsHandler
),
253 mHandlerIsString(aOther
.mHandlerIsString
),
254 mAllEvents(aOther
.mAllEvents
),
255 mEnabled(aOther
.mEnabled
) {
256 aOther
.mEventMessage
= eVoidEvent
;
257 aOther
.mListenerType
= eNoListener
;
258 aOther
.mListenerIsHandler
= false;
259 aOther
.mHandlerIsString
= false;
260 aOther
.mAllEvents
= false;
261 aOther
.mEnabled
= true;
265 if ((mListenerType
== eJSEventListener
) && mListener
) {
266 static_cast<JSEventHandler
*>(mListener
.GetXPCOMCallback())
269 if (mSignalFollower
) {
270 mSignalFollower
->Disconnect();
274 MOZ_ALWAYS_INLINE
bool MatchesEventMessage(
275 const WidgetEvent
* aEvent
, EventMessage aEventMessage
) const;
277 MOZ_ALWAYS_INLINE
bool MatchesEventGroup(const WidgetEvent
* aEvent
) const {
278 return mFlags
.mInSystemGroup
== aEvent
->mFlags
.mInSystemGroup
;
281 MOZ_ALWAYS_INLINE
bool MatchesEventPhase(const WidgetEvent
* aEvent
) const {
282 return ((mFlags
.mCapture
&& aEvent
->mFlags
.mInCapturePhase
) ||
283 (!mFlags
.mCapture
&& aEvent
->mFlags
.mInBubblingPhase
));
286 // Allow only trusted events, except when listener permits untrusted
288 MOZ_ALWAYS_INLINE
bool AllowsEventTrustedness(
289 const WidgetEvent
* aEvent
) const {
290 return aEvent
->IsTrusted() || mFlags
.mAllowUntrustedEvents
;
294 explicit EventListenerManager(dom::EventTarget
* aTarget
);
296 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(EventListenerManager
)
298 NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(EventListenerManager
)
300 void AddEventListener(const nsAString
& aType
, nsIDOMEventListener
* aListener
,
301 bool aUseCapture
, bool aWantsUntrusted
) {
302 AddEventListener(aType
, EventListenerHolder(aListener
), aUseCapture
,
305 void AddEventListener(const nsAString
& aType
, dom::EventListener
* aListener
,
306 const dom::AddEventListenerOptionsOrBoolean
& aOptions
,
307 bool aWantsUntrusted
) {
308 AddEventListener(aType
, EventListenerHolder(aListener
), aOptions
,
311 void RemoveEventListener(const nsAString
& aType
,
312 nsIDOMEventListener
* aListener
, bool aUseCapture
) {
313 RemoveEventListener(aType
, EventListenerHolder(aListener
), aUseCapture
);
315 void RemoveEventListener(const nsAString
& aType
,
316 dom::EventListener
* aListener
,
317 const dom::EventListenerOptionsOrBoolean
& aOptions
) {
318 RemoveEventListener(aType
, EventListenerHolder(aListener
), aOptions
);
321 void AddListenerForAllEvents(dom::EventListener
* aListener
, bool aUseCapture
,
322 bool aWantsUntrusted
, bool aSystemEventGroup
);
323 void RemoveListenerForAllEvents(dom::EventListener
* aListener
,
324 bool aUseCapture
, bool aSystemEventGroup
);
327 * Sets events listeners of all types.
328 * @param an event listener
330 void AddEventListenerByType(nsIDOMEventListener
* aListener
,
331 const nsAString
& type
,
332 const EventListenerFlags
& aFlags
) {
333 AddEventListenerByType(EventListenerHolder(aListener
), type
, aFlags
);
335 void AddEventListenerByType(dom::EventListener
* aListener
,
336 const nsAString
& type
,
337 const EventListenerFlags
& aFlags
) {
338 AddEventListenerByType(EventListenerHolder(aListener
), type
, aFlags
);
340 void AddEventListenerByType(
341 EventListenerHolder aListener
, const nsAString
& type
,
342 const EventListenerFlags
& aFlags
,
343 const dom::Optional
<bool>& aPassive
= dom::Optional
<bool>(),
344 dom::AbortSignal
* aSignal
= nullptr);
345 void RemoveEventListenerByType(nsIDOMEventListener
* aListener
,
346 const nsAString
& type
,
347 const EventListenerFlags
& aFlags
) {
348 RemoveEventListenerByType(EventListenerHolder(aListener
), type
, aFlags
);
350 void RemoveEventListenerByType(dom::EventListener
* aListener
,
351 const nsAString
& type
,
352 const EventListenerFlags
& aFlags
) {
353 RemoveEventListenerByType(EventListenerHolder(aListener
), type
, aFlags
);
355 void RemoveEventListenerByType(EventListenerHolder aListener
,
356 const nsAString
& type
,
357 const EventListenerFlags
& aFlags
);
360 * Sets the current "inline" event listener for aName to be a
361 * function compiled from aFunc if !aDeferCompilation. If
362 * aDeferCompilation, then we assume that we can get the string from
363 * mTarget later and compile lazily.
365 * aElement, if not null, is the element the string is associated with.
367 // XXXbz does that play correctly with nodes being adopted across
368 // documents? Need to double-check the spec here.
369 nsresult
SetEventHandler(nsAtom
* aName
, const nsAString
& aFunc
,
370 bool aDeferCompilation
, bool aPermitUntrustedEvents
,
371 dom::Element
* aElement
);
373 * Remove the current "inline" event listener for aName.
375 void RemoveEventHandler(nsAtom
* aName
);
377 // We only get called from the event dispatch code, which knows to be careful
378 // with what it's doing. We could annotate ourselves as MOZ_CAN_RUN_SCRIPT,
379 // but then the event dispatch code would need a ton of MOZ_KnownLive for
380 // things that come from slightly complicated stack-lifetime data structures.
381 MOZ_CAN_RUN_SCRIPT_BOUNDARY
382 void HandleEvent(nsPresContext
* aPresContext
, WidgetEvent
* aEvent
,
383 dom::Event
** aDOMEvent
, dom::EventTarget
* aCurrentTarget
,
384 nsEventStatus
* aEventStatus
, bool aItemInShadowTree
) {
385 if (!mMayHaveCapturingListeners
&& !aEvent
->mFlags
.mInBubblingPhase
) {
389 if (!mMayHaveSystemGroupListeners
&& aEvent
->mFlags
.mInSystemGroup
) {
393 if (!aEvent
->IsTrusted() && !mMayHaveListenersForUntrustedEvents
) {
397 // Check if we already know that there is no event listener for the event.
398 if (aEvent
->mMessage
== eUnidentifiedEvent
) {
399 if (mNoListenerForEventAtom
== aEvent
->mSpecifiedEventType
) {
402 } else if (mNoListenerForEvents
[0] == aEvent
->mMessage
||
403 mNoListenerForEvents
[1] == aEvent
->mMessage
||
404 mNoListenerForEvents
[2] == aEvent
->mMessage
) {
408 if (mListeners
.IsEmpty() || aEvent
->PropagationStopped()) {
412 HandleEventInternal(aPresContext
, aEvent
, aDOMEvent
, aCurrentTarget
,
413 aEventStatus
, aItemInShadowTree
);
417 * Tells the event listener manager that its target (which owns it) is
418 * no longer using it (and could go away).
423 * Allows us to quickly determine if we have mutation listeners registered.
425 bool HasMutationListeners();
428 * Allows us to quickly determine whether we have unload listeners registered.
430 bool HasUnloadListeners();
433 * Allows us to quickly determine whether we have beforeunload listeners
436 bool HasBeforeUnloadListeners();
439 * Returns the mutation bits depending on which mutation listeners are
440 * registered to this listener manager.
441 * @note If a listener is an nsIDOMMutationListener, all possible mutation
442 * event bits are returned. All bits are also returned if one of the
443 * event listeners is registered to handle DOMSubtreeModified events.
445 uint32_t MutationListenerBits();
448 * Returns true if there is at least one event listener for aEventName.
450 bool HasListenersFor(const nsAString
& aEventName
) const;
453 * Returns true if there is at least one event listener for aEventNameWithOn.
454 * Note that aEventNameWithOn must start with "on"!
456 bool HasListenersFor(nsAtom
* aEventNameWithOn
) const;
459 * Similar to HasListenersFor, but ignores system group listeners.
461 bool HasNonSystemGroupListenersFor(nsAtom
* aEventNameWithOn
) const;
464 * Returns true if there is at least one event listener.
466 bool HasListeners() const;
469 * Sets aList to the list of nsIEventListenerInfo objects representing the
470 * listeners managed by this listener manager.
472 nsresult
GetListenerInfo(nsTArray
<RefPtr
<nsIEventListenerInfo
>>& aList
);
474 nsresult
IsListenerEnabled(nsAString
& aType
, JSObject
* aListener
,
475 bool aCapturing
, bool aAllowsUntrusted
,
476 bool aInSystemEventGroup
, bool aIsHandler
,
479 nsresult
SetListenerEnabled(nsAString
& aType
, JSObject
* aListener
,
480 bool aCapturing
, bool aAllowsUntrusted
,
481 bool aInSystemEventGroup
, bool aIsHandler
,
484 uint32_t GetIdentifierForEvent(nsAtom
* aEvent
);
487 * Returns true if there may be a paint event listener registered,
488 * false if there definitely isn't.
490 bool MayHavePaintEventListener() const { return mMayHavePaintEventListener
; }
493 * Returns true if there may be a touch event listener registered,
494 * false if there definitely isn't.
496 bool MayHaveTouchEventListener() const { return mMayHaveTouchEventListener
; }
498 bool MayHaveMouseEnterLeaveEventListener() const {
499 return mMayHaveMouseEnterLeaveEventListener
;
501 bool MayHavePointerEnterLeaveEventListener() const {
502 return mMayHavePointerEnterLeaveEventListener
;
504 bool MayHaveSelectionChangeEventListener() const {
505 return mMayHaveSelectionChangeEventListener
;
507 bool MayHaveFormSelectEventListener() const {
508 return mMayHaveFormSelectEventListener
;
510 bool MayHaveTransitionEventListener() {
511 return mMayHaveTransitionEventListener
;
514 size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf
) const;
516 uint32_t ListenerCount() const { return mListeners
.Length(); }
520 void TraceListeners(JSTracer
* aTrc
);
522 dom::EventTarget
* GetTarget() { return mTarget
; }
524 bool HasNonSystemGroupListenersForUntrustedKeyEvents();
525 bool HasNonPassiveNonSystemGroupListenersForUntrustedKeyEvents();
527 bool HasApzAwareListeners();
528 bool IsApzAwareListener(Listener
* aListener
);
529 bool IsApzAwareEvent(nsAtom
* aEvent
);
531 bool HasNonPassiveWheelListener();
534 * Remove all event listeners from the event target this EventListenerManager
537 void RemoveAllListeners();
541 void HandleEventInternal(nsPresContext
* aPresContext
, WidgetEvent
* aEvent
,
542 dom::Event
** aDOMEvent
,
543 dom::EventTarget
* aCurrentTarget
,
544 nsEventStatus
* aEventStatus
, bool aItemInShadowTree
);
547 nsresult
HandleEventSubType(Listener
* aListener
, dom::Event
* aDOMEvent
,
548 dom::EventTarget
* aCurrentTarget
);
551 * If the given EventMessage has a legacy version that we support, then this
552 * function returns that legacy version. Otherwise, this function simply
553 * returns the passed-in EventMessage.
555 static EventMessage
GetLegacyEventMessage(EventMessage aEventMessage
);
558 * Get the event message for the given event name.
560 EventMessage
GetEventMessage(nsAtom
* aEventName
) const;
563 * Get the event message and atom for the given event type.
565 EventMessage
GetEventMessageAndAtomForListener(const nsAString
& aType
,
568 void ProcessApzAwareEventListenerAdd();
571 * Compile the "inline" event listener for aListener. The
572 * body of the listener can be provided in aBody; if this is null we
573 * will look for it on mTarget. If aBody is provided, aElement should be
574 * as well; otherwise it will also be inferred from mTarget.
576 nsresult
CompileEventHandlerInternal(Listener
* aListener
,
577 const nsAString
* aBody
,
578 dom::Element
* aElement
);
581 * Find the Listener for the "inline" event listener for aTypeAtom.
583 Listener
* FindEventHandler(EventMessage aEventMessage
, nsAtom
* aTypeAtom
);
586 * Set the "inline" event listener for aName to aHandler. aHandler may be
587 * have no actual handler set to indicate that we should lazily get and
588 * compile the string for this listener, but in that case aContext and
589 * aScopeGlobal must be non-null. Otherwise, aContext and aScopeGlobal are
590 * allowed to be null.
592 Listener
* SetEventHandlerInternal(nsAtom
* aName
,
593 const TypedEventHandler
& aHandler
,
594 bool aPermitUntrustedEvents
);
596 bool IsDeviceType(EventMessage aEventMessage
);
597 void EnableDevice(EventMessage aEventMessage
);
598 void DisableDevice(EventMessage aEventMessage
);
600 bool HasListenersForInternal(nsAtom
* aEventNameWithOn
,
601 bool aIgnoreSystemGroup
) const;
603 Listener
* GetListenerFor(nsAString
& aType
, JSObject
* aListener
,
604 bool aCapturing
, bool aAllowsUntrusted
,
605 bool aInSystemEventGroup
, bool aIsHandler
);
609 * Set the "inline" event listener for aEventName to aHandler. If
610 * aHandler is null, this will actually remove the event listener
612 void SetEventHandler(nsAtom
* aEventName
, dom::EventHandlerNonNull
* aHandler
);
613 void SetEventHandler(dom::OnErrorEventHandlerNonNull
* aHandler
);
614 void SetEventHandler(dom::OnBeforeUnloadEventHandlerNonNull
* aHandler
);
617 * Get the value of the "inline" event listener for aEventName.
618 * This may cause lazy compilation if the listener is uncompiled.
620 * Note: It's the caller's responsibility to make sure to call the right one
621 * of these methods. In particular, "onerror" events use
622 * OnErrorEventHandlerNonNull for some event targets and EventHandlerNonNull
625 dom::EventHandlerNonNull
* GetEventHandler(nsAtom
* aEventName
) {
626 const TypedEventHandler
* typedHandler
= GetTypedEventHandler(aEventName
);
627 return typedHandler
? typedHandler
->NormalEventHandler() : nullptr;
630 dom::OnErrorEventHandlerNonNull
* GetOnErrorEventHandler() {
631 const TypedEventHandler
* typedHandler
=
632 GetTypedEventHandler(nsGkAtoms::onerror
);
633 return typedHandler
? typedHandler
->OnErrorEventHandler() : nullptr;
636 dom::OnBeforeUnloadEventHandlerNonNull
* GetOnBeforeUnloadEventHandler() {
637 const TypedEventHandler
* typedHandler
=
638 GetTypedEventHandler(nsGkAtoms::onbeforeunload
);
639 return typedHandler
? typedHandler
->OnBeforeUnloadEventHandler() : nullptr;
643 already_AddRefed
<nsPIDOMWindowInner
> WindowFromListener(
644 Listener
* aListener
, bool aItemInShadowTree
);
648 * Helper method for implementing the various Get*EventHandler above. Will
649 * return null if we don't have an event handler for this event name.
651 const TypedEventHandler
* GetTypedEventHandler(nsAtom
* aEventName
);
653 void AddEventListener(const nsAString
& aType
, EventListenerHolder aListener
,
654 const dom::AddEventListenerOptionsOrBoolean
& aOptions
,
655 bool aWantsUntrusted
);
656 void AddEventListener(const nsAString
& aType
, EventListenerHolder aListener
,
657 bool aUseCapture
, bool aWantsUntrusted
);
658 void RemoveEventListener(const nsAString
& aType
,
659 EventListenerHolder aListener
,
660 const dom::EventListenerOptionsOrBoolean
& aOptions
);
661 void RemoveEventListener(const nsAString
& aType
,
662 EventListenerHolder aListener
, bool aUseCapture
);
664 void AddEventListenerInternal(EventListenerHolder aListener
,
665 EventMessage aEventMessage
, nsAtom
* aTypeAtom
,
666 const EventListenerFlags
& aFlags
,
667 bool aHandler
= false, bool aAllEvents
= false,
668 dom::AbortSignal
* aSignal
= nullptr);
669 void RemoveEventListenerInternal(EventListenerHolder aListener
,
670 EventMessage aEventMessage
,
672 const EventListenerFlags
& aFlags
,
673 bool aAllEvents
= false);
674 void RemoveAllListenersSilently();
675 void NotifyEventListenerRemoved(nsAtom
* aUserType
);
676 const EventTypeData
* GetTypeDataForIID(const nsIID
& aIID
);
677 const EventTypeData
* GetTypeDataForEventName(nsAtom
* aName
);
678 nsPIDOMWindowInner
* GetInnerWindowForTarget();
679 already_AddRefed
<nsPIDOMWindowInner
> GetTargetAsInnerWindow() const;
681 bool ListenerCanHandle(const Listener
* aListener
, const WidgetEvent
* aEvent
,
682 EventMessage aEventMessage
) const;
684 // BE AWARE, a lot of instances of EventListenerManager will be created.
685 // Therefor, we need to keep this class compact. When you add integer
686 // members, please add them to EventListemerManagerBase and check the size
689 already_AddRefed
<nsIScriptGlobalObject
> GetScriptGlobalAndDocument(
690 mozilla::dom::Document
** aDoc
);
692 void MaybeMarkPassive(EventMessage aMessage
, EventListenerFlags
& aFlags
);
694 nsAutoTObserverArray
<Listener
, 2> mListeners
;
695 dom::EventTarget
* MOZ_NON_OWNING_REF mTarget
;
696 RefPtr
<nsAtom
> mNoListenerForEventAtom
;
698 friend class ELMCreationDetector
;
699 static uint32_t sMainThreadCreatedCount
;
702 } // namespace mozilla
704 #endif // mozilla_EventListenerManager_h_