Backed out 3 changesets (bug 1641600) for failures at test_peerConnection_constructedStream.html. CLOSED TREE
authorButkovits Atila <abutkovits@mozilla.com>
Thu, 04 Jun 2020 15:06:33 +0300
changeset 597967 dd3769eed4d11f8b4c6fdb3a5335d6f3302f9a03
parent 597966 2b663e61ccbacf5128d4734245ae36d739cf39ad
child 597968 bef16d556f0946c0f9210b1be1b522fff5784e22
push id13310
push userffxbld-merge
push dateMon, 29 Jun 2020 14:50:06 +0000
treeherdermozilla-beta@15a59a0afa5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1641600
milestone79.0a1
backs out41a85b7d3e5e81e7090fd49317f96c69e8fec757
249782af96bbf82fa5d12ff7101e30c06b4fad92
86c2932e66d3dce463d7047bc63bf7af76221edc
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
Backed out 3 changesets (bug 1641600) for failures at test_peerConnection_constructedStream.html. CLOSED TREE Backed out changeset 41a85b7d3e5e (bug 1641600) Backed out changeset 249782af96bb (bug 1641600) Backed out changeset 86c2932e66d3 (bug 1641600)
media/webrtc/signaling/src/jsep/JsepSession.h
media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
media/webrtc/signaling/src/jsep/JsepTrack.cpp
media/webrtc/signaling/src/jsep/JsepTrack.h
media/webrtc/signaling/src/jsep/JsepTransceiver.h
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
modules/libpref/init/all.js
--- a/media/webrtc/signaling/src/jsep/JsepSession.h
+++ b/media/webrtc/signaling/src/jsep/JsepSession.h
@@ -202,23 +202,17 @@ class JsepSession {
 
       if (transceiver->mSendTrack.GetActive() ||
           transceiver->GetMediaType() == SdpMediaSection::kApplication) {
         sending[transceiver->mSendTrack.GetMediaType()]++;
       }
     }
   }
 
-  // See Bug 1642419, this can be removed when all sites are working with RTX.
-  void SetRtxIsAllowed(bool aRtxIsAllowed) { mRtxIsAllowed = aRtxIsAllowed; }
-
  protected:
   const std::string mName;
   JsepSignalingState mState;
   uint32_t mNegotiations;
-
-  // See Bug 1642419, this can be removed when all sites are working with RTX.
-  bool mRtxIsAllowed = true;
 };
 
 }  // namespace mozilla
 
 #endif
