Bug 1531908 - Part 0: Re-enable a test-case, and check length of label based on UTF-8 encoding. r=jib
authorByron Campen [:bwc] <docfaraday@gmail.com>
Thu, 09 May 2019 17:29:20 +0000
changeset 532087 28b74f2993a1d18951938785c3d8e612a10da80c
parent 532086 b744a5e29a890770389de37e94d1c2ffa305fc2b
child 532088 f19730eee2670032365c734c424f8b1ee186e898
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1531908
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1531908 - Part 0: Re-enable a test-case, and check length of label based on UTF-8 encoding. r=jib Differential Revision: https://phabricator.services.mozilla.com/D28557
dom/media/PeerConnection.jsm
testing/web-platform/meta/webrtc/RTCPeerConnection-createDataChannel.html.ini
--- a/dom/media/PeerConnection.jsm
+++ b/dom/media/PeerConnection.jsm
@@ -1649,16 +1649,24 @@ class RTCPeerConnection {
       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 (label.length > 32767) {
+      const byteCounter = new TextEncoder("utf-8");
+      if (byteCounter.encode(label).length > 65535) {
+        throw new this._win.DOMException(
+            "label cannot be longer than 65535 bytes", "TypeError");
+      }
+    }
+
     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(
--- a/testing/web-platform/meta/webrtc/RTCPeerConnection-createDataChannel.html.ini
+++ b/testing/web-platform/meta/webrtc/RTCPeerConnection-createDataChannel.html.ini
@@ -14,24 +14,16 @@
   [createDataChannel with priority "high" should succeed]
     expected: FAIL
     bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1531100
 
   [createDataChannel with invalid priority should throw TypeError]
     expected: FAIL
     bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1531100
 
-  [createDataChannel with negotiated false and long label should throw TypeError]
-    expected: FAIL
-    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1531908
-
-  [createDataChannel with negotiated true and long label and long protocol should succeed]
-    expected: FAIL
-    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1531908
-
   [Channels created after SCTP transport is established should have id assigned]
     expected: FAIL
     bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1526253
 
   [createDataChannel with negotiated false should succeed]
     expected: FAIL
 
   [createDataChannel with negotiated false and id 42 should ignore the id]
@@ -41,25 +33,19 @@
     expected: FAIL
 
   [Reusing a data channel id that is in use (after setRemoteDescription) should throw OperationError]
     expected: FAIL
 
   [New data channel should be in the connecting state after creation (after connection establishment)]
     expected: FAIL
 
-  [createDataChannel with too long label should throw TypeError]
-    expected: FAIL
-
   [Reusing a data channel id that is in use should throw OperationError]
     expected: FAIL
 
-  [createDataChannel with too long label (2 byte unicode) should throw TypeError]
-    expected: FAIL
-
   [createDataChannel with negotiated true and id null should throw TypeError]
     expected: FAIL
 
   [createDataChannel with both maxPacketLifeTime and maxRetransmits null should succeed]
     expected: FAIL
 
   [Channels created (after setRemoteDescription) should have id assigned]
     expected: FAIL