Backed out changeset 2dd2d24044af (bug 1887782) for causing bustage on uiaRawElmProvi...
[gecko.git] / netwerk / ipc / ProxyConfigLookupParent.cpp
blob597f43eef5c23fbc36d49552acc388d81299a83c
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "ProxyConfigLookupParent.h"
8 #include "ProxyConfigLookup.h"
9 #include "mozilla/Unused.h"
10 #include "nsProxyInfo.h"
12 namespace mozilla {
13 namespace net {
15 ProxyConfigLookupParent::ProxyConfigLookupParent(nsIURI* aURI,
16 uint32_t aProxyResolveFlags)
17 : mURI(aURI), mProxyResolveFlags(aProxyResolveFlags) {}
19 ProxyConfigLookupParent::~ProxyConfigLookupParent() = default;
21 void ProxyConfigLookupParent::DoProxyLookup() {
22 RefPtr<ProxyConfigLookupParent> self = this;
23 nsresult rv = ProxyConfigLookup::Create(
24 [self](nsIProxyInfo* aProxyInfo, nsresult aStatus) {
25 if (self->CanSend()) {
26 nsTArray<ProxyInfoCloneArgs> proxyInfoArray;
27 if (aProxyInfo && NS_SUCCEEDED(aStatus)) {
28 nsProxyInfo::SerializeProxyInfo(
29 static_cast<nsProxyInfo*>(aProxyInfo), proxyInfoArray);
31 Unused << Send__delete__(self, proxyInfoArray, aStatus);
34 mURI, mProxyResolveFlags);
36 if (NS_WARN_IF(NS_FAILED(rv))) {
37 nsTArray<ProxyInfoCloneArgs> emptyArray;
38 Unused << Send__delete__(self, emptyArray, rv);
42 } // namespace net
43 } // namespace mozilla