--- a/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
+++ b/media/webrtc/signaling/src/jsep/JsepSessionImpl.cpp
@@ -402,18 +402,17 @@ std::vector<SdpExtmapAttributeList::Extm
       mediaType = JsepMediaType::kVideo;
       if (msection.GetAttributeList().HasAttribute(
               SdpAttribute::kRidAttribute)) {
         // We need RID support
         // TODO: Would it be worth checking that the direction is sane?
         AddVideoRtpExtension(webrtc::RtpExtension::kRtpStreamIdUri,
                              SdpDirectionAttribute::kSendonly);
 
-        if (mRtxIsAllowed &&
-            Preferences::GetBool("media.peerconnection.video.use_rtx", false)) {
+        if (Preferences::GetBool("media.peerconnection.video.use_rtx", false)) {
           AddVideoRtpExtension(webrtc::RtpExtension::kRepairedRtpStreamIdUri,
                                SdpDirectionAttribute::kSendonly);
         }
       }
       break;
     default:;
   }
   if (mediaType != JsepMediaType::kNone) {
@@ -1945,17 +1944,16 @@ void JsepSessionImpl::SetupDefaultCodecs
 
   mSupportedCodecs.emplace_back(
       new JsepAudioCodecDescription("8", "PCMA", 8000, 1));
 
   mSupportedCodecs.emplace_back(
       new JsepAudioCodecDescription("101", "telephone-event", 8000, 1));
 
   bool useRtx =
-      mRtxIsAllowed &&
       Preferences::GetBool("media.peerconnection.video.use_rtx", false);
   // Supported video codecs.
   // Note: order here implies priority for building offers!
   UniquePtr<JsepVideoCodecDescription> vp8(
       new JsepVideoCodecDescription("120", "VP8", 90000));
   // Defaults for mandatory params
   vp8->mConstraints.maxFs = 12288;  // Enough for 2048x1536
   vp8->mConstraints.maxFps = 60;
--- a/media/webrtc/signaling/src/jsep/JsepTrack.cpp
+++ b/media/webrtc/signaling/src/jsep/JsepTrack.cpp
@@ -446,17 +446,16 @@ std::vector<UniquePtr<JsepCodecDescripti
 
         // Remember whether we negotiated rtx and the associated pt for later.
         if (codec->mType == SdpMediaSection::kVideo) {
           JsepVideoCodecDescription* videoCodec =
               static_cast<JsepVideoCodecDescription*>(codec.get());
           JsepVideoCodecDescription* cloneVideoCodec =
               static_cast<JsepVideoCodecDescription*>(clone.get());
           bool useRtx =
-              mRtxIsAllowed &&
               Preferences::GetBool("media.peerconnection.video.use_rtx", false);
           videoCodec->mRtxEnabled = useRtx && cloneVideoCodec->mRtxEnabled;
           videoCodec->mRtxPayloadType = cloneVideoCodec->mRtxPayloadType;
         }
 
         // Moves the codec out of mPrototypeCodecs, leaving an empty
         // UniquePtr, so we don't use it again. Also causes successfully
         // negotiated codecs to be placed up front in the future.
--- a/media/webrtc/signaling/src/jsep/JsepTrack.h
+++ b/media/webrtc/signaling/src/jsep/JsepTrack.h
@@ -193,18 +193,17 @@ class JsepTrack {
   virtual void SetCNAME(const std::string& cname) { mCNAME = cname; }
 
   virtual sdp::Direction GetDirection() const { return mDirection; }
 
   virtual const std::vector<uint32_t>& GetSsrcs() const { return mSsrcs; }
 
   virtual std::vector<uint32_t> GetRtxSsrcs() const {
     std::vector<uint32_t> result;
-    if (mRtxIsAllowed &&
-        Preferences::GetBool("media.peerconnection.video.use_rtx", false)) {
+    if (Preferences::GetBool("media.peerconnection.video.use_rtx", false)) {
       std::for_each(
           mSsrcToRtxSsrc.begin(), mSsrcToRtxSsrc.end(),
           [&result](const auto& pair) { result.push_back(pair.second); });
     }
     return result;
   }
 
   virtual void EnsureSsrcs(SsrcGenerator& ssrcGenerator, size_t aNumber);
@@ -274,19 +273,16 @@ class JsepTrack {
     MOZ_ASSERT(outConstraintsList);
     *outConstraintsList = mJsEncodeConstraints;
   }
 
   void AddToMsection(const std::vector<JsConstraints>& constraintsList,
                      sdp::Direction direction, SsrcGenerator& ssrcGenerator,
                      bool requireRtxSsrcs, SdpMediaSection* msection);
 
-  // See Bug 1642419, this can be removed when all sites are working with RTX.
-  void SetRtxIsAllowed(bool aRtxIsAllowed) { mRtxIsAllowed = aRtxIsAllowed; }
-
  private:
   std::vector<UniquePtr<JsepCodecDescription>> GetCodecClones() const;
   static void EnsureNoDuplicatePayloadTypes(
       std::vector<UniquePtr<JsepCodecDescription>>* codecs);
   static void GetPayloadTypes(
       const std::vector<UniquePtr<JsepCodecDescription>>& codecs,
       std::vector<uint16_t>* pts);
   void AddToMsection(const std::vector<UniquePtr<JsepCodecDescription>>& codecs,
@@ -324,16 +320,13 @@ class JsepTrack {
   // multiple of these. If there are none, we assume unconstrained unicast with
   // no rid.
   std::vector<JsConstraints> mJsEncodeConstraints;
   UniquePtr<JsepTrackNegotiatedDetails> mNegotiatedDetails;
   std::vector<uint32_t> mSsrcs;
   std::map<uint32_t, uint32_t> mSsrcToRtxSsrc;
   bool mActive;
   bool mRemoteSetSendBit;
-
-  // See Bug 1642419, this can be removed when all sites are working with RTX.
-  bool mRtxIsAllowed = true;
 };
 
 }  // namespace mozilla
 
 #endif
--- a/media/webrtc/signaling/src/jsep/JsepTransceiver.h
+++ b/media/webrtc/signaling/src/jsep/JsepTransceiver.h
@@ -172,22 +172,16 @@ class JsepTransceiver {
   bool HasOwnTransport() const {
     if (mTransport.mComponents &&
         (!HasBundleLevel() || (GetLevel() == BundleLevel()))) {
       return true;
     }
     return false;
   }
 
-  // See Bug 1642419, this can be removed when all sites are working with RTX.
-  void SetRtxIsAllowed(bool aRtxIsAllowed) {
-    mSendTrack.SetRtxIsAllowed(aRtxIsAllowed);
-    mRecvTrack.SetRtxIsAllowed(aRtxIsAllowed);
-  }
-
   // This is the direction JS wants. It might not actually happen.
   SdpDirectionAttribute::Direction mJsDirection;
 
   JsepTrack mSendTrack;
   JsepTrack mRecvTrack;
   JsepTransport mTransport;
 
  private:
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -14,17 +14,16 @@
 #include "timecard.h"
 
 #include "jsapi.h"
 #include "nspr.h"
 #include "nss.h"
 #include "pk11pub.h"
 
 #include "nsNetCID.h"
-#include "nsIIDNService.h"
 #include "nsILoadContext.h"
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsProxyRelease.h"
 #include "prtime.h"
 
@@ -317,20 +316,16 @@ PeerConnectionImpl::PeerConnectionImpl(c
   MOZ_ASSERT(NS_IsMainThread());
   if (aGlobal) {
     mWindow = do_QueryInterface(aGlobal->GetAsSupports());
     if (IsPrivateBrowsing(mWindow)) {
       mPrivateWindow = true;
     }
     mWindow->AddPeerConnection();
     mActiveOnWindow = true;
-
-    mRtxIsAllowed =
-        !HostnameInPref("media.peerconnection.video.use_rtx.blocklist",
-                        mWindow->GetDocumentURI());
   }
   CSFLogInfo(LOGTAG, "%s: PeerConnectionImpl constructor for %s", __FUNCTION__,
              mHandle.c_str());
   STAMP_TIMECARD(mTimeCard, "Constructor Completed");
   mForceIceTcp =
       Preferences::GetBool("media.peerconnection.ice.force_ice_tcp", false);
   memset(mMaxReceiving, 0, sizeof(mMaxReceiving));
   memset(mMaxSending, 0, sizeof(mMaxSending));
@@ -468,17 +463,16 @@ nsresult PeerConnectionImpl::Initialize(
                                         aConfiguration.mIceTransportPolicy);
   if (NS_FAILED(res)) {
     CSFLogError(LOGTAG, "%s: Failed to init mtransport", __FUNCTION__);
     return NS_ERROR_FAILURE;
   }
 
   mJsepSession =
       MakeUnique<JsepSessionImpl>(mName, MakeUnique<PCUuidGenerator>());
-  mJsepSession->SetRtxIsAllowed(mRtxIsAllowed);
 
   res = mJsepSession->Init();
   if (NS_FAILED(res)) {
     CSFLogError(LOGTAG, "%s: Couldn't init JSEP Session, res=%u", __FUNCTION__,
                 static_cast<unsigned>(res));
     return res;
   }
 
@@ -1027,18 +1021,16 @@ already_AddRefed<TransceiverImpl> PeerCo
 
   if (jrv.Failed()) {
     // Would be nice if we could peek at the rv without stealing it, so we
     // could log...
     CSFLogError(LOGTAG, "%s: failed", __FUNCTION__);
     return nullptr;
   }
 
-  jsepTransceiver->SetRtxIsAllowed(mRtxIsAllowed);
-
   // Do this last, since it is not possible to roll back.
   nsresult rv = AddRtpTransceiverToJsepSession(jsepTransceiver);
   if (NS_FAILED(rv)) {
     CSFLogError(LOGTAG, "%s: AddRtpTransceiverToJsepSession failed, res=%u",
                 __FUNCTION__, static_cast<unsigned>(rv));
     jrv = rv;
     return nullptr;
   }
@@ -1701,83 +1693,16 @@ void PeerConnectionImpl::DumpPacket_m(si
   if (!arrayBuffer.Init(jsobj)) {
     return;
   }
 
   JSErrorResult jrv;
   mPCObserver->OnPacket(level, type, sending, arrayBuffer, jrv);
 }
 
-bool PeerConnectionImpl::HostnameInPref(const char* aPref, nsIURI* aDocURI) {
-  auto HostInDomain = [](const nsCString& aHost, const nsCString& aPattern) {
-    int32_t patternOffset = 0;
-    int32_t hostOffset = 0;
-
-    // Act on '*.' wildcard in the left-most position in a domain pattern.
-    if (StringBeginsWith(aPattern, nsCString("*."))) {
-      patternOffset = 2;
-
-      // Ignore the lowest level sub-domain for the hostname.
-      hostOffset = aHost.FindChar('.') + 1;
-
-      if (hostOffset <= 1) {
-        // Reject a match between a wildcard and a TLD or '.foo' form.
-        return false;
-      }
-    }
-
-    nsDependentCString hostRoot(aHost, hostOffset);
-    return hostRoot.EqualsIgnoreCase(aPattern.BeginReading() + patternOffset);
-  };
-
-  if (!aDocURI) {
-    return false;
-  }
-
-  nsCString hostName;
-  aDocURI->GetAsciiHost(hostName);  // normalize UTF8 to ASCII equivalent
-  nsCString domainList;
-  nsresult nr = Preferences::GetCString(aPref, domainList);
-
-  if (NS_FAILED(nr)) {
-    return false;
-  }
-
-  domainList.StripWhitespace();
-
-  if (domainList.IsEmpty() || hostName.IsEmpty()) {
-    return false;
-  }
-
-  // Get UTF8 to ASCII domain name normalization service
-  nsresult rv;
-  nsCOMPtr<nsIIDNService> idnService =
-      do_GetService("@mozilla.org/network/idn-service;1", &rv);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return false;
-  }
-
-  // Test each domain name in the comma separated list
-  // after converting from UTF8 to ASCII. Each domain
-  // must match exactly or have a single leading '*.' wildcard.
-  for (const nsACString& each : domainList.Split(',')) {
-    nsCString domainName;
-    rv = idnService->ConvertUTF8toACE(each, domainName);
-    if (NS_SUCCEEDED(rv)) {
-      if (HostInDomain(hostName, domainName)) {
-        return true;
-      }
-    } else {
-      NS_WARNING("Failed to convert UTF-8 host to ASCII");
-    }
-  }
-
-  return false;
-}
-
 nsresult PeerConnectionImpl::EnablePacketDump(unsigned long level,
                                               dom::mozPacketDumpType type,
                                               bool sending) {
   mPacketDumpEnabled = true;
   std::vector<unsigned>* packetDumpFlags;
   if (sending) {
     packetDumpFlags = &mSendPacketDumpFlags;
   } else {
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
@@ -436,21 +436,16 @@ class PeerConnectionImpl final
 
   void DumpPacket_m(size_t level, dom::mozPacketDumpType type, bool sending,
                     UniquePtr<uint8_t[]>& packet, size_t size);
 
   const dom::RTCStatsTimestampMaker& GetTimestampMaker() const {
     return mTimestampMaker;
   }
 
-  // Utility function, given a string pref and an URI, returns whether or not
-  // the URI occurs in the pref. Wildcards are supported (e.g. *.example.com)
-  // and multiple hostnames can be present, separated by commas.
-  static bool HostnameInPref(const char* aPrefList, nsIURI* aDocURI);
-
  private:
   virtual ~PeerConnectionImpl();
   PeerConnectionImpl(const PeerConnectionImpl& rhs);
   PeerConnectionImpl& operator=(PeerConnectionImpl);
 
   RefPtr<dom::RTCStatsPromise> GetReceiverStats(
       const RefPtr<MediaPipelineReceive>& aPipeline);
   RefPtr<dom::RTCStatsPromise> GetSenderStats(
@@ -609,19 +604,16 @@ class PeerConnectionImpl final
   RefPtr<RTCStatsIdGenerator> mIdGenerator;
   // Ordinarily, I would use a std::map here, but this used to be a JS Map
   // which iterates in insertion order, and I want to avoid changing this.
   nsTArray<RefPtr<DOMMediaStream>> mReceiveStreams;
 
   DOMMediaStream* GetReceiveStream(const std::string& aId) const;
   DOMMediaStream* CreateReceiveStream(const std::string& aId);
 
-  // See Bug 1642419, this can be removed when all sites are working with RTX.
-  bool mRtxIsAllowed = true;
-
  public:
   // these are temporary until the DataChannel Listen/Connect API is removed
   unsigned short listenPort;
   unsigned short connectPort;
   char* connectStr;  // XXX ownership/free
 };
 
 // This is what is returned when you acquire on a handle
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp
@@ -323,28 +323,109 @@ bool PeerConnectionMedia::GetPrefDefault
 
   bool default_address_only = Preferences::GetBool(
       "media.peerconnection.ice.default_address_only", false);
   default_address_only |=
       !MediaManager::Get()->IsActivelyCapturingOrHasAPermission(winId);
   return default_address_only;
 }
 
+static bool HostInDomain(const nsCString& aHost, const nsCString& aPattern) {
+  int32_t patternOffset = 0;
+  int32_t hostOffset = 0;
+
+  // Act on '*.' wildcard in the left-most position in a domain pattern.
+  if (aPattern.Length() > 2 && aPattern[0] == '*' && aPattern[1] == '.') {
+    patternOffset = 2;
+
+    // Ignore the lowest level sub-domain for the hostname.
+    hostOffset = aHost.FindChar('.') + 1;
+
+    if (hostOffset <= 1) {
+      // Reject a match between a wildcard and a TLD or '.foo' form.
+      return false;
+    }
+  }
+
+  nsDependentCString hostRoot(aHost, hostOffset);
+  return hostRoot.EqualsIgnoreCase(aPattern.BeginReading() + patternOffset);
+}
+
+static bool HostInObfuscationWhitelist(nsIURI* docURI) {
+  if (!docURI) {
+    return false;
+  }
+
+  nsCString hostName;
+  docURI->GetAsciiHost(hostName);  // normalize UTF8 to ASCII equivalent
+  nsCString domainWhiteList;
+  nsresult nr = Preferences::GetCString(
+      "media.peerconnection.ice.obfuscate_host_addresses.whitelist",
+      domainWhiteList);
+
+  if (NS_FAILED(nr)) {
+    return false;
+  }
+
+  domainWhiteList.StripWhitespace();
+
+  if (domainWhiteList.IsEmpty() || hostName.IsEmpty()) {
+    return false;
+  }
+
+  // Get UTF8 to ASCII domain name normalization service
+  nsresult rv;
+  nsCOMPtr<nsIIDNService> idnService =
+      do_GetService("@mozilla.org/network/idn-service;1", &rv);
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return false;
+  }
+
+  uint32_t begin = 0;
+  uint32_t end = 0;
+  nsCString domainName;
+  /*
+     Test each domain name in the comma separated list
+     after converting from UTF8 to ASCII. Each domain
+     must match exactly or have a single leading '*.' wildcard
+  */
+  do {
+    end = domainWhiteList.FindChar(',', begin);
+    if (end == (uint32_t)-1) {
+      // Last or only domain name in the comma separated list
+      end = domainWhiteList.Length();
+    }
+
+    rv = idnService->ConvertUTF8toACE(
+        Substring(domainWhiteList, begin, end - begin), domainName);
+    if (NS_SUCCEEDED(rv)) {
+      if (HostInDomain(hostName, domainName)) {
+        return true;
+      }
+    } else {
+      NS_WARNING("Failed to convert UTF-8 host to ASCII");
+    }
+
+    begin = end + 1;
+  } while (end < domainWhiteList.Length());
+
+  return false;
+}
+
 bool PeerConnectionMedia::GetPrefObfuscateHostAddresses() const {
   ASSERT_ON_THREAD(mMainThread);  // will crash on STS thread
 
   uint64_t winId = mParent->GetWindow()->WindowID();
 
   bool obfuscate_host_addresses = Preferences::GetBool(
       "media.peerconnection.ice.obfuscate_host_addresses", false);
   obfuscate_host_addresses &=
       !MediaManager::Get()->IsActivelyCapturingOrHasAPermission(winId);
-  obfuscate_host_addresses &= !PeerConnectionImpl::HostnameInPref(
-      "media.peerconnection.ice.obfuscate_host_addresses.whitelist",
-      mParent->GetWindow()->GetDocumentURI());
+  obfuscate_host_addresses &=
+      !HostInObfuscationWhitelist(mParent->GetWindow()->GetDocumentURI());
   obfuscate_host_addresses &= XRE_IsContentProcess();
 
   return obfuscate_host_addresses;
 }
 
 void PeerConnectionMedia::ConnectSignals() {
   mTransportHandler->SignalGatheringStateChange.connect(
       this, &PeerConnectionMedia::IceGatheringStateChange_s);
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -419,22 +419,20 @@ pref("media.videocontrols.picture-in-pic
 pref("media.videocontrols.picture-in-picture.video-toggle.min-video-secs", 45);
 
 #ifdef MOZ_WEBRTC
   pref("media.navigator.video.enabled", true);
   pref("media.navigator.video.default_fps",30);
   pref("media.navigator.video.use_remb", true);
   #ifdef EARLY_BETA_OR_EARLIER
     pref("media.navigator.video.use_transport_cc", true);
-    pref("media.peerconnection.video.use_rtx", true);
   #else
     pref("media.navigator.video.use_transport_cc", false);
-    pref("media.peerconnection.video.use_rtx", false);
   #endif
-  pref("media.peerconnection.video.use_rtx.blocklist", "*.google.com");
+  pref("media.peerconnection.video.use_rtx", false);
   pref("media.navigator.video.use_tmmbr", false);
   pref("media.navigator.audio.use_fec", true);
   pref("media.navigator.video.red_ulpfec_enabled", false);
 
   #ifdef NIGHTLY_BUILD
     pref("media.peerconnection.sdp.parser", "sipcc");
     pref("media.peerconnection.sdp.alternate_parse_mode", "parallel");
     pref("media.peerconnection.sdp.strict_success", false);