Bug 1769952 - Fix running raptor on a Win10-64 VM r=sparky
[gecko.git] / dom / events / nsIEventListenerService.idl
blob45d835a4637872f9199af2061bfe0c8e20bd87ec
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"
8 webidl EventTarget;
10 interface nsIArray;
12 /**
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;
21 [noscript]
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);
31 /**
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
38 /**
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;
47 /**
48 * Changing the enabled state works only with listeners implemented in
49 * JS. An error is thrown for native listeners.
51 attribute boolean enabled;
53 /**
54 * The underlying JS object of the event listener, if this listener
55 * has one. Null otherwise.
57 [implicit_jscontext]
58 readonly attribute jsval listenerObject;
60 /**
61 * Tries to serialize event listener to a string.
62 * Returns null if serialization isn't possible
63 * (for example with C++ listeners).
65 AString toSource();
68 [scriptable, uuid(77aab5f7-213d-4db4-9f22-e46dfb774f15)]
69 interface nsIEventListenerService : nsISupports
71 /**
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);
77 /**
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.
85 [can_run_script]
86 Array<EventTarget> getEventTargetChainFor(in EventTarget aEventTarget,
87 in boolean composed);
89 /**
90 * Returns true if a event target has any listener for the given type.
92 boolean hasListenersFor(in EventTarget aEventTarget,
93 in AString aType);
95 /**
96 * Add a system-group eventlistener to a event target.
98 [implicit_jscontext]
99 void addSystemEventListener(in EventTarget target,
100 in AString type,
101 in jsval listener,
102 in boolean useCapture);
105 * Remove a system-group eventlistener from a event target.
107 [implicit_jscontext]
108 void removeSystemEventListener(in EventTarget target,
109 in AString type,
110 in jsval listener,
111 in boolean useCapture);
113 [implicit_jscontext]
114 void addListenerForAllEvents(in EventTarget target,
115 in jsval listener,
116 [optional] in boolean aUseCapture,
117 [optional] in boolean aWantsUntrusted,
118 [optional] in boolean aSystemEventGroup);
120 [implicit_jscontext]
121 void removeListenerForAllEvents(in EventTarget target,
122 in jsval listener,
123 [optional] in boolean aUseCapture,
124 [optional] in boolean aSystemEventGroup);
126 void addListenerChangeListener(in nsIListenerChangeListener aListener);
127 void removeListenerChangeListener(in nsIListenerChangeListener aListener);