2009-10-16 01:57:32 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2009-10-16 01:57:32 -07:00
|
|
|
|
2013-09-22 16:23:30 -07:00
|
|
|
#include "nsISupports.idl"
|
2009-10-16 01:57:32 -07:00
|
|
|
|
2013-09-22 16:23:30 -07:00
|
|
|
interface nsIDOMEventListener;
|
2009-10-16 01:57:32 -07:00
|
|
|
interface nsIDOMEventTarget;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An instance of this interface describes how an event listener
|
|
|
|
* was added to an event target.
|
|
|
|
*/
|
2014-06-27 11:05:08 -07:00
|
|
|
[scriptable, uuid(11ba5fd7-8db2-4b1a-9f67-342cfa11afad)]
|
2009-10-16 01:57:32 -07:00
|
|
|
interface nsIEventListenerInfo : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The type of the event for which the listener was added.
|
2013-06-14 10:10:22 -07:00
|
|
|
* Null if the listener is for all the events.
|
2009-10-16 01:57:32 -07:00
|
|
|
*/
|
|
|
|
readonly attribute AString type;
|
|
|
|
readonly attribute boolean capturing;
|
|
|
|
readonly attribute boolean allowsUntrusted;
|
|
|
|
readonly attribute boolean inSystemEventGroup;
|
2013-04-01 14:17:56 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The underlying JS object of the event listener, if this listener
|
|
|
|
* has one. Null otherwise.
|
|
|
|
*/
|
|
|
|
[implicit_jscontext]
|
|
|
|
readonly attribute jsval listenerObject;
|
|
|
|
|
2009-10-16 01:57:32 -07:00
|
|
|
/**
|
|
|
|
* Tries to serialize event listener to a string.
|
|
|
|
* Returns null if serialization isn't possible
|
|
|
|
* (for example with C++ listeners).
|
|
|
|
*/
|
|
|
|
AString toSource();
|
|
|
|
};
|
|
|
|
|
2012-11-01 05:42:29 -07:00
|
|
|
[scriptable, uuid(f6964bfb-dabe-4cab-9733-be0ee2bf8171)]
|
2009-10-16 01:57:32 -07:00
|
|
|
interface nsIEventListenerService : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Returns an array of nsIEventListenerInfo objects.
|
|
|
|
* If aEventTarget doesn't have any listeners, this returns null.
|
|
|
|
*/
|
|
|
|
void getListenerInfoFor(in nsIDOMEventTarget aEventTarget,
|
2009-10-23 13:24:47 -07:00
|
|
|
[optional] out unsigned long aCount,
|
2009-10-16 01:57:32 -07:00
|
|
|
[retval, array, size_is(aCount)] out
|
|
|
|
nsIEventListenerInfo aOutArray);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an array of event targets.
|
|
|
|
* aEventTarget will be at index 0.
|
|
|
|
* The objects are the ones that would be used as DOMEvent.currentTarget while
|
|
|
|
* dispatching an event to aEventTarget
|
|
|
|
* @note Some events, especially 'load', may actually have a shorter
|
|
|
|
* event target chain than what this methods returns.
|
2011-06-23 19:18:02 -07:00
|
|
|
*/
|
2009-10-16 01:57:32 -07:00
|
|
|
void getEventTargetChainFor(in nsIDOMEventTarget aEventTarget,
|
2009-10-23 13:24:47 -07:00
|
|
|
[optional] out unsigned long aCount,
|
2009-10-16 01:57:32 -07:00
|
|
|
[retval, array, size_is(aCount)] out
|
|
|
|
nsIDOMEventTarget aOutArray);
|
2010-06-09 18:16:58 -07:00
|
|
|
|
2011-06-23 19:18:02 -07:00
|
|
|
/**
|
|
|
|
* Returns true if a event target has any listener for the given type.
|
|
|
|
*/
|
|
|
|
boolean hasListenersFor(in nsIDOMEventTarget aEventTarget,
|
|
|
|
in DOMString aType);
|
|
|
|
|
2010-06-09 18:16:58 -07:00
|
|
|
/**
|
2011-06-23 19:18:02 -07:00
|
|
|
* Add a system-group eventlistener to a event target.
|
2010-06-09 18:16:58 -07:00
|
|
|
*/
|
2011-06-23 19:18:02 -07:00
|
|
|
void addSystemEventListener(in nsIDOMEventTarget target,
|
|
|
|
in DOMString type,
|
|
|
|
in nsIDOMEventListener listener,
|
|
|
|
in boolean useCapture);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a system-group eventlistener from a event target.
|
|
|
|
*/
|
|
|
|
void removeSystemEventListener(in nsIDOMEventTarget target,
|
|
|
|
in DOMString type,
|
|
|
|
in nsIDOMEventListener listener,
|
|
|
|
in boolean useCapture);
|
2012-11-01 05:42:29 -07:00
|
|
|
|
|
|
|
void addListenerForAllEvents(in nsIDOMEventTarget target,
|
|
|
|
in nsIDOMEventListener listener,
|
|
|
|
[optional] in boolean aUseCapture,
|
|
|
|
[optional] in boolean aWantsUntrusted,
|
|
|
|
[optional] in boolean aSystemEventGroup);
|
|
|
|
|
|
|
|
void removeListenerForAllEvents(in nsIDOMEventTarget target,
|
|
|
|
in nsIDOMEventListener listener,
|
|
|
|
[optional] in boolean aUseCapture,
|
|
|
|
[optional] in boolean aSystemEventGroup);
|
2009-10-16 01:57:32 -07:00
|
|
|
};
|
|
|
|
|