From fec8b0d80733940b1bcccbe26b5d6020be60d511 Mon Sep 17 00:00:00 2001 From: "Byron Campen [:bwc]" Date: Wed, 18 Sep 2019 14:27:42 +0000 Subject: [PATCH] Bug 1569183: Stop doing a proxy lookup to determine whether we're configured to use a proxy (for the proxy_only_if_behind_proxy pref), and instead look at whether we loaded the doc using a proxy. r=mjf,mayhemer,jld Differential Revision: https://phabricator.services.mozilla.com/D45289 --HG-- extra : moz-landing-system : lando --- dom/network/TCPSocketChild.h | 1 + ipc/ipdl/ipdl/direct_call.py | 2 - media/mtransport/ipc/PProxyConfigLookup.ipdl | 20 --- media/mtransport/ipc/ProxyConfigLookup.cpp | 79 ---------- media/mtransport/ipc/ProxyConfigLookup.h | 33 ---- .../mtransport/ipc/ProxyConfigLookupChild.cpp | 25 --- media/mtransport/ipc/ProxyConfigLookupChild.h | 32 ---- .../ipc/ProxyConfigLookupParent.cpp | 32 ---- .../mtransport/ipc/ProxyConfigLookupParent.h | 31 ---- media/mtransport/ipc/WebrtcTCPSocket.cpp | 1 + media/mtransport/ipc/moz.build | 7 - .../peerconnection/PeerConnectionMedia.cpp | 146 ++++++++---------- .../src/peerconnection/PeerConnectionMedia.h | 15 +- netwerk/ipc/NeckoChild.cpp | 14 -- netwerk/ipc/NeckoChild.h | 3 - netwerk/ipc/NeckoParent.cpp | 30 ---- netwerk/ipc/NeckoParent.h | 7 - netwerk/ipc/PNecko.ipdl | 4 - netwerk/ipc/PSocketProcess.ipdl | 3 - netwerk/ipc/SocketProcessChild.cpp | 14 -- netwerk/ipc/SocketProcessChild.h | 2 - netwerk/ipc/SocketProcessParent.cpp | 30 ---- netwerk/ipc/SocketProcessParent.h | 4 - netwerk/ipc/moz.build | 1 - 24 files changed, 69 insertions(+), 467 deletions(-) delete mode 100644 media/mtransport/ipc/PProxyConfigLookup.ipdl delete mode 100644 media/mtransport/ipc/ProxyConfigLookup.cpp delete mode 100644 media/mtransport/ipc/ProxyConfigLookup.h delete mode 100644 media/mtransport/ipc/ProxyConfigLookupChild.cpp delete mode 100644 media/mtransport/ipc/ProxyConfigLookupChild.h delete mode 100644 media/mtransport/ipc/ProxyConfigLookupParent.cpp delete mode 100644 media/mtransport/ipc/ProxyConfigLookupParent.h diff --git a/dom/network/TCPSocketChild.h b/dom/network/TCPSocketChild.h index 6fc66f026728..7729d5a6618d 100644 --- a/dom/network/TCPSocketChild.h +++ b/dom/network/TCPSocketChild.h @@ -12,6 +12,7 @@ #include "nsCycleCollectionParticipant.h" #include "nsCOMPtr.h" #include "js/TypeDecls.h" +#include "nsICancelable.h" class nsITCPSocketCallback; diff --git a/ipc/ipdl/ipdl/direct_call.py b/ipc/ipdl/ipdl/direct_call.py index a14c45f7a369..6fa1fc496f59 100644 --- a/ipc/ipdl/ipdl/direct_call.py +++ b/ipc/ipdl/ipdl/direct_call.py @@ -554,8 +554,6 @@ VIRTUAL_CALL_CLASSES = set([ ("PPluginWidget", "parent"), ("PProfiler", "child"), ("PProfiler", "parent"), - ("PProxyConfigLookup", "child"), - ("PProxyConfigLookup", "parent"), ("PSpeechSynthesisRequest", "child"), ("PSpeechSynthesisRequest", "parent"), ("PStunAddrsRequest", "child"), diff --git a/media/mtransport/ipc/PProxyConfigLookup.ipdl b/media/mtransport/ipc/PProxyConfigLookup.ipdl deleted file mode 100644 index f57feb054d49..000000000000 --- a/media/mtransport/ipc/PProxyConfigLookup.ipdl +++ /dev/null @@ -1,20 +0,0 @@ -/* 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 protocol PNecko; -include protocol PSocketProcess; - -namespace mozilla { -namespace net { - -protocol PProxyConfigLookup -{ - manager PNecko or PSocketProcess; - -child: - async __delete__(bool aProxied); -}; - -} // namespace net -} // namespace mozilla diff --git a/media/mtransport/ipc/ProxyConfigLookup.cpp b/media/mtransport/ipc/ProxyConfigLookup.cpp deleted file mode 100644 index aacfc38c4e85..000000000000 --- a/media/mtransport/ipc/ProxyConfigLookup.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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 "ProxyConfigLookup.h" -#include "mozilla/SystemGroup.h" -#include "mozilla/Unused.h" -#include "nsContentUtils.h" -#include "nsICancelable.h" -#include "nsIProtocolProxyService.h" -#include "nsNetUtil.h" - -namespace mozilla { -namespace net { - -// static -nsresult ProxyConfigLookup::Create(std::function&& aCallback) { - RefPtr helper = new ProxyConfigLookup(); - helper->mCallback = std::move(aCallback); - - nsresult rv; - nsCOMPtr pps = - do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv); - if (NS_WARN_IF(NS_FAILED(rv))) { - return NS_ERROR_FAILURE; - } - - // We use the following URL to find the "default" proxy address for all HTTPS - // connections. We will only attempt one HTTP(S) CONNECT per peer connection. - // "example.com" is guaranteed to be unallocated and should return the best - // default. - nsCOMPtr fakeHttpsLocation; - rv = NS_NewURI(getter_AddRefs(fakeHttpsLocation), "https://example.com"); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - - nsCOMPtr channel; - rv = NS_NewChannel(getter_AddRefs(channel), fakeHttpsLocation, - nsContentUtils::GetSystemPrincipal(), - nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL, - nsIContentPolicy::TYPE_OTHER); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - - nsCOMPtr target = - SystemGroup::EventTargetFor(TaskCategory::Network); - nsCOMPtr proxyRequest; - - rv = pps->AsyncResolve(channel, - nsIProtocolProxyService::RESOLVE_PREFER_HTTPS_PROXY | - nsIProtocolProxyService::RESOLVE_ALWAYS_TUNNEL, - helper, target, getter_AddRefs(proxyRequest)); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - - return NS_OK; -} - -ProxyConfigLookup::ProxyConfigLookup() = default; - -ProxyConfigLookup::~ProxyConfigLookup() = default; - -NS_IMETHODIMP ProxyConfigLookup::OnProxyAvailable(nsICancelable* aRequest, - nsIChannel* aChannel, - nsIProxyInfo* aProxyinfo, - nsresult aResult) { - mCallback(NS_SUCCEEDED(aResult) && aProxyinfo); - return NS_OK; -} - -NS_IMPL_ISUPPORTS(ProxyConfigLookup, nsIProtocolProxyCallback) - -} // namespace net -} // namespace mozilla diff --git a/media/mtransport/ipc/ProxyConfigLookup.h b/media/mtransport/ipc/ProxyConfigLookup.h deleted file mode 100644 index ab7623e1c279..000000000000 --- a/media/mtransport/ipc/ProxyConfigLookup.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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/. */ - -#ifndef mozilla_net_ProxyConfigLookup_h -#define mozilla_net_ProxyConfigLookup_h - -#include "nsIProtocolProxyCallback.h" -#include - -namespace mozilla { -namespace net { - -class ProxyConfigLookup final : public nsIProtocolProxyCallback { - public: - NS_DECL_ISUPPORTS - NS_DECL_NSIPROTOCOLPROXYCALLBACK - - static nsresult Create(std::function&& aCallback); - - private: - explicit ProxyConfigLookup(); - ~ProxyConfigLookup(); - - std::function mCallback; -}; - -} // namespace net -} // namespace mozilla - -#endif // mozilla_net_ProxyConfigLookup_h diff --git a/media/mtransport/ipc/ProxyConfigLookupChild.cpp b/media/mtransport/ipc/ProxyConfigLookupChild.cpp deleted file mode 100644 index fa8ca1f16969..000000000000 --- a/media/mtransport/ipc/ProxyConfigLookupChild.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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 "ProxyConfigLookupChild.h" - -namespace mozilla { -namespace net { - -ProxyConfigLookupChild::ProxyConfigLookupChild( - std::function&& aCallback) - : mCallback(std::move(aCallback)) {} - -ProxyConfigLookupChild::~ProxyConfigLookupChild() = default; - -mozilla::ipc::IPCResult ProxyConfigLookupChild::Recv__delete__( - const bool& aProxied) { - mCallback(aProxied); - return IPC_OK(); -} - -} // namespace net -} // namespace mozilla diff --git a/media/mtransport/ipc/ProxyConfigLookupChild.h b/media/mtransport/ipc/ProxyConfigLookupChild.h deleted file mode 100644 index c5c00621716d..000000000000 --- a/media/mtransport/ipc/ProxyConfigLookupChild.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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/. */ - -#ifndef mozilla_net_ProxyConfigLookupChild_h -#define mozilla_net_ProxyConfigLookupChild_h - -#include "mozilla/net/PProxyConfigLookup.h" -#include "mozilla/net/PProxyConfigLookupChild.h" -#include - -namespace mozilla { - -namespace net { - -class ProxyConfigLookupChild final : public PProxyConfigLookupChild { - public: - explicit ProxyConfigLookupChild(std::function&& aCallback); - ~ProxyConfigLookupChild(); - - mozilla::ipc::IPCResult Recv__delete__(const bool& aProxied) override; - - private: - std::function mCallback; -}; - -} // namespace net -} // namespace mozilla - -#endif // mozilla_net_ProxyConfigLookupChild_h diff --git a/media/mtransport/ipc/ProxyConfigLookupParent.cpp b/media/mtransport/ipc/ProxyConfigLookupParent.cpp deleted file mode 100644 index 5d6641007695..000000000000 --- a/media/mtransport/ipc/ProxyConfigLookupParent.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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 "ProxyConfigLookupParent.h" -#include "ProxyConfigLookup.h" -#include "mozilla/Unused.h" - -namespace mozilla { -namespace net { - -ProxyConfigLookupParent::ProxyConfigLookupParent() = default; - -ProxyConfigLookupParent::~ProxyConfigLookupParent() = default; - -void ProxyConfigLookupParent::DoProxyLookup() { - RefPtr self = this; - nsresult rv = ProxyConfigLookup::Create([self](bool aProxied) { - if (self->CanSend()) { - Unused << Send__delete__(self, aProxied); - } - }); - - if (NS_WARN_IF(NS_FAILED(rv))) { - Unused << Send__delete__(self, false); - } -} - -} // namespace net -} // namespace mozilla diff --git a/media/mtransport/ipc/ProxyConfigLookupParent.h b/media/mtransport/ipc/ProxyConfigLookupParent.h deleted file mode 100644 index 3003ec2c5b73..000000000000 --- a/media/mtransport/ipc/ProxyConfigLookupParent.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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/. */ - -#ifndef mozilla_net_ProxyConfigLookupParent_h -#define mozilla_net_ProxyConfigLookupParent_h - -#include "mozilla/net/PProxyConfigLookup.h" -#include "mozilla/net/PProxyConfigLookupParent.h" - -namespace mozilla { -namespace net { - -class ProxyConfigLookupParent final : public PProxyConfigLookupParent { - public: - NS_INLINE_DECL_REFCOUNTING(ProxyConfigLookupParent) - - ProxyConfigLookupParent(); - - void DoProxyLookup(); - - private: - ~ProxyConfigLookupParent(); -}; - -} // namespace net -} // namespace mozilla - -#endif // mozilla_net_ProxyConfigLookupParent_h diff --git a/media/mtransport/ipc/WebrtcTCPSocket.cpp b/media/mtransport/ipc/WebrtcTCPSocket.cpp index 3ade3697ef17..70c870e636c3 100644 --- a/media/mtransport/ipc/WebrtcTCPSocket.cpp +++ b/media/mtransport/ipc/WebrtcTCPSocket.cpp @@ -20,6 +20,7 @@ #include "mozilla/dom/ContentProcessManager.h" #include "mozilla/dom/BrowserParent.h" #include "nsISocketTransportService.h" +#include "nsICancelable.h" #include "WebrtcTCPSocketCallback.h" #include "WebrtcTCPSocketLog.h" diff --git a/media/mtransport/ipc/moz.build b/media/mtransport/ipc/moz.build index a7d275309d2b..c959453aa080 100644 --- a/media/mtransport/ipc/moz.build +++ b/media/mtransport/ipc/moz.build @@ -4,9 +4,6 @@ EXPORTS.mozilla.net += [ 'NrIceStunAddrMessageUtils.h', - 'ProxyConfigLookup.h', - 'ProxyConfigLookupChild.h', - 'ProxyConfigLookupParent.h', 'PStunAddrsParams.h', 'StunAddrsRequestChild.h', 'StunAddrsRequestParent.h', @@ -17,9 +14,6 @@ EXPORTS.mozilla.net += [ ] UNIFIED_SOURCES += [ - 'ProxyConfigLookup.cpp', - 'ProxyConfigLookupChild.cpp', - 'ProxyConfigLookupParent.cpp', 'StunAddrsRequestChild.cpp', 'StunAddrsRequestParent.cpp', 'WebrtcTCPSocket.cpp', @@ -29,7 +23,6 @@ UNIFIED_SOURCES += [ ] IPDL_SOURCES += [ - 'PProxyConfigLookup.ipdl', 'PStunAddrsRequest.ipdl', 'PWebrtcTCPSocket.ipdl', ] diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp index 317435cfdfdc..fecc6d41a4e4 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp @@ -20,19 +20,14 @@ #include "nsILoadInfo.h" #include "nsIContentPolicy.h" #include "nsIProxyInfo.h" -#include "nsIProtocolProxyService.h" #include "nsIPrincipal.h" #include "mozilla/LoadInfo.h" -#include "nsProxyRelease.h" -#include "nsIHttpChannelInternal.h" +#include "nsIProxiedChannel.h" #include "nsIScriptGlobalObject.h" #include "mozilla/Preferences.h" #include "mozilla/dom/BrowserChild.h" #include "mozilla/net/NeckoChild.h" -#include "mozilla/net/ProxyConfigLookup.h" -#include "mozilla/net/ProxyConfigLookupChild.h" -#include "mozilla/net/SocketProcessChild.h" #include "MediaManager.h" #include "WebrtcGmpVideoCodec.h" @@ -70,7 +65,6 @@ PeerConnectionMedia::PeerConnectionMedia(PeerConnectionImpl* parent) mParentName(parent->GetName()), mMainThread(mParent->GetMainThread()), mSTSThread(mParent->GetSTSThread()), - mWaitingOnProxyLookup(false), mForceProxy(false), mStunAddrsRequest(nullptr), mLocalAddrsCompleted(false), @@ -99,60 +93,44 @@ void PeerConnectionMedia::InitLocalAddrs() { } } -static net::ProxyConfigLookupChild* CreateActor(PeerConnectionMedia* aSelf) { - RefPtr self = aSelf; - return new net::ProxyConfigLookupChild( - [self](bool aProxied) { self->ProxySettingReceived(aProxied); }); -} - -nsresult PeerConnectionMedia::InitProxy() { - // Allow mochitests to disable this, since mochitest configures a fake proxy - // that serves up content. - mForceProxy = - Preferences::GetBool("media.peerconnection.ice.proxy_only", false); - if (mForceProxy) { - // Matter is settled, we're done. - return NS_OK; +bool PeerConnectionMedia::ShouldForceProxy() const { + if (Preferences::GetBool("media.peerconnection.ice.proxy_only", false)) { + return true; } - mWaitingOnProxyLookup = Preferences::GetBool( - "media.peerconnection.ice.proxy_only_if_behind_proxy", false); - if (!mWaitingOnProxyLookup) { - // We won't be forcing the use of a proxy. - return NS_OK; + if (!Preferences::GetBool( + "media.peerconnection.ice.proxy_only_if_behind_proxy", false)) { + return false; } - // We have to determine if we're behind a proxy before we can decide whether - // to set mForceProxy. - if (XRE_IsContentProcess()) { - if (NS_WARN_IF(!net::gNeckoChild)) { - return NS_ERROR_FAILURE; - } + // Ok, we're supposed to be proxy_only, but only if a proxy is configured. + // Let's just see if the document was loaded via a proxy. - net::gNeckoChild->SendPProxyConfigLookupConstructor(CreateActor(this)); - return NS_OK; + nsCOMPtr httpChannelInternal = GetChannel(); + if (!httpChannelInternal) { + return false; } - if (XRE_IsSocketProcess()) { - net::SocketProcessChild* child = net::SocketProcessChild::GetSingleton(); - if (!child) { - return NS_ERROR_FAILURE; - } - - child->SendPProxyConfigLookupConstructor(CreateActor(this)); - return NS_OK; + nsCOMPtr proxiedChannel = + do_QueryInterface(httpChannelInternal); + if (!proxiedChannel) { + return false; } - RefPtr self = this; - return net::ProxyConfigLookup::Create( - [self](bool aProxied) { self->ProxySettingReceived(aProxied); }); + nsCOMPtr proxyInfo; + proxiedChannel->GetProxyInfo(getter_AddRefs(proxyInfo)); + if (!proxyInfo) { + return false; + } + + nsCString proxyType; + proxyInfo->GetType(proxyType); + + return !proxyType.IsEmpty() && !proxyType.EqualsLiteral("direct"); } nsresult PeerConnectionMedia::Init() { - nsresult rv = InitProxy(); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } + mForceProxy = ShouldForceProxy(); // setup the stun local addresses IPC async call InitLocalAddrs(); @@ -379,47 +357,57 @@ void PeerConnectionMedia::GatherIfReady() { PerformOrEnqueueIceCtxOperation(runnable); } -nsresult PeerConnectionMedia::SetTargetForDefaultLocalAddressLookup() { +already_AddRefed PeerConnectionMedia::GetChannel() + const { Document* doc = mParent->GetWindow()->GetExtantDoc(); - if (!doc) { + if (NS_WARN_IF(!doc)) { NS_WARNING("Unable to get document from window"); - return NS_ERROR_NOT_AVAILABLE; + return nullptr; } if (!doc->GetDocumentURI()->SchemeIs("file")) { nsIChannel* channel = doc->GetChannel(); if (!channel) { NS_WARNING("Unable to get channel from document"); - return NS_ERROR_NOT_AVAILABLE; + return nullptr; } nsCOMPtr httpChannelInternal = do_QueryInterface(channel); - if (!httpChannelInternal) { + if (NS_WARN_IF(!httpChannelInternal)) { CSFLogInfo(LOGTAG, "%s: Document does not have an HTTP channel", __FUNCTION__); - return NS_OK; + return nullptr; } - - nsCString remoteIp; - nsresult rv = httpChannelInternal->GetRemoteAddress(remoteIp); - if (NS_FAILED(rv) || remoteIp.IsEmpty()) { - CSFLogError(LOGTAG, "%s: Failed to get remote IP address: %d", - __FUNCTION__, (int)rv); - return rv; - } - - int32_t remotePort; - rv = httpChannelInternal->GetRemotePort(&remotePort); - if (NS_FAILED(rv)) { - CSFLogError(LOGTAG, "%s: Failed to get remote port number: %d", - __FUNCTION__, (int)rv); - return rv; - } - - mTransportHandler->SetTargetForDefaultLocalAddressLookup(remoteIp.get(), - remotePort); + return httpChannelInternal.forget(); } + return nullptr; +} + +nsresult PeerConnectionMedia::SetTargetForDefaultLocalAddressLookup() { + nsCOMPtr httpChannelInternal = GetChannel(); + if (!httpChannelInternal) { + return NS_OK; + } + + nsCString remoteIp; + nsresult rv = httpChannelInternal->GetRemoteAddress(remoteIp); + if (NS_FAILED(rv) || remoteIp.IsEmpty()) { + CSFLogError(LOGTAG, "%s: Failed to get remote IP address: %d", __FUNCTION__, + (int)rv); + return rv; + } + + int32_t remotePort; + rv = httpChannelInternal->GetRemotePort(&remotePort); + if (NS_FAILED(rv)) { + CSFLogError(LOGTAG, "%s: Failed to get remote port number: %d", + __FUNCTION__, (int)rv); + return rv; + } + + mTransportHandler->SetTargetForDefaultLocalAddressLookup(remoteIp.get(), + remotePort); return NS_OK; } @@ -765,16 +753,6 @@ nsPIDOMWindowInner* PeerConnectionMedia::GetWindow() const { return mParent->GetWindow(); } -void PeerConnectionMedia::ProxySettingReceived(bool aProxied) { - if (mDestroyed) { - // PeerConnectionMedia is no longer waiting - return; - } - mWaitingOnProxyLookup = false; - mForceProxy = aProxied; - FlushIceCtxOperationQueueIfReady(); -} - std::unique_ptr PeerConnectionMedia::GetProxyConfig() const { MOZ_ASSERT(NS_IsMainThread()); diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h index 9bfdcb9bdd79..ef5325f3d60a 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h @@ -12,8 +12,8 @@ #include "mozilla/RefPtr.h" #include "mozilla/UniquePtr.h" #include "mozilla/net/StunAddrsRequestChild.h" -#include "nsIProtocolProxyCallback.h" #include "MediaTransportHandler.h" +#include "nsIHttpChannelInternal.h" #include "TransceiverImpl.h" @@ -125,12 +125,11 @@ class PeerConnectionMedia : public sigslot::has_slots<> { } nsPIDOMWindowInner* GetWindow() const; + already_AddRefed GetChannel() const; void AlpnNegotiated_s(const std::string& aAlpn); void AlpnNegotiated_m(const std::string& aAlpn); - void ProxySettingReceived(bool aProxied); - // TODO: Move to PeerConnectionImpl RefPtr mCall; @@ -139,7 +138,7 @@ class PeerConnectionMedia : public sigslot::has_slots<> { private: void InitLocalAddrs(); // for stun local address IPC request - nsresult InitProxy(); + bool ShouldForceProxy() const; std::unique_ptr GetProxyConfig() const; class StunAddrsHandler : public net::StunAddrsListener { @@ -185,9 +184,7 @@ class PeerConnectionMedia : public sigslot::has_slots<> { void OnCandidateFound_m(const std::string& aTransportId, const CandidateInfo& aCandidateInfo); - bool IsIceCtxReady() const { - return !mWaitingOnProxyLookup && mLocalAddrsCompleted; - } + bool IsIceCtxReady() const { return mLocalAddrsCompleted; } // The parent PC PeerConnectionImpl* mParent; @@ -209,9 +206,7 @@ class PeerConnectionMedia : public sigslot::has_slots<> { // gathering or start checking) std::vector> mQueuedIceCtxOperations; - // If the "media.peerconnection.ice.proxy_only_if_behind_proxy" pref is set, - // we need to test this before we can know what proxy policy to use. - bool mWaitingOnProxyLookup; + // Set if prefs dictate that we should force the use of a web proxy. bool mForceProxy; // Used to cancel incoming stun addrs response diff --git a/netwerk/ipc/NeckoChild.cpp b/netwerk/ipc/NeckoChild.cpp index 74e10a765439..42a5f5848f4a 100644 --- a/netwerk/ipc/NeckoChild.cpp +++ b/netwerk/ipc/NeckoChild.cpp @@ -27,7 +27,6 @@ #include "mozilla/net/ClassifierDummyChannelChild.h" #include "mozilla/net/SocketProcessBridgeChild.h" #ifdef MOZ_WEBRTC -# include "mozilla/net/ProxyConfigLookupChild.h" # include "mozilla/net/StunAddrsRequestChild.h" # include "mozilla/net/WebrtcTCPSocketChild.h" #endif @@ -394,18 +393,5 @@ bool NeckoChild::DeallocPClassifierDummyChannelChild( return true; } -PProxyConfigLookupChild* NeckoChild::AllocPProxyConfigLookupChild() { - MOZ_CRASH("AllocPProxyConfigLookupChild should not be called"); - return nullptr; -} - -bool NeckoChild::DeallocPProxyConfigLookupChild( - PProxyConfigLookupChild* aActor) { -#ifdef MOZ_WEBRTC - delete static_cast(aActor); -#endif - return true; -} - } // namespace net } // namespace mozilla diff --git a/netwerk/ipc/NeckoChild.h b/netwerk/ipc/NeckoChild.h index 347bf93f3664..968be1c8516c 100644 --- a/netwerk/ipc/NeckoChild.h +++ b/netwerk/ipc/NeckoChild.h @@ -95,9 +95,6 @@ class NeckoChild : public PNeckoChild { bool DeallocPClassifierDummyChannelChild( PClassifierDummyChannelChild* aChannel); - - PProxyConfigLookupChild* AllocPProxyConfigLookupChild(); - bool DeallocPProxyConfigLookupChild(PProxyConfigLookupChild* aActor); }; /** diff --git a/netwerk/ipc/NeckoParent.cpp b/netwerk/ipc/NeckoParent.cpp index 10232e55e58c..82e6be898a8f 100644 --- a/netwerk/ipc/NeckoParent.cpp +++ b/netwerk/ipc/NeckoParent.cpp @@ -31,7 +31,6 @@ #include "mozilla/net/SocketProcessParent.h" #include "mozilla/net/PSocketProcessBridgeParent.h" #ifdef MOZ_WEBRTC -# include "mozilla/net/ProxyConfigLookupParent.h" # include "mozilla/net/StunAddrsRequestParent.h" # include "mozilla/net/WebrtcTCPSocketParent.h" #endif @@ -1001,34 +1000,5 @@ mozilla::ipc::IPCResult NeckoParent::RecvEnsureHSTSData( return IPC_OK(); } -PProxyConfigLookupParent* NeckoParent::AllocPProxyConfigLookupParent() { -#ifdef MOZ_WEBRTC - RefPtr actor = new ProxyConfigLookupParent(); - return actor.forget().take(); -#else - return nullptr; -#endif -} - -mozilla::ipc::IPCResult NeckoParent::RecvPProxyConfigLookupConstructor( - PProxyConfigLookupParent* aActor) { -#ifdef MOZ_WEBRTC - ProxyConfigLookupParent* actor = - static_cast(aActor); - actor->DoProxyLookup(); -#endif - return IPC_OK(); -} - -bool NeckoParent::DeallocPProxyConfigLookupParent( - PProxyConfigLookupParent* aActor) { -#ifdef MOZ_WEBRTC - RefPtr actor = - dont_AddRef(static_cast(aActor)); - MOZ_ASSERT(actor); -#endif - return true; -} - } // namespace net } // namespace mozilla diff --git a/netwerk/ipc/NeckoParent.h b/netwerk/ipc/NeckoParent.h index 4308ae242f06..497ed517431d 100644 --- a/netwerk/ipc/NeckoParent.h +++ b/netwerk/ipc/NeckoParent.h @@ -251,13 +251,6 @@ class NeckoParent : public PNeckoParent { mozilla::ipc::IPCResult RecvEnsureHSTSData( EnsureHSTSDataResolver&& aResolver); - - PProxyConfigLookupParent* AllocPProxyConfigLookupParent(); - - virtual mozilla::ipc::IPCResult RecvPProxyConfigLookupConstructor( - PProxyConfigLookupParent* aActor) override; - - bool DeallocPProxyConfigLookupParent(PProxyConfigLookupParent* aActor); }; } // namespace net diff --git a/netwerk/ipc/PNecko.ipdl b/netwerk/ipc/PNecko.ipdl index ee21d0d533e9..d66231b4fd89 100644 --- a/netwerk/ipc/PNecko.ipdl +++ b/netwerk/ipc/PNecko.ipdl @@ -28,7 +28,6 @@ include protocol PFileChannel; include protocol PClassifierDummyChannel; include protocol PWebrtcTCPSocket; include protocol PSocketProcessBridge; -include protocol PProxyConfigLookup; include protocol PDocumentChannel; include IPCStream; @@ -69,7 +68,6 @@ nested(upto inside_cpow) sync protocol PNecko manages PStunAddrsRequest; manages PClassifierDummyChannel; manages PWebrtcTCPSocket; - manages PProxyConfigLookup; manages PDocumentChannel; parent: @@ -146,8 +144,6 @@ parent: /* tabId is only required for web-proxy support, which isn't always needed */ async PWebrtcTCPSocket(TabId? tabId); - async PProxyConfigLookup(); - /** * WebExtension-specific remote resource loading */ diff --git a/netwerk/ipc/PSocketProcess.ipdl b/netwerk/ipc/PSocketProcess.ipdl index 108449bbcd01..1ad1c9be9369 100644 --- a/netwerk/ipc/PSocketProcess.ipdl +++ b/netwerk/ipc/PSocketProcess.ipdl @@ -6,7 +6,6 @@ include protocol PDNSRequest; include protocol PSocketProcessBridge; include protocol PProfiler; -include protocol PProxyConfigLookup; include protocol PWebrtcTCPSocket; include MemoryReportTypes; @@ -30,7 +29,6 @@ protocol PSocketProcess { manages PDNSRequest; manages PWebrtcTCPSocket; - manages PProxyConfigLookup; parent: async InitCrashReporter(Shmem shmem, NativeThreadId threadId); @@ -48,7 +46,6 @@ parent: async PWebrtcTCPSocket(TabId? tabId); async PDNSRequest(nsCString hostName, OriginAttributes originAttributes, uint32_t flags); - async PProxyConfigLookup(); child: async PreferenceUpdate(Pref pref); diff --git a/netwerk/ipc/SocketProcessChild.cpp b/netwerk/ipc/SocketProcessChild.cpp index 2594c0a88c34..a61a3a66469e 100644 --- a/netwerk/ipc/SocketProcessChild.cpp +++ b/netwerk/ipc/SocketProcessChild.cpp @@ -23,7 +23,6 @@ #endif #ifdef MOZ_WEBRTC -# include "mozilla/net/ProxyConfigLookupChild.h" # include "mozilla/net/WebrtcTCPSocketChild.h" #endif @@ -228,18 +227,5 @@ bool SocketProcessChild::DeallocPDNSRequestChild(PDNSRequestChild* aChild) { return true; } -PProxyConfigLookupChild* SocketProcessChild::AllocPProxyConfigLookupChild() { - MOZ_CRASH("AllocPProxyConfigLookupChild should not be called"); - return nullptr; -} - -bool SocketProcessChild::DeallocPProxyConfigLookupChild( - PProxyConfigLookupChild* aActor) { -#ifdef MOZ_WEBRTC - delete static_cast(aActor); -#endif - return true; -} - } // namespace net } // namespace mozilla diff --git a/netwerk/ipc/SocketProcessChild.h b/netwerk/ipc/SocketProcessChild.h index e299abe27497..511d099838a4 100644 --- a/netwerk/ipc/SocketProcessChild.h +++ b/netwerk/ipc/SocketProcessChild.h @@ -51,8 +51,6 @@ class SocketProcessChild final : public PSocketProcessChild { const nsCString& aHost, const OriginAttributes& aOriginAttributes, const uint32_t& aFlags); bool DeallocPDNSRequestChild(PDNSRequestChild*); - PProxyConfigLookupChild* AllocPProxyConfigLookupChild(); - bool DeallocPProxyConfigLookupChild(PProxyConfigLookupChild* aActor); void CleanUp(); void DestroySocketProcessBridgeParent(ProcessId aId); diff --git a/netwerk/ipc/SocketProcessParent.cpp b/netwerk/ipc/SocketProcessParent.cpp index 83d7bd34dde0..eec3d46c8c02 100644 --- a/netwerk/ipc/SocketProcessParent.cpp +++ b/netwerk/ipc/SocketProcessParent.cpp @@ -12,7 +12,6 @@ #ifdef MOZ_WEBRTC # include "mozilla/dom/ContentProcessManager.h" # include "mozilla/dom/BrowserParent.h" -# include "mozilla/net/ProxyConfigLookupParent.h" # include "mozilla/net/WebrtcTCPSocketParent.h" #endif @@ -164,35 +163,6 @@ bool SocketProcessParent::DeallocPDNSRequestParent(PDNSRequestParent* aParent) { return true; } -PProxyConfigLookupParent* SocketProcessParent::AllocPProxyConfigLookupParent() { -#ifdef MOZ_WEBRTC - RefPtr actor = new ProxyConfigLookupParent(); - return actor.forget().take(); -#else - return nullptr; -#endif -} - -mozilla::ipc::IPCResult SocketProcessParent::RecvPProxyConfigLookupConstructor( - PProxyConfigLookupParent* aActor) { -#ifdef MOZ_WEBRTC - ProxyConfigLookupParent* actor = - static_cast(aActor); - actor->DoProxyLookup(); -#endif - return IPC_OK(); -} - -bool SocketProcessParent::DeallocPProxyConfigLookupParent( - PProxyConfigLookupParent* aActor) { -#ifdef MOZ_WEBRTC - RefPtr actor = - dont_AddRef(static_cast(aActor)); - MOZ_ASSERT(actor); -#endif - return true; -} - // To ensure that IPDL is finished before SocketParent gets deleted. class DeferredDeleteSocketProcessParent : public Runnable { public: diff --git a/netwerk/ipc/SocketProcessParent.h b/netwerk/ipc/SocketProcessParent.h index 8bd87c73c697..3726d68ef879 100644 --- a/netwerk/ipc/SocketProcessParent.h +++ b/netwerk/ipc/SocketProcessParent.h @@ -64,10 +64,6 @@ class SocketProcessParent final const OriginAttributes& aOriginAttributes, const uint32_t& flags) override; bool DeallocPDNSRequestParent(PDNSRequestParent*); - PProxyConfigLookupParent* AllocPProxyConfigLookupParent(); - virtual mozilla::ipc::IPCResult RecvPProxyConfigLookupConstructor( - PProxyConfigLookupParent* aActor) override; - bool DeallocPProxyConfigLookupParent(PProxyConfigLookupParent* aActor); void ActorDestroy(ActorDestroyReason aWhy) override; bool SendRequestMemoryReport(const uint32_t& aGeneration, diff --git a/netwerk/ipc/moz.build b/netwerk/ipc/moz.build index 8cd09f6ccdd3..064cb3cca2c3 100644 --- a/netwerk/ipc/moz.build +++ b/netwerk/ipc/moz.build @@ -52,7 +52,6 @@ IPDL_SOURCES = [ # needed so --disable-webrtc builds work (yes, a bit messy) if not CONFIG['MOZ_WEBRTC']: IPDL_SOURCES += [ - '../../media/mtransport/ipc/PProxyConfigLookup.ipdl', '../../media/mtransport/ipc/PStunAddrsRequest.ipdl', '../../media/mtransport/ipc/PWebrtcTCPSocket.ipdl', ]