Issue #2332 - Have addIceCandidate take a dictionary

Backport of https://bugzilla.mozilla.org/show_bug.cgi?id=1263312 part 2
This commit is contained in:
Basilisk-Dev 2023-10-09 17:04:07 -04:00 committed by roytam1
commit 80a3c49ba2
3 changed files with 24 additions and 18 deletions

View file

@ -985,12 +985,15 @@ RTCPeerConnection.prototype = {
containsTrickle(topSection) || sections.every(containsTrickle);
},
addIceCandidate: function(c, onSuccess, onError) {
return this._legacyCatchAndCloseGuard(onSuccess, onError, () => {
if (!c.candidate && !c.sdpMLineIndex) {
throw new this._win.DOMException("Invalid candidate passed to addIceCandidate!",
"InvalidParameterError");
if (!c) {
// TODO: Implement processing for end-of-candidates (bug 1318167)
return Promise.resolve();
}
if (c.sdpMid === null && c.sdpMLineIndex === null) {
throw new this._win.DOMException("Invalid candidate (both sdpMid and sdpMLineIndex are null).",
"TypeError");
}
return this._chain(() => new this._win.Promise((resolve, reject) => {
this._onAddIceCandidateSuccess = resolve;