tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsIEventListenerService.idl (3199B)


      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/. */
      5 
      6 #include "nsISupports.idl"
      7 
      8 webidl EventTarget;
      9 
     10 interface nsIArray;
     11 
     12 /**
     13 * Contains an event target along with a count of event listener changes
     14 * affecting accessibility.
     15 */
     16 [scriptable, uuid(07222b02-da12-4cf4-b2f7-761da007a8d8)]
     17 interface nsIEventListenerChange : nsISupports
     18 {
     19  readonly attribute EventTarget target;
     20 
     21  [noscript]
     22  readonly attribute uint32_t countOfEventListenerChangesAffectingAccessibility;
     23 };
     24 
     25 [scriptable, function, uuid(aa7c95f6-d3b5-44b3-9597-1d9f19b9c5f2)]
     26 interface nsIListenerChangeListener : nsISupports
     27 {
     28  void listenersChanged(in nsIArray aEventListenerChanges);
     29 };
     30 
     31 /**
     32 * An instance of this interface describes how an event listener
     33 * was added to an event target.
     34 */
     35 [scriptable, uuid(11ba5fd7-8db2-4b1a-9f67-342cfa11afad)]
     36 interface nsIEventListenerInfo : nsISupports
     37 {
     38  /**
     39   * The type of the event for which the listener was added.
     40   * Null if the listener is for all the events.
     41   */
     42  readonly attribute AString type;
     43  readonly attribute boolean capturing;
     44  readonly attribute boolean allowsUntrusted;
     45  readonly attribute boolean inSystemEventGroup;
     46 
     47  /**
     48   * Changing the enabled state works only with listeners implemented in
     49   * JS. An error is thrown for native listeners.
     50   */
     51  attribute boolean enabled;
     52 
     53  /**
     54   * The underlying JS object of the event listener, if this listener
     55   * has one.  Null otherwise.
     56   */
     57  [implicit_jscontext]
     58  readonly attribute jsval listenerObject;
     59 
     60  /**
     61   * Tries to serialize event listener to a string.
     62   * Returns null if serialization isn't possible
     63   * (for example with C++ listeners).
     64   */
     65  AString toSource();
     66 };
     67 
     68 [scriptable, uuid(77aab5f7-213d-4db4-9f22-e46dfb774f15)]
     69 interface nsIEventListenerService : nsISupports
     70 {
     71  /**
     72   * Returns an array of nsIEventListenerInfo objects.
     73   * If aEventTarget doesn't have any listeners, this returns null.
     74   */
     75  Array<nsIEventListenerInfo> getListenerInfoFor(in EventTarget aEventTarget);
     76 
     77  /**
     78   * Returns true if a event target has any listener for the given type.
     79   */
     80  boolean hasListenersFor(in EventTarget aEventTarget,
     81                          in AString aType);
     82 
     83  [implicit_jscontext]
     84  void addListenerForAllEvents(in EventTarget target,
     85                               in jsval listener,
     86                               [optional] in boolean aUseCapture,
     87                               [optional] in boolean aWantsUntrusted,
     88                               [optional] in boolean aSystemEventGroup);
     89 
     90  [implicit_jscontext]
     91  void removeListenerForAllEvents(in EventTarget target,
     92                                  in jsval listener,
     93                                  [optional] in boolean aUseCapture,
     94                                  [optional] in boolean aSystemEventGroup);
     95 
     96  void addListenerChangeListener(in nsIListenerChangeListener aListener);
     97  void removeListenerChangeListener(in nsIListenerChangeListener aListener);
     98 };