Bug 1640091 - Make sure we TRRServiceChannel::mProxyRequest is initialized and used r=kershaw,necko-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D78525
This commit is contained in:
Valentin Gosu 2020-06-08 06:57:23 +00:00
Родитель b0af883a42
Коммит 42d7490489
3 изменённых файлов: 11 добавлений и 6 удалений

Просмотреть файл

@ -20,12 +20,12 @@ namespace net {
// static
nsresult ProxyConfigLookup::Create(
std::function<void(nsIProxyInfo*, nsresult)>&& aCallback, nsIURI* aURI,
uint32_t aProxyResolveFlags) {
uint32_t aProxyResolveFlags, nsICancelable** aLookupCancellable) {
MOZ_ASSERT(NS_IsMainThread());
RefPtr<ProxyConfigLookup> lookUp =
new ProxyConfigLookup(std::move(aCallback), aURI, aProxyResolveFlags);
return lookUp->DoProxyResolve();
return lookUp->DoProxyResolve(aLookupCancellable);
}
ProxyConfigLookup::ProxyConfigLookup(
@ -37,7 +37,7 @@ ProxyConfigLookup::ProxyConfigLookup(
ProxyConfigLookup::~ProxyConfigLookup() = default;
nsresult ProxyConfigLookup::DoProxyResolve() {
nsresult ProxyConfigLookup::DoProxyResolve(nsICancelable** aLookupCancellable) {
if (!XRE_IsParentProcess()) {
RefPtr<ProxyConfigLookup> self = this;
bool result = ProxyConfigLookupChild::Create(
@ -77,6 +77,10 @@ nsresult ProxyConfigLookup::DoProxyResolve() {
getter_AddRefs(proxyRequest));
}
if (aLookupCancellable) {
proxyRequest.forget(aLookupCancellable);
}
return rv;
}

Просмотреть файл

@ -22,14 +22,15 @@ class ProxyConfigLookup final : public nsIProtocolProxyCallback {
static nsresult Create(
std::function<void(nsIProxyInfo*, nsresult)>&& aCallback, nsIURI* aURI,
uint32_t aProxyResolveFlags);
uint32_t aProxyResolveFlags,
nsICancelable** aLookupCancellable = nullptr);
private:
explicit ProxyConfigLookup(
std::function<void(nsIProxyInfo*, nsresult)>&& aCallback, nsIURI* aURI,
uint32_t aProxyResolveFlags);
virtual ~ProxyConfigLookup();
nsresult DoProxyResolve();
nsresult DoProxyResolve(nsICancelable** aLookupCancellable);
std::function<void(nsIProxyInfo*, nsresult)> mCallback;
nsCOMPtr<nsIURI> mURI;

Просмотреть файл

@ -252,7 +252,7 @@ nsresult TRRServiceChannel::ResolveProxy() {
[self](nsIProxyInfo* aProxyInfo, nsresult aStatus) {
self->OnProxyAvailable(nullptr, nullptr, aProxyInfo, aStatus);
},
mURI, mProxyResolveFlags);
mURI, mProxyResolveFlags, getter_AddRefs(mProxyRequest));
if (NS_FAILED(rv)) {
if (!mCurrentEventTarget->IsOnCurrentThread()) {