зеркало из https://github.com/mozilla/gecko-dev.git
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
This commit is contained in:
Родитель
2fe90843a0
Коммит
fec8b0d807
|
@ -12,6 +12,7 @@
|
|||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "js/TypeDecls.h"
|
||||
#include "nsICancelable.h"
|
||||
|
||||
class nsITCPSocketCallback;
|
||||
|
||||
|
|
|
@ -554,8 +554,6 @@ VIRTUAL_CALL_CLASSES = set([
|
|||
("PPluginWidget", "parent"),
|
||||
("PProfiler", "child"),
|
||||
("PProfiler", "parent"),
|
||||
("PProxyConfigLookup", "child"),
|
||||
("PProxyConfigLookup", "parent"),
|
||||
("PSpeechSynthesisRequest", "child"),
|
||||
("PSpeechSynthesisRequest", "parent"),
|
||||
("PStunAddrsRequest", "child"),
|
||||
|
|
|
@ -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
|
|
@ -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<void(bool)>&& aCallback) {
|
||||
RefPtr<ProxyConfigLookup> helper = new ProxyConfigLookup();
|
||||
helper->mCallback = std::move(aCallback);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIProtocolProxyService> 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<nsIURI> fakeHttpsLocation;
|
||||
rv = NS_NewURI(getter_AddRefs(fakeHttpsLocation), "https://example.com");
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> 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<nsIEventTarget> target =
|
||||
SystemGroup::EventTargetFor(TaskCategory::Network);
|
||||
nsCOMPtr<nsICancelable> 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
|
|
@ -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 <functional>
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
class ProxyConfigLookup final : public nsIProtocolProxyCallback {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPROTOCOLPROXYCALLBACK
|
||||
|
||||
static nsresult Create(std::function<void(bool)>&& aCallback);
|
||||
|
||||
private:
|
||||
explicit ProxyConfigLookup();
|
||||
~ProxyConfigLookup();
|
||||
|
||||
std::function<void(bool)> mCallback;
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_net_ProxyConfigLookup_h
|
|
@ -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<void(bool)>&& 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
|
|
@ -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 <functional>
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace net {
|
||||
|
||||
class ProxyConfigLookupChild final : public PProxyConfigLookupChild {
|
||||
public:
|
||||
explicit ProxyConfigLookupChild(std::function<void(bool)>&& aCallback);
|
||||
~ProxyConfigLookupChild();
|
||||
|
||||
mozilla::ipc::IPCResult Recv__delete__(const bool& aProxied) override;
|
||||
|
||||
private:
|
||||
std::function<void(bool)> mCallback;
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_net_ProxyConfigLookupChild_h
|
|
@ -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<ProxyConfigLookupParent> 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
|
|
@ -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
|
|
@ -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"
|
||||
|
|
|
@ -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',
|
||||
]
|
||||
|
|
|
@ -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<PeerConnectionMedia> 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<nsIHttpChannelInternal> 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<nsIProxiedChannel> proxiedChannel =
|
||||
do_QueryInterface(httpChannelInternal);
|
||||
if (!proxiedChannel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RefPtr<PeerConnectionMedia> self = this;
|
||||
return net::ProxyConfigLookup::Create(
|
||||
[self](bool aProxied) { self->ProxySettingReceived(aProxied); });
|
||||
nsCOMPtr<nsIProxyInfo> 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<nsIHttpChannelInternal> 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<nsIHttpChannelInternal> 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<nsIHttpChannelInternal> 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<NrSocketProxyConfig> PeerConnectionMedia::GetProxyConfig()
|
||||
const {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
|
|
@ -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<nsIHttpChannelInternal> 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<WebRtcCallWrapper> 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<NrSocketProxyConfig> 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<nsCOMPtr<nsIRunnable>> 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
|
||||
|
|
|
@ -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<ProxyConfigLookupChild*>(aActor);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -95,9 +95,6 @@ class NeckoChild : public PNeckoChild {
|
|||
|
||||
bool DeallocPClassifierDummyChannelChild(
|
||||
PClassifierDummyChannelChild* aChannel);
|
||||
|
||||
PProxyConfigLookupChild* AllocPProxyConfigLookupChild();
|
||||
bool DeallocPProxyConfigLookupChild(PProxyConfigLookupChild* aActor);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -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<ProxyConfigLookupParent> 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<ProxyConfigLookupParent*>(aActor);
|
||||
actor->DoProxyLookup();
|
||||
#endif
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
bool NeckoParent::DeallocPProxyConfigLookupParent(
|
||||
PProxyConfigLookupParent* aActor) {
|
||||
#ifdef MOZ_WEBRTC
|
||||
RefPtr<ProxyConfigLookupParent> actor =
|
||||
dont_AddRef(static_cast<ProxyConfigLookupParent*>(aActor));
|
||||
MOZ_ASSERT(actor);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<ProxyConfigLookupChild*>(aActor);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<ProxyConfigLookupParent> 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<ProxyConfigLookupParent*>(aActor);
|
||||
actor->DoProxyLookup();
|
||||
#endif
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
bool SocketProcessParent::DeallocPProxyConfigLookupParent(
|
||||
PProxyConfigLookupParent* aActor) {
|
||||
#ifdef MOZ_WEBRTC
|
||||
RefPtr<ProxyConfigLookupParent> actor =
|
||||
dont_AddRef(static_cast<ProxyConfigLookupParent*>(aActor));
|
||||
MOZ_ASSERT(actor);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
// To ensure that IPDL is finished before SocketParent gets deleted.
|
||||
class DeferredDeleteSocketProcessParent : public Runnable {
|
||||
public:
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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',
|
||||
]
|
||||
|
|
Загрузка…
Ссылка в новой задаче