dom/events/nsIEventListenerService.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsISupports.idl"
michael@0 7
michael@0 8 interface nsIDOMEventListener;
michael@0 9 interface nsIDOMEventTarget;
michael@0 10
michael@0 11 /**
michael@0 12 * An instance of this interface describes how an event listener
michael@0 13 * was added to an event target.
michael@0 14 */
michael@0 15 [scriptable, uuid(c4776eb7-05bc-49ce-a0ca-6213a346d53a)]
michael@0 16 interface nsIEventListenerInfo : nsISupports
michael@0 17 {
michael@0 18 /**
michael@0 19 * The type of the event for which the listener was added.
michael@0 20 * Null if the listener is for all the events.
michael@0 21 */
michael@0 22 readonly attribute AString type;
michael@0 23 readonly attribute boolean capturing;
michael@0 24 readonly attribute boolean allowsUntrusted;
michael@0 25 readonly attribute boolean inSystemEventGroup;
michael@0 26
michael@0 27 /**
michael@0 28 * The underlying JS object of the event listener, if this listener
michael@0 29 * has one. Null otherwise.
michael@0 30 */
michael@0 31 [implicit_jscontext]
michael@0 32 readonly attribute jsval listenerObject;
michael@0 33
michael@0 34 /**
michael@0 35 * Tries to serialize event listener to a string.
michael@0 36 * Returns null if serialization isn't possible
michael@0 37 * (for example with C++ listeners).
michael@0 38 */
michael@0 39 AString toSource();
michael@0 40
michael@0 41 /**
michael@0 42 * If jsdIDebuggerService is active and the listener is implemented in JS,
michael@0 43 * this returns the listener as a jsdIValue. Otherwise null.
michael@0 44 */
michael@0 45 nsISupports getDebugObject();
michael@0 46 };
michael@0 47
michael@0 48 [scriptable, uuid(f6964bfb-dabe-4cab-9733-be0ee2bf8171)]
michael@0 49 interface nsIEventListenerService : nsISupports
michael@0 50 {
michael@0 51 /**
michael@0 52 * Returns an array of nsIEventListenerInfo objects.
michael@0 53 * If aEventTarget doesn't have any listeners, this returns null.
michael@0 54 */
michael@0 55 void getListenerInfoFor(in nsIDOMEventTarget aEventTarget,
michael@0 56 [optional] out unsigned long aCount,
michael@0 57 [retval, array, size_is(aCount)] out
michael@0 58 nsIEventListenerInfo aOutArray);
michael@0 59
michael@0 60 /**
michael@0 61 * Returns an array of event targets.
michael@0 62 * aEventTarget will be at index 0.
michael@0 63 * The objects are the ones that would be used as DOMEvent.currentTarget while
michael@0 64 * dispatching an event to aEventTarget
michael@0 65 * @note Some events, especially 'load', may actually have a shorter
michael@0 66 * event target chain than what this methods returns.
michael@0 67 */
michael@0 68 void getEventTargetChainFor(in nsIDOMEventTarget aEventTarget,
michael@0 69 [optional] out unsigned long aCount,
michael@0 70 [retval, array, size_is(aCount)] out
michael@0 71 nsIDOMEventTarget aOutArray);
michael@0 72
michael@0 73 /**
michael@0 74 * Returns true if a event target has any listener for the given type.
michael@0 75 */
michael@0 76 boolean hasListenersFor(in nsIDOMEventTarget aEventTarget,
michael@0 77 in DOMString aType);
michael@0 78
michael@0 79 /**
michael@0 80 * Add a system-group eventlistener to a event target.
michael@0 81 */
michael@0 82 void addSystemEventListener(in nsIDOMEventTarget target,
michael@0 83 in DOMString type,
michael@0 84 in nsIDOMEventListener listener,
michael@0 85 in boolean useCapture);
michael@0 86
michael@0 87 /**
michael@0 88 * Remove a system-group eventlistener from a event target.
michael@0 89 */
michael@0 90 void removeSystemEventListener(in nsIDOMEventTarget target,
michael@0 91 in DOMString type,
michael@0 92 in nsIDOMEventListener listener,
michael@0 93 in boolean useCapture);
michael@0 94
michael@0 95 void addListenerForAllEvents(in nsIDOMEventTarget target,
michael@0 96 in nsIDOMEventListener listener,
michael@0 97 [optional] in boolean aUseCapture,
michael@0 98 [optional] in boolean aWantsUntrusted,
michael@0 99 [optional] in boolean aSystemEventGroup);
michael@0 100
michael@0 101 void removeListenerForAllEvents(in nsIDOMEventTarget target,
michael@0 102 in nsIDOMEventListener listener,
michael@0 103 [optional] in boolean aUseCapture,
michael@0 104 [optional] in boolean aSystemEventGroup);
michael@0 105 };
michael@0 106

mercurial