tor-browser

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

EventTarget.webidl (2706B)


      1 /* -*- Mode: IDL; 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 file,
      4 * You can obtain one at http://mozilla.org/MPL/2.0/.
      5 *
      6 * The origin of this IDL file is
      7 * http://www.w3.org/TR/2012/WD-dom-20120105/
      8 *
      9 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
     10 * liability, trademark and document use rules apply.
     11 */
     12 
     13 
     14 dictionary EventListenerOptions {
     15  boolean capture = false;
     16  /* Setting to true make the listener be added to the system group. */
     17  [Func="ThreadSafeIsChromeOrUAWidget"]
     18  boolean mozSystemGroup = false;
     19 };
     20 
     21 dictionary AddEventListenerOptions : EventListenerOptions {
     22  boolean passive;
     23  boolean once = false;
     24  AbortSignal signal;
     25  [ChromeOnly]
     26  boolean wantUntrusted;
     27 };
     28 
     29 [Exposed=*]
     30 interface EventTarget {
     31  [Throws]
     32  constructor();
     33 
     34  /* Passing null for wantsUntrusted means "default behavior", which
     35     differs in content and chrome.  In content that default boolean
     36     value is true, while in chrome the default boolean value is
     37     false. */
     38  undefined addEventListener(DOMString type,
     39                             EventListener? listener,
     40                             optional (AddEventListenerOptions or boolean) options = {},
     41                             optional boolean? wantsUntrusted = null);
     42  undefined removeEventListener(DOMString type,
     43                                EventListener? listener,
     44                                optional (EventListenerOptions or boolean) options = {});
     45  [Throws, NeedsCallerType]
     46  boolean dispatchEvent(Event event);
     47 };
     48 
     49 // Mozilla extensions for use by JS-implemented event targets to
     50 // implement on* properties.
     51 partial interface EventTarget {
     52  // The use of [TreatNonCallableAsNull] here is a bit of a hack: it just makes
     53  // the codegen check whether the type involved is either
     54  // [TreatNonCallableAsNull] or [TreatNonObjectAsNull] and if it is handle it
     55  // accordingly.  In particular, it will NOT actually treat a non-null
     56  // non-callable object as null here.
     57  [ChromeOnly, Throws]
     58  undefined setEventHandler(DOMString type,
     59                            [TreatNonCallableAsNull] EventHandler handler);
     60 
     61  [ChromeOnly]
     62  EventHandler getEventHandler(DOMString type);
     63 };
     64 
     65 // Mozilla extension to make firing events on event targets from
     66 // chrome easier.  This returns the window which can be used to create
     67 // events to fire at this EventTarget, or null if there isn't one.
     68 partial interface EventTarget {
     69  [ChromeOnly, Exposed=Window, BinaryName="ownerGlobalForBindings"]
     70  readonly attribute WindowProxy? ownerGlobal;
     71 };