Bug 1431903. Remove unused methods from nsIDOMDataChannel. r=mccr8
authorBoris Zbarsky <bzbarsky@mit.edu>
Sun, 21 Jan 2018 12:07:29 -0500
changeset 400139 df07eaf643a3c348ef876c3e4b569f49b0b896aa
parent 400138 4be3c1a37b99569d71515cf3820924a2a76ba1d0
child 400140 22a83c38a0d73453946a2d175d313e72063f71e6
push id99091
push userbzbarsky@mozilla.com
push dateSun, 21 Jan 2018 17:07:55 +0000
treeherdermozilla-inbound@cbea2cff1cc2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1431903
milestone59.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 1431903. Remove unused methods from nsIDOMDataChannel. r=mccr8 MozReview-Commit-ID: NRfLiNEWPK
dom/base/nsDOMDataChannel.cpp
dom/base/nsDOMDataChannel.h
dom/base/nsIDOMDataChannel.idl
--- a/dom/base/nsDOMDataChannel.cpp
+++ b/dom/base/nsDOMDataChannel.cpp
@@ -108,161 +108,80 @@ nsDOMDataChannel::Init(nsPIDOMWindowInne
 
   rv = nsContentUtils::GetUTFOrigin(principal,mOrigin);
   LOG(("%s: origin = %s\n",__FUNCTION__,NS_LossyConvertUTF16toASCII(mOrigin).get()));
   return rv;
 }
 
 // Most of the GetFoo()/SetFoo()s don't need to touch shared resources and
 // are safe after Close()
-NS_IMETHODIMP
+void
 nsDOMDataChannel::GetLabel(nsAString& aLabel)
 {
   mDataChannel->GetLabel(aLabel);
-  return NS_OK;
 }
 
-NS_IMETHODIMP
+void
 nsDOMDataChannel::GetProtocol(nsAString& aProtocol)
 {
   mDataChannel->GetProtocol(aProtocol);
-  return NS_OK;
 }
 
 uint16_t
 nsDOMDataChannel::Id() const
 {
   return mDataChannel->GetStream();
 }
 
-NS_IMETHODIMP
-nsDOMDataChannel::GetId(uint16_t *aId)
-{
-  *aId = Id();
-  return NS_OK;
-}
-
 // XXX should be GetType()?  Open question for the spec
 bool
 nsDOMDataChannel::Reliable() const
 {
   return mDataChannel->GetType() == mozilla::DataChannelConnection::RELIABLE;
 }
 
-NS_IMETHODIMP
-nsDOMDataChannel::GetReliable(bool* aReliable)
-{
-  *aReliable = Reliable();
-  return NS_OK;
-}
-
 bool
 nsDOMDataChannel::Ordered() const
 {
   return mDataChannel->GetOrdered();
 }
 
-NS_IMETHODIMP
-nsDOMDataChannel::GetOrdered(bool* aOrdered)
-{
-  *aOrdered = Ordered();
-  return NS_OK;
-}
-
 RTCDataChannelState
 nsDOMDataChannel::ReadyState() const
 {
   return static_cast<RTCDataChannelState>(mDataChannel->GetReadyState());
 }
 
 
-NS_IMETHODIMP
-nsDOMDataChannel::GetReadyState(nsAString& aReadyState)
-{
-  // mState is handled on multiple threads and needs locking
-  uint16_t readyState = mozilla::DataChannel::CLOSED;
-  if (!mSentClose) {
-    readyState = mDataChannel->GetReadyState();
-  }
-  // From the WebRTC spec
-  const char * stateName[] = {
-    "connecting",
-    "open",
-    "closing",
-    "closed"
-  };
-  MOZ_ASSERT(/*readyState >= mozilla::DataChannel::CONNECTING && */ // Always true due to datatypes
-             readyState <= mozilla::DataChannel::CLOSED);
-  aReadyState.AssignASCII(stateName[readyState]);
-
-  return NS_OK;
-}
-
 uint32_t
 nsDOMDataChannel::BufferedAmount() const
 {
   if (!mSentClose) {
     return mDataChannel->GetBufferedAmount();
   }
   return 0;
 }
 
 uint32_t
 nsDOMDataChannel::BufferedAmountLowThreshold() const
 {
   return mDataChannel->GetBufferedAmountLowThreshold();
 }
 
-NS_IMETHODIMP
-nsDOMDataChannel::GetBufferedAmount(uint32_t* aBufferedAmount)
-{
-  *aBufferedAmount = BufferedAmount();
-  return NS_OK;
-}
-
 void
 nsDOMDataChannel::SetBufferedAmountLowThreshold(uint32_t aThreshold)
 {
   mDataChannel->SetBufferedAmountLowThreshold(aThreshold);
 }
 
-NS_IMETHODIMP nsDOMDataChannel::GetBinaryType(nsAString & aBinaryType)
-{
-  switch (mBinaryType) {
-  case DC_BINARY_TYPE_ARRAYBUFFER:
-    aBinaryType.AssignLiteral("arraybuffer");
-    break;
-  case DC_BINARY_TYPE_BLOB:
-    aBinaryType.AssignLiteral("blob");
-    break;
-  default:
-    NS_ERROR("Should not happen");
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMDataChannel::SetBinaryType(const nsAString& aBinaryType)
-{
-  if (aBinaryType.EqualsLiteral("arraybuffer")) {
-    mBinaryType = DC_BINARY_TYPE_ARRAYBUFFER;
-  } else if (aBinaryType.EqualsLiteral("blob")) {
-    mBinaryType = DC_BINARY_TYPE_BLOB;
-  } else  {
-    return NS_ERROR_INVALID_ARG;
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
+void
 nsDOMDataChannel::Close()
 {
   mDataChannel->Close();
   UpdateMustKeepAlive();
-  return NS_OK;
 }
 
 // All of the following is copy/pasted from WebSocket.cpp.
 void
 nsDOMDataChannel::Send(const nsAString& aData, ErrorResult& aRv)
 {
   NS_ConvertUTF16toUTF8 msgString(aData);
   Send(nullptr, msgString, false, aRv);
--- a/dom/base/nsDOMDataChannel.h
+++ b/dom/base/nsDOMDataChannel.h
@@ -52,26 +52,27 @@ public:
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
     override;
   nsPIDOMWindowInner* GetParentObject() const
   {
     return GetOwner();
   }
 
   // WebIDL
-  // Uses XPIDL GetLabel.
+  void GetLabel(nsAString& aLabel);
+  void GetProtocol(nsAString& aProtocol);
   bool Reliable() const;
   mozilla::dom::RTCDataChannelState ReadyState() const;
   uint32_t BufferedAmount() const;
   uint32_t BufferedAmountLowThreshold() const;
   void SetBufferedAmountLowThreshold(uint32_t aThreshold);
   IMPL_EVENT_HANDLER(open)
   IMPL_EVENT_HANDLER(error)
   IMPL_EVENT_HANDLER(close)
-  // Uses XPIDL Close.
+  void Close();
   IMPL_EVENT_HANDLER(message)
   IMPL_EVENT_HANDLER(bufferedamountlow)
   mozilla::dom::RTCDataChannelType BinaryType() const
   {
     return static_cast<mozilla::dom::RTCDataChannelType>(
       static_cast<int>(mBinaryType));
   }
   void SetBinaryType(mozilla::dom::RTCDataChannelType aType)
@@ -80,17 +81,16 @@ public:
       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);
 
-  // Uses XPIDL GetProtocol.
   bool Ordered() const;
   uint16_t Id() const;
 
   nsresult
   DoOnMessageAvailable(const nsACString& aMessage, bool aBinary);
 
   virtual nsresult
   OnMessageAvailable(nsISupports* aContext, const nsACString& aMessage) override;
--- a/dom/base/nsIDOMDataChannel.idl
+++ b/dom/base/nsIDOMDataChannel.idl
@@ -1,32 +1,10 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIDOMEventTarget.idl"
 
-%{C++
-#ifdef GetBinaryType
-// Windows apparently has a #define for GetBinaryType...
-#undef GetBinaryType
-#endif
-%}
-
-interface nsIVariant;
-
 [builtinclass, uuid(b00a4ca7-312e-4926-84f6-8ebb43e53d83)]
 interface nsIDOMDataChannel : nsIDOMEventTarget
 {
-  readonly attribute DOMString label;
-  readonly attribute DOMString protocol;
-  readonly attribute boolean reliable;
-  readonly attribute boolean ordered;
-
-  readonly attribute DOMString readyState;
-  readonly attribute unsigned long bufferedAmount;
-
-  readonly attribute unsigned short id;
-
-  attribute DOMString binaryType;
-
-  void close();
 };