Bug 1547106: Throw OperationError in createDataChannel() if id in use. r=bwc

Differential Revision: https://phabricator.services.mozilla.com/D60569

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan-Ivar Bruaroey 2020-01-22 14:20:26 +00:00
Родитель b14b35557c
Коммит 85c420c220
4 изменённых файлов: 24 добавлений и 27 удалений

Просмотреть файл

@ -1905,16 +1905,27 @@ class RTCPeerConnection {
type = Ci.IPeerConnection.kDataChannelReliable;
}
// Synchronous since it doesn't block.
let dataChannel = this._impl.createDataChannel(
label,
protocol,
type,
ordered,
maxPacketLifeTime,
maxRetransmits,
negotiated,
id
);
let dataChannel;
try {
dataChannel = this._impl.createDataChannel(
label,
protocol,
type,
ordered,
maxPacketLifeTime,
maxRetransmits,
negotiated,
id
);
} catch (e) {
if (e.result != Cr.NS_ERROR_NOT_AVAILABLE) {
throw e;
}
const msg =
id === null ? "No available id could be generated" : "Id is in use";
throw new this._win.DOMException(msg, "OperationError");
}
// Spec says to only do this if this is the first DataChannel created,
// but the c++ code that does the "is negotiation needed" checking will

Просмотреть файл

@ -1115,9 +1115,9 @@ PeerConnectionImpl::CreateDataChannel(
PC_AUTO_ENTER_API_CALL(false);
MOZ_ASSERT(aRetval);
// WebRTC is not enabled when recording/replaying. See bug 1304149.
// WebRTC is not enabled when recording/replaying (being removed) bug 1304149.
if (recordreplay::IsRecordingOrReplaying()) {
return NS_ERROR_NOT_AVAILABLE;
return NS_ERROR_UNEXPECTED;
}
RefPtr<DataChannel> dataChannel;
@ -1138,7 +1138,7 @@ PeerConnectionImpl::CreateDataChannel(
: (aType == DataChannelConnection::PARTIAL_RELIABLE_TIMED ? aMaxTime
: 0),
nullptr, nullptr, aExternalNegotiated, aStream);
NS_ENSURE_TRUE(dataChannel, NS_ERROR_FAILURE);
NS_ENSURE_TRUE(dataChannel, NS_ERROR_NOT_AVAILABLE);
CSFLogDebug(LOGTAG, "%s: making DOMDataChannel", __FUNCTION__);

Просмотреть файл

@ -2360,8 +2360,6 @@ already_AddRefed<DataChannel> DataChannelConnection::Open(
if (aStream != INVALID_STREAM && mChannels.Get(aStream)) {
DC_ERROR(("external negotiation of already-open channel %u", aStream));
// XXX How do we indicate this up to the application? Probably the
// caller's job, but we may need to return an error code.
return nullptr;
}

Просмотреть файл

@ -2,18 +2,6 @@
expected:
if processor == "aarch64": ["OK", "TIMEOUT"]
[Reusing a data channel id that is in use (after setRemoteDescription, negotiated via DCEP) should throw OperationError]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1547106
expected: FAIL
[Reusing a data channel id that is in use (after setRemoteDescription) should throw OperationError]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1547106
expected: FAIL
[Reusing a data channel id that is in use should throw OperationError]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1547106
expected: FAIL
[addTrack, then createDataChannel, should negotiate properly]
expected:
if processor == "aarch64": ["PASS", "TIMEOUT"]