dom/webidl/RTCPeerConnectionStatic.webidl
author Butkovits Atila <abutkovits@mozilla.com>
Tue, 27 Sep 2022 12:37:10 +0300
changeset 636455 170f356185eb469b153bc62d1a203e66a25a8035
parent 635948 8a62d45d03cfe41d7f33b9e629d4ed03b9b4abba
permissions -rw-r--r--
Backed out 2 changesets (bug 1655598) for causing Bug 1792435. a=backout Backed out changeset 9eb3b3e7295b (bug 1655598) Backed out changeset 052c6f05c623 (bug 1655598)

/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/.
 */

/*
  Right now, it is not possible to add static functions to a JS implemented
  interface (see bug 863952), so we need to create a simple interface with a
  trivial constructor and no data to hold these functions that really ought to
  be static in RTCPeerConnection.
  TODO(bcampen@mozilla.com) Merge this code into RTCPeerConnection once this
  limitation is gone. (Bug 1017082)
*/

enum RTCLifecycleEvent {
    "initialized",
    "icegatheringstatechange",
    "iceconnectionstatechange"
};

callback PeerConnectionLifecycleCallback = undefined (RTCPeerConnection pc,
                                                      unsigned long long windowId,
                                                      RTCLifecycleEvent eventType);

[ChromeOnly,
 Pref="media.peerconnection.enabled",
 JSImplementation="@mozilla.org/dom/peerconnectionstatic;1",
 Exposed=Window]
interface RTCPeerConnectionStatic {
  [Throws]
  constructor();

  /* One slot per window (the window in which the register call is made),
     automatically unregistered when window goes away.
     Fires when a PC is created, and whenever the ICE connection state or
     gathering state changes. */
  undefined registerPeerConnectionLifecycleCallback(
    PeerConnectionLifecycleCallback cb);
};