Bug 1263312 - Have createOffer/Answer resolve with dictionaries.
MozReview-Commit-ID: Flhl2KoqQcX
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -725,18 +725,17 @@ RTCPeerConnection.prototype = {
return this._chain(() => {
let p = Promise.all([this.getPermission(), this._certificateReady])
.then(() => new this._win.Promise((resolve, reject) => {
this._onCreateOfferSuccess = resolve;
this._onCreateOfferFailure = reject;
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));
});
});
},
createAnswer: function(optionsOrOnSuccess, onError) {
// This entry-point handles both new and legacy call sig. Decipher which one
let onSuccess, options;
if (typeof optionsOrOnSuccess == "function") {
@@ -760,19 +759,17 @@ RTCPeerConnection.prototype = {
throw new this._win.DOMException("No outstanding offer",
"InvalidStateError");
}
this._onCreateAnswerSuccess = resolve;
this._onCreateAnswerFailure = reject;
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));
});
});
},
getPermission: function() {
if (this._havePermission) {
return this._havePermission;
}
@@ -1124,28 +1121,26 @@ RTCPeerConnection.prototype = {
get localDescription() {
this._checkClosed();
let sdp = this._impl.localDescription;
if (sdp.length == 0) {
return null;
}
- return new this._win.RTCSessionDescription({ type: this._localType,
- sdp: sdp });
+ return new this._win.RTCSessionDescription({ type: this._localType, sdp });
},
get remoteDescription() {
this._checkClosed();
let sdp = this._impl.remoteDescription;
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; },
get idpLoginUrl() { return this._localIdp.idpLoginUrl; },
get id() { return this._impl.id; },
set id(s) { this._impl.id = s; },
get iceGatheringState() { return this._iceGatheringState; },
get iceConnectionState() { return this._iceConnectionState; },