Before bug 938437, we had a rather large and error-prone nsStaticXULComponents.cpp used to register all modules. That was replaced with clever use of the linker, which allowed to avoid the mess that maintaining that file was. Fast forward to now, where after bug 1524687 and other work that preceded it, we have a much smaller number of remaining static xpcom components, registered via this linker hack, and don't expect to add any new ones. The list should eventually go down to zero. Within that context, it seems to be the right time to get rid of the magic, and with it the problems it causes on its own. Some of those components could probably be trivially be converted to static registration via .conf files, but I didn't want to deal with the possible need to increase the number of dummy modules in XPCOMInit.cpp. They can still be converted as a followup. Differential Revision: https://phabricator.services.mozilla.com/D26076
77 lines
2.5 KiB
C++
77 lines
2.5 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* 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 "nsIURI.h"
|
|
|
|
#include "nsISystemProxySettings.h"
|
|
#include "nsIServiceManager.h"
|
|
#include "mozilla/ModuleUtils.h"
|
|
#include "nsPrintfCString.h"
|
|
#include "nsNetCID.h"
|
|
#include "nsISupportsPrimitives.h"
|
|
#include "nsIURI.h"
|
|
|
|
#include "AndroidBridge.h"
|
|
|
|
class nsAndroidSystemProxySettings : public nsISystemProxySettings {
|
|
public:
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
|
NS_DECL_NSISYSTEMPROXYSETTINGS
|
|
|
|
nsAndroidSystemProxySettings(){};
|
|
nsresult Init();
|
|
|
|
private:
|
|
virtual ~nsAndroidSystemProxySettings() {}
|
|
};
|
|
|
|
NS_IMPL_ISUPPORTS(nsAndroidSystemProxySettings, nsISystemProxySettings)
|
|
|
|
NS_IMETHODIMP
|
|
nsAndroidSystemProxySettings::GetMainThreadOnly(bool* aMainThreadOnly) {
|
|
*aMainThreadOnly = true;
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult nsAndroidSystemProxySettings::Init() { return NS_OK; }
|
|
|
|
nsresult nsAndroidSystemProxySettings::GetPACURI(nsACString& aResult) {
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult nsAndroidSystemProxySettings::GetProxyForURI(const nsACString& aSpec,
|
|
const nsACString& aScheme,
|
|
const nsACString& aHost,
|
|
const int32_t aPort,
|
|
nsACString& aResult) {
|
|
return mozilla::AndroidBridge::Bridge()->GetProxyForURI(aSpec, aScheme, aHost,
|
|
aPort, aResult);
|
|
}
|
|
|
|
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAndroidSystemProxySettings, Init)
|
|
|
|
#define NS_ANDROIDSYSTEMPROXYSERVICE_CID \
|
|
{ \
|
|
0xf01f0060, 0x3708, 0x478e, { \
|
|
0xb9, 0x35, 0x3e, 0xce, 0x8b, 0xe2, 0x94, 0xb8 \
|
|
} \
|
|
}
|
|
|
|
NS_DEFINE_NAMED_CID(NS_ANDROIDSYSTEMPROXYSERVICE_CID);
|
|
|
|
void test(){};
|
|
|
|
static const mozilla::Module::CIDEntry kSysProxyCIDs[] = {
|
|
{&kNS_ANDROIDSYSTEMPROXYSERVICE_CID, false, nullptr,
|
|
nsAndroidSystemProxySettingsConstructor},
|
|
{nullptr}};
|
|
|
|
static const mozilla::Module::ContractIDEntry kSysProxyContracts[] = {
|
|
{NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_ANDROIDSYSTEMPROXYSERVICE_CID},
|
|
{nullptr}};
|
|
|
|
extern const mozilla::Module kSysProxyModule = {
|
|
mozilla::Module::kVersion, kSysProxyCIDs, kSysProxyContracts};
|