1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsISupports.idl"
13 * Contains an event target along with a count of event listener changes
14 * affecting accessibility.
16 [scriptable
, uuid(07222b02
-da12
-4cf4
-b2f7
-761da007a8d8
)]
17 interface nsIEventListenerChange
: nsISupports
19 readonly attribute EventTarget target
;
22 readonly attribute uint32_t countOfEventListenerChangesAffectingAccessibility
;
25 [scriptable
, function
, uuid(aa7c95f6
-d3b5
-44b3
-9597-1d9f19b9c5f2
)]
26 interface nsIListenerChangeListener
: nsISupports
28 void listenersChanged
(in nsIArray aEventListenerChanges
);
32 * An instance of this interface describes how an event listener
33 * was added to an event target.
35 [scriptable
, uuid(11ba5fd7
-8db2
-4b1a
-9f67
-342cfa11afad
)]
36 interface nsIEventListenerInfo
: nsISupports
39 * The type of the event for which the listener was added.
40 * Null if the listener is for all the events.
42 readonly attribute AString type
;
43 readonly attribute
boolean capturing
;
44 readonly attribute
boolean allowsUntrusted
;
45 readonly attribute
boolean inSystemEventGroup
;
48 * Changing the enabled state works only with listeners implemented in
49 * JS. An error is thrown for native listeners.
51 attribute
boolean enabled
;
54 * The underlying JS object of the event listener, if this listener
55 * has one. Null otherwise.
58 readonly attribute jsval listenerObject
;
61 * Tries to serialize event listener to a string.
62 * Returns null if serialization isn't possible
63 * (for example with C++ listeners).
68 [scriptable
, uuid(77aab5f7
-213d
-4db4
-9f22
-e46dfb774f15
)]
69 interface nsIEventListenerService
: nsISupports
72 * Returns an array of nsIEventListenerInfo objects.
73 * If aEventTarget doesn't have any listeners, this returns null.
75 Array
<nsIEventListenerInfo
> getListenerInfoFor
(in EventTarget aEventTarget
);
78 * Returns an array of event targets.
79 * aEventTarget will be at index 0.
80 * The objects are the ones that would be used as DOMEvent.currentTarget while
81 * dispatching an event to aEventTarget
82 * @note Some events, especially 'load', may actually have a shorter
83 * event target chain than what this methods returns.
86 Array
<EventTarget
> getEventTargetChainFor
(in EventTarget aEventTarget
,
90 * Returns true if a event target has any listener for the given type.
92 boolean hasListenersFor
(in EventTarget aEventTarget
,
96 * Add a system-group eventlistener to a event target.
99 void addSystemEventListener
(in EventTarget target
,
102 in boolean useCapture
);
105 * Remove a system-group eventlistener from a event target.
108 void removeSystemEventListener
(in EventTarget target
,
111 in boolean useCapture
);
114 void addListenerForAllEvents
(in EventTarget target
,
116 [optional] in boolean aUseCapture
,
117 [optional] in boolean aWantsUntrusted
,
118 [optional] in boolean aSystemEventGroup
);
121 void removeListenerForAllEvents
(in EventTarget target
,
123 [optional] in boolean aUseCapture
,
124 [optional] in boolean aSystemEventGroup
);
126 void addListenerChangeListener
(in nsIListenerChangeListener aListener
);
127 void removeListenerChangeListener
(in nsIListenerChangeListener aListener
);