Skip to content
This repository was archived by the owner on Feb 25, 2026. It is now read-only.
This repository was archived by the owner on Feb 25, 2026. It is now read-only.

Wrong usage of RTCIceGatherOptions dictionaries on examples #464

Description

@murillo128

Accroding to WebIDL definition, directories are asociative array data type with a fixed, ordered set of key–value pairs (https://www.w3.org/TR/WebIDL/#idl-dictionaries). The don't have a constructor, so in javascript a normal object mus be used when creating a dictionary.

But in several examples, for example, the RTCIceGatherOptions is created via a constructor (which is wrong).

// Create ICE gather options
var gatherOptions = new RTCIceGatherOptions();
gatherOptions.gatherPolicy = RTCIceGatherPolicy.relay;
gatherOptions.iceServers = [
  { urls: "stun:stun1.example.net" },
  { urls: "turn:turn.example.org", username: "user", credential: "myPassword", credentialType: "password" }
];

It sould be

// Create ICE gather options
var gatherOptions = {};
gatherOptions.gatherPolicy = RTCIceGatherPolicy.relay;
gatherOptions.iceServers = [
  { urls: "stun:stun1.example.net" },
  { urls: "turn:turn.example.org", username: "user", credential: "myPassword", credentialType: "password" }
];

or even better:

// Create ICE gather options
var gatherOptions = {
  gatherPolicy : RTCIceGatherPolicy.relay,
  gatherOptions.iceServers : [
    { urls: "stun:stun1.example.net" },
    { urls: "turn:turn.example.org", username: "user", credential: "myPassword", credentialType: "password" }
  ]
};

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions