mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1531904 - Part 3: Fix some validation logic in createDataChannel. r=jib
Differential Revision: https://phabricator.services.mozilla.com/D26772 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
4d1281bbfd
commit
2c684f17ba
@ -1605,7 +1605,7 @@ class RTCPeerConnection {
|
||||
}
|
||||
|
||||
createDataChannel(label, {
|
||||
maxRetransmits, ordered, negotiated, id = 0xFFFF,
|
||||
maxRetransmits, ordered, negotiated, id = null,
|
||||
maxRetransmitTime, maxPacketLifeTime,
|
||||
protocol,
|
||||
} = {}) {
|
||||
@ -1619,11 +1619,21 @@ class RTCPeerConnection {
|
||||
if (maxRetransmitTime !== undefined) {
|
||||
this.logWarning("Use maxPacketLifeTime instead of deprecated maxRetransmitTime which will stop working soon in createDataChannel!");
|
||||
}
|
||||
if (!negotiated) {
|
||||
id = null;
|
||||
} else if (id === null) {
|
||||
throw new this._win.DOMException(
|
||||
"id is required when negotiated is true", "TypeError");
|
||||
}
|
||||
if (maxPacketLifeTime !== undefined && maxRetransmits !== undefined) {
|
||||
throw new this._win.DOMException(
|
||||
"Both maxPacketLifeTime and maxRetransmits cannot be provided",
|
||||
"InvalidParameterError");
|
||||
}
|
||||
if (id == 65535) {
|
||||
throw new this._win.DOMException(
|
||||
"id cannot be 65535", "TypeError");
|
||||
}
|
||||
// Must determine the type where we still know if entries are undefined.
|
||||
let type;
|
||||
if (maxPacketLifeTime !== undefined) {
|
||||
|
@ -2342,7 +2342,10 @@ already_AddRefed<DataChannel> DataChannelConnection::Open(
|
||||
const nsACString &label, const nsACString &protocol, Type type,
|
||||
bool inOrder, uint32_t prValue, DataChannelListener *aListener,
|
||||
nsISupports *aContext, bool aExternalNegotiated, uint16_t aStream) {
|
||||
// aStream == INVALID_STREAM to have the protocol allocate
|
||||
if (!aExternalNegotiated) {
|
||||
// aStream == INVALID_STREAM to have the protocol allocate
|
||||
aStream = INVALID_STREAM;
|
||||
}
|
||||
uint16_t prPolicy = SCTP_PR_SCTP_NONE;
|
||||
uint32_t flags;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user