2009-10-16 12:57:32 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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 12:57:32 +04:00
|
|
|
|
2013-09-23 03:23:30 +04:00
|
|
|
#include "nsISupports.idl"
|
2009-10-16 12:57:32 +04:00
|
|
|
|
2018-04-20 07:49:30 +03:00
|
|
|
webidl EventTarget;
|
|
|
|
|
2015-04-28 23:10:05 +03:00
|
|
|
interface nsIArray;
|
|
|
|
|
2015-07-17 18:07:37 +03:00
|
|
|
/**
|
2017-09-25 09:38:04 +03:00
|
|
|
* Contains an event target along with a count of event listener changes
|
|
|
|
* affecting accessibility.
|
2015-07-17 18:07:37 +03:00
|
|
|
*/
|
|
|
|
[scriptable, uuid(07222b02-da12-4cf4-b2f7-761da007a8d8)]
|
|
|
|
interface nsIEventListenerChange : nsISupports
|
|
|
|
{
|
2018-04-20 07:49:30 +03:00
|
|
|
readonly attribute EventTarget target;
|
2017-09-25 09:38:04 +03:00
|
|
|
|
|
|
|
[noscript]
|
|
|
|
readonly attribute uint32_t countOfEventListenerChangesAffectingAccessibility;
|
2015-07-17 18:07:37 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
[scriptable, function, uuid(aa7c95f6-d3b5-44b3-9597-1d9f19b9c5f2)]
|
2015-04-28 23:10:05 +03:00
|
|
|
interface nsIListenerChangeListener : nsISupports
|
|
|
|
{
|
2015-07-17 18:07:37 +03:00
|
|
|
void listenersChanged(in nsIArray aEventListenerChanges);
|
2015-04-28 23:10:05 +03:00
|
|
|
};
|
2009-10-16 12:57:32 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* An instance of this interface describes how an event listener
|
|
|
|
* was added to an event target.
|
|
|
|
*/
|
2014-06-27 22:05:08 +04:00
|
|
|
[scriptable, uuid(11ba5fd7-8db2-4b1a-9f67-342cfa11afad)]
|
2009-10-16 12:57:32 +04:00
|
|
|
interface nsIEventListenerInfo : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The type of the event for which the listener was added.
|
2013-06-14 21:10:22 +04:00
|
|
|
* Null if the listener is for all the events.
|
2009-10-16 12:57:32 +04:00
|
|
|
*/
|
|
|
|
readonly attribute AString type;
|
|
|
|
readonly attribute boolean capturing;
|
|
|
|
readonly attribute boolean allowsUntrusted;
|
|
|
|
readonly attribute boolean inSystemEventGroup;
|
2013-04-02 01:17:56 +04: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 12:57:32 +04:00
|
|
|
/**
|
|
|
|
* Tries to serialize event listener to a string.
|
|
|
|
* Returns null if serialization isn't possible
|
|
|
|
* (for example with C++ listeners).
|
|
|
|
*/
|
|
|
|
AString toSource();
|
|
|
|
};
|
|
|
|
|
2015-04-28 23:10:05 +03:00
|
|
|
[scriptable, uuid(77aab5f7-213d-4db4-9f22-e46dfb774f15)]
|
2009-10-16 12:57:32 +04:00
|
|
|
interface nsIEventListenerService : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Returns an array of nsIEventListenerInfo objects.
|
|
|
|
* If aEventTarget doesn't have any listeners, this returns null.
|
|
|
|
*/
|
2019-05-11 11:28:29 +03:00
|
|
|
Array<nsIEventListenerInfo> getListenerInfoFor(in EventTarget aEventTarget);
|
2009-10-16 12:57:32 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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-24 06:18:02 +04:00
|
|
|
*/
|
2019-05-11 11:28:29 +03:00
|
|
|
Array<EventTarget> getEventTargetChainFor(in EventTarget aEventTarget,
|
|
|
|
in boolean composed);
|
2010-06-10 05:16:58 +04:00
|
|
|
|
2011-06-24 06:18:02 +04:00
|
|
|
/**
|
|
|
|
* Returns true if a event target has any listener for the given type.
|
|
|
|
*/
|
2018-04-20 07:49:30 +03:00
|
|
|
boolean hasListenersFor(in EventTarget aEventTarget,
|
2018-09-06 11:02:43 +03:00
|
|
|
in AString aType);
|
2011-06-24 06:18:02 +04:00
|
|
|
|
2010-06-10 05:16:58 +04:00
|
|
|
/**
|
2011-06-24 06:18:02 +04:00
|
|
|
* Add a system-group eventlistener to a event target.
|
2010-06-10 05:16:58 +04:00
|
|
|
*/
|
2018-04-11 17:27:01 +03:00
|
|
|
[implicit_jscontext]
|
2018-04-20 07:49:30 +03:00
|
|
|
void addSystemEventListener(in EventTarget target,
|
2018-09-06 11:02:43 +03:00
|
|
|
in AString type,
|
2018-04-11 17:27:01 +03:00
|
|
|
in jsval listener,
|
2011-06-24 06:18:02 +04:00
|
|
|
in boolean useCapture);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a system-group eventlistener from a event target.
|
|
|
|
*/
|
2018-04-11 17:27:01 +03:00
|
|
|
[implicit_jscontext]
|
2018-04-20 07:49:30 +03:00
|
|
|
void removeSystemEventListener(in EventTarget target,
|
2018-09-06 11:02:43 +03:00
|
|
|
in AString type,
|
2018-04-11 17:27:01 +03:00
|
|
|
in jsval listener,
|
2011-06-24 06:18:02 +04:00
|
|
|
in boolean useCapture);
|
2012-11-01 16:42:29 +04:00
|
|
|
|
2018-04-11 17:27:01 +03:00
|
|
|
[implicit_jscontext]
|
2018-04-20 07:49:30 +03:00
|
|
|
void addListenerForAllEvents(in EventTarget target,
|
2018-04-11 17:27:01 +03:00
|
|
|
in jsval listener,
|
2012-11-01 16:42:29 +04:00
|
|
|
[optional] in boolean aUseCapture,
|
|
|
|
[optional] in boolean aWantsUntrusted,
|
|
|
|
[optional] in boolean aSystemEventGroup);
|
|
|
|
|
2018-04-11 17:27:01 +03:00
|
|
|
[implicit_jscontext]
|
2018-04-20 07:49:30 +03:00
|
|
|
void removeListenerForAllEvents(in EventTarget target,
|
2018-04-11 17:27:01 +03:00
|
|
|
in jsval listener,
|
2012-11-01 16:42:29 +04:00
|
|
|
[optional] in boolean aUseCapture,
|
|
|
|
[optional] in boolean aSystemEventGroup);
|
2015-04-28 23:10:05 +03:00
|
|
|
|
|
|
|
void addListenerChangeListener(in nsIListenerChangeListener aListener);
|
|
|
|
void removeListenerChangeListener(in nsIListenerChangeListener aListener);
|
2009-10-16 12:57:32 +04:00
|
|
|
};
|
|
|
|
|