зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1187206 - Adding checks for null SDP, r=jib
--HG-- extra : commitid : 9y8LpOJjbmc
This commit is contained in:
Родитель
157be033a5
Коммит
e113d1c654
|
@ -761,6 +761,13 @@ RTCPeerConnection.prototype = {
|
|||
"Invalid type " + desc.type + " provided to setLocalDescription",
|
||||
"InvalidParameterError");
|
||||
}
|
||||
|
||||
if (desc.type !== "rollback" && !desc.sdp) {
|
||||
throw new this._win.DOMException(
|
||||
"Empty or null SDP provided to setLocalDescription",
|
||||
"InvalidParameterError");
|
||||
}
|
||||
|
||||
return this._chain(() => new this._win.Promise((resolve, reject) => {
|
||||
this._onSetLocalDescriptionSuccess = resolve;
|
||||
this._onSetLocalDescriptionFailure = reject;
|
||||
|
@ -835,21 +842,34 @@ RTCPeerConnection.prototype = {
|
|||
default:
|
||||
throw new this._win.DOMException(
|
||||
"Invalid type " + desc.type + " provided to setRemoteDescription",
|
||||
"InvalidParameterError");
|
||||
}
|
||||
|
||||
if (!desc.sdp && desc.type !== "rollback") {
|
||||
throw new this._win.DOMException(
|
||||
"Empty or null SDP provided to setRemoteDescription",
|
||||
"InvalidParameterError");
|
||||
}
|
||||
|
||||
// Get caller's origin before hitting the promise chain
|
||||
let origin = Cu.getWebIDLCallerPrincipal().origin;
|
||||
|
||||
// Do setRemoteDescription and identity validation in parallel
|
||||
return this._chain(() => this._win.Promise.all([
|
||||
new this._win.Promise((resolve, reject) => {
|
||||
return this._chain(() => {
|
||||
let setRem = new this._win.Promise((resolve, reject) => {
|
||||
this._onSetRemoteDescriptionSuccess = resolve;
|
||||
this._onSetRemoteDescriptionFailure = reject;
|
||||
this._impl.setRemoteDescription(type, desc.sdp);
|
||||
}),
|
||||
this._validateIdentity(desc.sdp, origin)
|
||||
])).then(() => {}); // must return undefined
|
||||
});
|
||||
|
||||
if (desc.type === "rollback") {
|
||||
return setRem;
|
||||
}
|
||||
|
||||
// Do setRemoteDescription and identity validation in parallel
|
||||
let validId = this._validateIdentity(desc.sdp, origin);
|
||||
return this._win.Promise.all([setRem, validId])
|
||||
.then(() => {}); // must return undefined
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче