Bug 1529695: Implement RTCDataChannel.negotiated. r=bwc,smaug
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>
Thu, 16 May 2019 23:11:46 +0200
changeset 533128 3235df2518146938b504428a4a63242535cf90a4
parent 533127 73c897cf5ec08aa31c207cdd04cc7431b8404a1d
child 533129 28587715459e4541e26e5f0986d20b0479fda083
push id11276
push userrgurzau@mozilla.com
push dateMon, 20 May 2019 13:11:24 +0000
treeherdermozilla-beta@847755a7c325 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc, smaug
bugs1529695
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 1529695: Implement RTCDataChannel.negotiated. r=bwc,smaug
dom/base/nsDOMDataChannel.cpp
dom/base/nsDOMDataChannel.h
dom/webidl/RTCDataChannel.webidl
netwerk/sctp/datachannel/DataChannel.h
testing/web-platform/meta/webrtc/RTCPeerConnection-createDataChannel.html.ini
testing/web-platform/meta/webrtc/idlharness.https.window.js.ini
--- a/dom/base/nsDOMDataChannel.cpp
+++ b/dom/base/nsDOMDataChannel.cpp
@@ -137,16 +137,18 @@ mozilla::dom::Nullable<uint16_t> nsDOMDa
     const {
   return mDataChannel->GetMaxPacketLifeTime();
 }
 
 mozilla::dom::Nullable<uint16_t> nsDOMDataChannel::GetMaxRetransmits() const {
   return mDataChannel->GetMaxRetransmits();
 }
 
+bool nsDOMDataChannel::Negotiated() const { return mDataChannel->GetNegotiated(); }
+
 bool nsDOMDataChannel::Ordered() const { return mDataChannel->GetOrdered(); }
 
 RTCDataChannelState nsDOMDataChannel::ReadyState() const {
   return static_cast<RTCDataChannelState>(mDataChannel->GetReadyState());
 }
 
 uint32_t nsDOMDataChannel::BufferedAmount() const {
   if (!mSentClose) {
--- a/dom/base/nsDOMDataChannel.h
+++ b/dom/base/nsDOMDataChannel.h
@@ -69,16 +69,17 @@ class nsDOMDataChannel final : public mo
     mBinaryType = static_cast<DataChannelBinaryType>(static_cast<int>(aType));
   }
   void Send(const nsAString& aData, mozilla::ErrorResult& aRv);
   void Send(mozilla::dom::Blob& aData, mozilla::ErrorResult& aRv);
   void Send(const mozilla::dom::ArrayBuffer& aData, mozilla::ErrorResult& aRv);
   void Send(const mozilla::dom::ArrayBufferView& aData,
             mozilla::ErrorResult& aRv);
 
+  bool Negotiated() const;
   bool Ordered() const;
   mozilla::dom::Nullable<uint16_t> GetId() const;
 
   nsresult DoOnMessageAvailable(const nsACString& aMessage, bool aBinary);
 
   virtual nsresult OnMessageAvailable(nsISupports* aContext,
                                       const nsACString& aMessage) override;
 
--- a/dom/webidl/RTCDataChannel.webidl
+++ b/dom/webidl/RTCDataChannel.webidl
@@ -12,16 +12,17 @@ enum RTCDataChannelState {
 enum RTCDataChannelType {
   "arraybuffer",
   "blob"
 };
 
 interface RTCDataChannel : EventTarget
 {
   readonly attribute DOMString label;
+  readonly attribute boolean negotiated;
   readonly attribute boolean ordered;
   readonly attribute boolean reliable;
   readonly attribute unsigned short? maxPacketLifeTime;
   readonly attribute unsigned short? maxRetransmits;
   readonly attribute USVString protocol;
   readonly attribute unsigned short? id;
   readonly attribute RTCDataChannelState readyState;
   readonly attribute unsigned long bufferedAmount;
--- a/netwerk/sctp/datachannel/DataChannel.h
+++ b/netwerk/sctp/datachannel/DataChannel.h
@@ -379,16 +379,17 @@ class DataChannel {
         mContext(aContext),
         mConnection(connection),
         mLabel(label),
         mProtocol(protocol),
         mState(state),
         mStream(stream),
         mPrPolicy(policy),
         mPrValue(value),
+        mNegotiated(negotiated),
         mOrdered(ordered),
         mFlags(0),
         mId(0),
         mIsRecvBinary(false),
         mBufferedThreshold(0),  // default from spec
         mBufferedAmount(0),
         mMainThreadEventTarget(connection->GetNeckoTarget()) {
     if (!ordered) {
@@ -434,16 +435,18 @@ class DataChannel {
   void SendBinaryBlob(dom::Blob& aBlob, ErrorResult& aRv);
 
   uint16_t GetType() { return mPrPolicy; }
 
   dom::Nullable<uint16_t> GetMaxPacketLifeTime() const;
 
   dom::Nullable<uint16_t> GetMaxRetransmits() const;
 
+  bool GetNegotiated() { return mNegotiated; }
+
   bool GetOrdered() { return mOrdered; }
 
   void IncrementBufferedAmount(uint32_t aSize, ErrorResult& aRv);
   void DecrementBufferedAmount(uint32_t aSize);
 
   // Amount of data buffered to send
   uint32_t GetBufferedAmount() {
     MOZ_ASSERT(NS_IsMainThread());
@@ -488,16 +491,17 @@ class DataChannel {
 
   RefPtr<DataChannelConnection> mConnection;
   nsCString mLabel;
   nsCString mProtocol;
   uint16_t mState;
   uint16_t mStream;
   uint16_t mPrPolicy;
   uint32_t mPrValue;
+  const bool mNegotiated;
   const bool mOrdered;
   uint32_t mFlags;
   uint32_t mId;
   bool mIsRecvBinary;
   size_t mBufferedThreshold;
   // Read/written on main only. Decremented via message-passing, because the
   // spec requires us to queue a task for this.
   size_t mBufferedAmount;
--- a/testing/web-platform/meta/webrtc/RTCPeerConnection-createDataChannel.html.ini
+++ b/testing/web-platform/meta/webrtc/RTCPeerConnection-createDataChannel.html.ini
@@ -1,12 +1,12 @@
 [RTCPeerConnection-createDataChannel.html]
   [createDataChannel attribute default values]
     expected: FAIL
-    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1529695
+    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1531100
 
   [createDataChannel with provided parameters should initialize attributes to provided values]
     expected: FAIL
     bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1531900
 
   [createDataChannel with negotiated true should succeed]
     expected: FAIL
     bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1529695
@@ -18,24 +18,16 @@
   [createDataChannel with invalid priority should throw TypeError]
     expected: FAIL
     bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1531100
 
   [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
-    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1529695
-
-  [createDataChannel with negotiated false and id 42 should ignore the id]
-    expected: FAIL
-    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1529695
-
   [Reusing a data channel id that is in use (after setRemoteDescription, negotiated via DCEP) should throw OperationError]
     expected: FAIL
     bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1547106
 
   [Reusing a data channel id that is in use (after setRemoteDescription) should throw OperationError]
     expected: FAIL
     bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1547106
 
--- a/testing/web-platform/meta/webrtc/idlharness.https.window.js.ini
+++ b/testing/web-platform/meta/webrtc/idlharness.https.window.js.ini
@@ -276,19 +276,16 @@
     expected: FAIL
 
   [RTCRtpSender interface: operation getCapabilities(DOMString)]
     expected: FAIL
 
   [RTCPeerConnectionIceErrorEvent interface: new RTCPeerConnectionIceErrorEvent('ice-error', { errorCode: 701 }); must inherit property "errorText" with the proper type]
     expected: FAIL
 
-  [RTCDataChannel interface: attribute negotiated]
-    expected: FAIL
-
   [RTCRtpReceiver interface: attribute transport]
     expected: FAIL
 
   [Stringification of new RTCPeerConnectionIceErrorEvent('ice-error', { errorCode: 701 });]
     expected: FAIL
 
   [RTCIceTransport interface: idlTestObjects.iceTransport must inherit property "getLocalParameters()" with the proper type]
     expected: FAIL
@@ -396,19 +393,16 @@
     expected: FAIL
 
   [RTCCertificate interface: operation getSupportedAlgorithms()]
     expected: FAIL
 
   [RTCIceTransport interface: attribute onstatechange]
     expected: FAIL
 
-  [RTCDataChannel interface: new RTCPeerConnection().createDataChannel('') must inherit property "negotiated" with the proper type]
-    expected: FAIL
-
   [RTCStatsEvent interface: existence and properties of interface prototype object's "constructor" property]
     expected: FAIL
 
   [RTCStatsEvent interface: existence and properties of interface prototype object's @@unscopables property]
     expected: FAIL
 
   [RTCIceTransport interface: idlTestObjects.iceTransport must inherit property "role" with the proper type]
     expected: FAIL