Skip to content

Commit

Permalink
Bug 1542996 - Remove duplicate component registration. r=kmag
Browse files Browse the repository at this point in the history
Bug 1478124 and bug 1524687 converted many things to static xpcom
component registration, but somehow left the corresponding C++
initialization.

Differential Revision: https://phabricator.services.mozilla.com/D26697

--HG--
extra : moz-landing-system : lando
  • Loading branch information
glandium committed Apr 9, 2019
1 parent 742e0ce commit d452755
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 67 deletions.
1 change: 1 addition & 0 deletions parser/htmlparser/components.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Headers = [
'nsHTMLTags.h',
]

InitFunc = 'nsParserInitialize'
UnloadFunc = 'nsHTMLTags::ReleaseTable'

Classes = [
Expand Down
2 changes: 2 additions & 0 deletions parser/htmlparser/nsParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,4 +385,6 @@ class nsParser final : public nsIParser,
bool mIsAboutBlank;
};

nsresult nsParserInitialize();

#endif
24 changes: 1 addition & 23 deletions parser/htmlparser/nsParserModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,9 @@
* 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 "mozilla/ModuleUtils.h"
#include "nsParser.h"
#include "nsParserCIID.h"
#include "nsHTMLTags.h"

//----------------------------------------------------------------------

NS_GENERIC_FACTORY_CONSTRUCTOR(nsParser)

NS_DEFINE_NAMED_CID(NS_PARSER_CID);

static const mozilla::Module::CIDEntry kParserCIDs[] = {
{&kNS_PARSER_CID, false, nullptr, nsParserConstructor}, {nullptr}};

static nsresult Initialize() {
nsresult nsParserInitialize() {
nsresult rv = nsHTMLTags::AddRefTable();
NS_ENSURE_SUCCESS(rv, rv);

Expand All @@ -28,13 +16,3 @@ static nsresult Initialize() {

return rv;
}

static void Shutdown() { nsHTMLTags::ReleaseTable(); }

extern const mozilla::Module kParserModule = {mozilla::Module::kVersion,
kParserCIDs,
nullptr,
nullptr,
nullptr,
Initialize,
Shutdown};
21 changes: 0 additions & 21 deletions security/manager/ssl/LocalCertService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,25 +450,4 @@ LocalCertService::GetLoginPromptRequired(bool* aRequired) {
return NS_OK;
}

#define LOCALCERTSERVICE_CID \
{ \
0x47402be2, 0xe653, 0x45d0, { \
0x8d, 0xaa, 0x9f, 0x0d, 0xce, 0x0a, 0xc1, 0x48 \
} \
}

NS_GENERIC_FACTORY_CONSTRUCTOR(LocalCertService)

NS_DEFINE_NAMED_CID(LOCALCERTSERVICE_CID);

static const Module::CIDEntry kLocalCertServiceCIDs[] = {
{&kLOCALCERTSERVICE_CID, false, nullptr, LocalCertServiceConstructor},
{nullptr}};

static const Module::ContractIDEntry kLocalCertServiceContracts[] = {
{LOCALCERTSERVICE_CONTRACTID, &kLOCALCERTSERVICE_CID}, {nullptr}};

extern const Module kLocalCertServiceModule = {
Module::kVersion, kLocalCertServiceCIDs, kLocalCertServiceContracts};

} // namespace mozilla
7 changes: 6 additions & 1 deletion toolkit/xre/components.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
# 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/.

if defined('MOZ_CRASHREPORTER'):
crash_reporter = ['@mozilla.org/toolkit/crash-reporter;1']
else:
crash_reporter = []

Classes = [
{
'cid': '{95d89e3e-a169-41a3-8e56-719978e15b12}',
'contract_ids': [
'@mozilla.org/xre/app-info;1',
'@mozilla.org/xre/runtime;1',
],
] + crash_reporter,
'legacy_constructor': 'mozilla::AppInfoConstructor',
'headers': ['nsAppRunner.h'],
},
Expand Down
16 changes: 0 additions & 16 deletions toolkit/xre/nsAppRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1245,14 +1245,6 @@ ScopedXPCOMStartup::~ScopedXPCOMStartup() {
}
}

// {95d89e3e-a169-41a3-8e56-719978e15b12}
#define APPINFO_CID \
{ \
0x95d89e3e, 0xa169, 0x41a3, { \
0x8e, 0x56, 0x71, 0x99, 0x78, 0xe1, 0x5b, 0x12 \
} \
}

// {5F5E59CE-27BC-47eb-9D1F-B09CA9049836}
static const nsCID kProfileServiceCID = {
0x5f5e59ce,
Expand All @@ -1267,19 +1259,11 @@ static already_AddRefed<nsIFactory> ProfileServiceFactoryConstructor(
return factory.forget();
}

NS_DEFINE_NAMED_CID(APPINFO_CID);

static const mozilla::Module::CIDEntry kXRECIDs[] = {
{&kAPPINFO_CID, false, nullptr, AppInfoConstructor},
{&kProfileServiceCID, false, ProfileServiceFactoryConstructor, nullptr},
{nullptr}};

static const mozilla::Module::ContractIDEntry kXREContracts[] = {
{XULAPPINFO_SERVICE_CONTRACTID, &kAPPINFO_CID},
{XULRUNTIME_SERVICE_CONTRACTID, &kAPPINFO_CID},
#ifdef MOZ_CRASHREPORTER
{NS_CRASHREPORTER_CONTRACTID, &kAPPINFO_CID},
#endif // MOZ_CRASHREPORTER
{NS_PROFILESERVICE_CONTRACTID, &kProfileServiceCID},
{nullptr}};

Expand Down
6 changes: 0 additions & 6 deletions xpcom/components/nsComponentManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ nsComponentManagerImpl::nsComponentManagerImpl()
mStatus(NOT_INITIALIZED) {}

extern const mozilla::Module kNeckoModule;
extern const mozilla::Module kParserModule;
#if defined(XP_WIN) || defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_ANDROID)
extern const mozilla::Module kSpeechSynthModule;
#endif
Expand All @@ -361,9 +360,6 @@ extern const mozilla::Module kContentProcessWidgetModule;
extern const mozilla::Module kWidgetModule;
#endif
extern const mozilla::Module kLayoutModule;
namespace mozilla {
extern const mozilla::Module kLocalCertServiceModule;
}
extern const mozilla::Module kKeyValueModule;
extern const mozilla::Module kXREModule;
extern const mozilla::Module kEmbeddingModule;
Expand Down Expand Up @@ -466,7 +462,6 @@ nsresult nsComponentManagerImpl::Init() {

RegisterModule(&kXPCOMModule);
RegisterModule(&kNeckoModule);
RegisterModule(&kParserModule);
#if defined(XP_WIN) || defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_ANDROID)
RegisterModule(&kSpeechSynthModule);
#endif
Expand All @@ -476,7 +471,6 @@ nsresult nsComponentManagerImpl::Init() {
RegisterModule(&kWidgetModule);
#endif
RegisterModule(&kLayoutModule);
RegisterModule(&mozilla::kLocalCertServiceModule);
RegisterModule(&kKeyValueModule);
RegisterModule(&kXREModule);
RegisterModule(&kEmbeddingModule);
Expand Down

0 comments on commit d452755

Please sign in to comment.