Bug 1531910: Re-enable a test-case, and check protocol length based on UTF-8 encoding. r=jib

Depends on D28252

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Byron Campen [:bwc] 2019-05-02 18:27:53 +00:00
parent 1b163e4dfb
commit 17a80eda9c
2 changed files with 14 additions and 5 deletions

View File

@ -1641,6 +1641,19 @@ class RTCPeerConnection {
if (maxRetransmitTime !== undefined) {
this.logWarning("Use maxPacketLifeTime instead of deprecated maxRetransmitTime which will stop working soon in createDataChannel!");
}
if (protocol.length > 32767) {
// At least 65536/2 UTF-16 characters. UTF-8 might be too long.
// Spec says to check how long |protocol| and |label| are in _bytes_. This
// is a little ambiguous. For now, examine the length of the utf-8 encoding.
const byteCounter = new TextEncoder("utf-8");
if (byteCounter.encode(protocol).length > 65535) {
throw new this._win.DOMException(
"protocol cannot be longer than 65535 bytes", "TypeError");
}
}
if (!negotiated) {
id = null;
} else if (id === null) {

View File

@ -23,13 +23,9 @@
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1531908
[createDataChannel with negotiated false and long protocol should throw TypeError]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1531910
[createDataChannel with negotiated true and long label and long protocol should succeed]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1531908 and https://bugzilla.mozilla.org/show_bug.cgi?id=1531910
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1531908
[Channels created after SCTP transport is established should have id assigned]
expected: FAIL