Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1543009 - Move Windows system proxy xpcom component to static reg…
Browse files Browse the repository at this point in the history
…istration. r=kmag

Differential Revision: https://phabricator.services.mozilla.com/D26890
  • Loading branch information
glandium committed Apr 11, 2019
1 parent 715ee5b commit fac0291
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 32 deletions.
13 changes: 13 additions & 0 deletions toolkit/system/windowsproxy/components.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.

Classes = [
{
'cid': '{4e22d3ea-aaa2-436e-ada4-9247de57d367}',
'contract_ids': ['@mozilla.org/system-proxy-settings;1'],
'type': 'nsWindowsSystemProxySettings',
},
]
4 changes: 4 additions & 0 deletions toolkit/system/windowsproxy/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,8 @@ SOURCES += [
'ProxyUtils.cpp'
]

XPCOM_MANIFESTS += [
'components.conf',
]

FINAL_LIBRARY = 'xul'
31 changes: 5 additions & 26 deletions toolkit/system/windowsproxy/nsWindowsSystemProxySettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "mozilla/Attributes.h"
#include "nsISystemProxySettings.h"
#include "nsIServiceManager.h"
#include "mozilla/ModuleUtils.h"
#include "mozilla/Components.h"
#include "nsPrintfCString.h"
#include "nsNetCID.h"
#include "nsISupportsPrimitives.h"
Expand All @@ -27,7 +27,6 @@ class nsWindowsSystemProxySettings final : public nsISystemProxySettings {
NS_DECL_NSISYSTEMPROXYSETTINGS

nsWindowsSystemProxySettings(){};
nsresult Init();

private:
~nsWindowsSystemProxySettings(){};
Expand All @@ -47,8 +46,6 @@ nsWindowsSystemProxySettings::GetMainThreadOnly(bool* aMainThreadOnly) {
return NS_OK;
}

nsresult nsWindowsSystemProxySettings::Init() { return NS_OK; }

static void SetProxyResult(const char* aType, const nsACString& aHostPort,
nsACString& aResult) {
aResult.AssignASCII(aType);
Expand Down Expand Up @@ -247,25 +244,7 @@ nsresult nsWindowsSystemProxySettings::GetProxyForURI(const nsACString& aSpec,
return NS_OK;
}

/* 4e22d3ea-aaa2-436e-ada4-9247de57d367 */
#define NS_WINDOWSSYSTEMPROXYSERVICE_CID \
{ \
0x4e22d3ea, 0xaaa2, 0x436e, { \
0xad, 0xa4, 0x92, 0x47, 0xde, 0x57, 0xd3, 0x67 \
} \
}

NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowsSystemProxySettings, Init)
NS_DEFINE_NAMED_CID(NS_WINDOWSSYSTEMPROXYSERVICE_CID);

static const mozilla::Module::CIDEntry kSysProxyCIDs[] = {
{&kNS_WINDOWSSYSTEMPROXYSERVICE_CID, false, nullptr,
nsWindowsSystemProxySettingsConstructor},
{nullptr}};

static const mozilla::Module::ContractIDEntry kSysProxyContracts[] = {
{NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_WINDOWSSYSTEMPROXYSERVICE_CID},
{nullptr}};

extern const mozilla::Module kSysProxyModule = {
mozilla::Module::kVersion, kSysProxyCIDs, kSysProxyContracts};
NS_IMPL_COMPONENT_FACTORY(nsWindowsSystemProxySettings) {
return mozilla::MakeAndAddRef<nsWindowsSystemProxySettings>()
.downcast<nsISupports>();
}
6 changes: 0 additions & 6 deletions xpcom/components/nsComponentManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,6 @@ extern const mozilla::Module kKeyValueModule;
extern const mozilla::Module kXREModule;
extern const mozilla::Module kEmbeddingModule;
#if defined(XP_WIN)
extern const mozilla::Module kSysProxyModule;
#endif
#if defined(XP_WIN)
namespace mozilla {
namespace toolkit {
namespace system {
Expand Down Expand Up @@ -468,9 +465,6 @@ nsresult nsComponentManagerImpl::Init() {
RegisterModule(&kKeyValueModule);
RegisterModule(&kXREModule);
RegisterModule(&kEmbeddingModule);
#if defined(XP_WIN)
RegisterModule(&kSysProxyModule);
#endif
#if defined(XP_WIN)
RegisterModule(&mozilla::toolkit::system::windowsDHCPClient::kSysDHCPClientModule);
#endif
Expand Down

0 comments on commit fac0291

Please sign in to comment.