author Dennis Jackson <>
Sun, 26 Mar 2023 07:31:40 +0000
changeset 657950 dee1eb3308521b4cb7c8a3afe44520efcf582650
parent 656685 cb59dcbe34f2b40958ef23c01d34ca9b04f04231
permissions -rw-r--r--
Bug 1822876: Add H3 ECH Telemetry. r=kershaw,necko-reviewers This patch adds telemetry which records when H3 connections succeed / fail and what kind of ECH they used. Our H3 ECH tests are extended to test these different modes and that the telemetry is recorded correctly. Differential Revision:

/* -*- 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
 * The origin of this IDL file is

callback RTCSessionDescriptionCallback = undefined (RTCSessionDescriptionInit description);
callback RTCPeerConnectionErrorCallback = undefined (DOMException error);
callback RTCStatsCallback = undefined (RTCStatsReport report);

enum RTCSignalingState {

enum RTCIceGatheringState {

enum RTCIceConnectionState {

enum RTCPeerConnectionState {

enum mozPacketDumpType {
  "rtp", // dump unencrypted rtp as the MediaPipeline sees it
  "srtp", // dump encrypted rtp as the MediaPipeline sees it
  "rtcp", // dump unencrypted rtcp as the MediaPipeline sees it
  "srtcp" // dump encrypted rtcp as the MediaPipeline sees it

callback mozPacketCallback = undefined (unsigned long level,
                                        mozPacketDumpType type,
                                        boolean sending,
                                        ArrayBuffer packet);

dictionary RTCDataChannelInit {
  boolean        ordered = true;
  unsigned short maxPacketLifeTime;
  unsigned short maxRetransmits;
  DOMString      protocol = "";
  boolean        negotiated = false;
  unsigned short id;

  // These are deprecated due to renaming in the spec, but still supported for Fx53
  unsigned short maxRetransmitTime;

dictionary RTCOfferAnswerOptions {
//  boolean voiceActivityDetection = true; // TODO: support this (Bug 1184712)

dictionary RTCAnswerOptions : RTCOfferAnswerOptions {

dictionary RTCOfferOptions : RTCOfferAnswerOptions {
  boolean offerToReceiveVideo;
  boolean offerToReceiveAudio;
  boolean iceRestart = false;

interface RTCPeerConnection : EventTarget  {
  constructor(optional RTCConfiguration configuration = {},
              optional object? constraints);

  [Throws, StaticClassOverride="mozilla::dom::RTCCertificate"]
  static Promise<RTCCertificate> generateCertificate (AlgorithmIdentifier keygenAlgorithm);

  undefined setIdentityProvider (DOMString provider,
                                 optional RTCIdentityProviderOptions options = {});
  Promise<DOMString> getIdentityAssertion();
  Promise<RTCSessionDescriptionInit> createOffer (optional RTCOfferOptions options = {});
  Promise<RTCSessionDescriptionInit> createAnswer (optional RTCAnswerOptions options = {});
  Promise<undefined> setLocalDescription (optional RTCSessionDescriptionInit description = {});
  Promise<undefined> setRemoteDescription (optional RTCSessionDescriptionInit description = {});
  readonly attribute RTCSessionDescription? localDescription;
  readonly attribute RTCSessionDescription? currentLocalDescription;
  readonly attribute RTCSessionDescription? pendingLocalDescription;
  readonly attribute RTCSessionDescription? remoteDescription;
  readonly attribute RTCSessionDescription? currentRemoteDescription;
  readonly attribute RTCSessionDescription? pendingRemoteDescription;
  readonly attribute RTCSignalingState signalingState;
  Promise<undefined> addIceCandidate (optional (RTCIceCandidateInit or RTCIceCandidate) candidate = {});
  readonly attribute boolean? canTrickleIceCandidates;
  readonly attribute RTCIceGatheringState iceGatheringState;
  readonly attribute RTCIceConnectionState iceConnectionState;
  readonly attribute RTCPeerConnectionState connectionState;
  undefined restartIce ();
  readonly attribute Promise<RTCIdentityAssertion> peerIdentity;
  readonly attribute DOMString? idpLoginUrl;

  attribute DOMString id;

  RTCConfiguration      getConfiguration ();
  undefined setConfiguration(optional RTCConfiguration configuration = {});
  sequence<MediaStream> getLocalStreams ();
  sequence<MediaStream> getRemoteStreams ();
  undefined addStream (MediaStream stream);

  // replaces addStream; fails if already added
  // because a track can be part of multiple streams, stream parameters
  // indicate which particular streams should be referenced in signaling

  RTCRtpSender addTrack(MediaStreamTrack track,
                        MediaStream... streams);
  undefined removeTrack(RTCRtpSender sender);

  RTCRtpTransceiver addTransceiver((MediaStreamTrack or DOMString) trackOrKind,
                                   optional RTCRtpTransceiverInit init = {});

  sequence<RTCRtpSender> getSenders();
  sequence<RTCRtpReceiver> getReceivers();
  sequence<RTCRtpTransceiver> getTransceivers();

  undefined mozSetPacketCallback(mozPacketCallback callback);
  undefined mozEnablePacketDump(unsigned long level,
                                mozPacketDumpType type,
                                boolean sending);
  undefined mozDisablePacketDump(unsigned long level,
                                 mozPacketDumpType type,
                                 boolean sending);

  undefined close ();
  attribute EventHandler onnegotiationneeded;
  attribute EventHandler onicecandidate;
  attribute EventHandler onsignalingstatechange;
  attribute EventHandler onaddstream; // obsolete
  attribute EventHandler onaddtrack;  // obsolete
  attribute EventHandler ontrack;     // replaces onaddtrack and onaddstream.
  attribute EventHandler oniceconnectionstatechange;
  attribute EventHandler onicegatheringstatechange;
  attribute EventHandler onconnectionstatechange;

  Promise<RTCStatsReport> getStats (optional MediaStreamTrack? selector = null);

  readonly attribute RTCSctpTransport? sctp;
  // Data channel.
  RTCDataChannel createDataChannel (DOMString label,
                                    optional RTCDataChannelInit dataChannelDict = {});
  attribute EventHandler ondatachannel;

// Legacy callback API

partial interface RTCPeerConnection {

  // Dummy Promise<undefined> return values avoid "WebIDL.WebIDLError: error:
  // We have overloads with both Promise and non-Promise return types"

  Promise<undefined> createOffer (RTCSessionDescriptionCallback successCallback,
                                  RTCPeerConnectionErrorCallback failureCallback,
                                  optional RTCOfferOptions options = {});
  Promise<undefined> createAnswer (RTCSessionDescriptionCallback successCallback,
                                   RTCPeerConnectionErrorCallback failureCallback);
  Promise<undefined> setLocalDescription (RTCSessionDescriptionInit description,
                                          VoidFunction successCallback,
                                          RTCPeerConnectionErrorCallback failureCallback);
  Promise<undefined> setRemoteDescription (RTCSessionDescriptionInit description,
                                           VoidFunction successCallback,
                                           RTCPeerConnectionErrorCallback failureCallback);
  Promise<undefined> addIceCandidate (RTCIceCandidate candidate,
                                      VoidFunction successCallback,
                                      RTCPeerConnectionErrorCallback failureCallback);