summaryrefslogtreecommitdiff
path: root/dom
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2023-10-10 11:13:22 +0000
committerMoonchild <moonchild@palemoon.org>2023-10-10 11:13:22 +0000
commitcdfd243b5ab6848fe169e6aef426d953b296ffbd (patch)
tree592a9386995b895476337c0482ee08f1ec06b504 /dom
parentb32687387167a35e9ab249889f6222a2c1aacdaf (diff)
parent95a8edc5fc34800f4823a216fad64de5b966d0a0 (diff)
downloaduxp-cdfd243b5ab6848fe169e6aef426d953b296ffbd.tar.gz
Merge pull request 'Issue #2332 - WebRTC Spec Updates' (#2338) from Basilisk-Dev/UXP-contrib:master into master
Reviewed-on: https://repo.palemoon.org/MoonchildProductions/UXP/pulls/2338
Diffstat (limited to 'dom')
-rw-r--r--dom/media/PeerConnection.js92
-rw-r--r--dom/media/tests/mochitest/identity/test_fingerprints.html3
-rw-r--r--dom/media/tests/mochitest/pc.js12
-rw-r--r--dom/media/tests/mochitest/templates.js2
-rw-r--r--dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html43
-rw-r--r--dom/media/tests/mochitest/test_peerConnection_closeDuringIce.html4
-rw-r--r--dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html6
-rw-r--r--dom/media/tests/mochitest/test_peerConnection_iceFailure.html4
-rw-r--r--dom/media/tests/mochitest/test_peerConnection_localReofferRollback.html7
-rw-r--r--dom/media/tests/mochitest/test_peerConnection_localRollback.html7
-rw-r--r--dom/media/tests/mochitest/test_peerConnection_remoteReofferRollback.html6
-rw-r--r--dom/media/tests/mochitest/test_peerConnection_remoteRollback.html6
-rw-r--r--dom/media/tests/mochitest/test_peerConnection_restartIceLocalAndRemoteRollback.html6
-rw-r--r--dom/media/tests/mochitest/test_peerConnection_restartIceLocalRollback.html8
-rw-r--r--dom/webidl/RTCIceCandidate.webidl8
-rw-r--r--dom/webidl/RTCPeerConnection.webidl16
-rw-r--r--dom/webidl/RTCSessionDescription.webidl9
17 files changed, 128 insertions, 111 deletions
diff --git a/dom/media/PeerConnection.js b/dom/media/PeerConnection.js
index 622b1f08be..e4612f8316 100644
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -38,6 +38,16 @@ const PC_RECEIVER_CID = Components.ID("{d974b814-8fde-411c-8c45-b86791b81030}");
const PC_COREQUEST_CID = Components.ID("{74b2122d-65a8-4824-aa9e-3d664cb75dc2}");
const PC_DTMF_SENDER_CID = Components.ID("{3610C242-654E-11E6-8EC0-6D1BE389A607}");
+function logMsg(msg, file, line, flag, winID) {
+ let scriptErrorClass = Cc["@mozilla.org/scripterror;1"];
+ let scriptError = scriptErrorClass.createInstance(Ci.nsIScriptError);
+ scriptError.initWithWindowID(msg, file, null, line, 0, flag,
+ "content javascript", winID);
+ let console = Cc["@mozilla.org/consoleservice;1"].
+ getService(Ci.nsIConsoleService);
+ console.logMessage(scriptError);
+};
+
// Global list of PeerConnection objects, so they can be cleaned up when
// a page is torn down. (Maps inner window ID to an array of PC objects).
function GlobalPCList() {
@@ -217,9 +227,7 @@ GlobalPCList.prototype = {
};
var _globalPCList = new GlobalPCList();
-function RTCIceCandidate() {
- this.candidate = this.sdpMid = this.sdpMLineIndex = null;
-}
+function RTCIceCandidate() {}
RTCIceCandidate.prototype = {
classDescription: "RTCIceCandidate",
classID: PC_ICE_CID,
@@ -230,15 +238,11 @@ RTCIceCandidate.prototype = {
init: function(win) { this._win = win; },
__init: function(dict) {
- this.candidate = dict.candidate;
- this.sdpMid = dict.sdpMid;
- this.sdpMLineIndex = ("sdpMLineIndex" in dict)? dict.sdpMLineIndex : null;
+ Object.assign(this, dict);
}
};
-function RTCSessionDescription() {
- this.type = this.sdp = null;
-}
+function RTCSessionDescription() {}
RTCSessionDescription.prototype = {
classDescription: "RTCSessionDescription",
classID: PC_SESSION_CID,
@@ -246,11 +250,41 @@ RTCSessionDescription.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
Ci.nsIDOMGlobalPropertyInitializer]),
- init: function(win) { this._win = win; },
+ init: function(win) {
+ this._win = win;
+ this._winID = this._win.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
+ },
- __init: function(dict) {
- this.type = dict.type;
- this.sdp = dict.sdp;
+ __init: function({ type, sdp }) {
+ Object.assign(this, { _type: type, _sdp: sdp });
+ },
+
+ get type() { return this._type; },
+ set type(type) {
+ this.warn();
+ this._type = type;
+ },
+
+ get sdp() { return this._sdp; },
+ set sdp(sdp) {
+ this.warn();
+ this._sdp = sdp;
+ },
+
+ warn: function() {
+ if (!this._warned) {
+ // Warn once per RTCSessionDescription about deprecated writable usage.
+ this.logWarning("RTCSessionDescription's members are readonly! " +
+ "Writing to them is deprecated and will break soon!");
+ this._warned = true;
+ }
+ },
+
+ logWarning: function(msg) {
+ let err = this._win.Error();
+ logMsg(msg, err.fileName, err.lineNumber, Ci.nsIScriptError.warningFlag,
+ this._winID);
}
};
@@ -645,13 +679,7 @@ RTCPeerConnection.prototype = {
},
logMsg: function(msg, file, line, flag) {
- let scriptErrorClass = Cc["@mozilla.org/scripterror;1"];
- let scriptError = scriptErrorClass.createInstance(Ci.nsIScriptError);
- scriptError.initWithWindowID(msg, file, null, line, 0, flag,
- "content javascript", this._winID);
- let console = Cc["@mozilla.org/consoleservice;1"].
- getService(Ci.nsIConsoleService);
- console.logMessage(scriptError);
+ return logMsg(msg, file, line, flag, this._winID);
},
getEH: function(type) {
@@ -711,8 +739,7 @@ RTCPeerConnection.prototype = {
this._impl.createOffer(options);
}));
p = this._addIdentityAssertion(p, origin);
- return p.then(
- sdp => new this._win.RTCSessionDescription({ type: "offer", sdp: sdp }));
+ return p.then(sdp => Cu.cloneInto({ type: "offer", sdp: sdp }, this._win));
});
});
},
@@ -746,9 +773,7 @@ RTCPeerConnection.prototype = {
this._impl.createAnswer();
}));
p = this._addIdentityAssertion(p, origin);
- return p.then(sdp => {
- return new this._win.RTCSessionDescription({ type: "answer", sdp: sdp });
- });
+ return p.then(sdp => Cu.cloneInto({ type: "answer", sdp: sdp }, this._win));
});
});
},
@@ -957,12 +982,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;
@@ -1106,8 +1134,7 @@ RTCPeerConnection.prototype = {
return null;
}
- return new this._win.RTCSessionDescription({ type: this._localType,
- sdp: sdp });
+ return new this._win.RTCSessionDescription({ type: this._localType, sdp });
},
get remoteDescription() {
@@ -1116,8 +1143,7 @@ RTCPeerConnection.prototype = {
if (sdp.length == 0) {
return null;
}
- return new this._win.RTCSessionDescription({ type: this._remoteType,
- sdp: sdp });
+ return new this._win.RTCSessionDescription({ type: this._remoteType, sdp });
},
get peerIdentity() { return this._peerIdentity; },
diff --git a/dom/media/tests/mochitest/identity/test_fingerprints.html b/dom/media/tests/mochitest/identity/test_fingerprints.html
index 0fd065af26..bf26c2fdd5 100644
--- a/dom/media/tests/mochitest/identity/test_fingerprints.html
+++ b/dom/media/tests/mochitest/identity/test_fingerprints.html
@@ -86,8 +86,7 @@ function testMultipleFingerprints() {
fingerprintSdp(fingerprints.slice(1)) +
offer.sdp.slice(match.index);
- var desc = new RTCSessionDescription({ type: 'offer', sdp: sdp });
- return pcStrict.setRemoteDescription(desc);
+ return pcStrict.setRemoteDescription({ type: 'offer', sdp });
})
.then(() => {
ok(true, 'Modified fingerprints were accepted');
diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js
index 2e9c7c63f1..4363841da7 100644
--- a/dom/media/tests/mochitest/pc.js
+++ b/dom/media/tests/mochitest/pc.js
@@ -334,7 +334,7 @@ PeerConnectionTest.prototype.createOffer = function(peer) {
*
* @param {PeerConnectionWrapper} peer
The peer connection wrapper to run the command on
- * @param {RTCSessionDescription} desc
+ * @param {RTCSessionDescriptionInit} desc
* Session description for the local description request
*/
PeerConnectionTest.prototype.setLocalDescription =
@@ -403,7 +403,7 @@ PeerConnectionTest.prototype.setOfferOptions = function(options) {
*
* @param {PeerConnectionWrapper} peer
The peer connection wrapper to run the command on
- * @param {RTCSessionDescription} desc
+ * @param {RTCSessionDescriptionInit} desc
* Session description for the remote description request
*/
PeerConnectionTest.prototype.setRemoteDescription =
@@ -1064,7 +1064,7 @@ PeerConnectionWrapper.prototype = {
* Sets the local description and automatically handles the failure case.
*
* @param {object} desc
- * RTCSessionDescription for the local description request
+ * RTCSessionDescriptionInit for the local description request
*/
setLocalDescription : function(desc) {
this.observedNegotiationNeeded = undefined;
@@ -1078,7 +1078,7 @@ PeerConnectionWrapper.prototype = {
* causes the test case to fail if the call succeeds.
*
* @param {object} desc
- * RTCSessionDescription for the local description request
+ * RTCSessionDescriptionInit for the local description request
* @returns {Promise}
* A promise that resolves to the expected error
*/
@@ -1095,7 +1095,7 @@ PeerConnectionWrapper.prototype = {
* Sets the remote description and automatically handles the failure case.
*
* @param {object} desc
- * RTCSessionDescription for the remote description request
+ * RTCSessionDescriptionInit for the remote description request
*/
setRemoteDescription : function(desc) {
this.observedNegotiationNeeded = undefined;
@@ -1115,7 +1115,7 @@ PeerConnectionWrapper.prototype = {
* causes the test case to fail if the call succeeds.
*
* @param {object} desc
- * RTCSessionDescription for the remote description request
+ * RTCSessionDescriptionInit for the remote description request
* @returns {Promise}
* a promise that resolve to the returned error
*/
diff --git a/dom/media/tests/mochitest/templates.js b/dom/media/tests/mochitest/templates.js
index 3a8e0dd496..7a149c146e 100644
--- a/dom/media/tests/mochitest/templates.js
+++ b/dom/media/tests/mochitest/templates.js
@@ -118,7 +118,7 @@ var commandsPeerConnectionInitial = [
test.setupSignalingClient();
test.registerSignalingCallback("ice_candidate", function (message) {
var pc = test.pcRemote ? test.pcRemote : test.pcLocal;
- pc.storeOrAddIceCandidate(new RTCIceCandidate(message.ice_candidate));
+ pc.storeOrAddIceCandidate(message.ice_candidate);
});
test.registerSignalingCallback("end_of_trickle_ice", function (message) {
test.signalingMessagesFinished();
diff --git a/dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html b/dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html
index 93cbdd0832..ba0039a513 100644
--- a/dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html
+++ b/dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html
@@ -19,9 +19,9 @@
test.chain.insertAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION", [
function PC_LOCAL_ADD_CANDIDATE_EARLY(test) {
- var candidate = new RTCIceCandidate(
- {candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host",
- sdpMLineIndex: 0});
+ var candidate = {
+ candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host",
+ sdpMLineIndex: 0};
return test.pcLocal._pc.addIceCandidate(candidate).then(
generateErrorCallback("addIceCandidate should have failed."),
err => {
@@ -54,23 +54,23 @@
}
);
},
- function PC_REMOTE_ADD_CANDIDATE_MISSING_INDEX(test) {
- // Note: it is probably not a good idea to automatically fill a missing
- // MLineIndex with a default value of zero, see bug 1157034
+ function PC_REMOTE_ADD_MISSING_MID_AND_MISSING_INDEX(test) {
var broken = new RTCIceCandidate(
{candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host"});
return test.pcRemote._pc.addIceCandidate(broken)
.then(
- // FIXME this needs to be updated once bug 1157034 is fixed
- todo(false, "Missing index in got automatically set to a valid value bz://1157034")
+ generateErrorCallback("addIceCandidate should have failed."),
+ err => {
+ is(err.name, "TypeError", "Error is TypeError");
+ }
);
},
function PC_REMOTE_ADD_VALID_CANDIDATE(test) {
- var candidate = new RTCIceCandidate(
- {candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host",
- sdpMLineIndex: 0});
+ var candidate = {
+ candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host",
+ sdpMLineIndex: 0};
return test.pcRemote._pc.addIceCandidate(candidate)
- .then(ok(true, "Successfully added valid ICE candidate"));
+ .then(() => ok(true, "Successfully added valid ICE candidate"));
},
// bug 1095793
function PC_REMOTE_ADD_MISMATCHED_MID_AND_LEVEL_CANDIDATE(test) {
@@ -79,20 +79,23 @@
sdpMLineIndex: 0,
sdpMid: "sdparta_1"});
return test.pcRemote._pc.addIceCandidate(bogus)
- .then(
- generateErrorCallback("addIceCandidate should have failed."),
- err => {
- is(err.name, "InvalidCandidateError", "Error is InvalidCandidateError");
- }
- );
+ .then(generateErrorCallback("addIceCandidate should have failed."),
+ err => is(err.name, "InvalidCandidateError", "Error is InvalidCandidateError"));
+ },
+ function PC_REMOTE_ADD_MID_AND_MISSING_INDEX(test) {
+ var candidate = new RTCIceCandidate(
+ {candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host",
+ sdpMid: "sdparta_0"});
+ return test.pcRemote._pc.addIceCandidate(candidate)
+ .then(() => ok(true, "Successfully added valid ICE candidate"));
},
function PC_REMOTE_ADD_MATCHING_MID_AND_LEVEL_CANDIDATE(test) {
- var candidate = new mozRTCIceCandidate(
+ var candidate = new RTCIceCandidate(
{candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host",
sdpMLineIndex: 0,
sdpMid: "sdparta_0"});
return test.pcRemote._pc.addIceCandidate(candidate)
- .then(ok(true, "Successfully added valid ICE candidate with matching mid and level"));
+ .then(() => ok(true, "Successfully added valid ICE candidate with matching mid and level"));
}
]);
test.run();
diff --git a/dom/media/tests/mochitest/test_peerConnection_closeDuringIce.html b/dom/media/tests/mochitest/test_peerConnection_closeDuringIce.html
index eb8228d03c..37b2011664 100644
--- a/dom/media/tests/mochitest/test_peerConnection_closeDuringIce.html
+++ b/dom/media/tests/mochitest/test_peerConnection_closeDuringIce.html
@@ -21,12 +21,12 @@ function PC_REMOTE_SETUP_NULL_ICE_HANDLER(test) {
test.pcRemote.setupIceCandidateHandler(test, function() {}, function () {});
}
function PC_REMOTE_ADD_FAKE_ICE_CANDIDATE(test) {
- var cand = new RTCIceCandidate({"candidate":"candidate:0 1 UDP 2130379007 192.0.2.1 12345 typ host","sdpMid":"","sdpMLineIndex":0});
+ var cand = {"candidate":"candidate:0 1 UDP 2130379007 192.0.2.1 12345 typ host","sdpMid":"","sdpMLineIndex":0};
test.pcRemote.storeOrAddIceCandidate(cand);
info(test.pcRemote + " Stored fake candidate: " + JSON.stringify(cand));
}
function PC_LOCAL_ADD_FAKE_ICE_CANDIDATE(test) {
- var cand = new RTCIceCandidate({"candidate":"candidate:0 1 UDP 2130379007 192.0.2.2 56789 typ host","sdpMid":"","sdpMLineIndex":0});
+ var cand = {"candidate":"candidate:0 1 UDP 2130379007 192.0.2.2 56789 typ host","sdpMid":"","sdpMLineIndex":0};
test.pcLocal.storeOrAddIceCandidate(cand);
info(test.pcLocal + " Stored fake candidate: " + JSON.stringify(cand));
}
diff --git a/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html b/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html
index 6d152a4fa6..9ae3b8d50f 100644
--- a/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html
+++ b/dom/media/tests/mochitest/test_peerConnection_errorCallbacks.html
@@ -27,8 +27,7 @@
function testSetLocalDescriptionError() {
var pc = new RTCPeerConnection();
info ("Testing setLocalDescription error");
- return pc.setLocalDescription(new RTCSessionDescription({ sdp: "Picklechips!",
- type: "offer" }))
+ return pc.setLocalDescription({ sdp: "Picklechips!", type: "offer" })
.then(generateErrorCallback("setLocalDescription with nonsense SDP should fail"),
validateReason);
};
@@ -36,8 +35,7 @@
function testSetRemoteDescriptionError() {
var pc = new RTCPeerConnection();
info ("Testing setRemoteDescription error");
- return pc.setRemoteDescription(new RTCSessionDescription({ sdp: "Who?",
- type: "offer" }))
+ return pc.setRemoteDescription({ sdp: "Who?", type: "offer" })
.then(generateErrorCallback("setRemoteDescription with nonsense SDP should fail"),
validateReason);
};
diff --git a/dom/media/tests/mochitest/test_peerConnection_iceFailure.html b/dom/media/tests/mochitest/test_peerConnection_iceFailure.html
index cbdfd018a0..3f6728573f 100644
--- a/dom/media/tests/mochitest/test_peerConnection_iceFailure.html
+++ b/dom/media/tests/mochitest/test_peerConnection_iceFailure.html
@@ -20,12 +20,12 @@ function PC_REMOTE_SETUP_NULL_ICE_HANDLER(test) {
test.pcRemote.setupIceCandidateHandler(test, function() {}, function () {});
}
function PC_REMOTE_ADD_FAKE_ICE_CANDIDATE(test) {
- var cand = new RTCIceCandidate({"candidate":"candidate:0 1 UDP 2130379007 192.0.2.1 12345 typ host","sdpMid":"","sdpMLineIndex":0});
+ var cand = {"candidate":"candidate:0 1 UDP 2130379007 192.0.2.1 12345 typ host","sdpMid":"","sdpMLineIndex":0};
test.pcRemote.storeOrAddIceCandidate(cand);
info(test.pcRemote + " Stored fake candidate: " + JSON.stringify(cand));
}
function PC_LOCAL_ADD_FAKE_ICE_CANDIDATE(test) {
- var cand = new RTCIceCandidate({"candidate":"candidate:0 1 UDP 2130379007 192.0.2.2 56789 typ host","sdpMid":"","sdpMLineIndex":0});
+ var cand = {"candidate":"candidate:0 1 UDP 2130379007 192.0.2.2 56789 typ host","sdpMid":"","sdpMLineIndex":0};
test.pcLocal.storeOrAddIceCandidate(cand);
info(test.pcLocal + " Stored fake candidate: " + JSON.stringify(cand));
}
diff --git a/dom/media/tests/mochitest/test_peerConnection_localReofferRollback.html b/dom/media/tests/mochitest/test_peerConnection_localReofferRollback.html
index 0b0b35fe80..ed149747ca 100644
--- a/dom/media/tests/mochitest/test_peerConnection_localReofferRollback.html
+++ b/dom/media/tests/mochitest/test_peerConnection_localReofferRollback.html
@@ -37,10 +37,9 @@
},
function PC_REMOTE_ROLLBACK(test) {
- return test.setLocalDescription(
- test.pcRemote,
- new RTCSessionDescription({ type: "rollback", sdp: ""}),
- STABLE);
+ return test.setLocalDescription(test.pcRemote,
+ { type: "rollback", sdp: "" },
+ STABLE);
},
// Rolling back should shut down gathering
diff --git a/dom/media/tests/mochitest/test_peerConnection_localRollback.html b/dom/media/tests/mochitest/test_peerConnection_localRollback.html
index 2a35920baa..45ceba844e 100644
--- a/dom/media/tests/mochitest/test_peerConnection_localRollback.html
+++ b/dom/media/tests/mochitest/test_peerConnection_localRollback.html
@@ -23,10 +23,9 @@
},
function PC_REMOTE_ROLLBACK(test) {
- return test.setLocalDescription(
- test.pcRemote,
- new RTCSessionDescription({ type: "rollback", sdp: ""}),
- STABLE);
+ return test.setLocalDescription(test.pcRemote,
+ { type: "rollback", sdp: "" },
+ STABLE);
},
// Rolling back should shut down gathering
diff --git a/dom/media/tests/mochitest/test_peerConnection_remoteReofferRollback.html b/dom/media/tests/mochitest/test_peerConnection_remoteReofferRollback.html
index 6b518e1d29..7580358b86 100644
--- a/dom/media/tests/mochitest/test_peerConnection_remoteReofferRollback.html
+++ b/dom/media/tests/mochitest/test_peerConnection_remoteReofferRollback.html
@@ -35,10 +35,8 @@
},
function PC_REMOTE_ROLLBACK(test) {
- return test.setRemoteDescription(
- test.pcRemote,
- new RTCSessionDescription({ type: "rollback" }),
- STABLE)
+ return test.setRemoteDescription(test.pcRemote, { type: "rollback" },
+ STABLE)
.then(() => test.pcRemote.rollbackRemoteTracksIfNotNegotiated());
},
diff --git a/dom/media/tests/mochitest/test_peerConnection_remoteRollback.html b/dom/media/tests/mochitest/test_peerConnection_remoteRollback.html
index 099628ab88..35a51d03c0 100644
--- a/dom/media/tests/mochitest/test_peerConnection_remoteRollback.html
+++ b/dom/media/tests/mochitest/test_peerConnection_remoteRollback.html
@@ -20,10 +20,8 @@
function PC_REMOTE_ROLLBACK(test) {
// We still haven't negotiated the tracks
test.pcRemote.expectNegotiationNeeded();
- return test.setRemoteDescription(
- test.pcRemote,
- new RTCSessionDescription({ type: "rollback" }),
- STABLE)
+ return test.setRemoteDescription(test.pcRemote, { type: "rollback" },
+ STABLE)
.then(() => test.pcRemote.rollbackRemoteTracksIfNotNegotiated());
},
diff --git a/dom/media/tests/mochitest/test_peerConnection_restartIceLocalAndRemoteRollback.html b/dom/media/tests/mochitest/test_peerConnection_restartIceLocalAndRemoteRollback.html
index e926171644..d2280cee87 100644
--- a/dom/media/tests/mochitest/test_peerConnection_restartIceLocalAndRemoteRollback.html
+++ b/dom/media/tests/mochitest/test_peerConnection_restartIceLocalAndRemoteRollback.html
@@ -51,10 +51,8 @@
},
function PC_REMOTE_ROLLBACK(test) {
- return test.setRemoteDescription(
- test.pcRemote,
- new RTCSessionDescription({ type: "rollback" }),
- STABLE);
+ return test.setRemoteDescription(test.pcRemote, { type: "rollback" },
+ STABLE);
},
function PC_LOCAL_ROLLBACK(test) {
diff --git a/dom/media/tests/mochitest/test_peerConnection_restartIceLocalRollback.html b/dom/media/tests/mochitest/test_peerConnection_restartIceLocalRollback.html
index c1ac186de1..fd9fee9c0c 100644
--- a/dom/media/tests/mochitest/test_peerConnection_restartIceLocalRollback.html
+++ b/dom/media/tests/mochitest/test_peerConnection_restartIceLocalRollback.html
@@ -42,11 +42,9 @@
test.pcLocal.iceCheckingIceRollbackExpected = true;
},
function PC_LOCAL_ROLLBACK(test) {
- return test.setLocalDescription(
- test.pcLocal,
- new RTCSessionDescription({ type: "rollback",
- sdp: ""}),
- STABLE);
+ return test.setLocalDescription(test.pcLocal,
+ { type: "rollback", sdp: ""},
+ STABLE);
},
// Rolling back should shut down gathering
function PC_LOCAL_WAIT_FOR_END_OF_TRICKLE(test) {
diff --git a/dom/webidl/RTCIceCandidate.webidl b/dom/webidl/RTCIceCandidate.webidl
index 67d479aef2..35b404bb7d 100644
--- a/dom/webidl/RTCIceCandidate.webidl
+++ b/dom/webidl/RTCIceCandidate.webidl
@@ -8,16 +8,16 @@
*/
dictionary RTCIceCandidateInit {
- DOMString? candidate = null;
+ required DOMString candidate;
DOMString? sdpMid = null;
- unsigned short sdpMLineIndex;
+ unsigned short? sdpMLineIndex = null;
};
[Pref="media.peerconnection.enabled",
JSImplementation="@mozilla.org/dom/rtcicecandidate;1",
- Constructor(optional RTCIceCandidateInit candidateInitDict)]
+ Constructor(RTCIceCandidateInit candidateInitDict)]
interface RTCIceCandidate {
- attribute DOMString? candidate;
+ attribute DOMString candidate;
attribute DOMString? sdpMid;
attribute unsigned short? sdpMLineIndex;
diff --git a/dom/webidl/RTCPeerConnection.webidl b/dom/webidl/RTCPeerConnection.webidl
index b852d32070..7e9016e0aa 100644
--- a/dom/webidl/RTCPeerConnection.webidl
+++ b/dom/webidl/RTCPeerConnection.webidl
@@ -7,7 +7,7 @@
* http://w3c.github.io/webrtc-pc/#interface-definition
*/
-callback RTCSessionDescriptionCallback = void (RTCSessionDescription sdp);
+callback RTCSessionDescriptionCallback = void (RTCSessionDescriptionInit description);
callback RTCPeerConnectionErrorCallback = void (DOMError error);
callback RTCStatsCallback = void (RTCStatsReport report);
@@ -84,14 +84,14 @@ interface RTCPeerConnection : EventTarget {
optional DOMString username);
[Pref="media.peerconnection.identity.enabled"]
Promise<DOMString> getIdentityAssertion();
- Promise<RTCSessionDescription> createOffer (optional RTCOfferOptions options);
- Promise<RTCSessionDescription> createAnswer (optional RTCAnswerOptions options);
- Promise<void> setLocalDescription (RTCSessionDescription description);
- Promise<void> setRemoteDescription (RTCSessionDescription description);
+ Promise<RTCSessionDescriptionInit> createOffer (optional RTCOfferOptions options);
+ Promise<RTCSessionDescriptionInit> createAnswer (optional RTCAnswerOptions options);
+ Promise<void> setLocalDescription (RTCSessionDescriptionInit description);
+ Promise<void> setRemoteDescription (RTCSessionDescriptionInit description);
readonly attribute RTCSessionDescription? localDescription;
readonly attribute RTCSessionDescription? remoteDescription;
readonly attribute RTCSignalingState signalingState;
- Promise<void> addIceCandidate (RTCIceCandidate candidate);
+ Promise<void> addIceCandidate ((RTCIceCandidateInit or RTCIceCandidate)? candidate);
readonly attribute boolean? canTrickleIceCandidates;
readonly attribute RTCIceGatheringState iceGatheringState;
readonly attribute RTCIceConnectionState iceConnectionState;
@@ -155,10 +155,10 @@ partial interface RTCPeerConnection {
optional RTCOfferOptions options);
Promise<void> createAnswer (RTCSessionDescriptionCallback successCallback,
RTCPeerConnectionErrorCallback failureCallback);
- Promise<void> setLocalDescription (RTCSessionDescription description,
+ Promise<void> setLocalDescription (RTCSessionDescriptionInit description,
VoidFunction successCallback,
RTCPeerConnectionErrorCallback failureCallback);
- Promise<void> setRemoteDescription (RTCSessionDescription description,
+ Promise<void> setRemoteDescription (RTCSessionDescriptionInit description,
VoidFunction successCallback,
RTCPeerConnectionErrorCallback failureCallback);
Promise<void> addIceCandidate (RTCIceCandidate candidate,
diff --git a/dom/webidl/RTCSessionDescription.webidl b/dom/webidl/RTCSessionDescription.webidl
index 07bfb36f02..4dafe01e1b 100644
--- a/dom/webidl/RTCSessionDescription.webidl
+++ b/dom/webidl/RTCSessionDescription.webidl
@@ -15,16 +15,17 @@ enum RTCSdpType {
};
dictionary RTCSessionDescriptionInit {
- RTCSdpType? type = null;
- DOMString? sdp = "";
+ required RTCSdpType type;
+ DOMString sdp = "";
};
[Pref="media.peerconnection.enabled",
JSImplementation="@mozilla.org/dom/rtcsessiondescription;1",
Constructor(optional RTCSessionDescriptionInit descriptionInitDict)]
interface RTCSessionDescription {
- attribute RTCSdpType? type;
- attribute DOMString? sdp;
+ // These should be readonly, but writing causes deprecation warnings for a bit
+ attribute RTCSdpType type;
+ attribute DOMString sdp;
jsonifier;
};