From 6d4728645849e9bade608ed938b03f1f9b80d4fc Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 24 Jan 2019 16:34:52 -0800 Subject: [PATCH] Bug 1524687: Part 8 - Convert remaining toolkit modules to static registration. r=mossop Differential Revision: https://phabricator.services.mozilla.com/D18403 --HG-- extra : rebase_source : 9200029151b677261c0bb16e7d874d56c20f88dc extra : source : b9862758b98ccb95e90901258bcea159784c7483 --- .../components/autocomplete/components.conf | 20 +++++++ toolkit/components/autocomplete/moz.build | 4 ++ .../autocomplete/nsAutoCompleteController.cpp | 25 --------- .../nsAutoCompleteSimpleResult.cpp | 22 -------- .../autocomplete/nsAutoCompleteSimpleResult.h | 22 +++++++- .../components/browser/build/components.conf | 15 ++++++ toolkit/components/browser/build/moz.build | 7 +-- .../browser/build/nsWebBrowserModule.cpp | 40 -------------- toolkit/components/build/nsToolkitCompsCID.h | 24 --------- toolkit/components/ctypes/components.conf | 14 +++++ toolkit/components/ctypes/ctypes.cpp | 26 --------- toolkit/components/ctypes/moz.build | 4 ++ .../components/mediasniffer/components.conf | 18 +++++++ toolkit/components/mediasniffer/moz.build | 5 +- .../mediasniffer/nsMediaSnifferModule.cpp | 32 ----------- toolkit/components/mozintl/MozIntlHelper.cpp | 28 ---------- toolkit/components/mozintl/components.conf | 14 +++++ toolkit/components/mozintl/moz.build | 4 ++ toolkit/components/perf/PerfMeasurement.cpp | 26 --------- toolkit/components/perf/components.conf | 14 +++++ toolkit/components/perf/moz.build | 4 ++ toolkit/components/reflect/components.conf | 14 +++++ toolkit/components/reflect/moz.build | 4 ++ toolkit/components/reflect/reflect.cpp | 26 --------- toolkit/components/remote/components.conf | 14 +++++ toolkit/components/remote/moz.build | 4 ++ toolkit/components/remote/nsRemoteService.cpp | 25 --------- toolkit/components/satchel/components.conf | 17 ++++++ toolkit/components/satchel/moz.build | 4 ++ .../satchel/nsFormFillController.cpp | 21 -------- .../components/telemetry/core/Telemetry.cpp | 40 ++++---------- toolkit/components/telemetry/core/Telemetry.h | 5 ++ .../components/telemetry/core/components.conf | 19 +++++++ toolkit/components/telemetry/moz.build | 4 ++ toolkit/components/thumbnails/components.conf | 14 +++++ toolkit/components/thumbnails/moz.build | 5 +- .../thumbnails/nsPageThumbsModule.cpp | 21 -------- toolkit/system/gnome/components.conf | 45 ++++++++++++++++ toolkit/system/gnome/moz.build | 4 ++ toolkit/system/gnome/nsGConfService.h | 11 ++-- toolkit/system/gnome/nsGnomeModule.cpp | 53 ++----------------- toolkit/system/gnome/nsGnomeModule.h | 10 ++++ toolkit/system/unixproxy/components.conf | 13 +++++ toolkit/system/unixproxy/moz.build | 4 ++ .../system/unixproxy/nsLibProxySettings.cpp | 32 ++--------- .../unixproxy/nsUnixSystemProxySettings.cpp | 39 ++++---------- 46 files changed, 348 insertions(+), 468 deletions(-) create mode 100644 toolkit/components/autocomplete/components.conf create mode 100644 toolkit/components/browser/build/components.conf delete mode 100644 toolkit/components/browser/build/nsWebBrowserModule.cpp create mode 100644 toolkit/components/ctypes/components.conf create mode 100644 toolkit/components/mediasniffer/components.conf delete mode 100644 toolkit/components/mediasniffer/nsMediaSnifferModule.cpp create mode 100644 toolkit/components/mozintl/components.conf create mode 100644 toolkit/components/perf/components.conf create mode 100644 toolkit/components/reflect/components.conf create mode 100644 toolkit/components/remote/components.conf create mode 100644 toolkit/components/satchel/components.conf create mode 100644 toolkit/components/telemetry/core/components.conf create mode 100644 toolkit/components/thumbnails/components.conf delete mode 100644 toolkit/components/thumbnails/nsPageThumbsModule.cpp create mode 100644 toolkit/system/gnome/components.conf create mode 100644 toolkit/system/gnome/nsGnomeModule.h create mode 100644 toolkit/system/unixproxy/components.conf diff --git a/toolkit/components/autocomplete/components.conf b/toolkit/components/autocomplete/components.conf new file mode 100644 index 000000000000..432a6309edee --- /dev/null +++ b/toolkit/components/autocomplete/components.conf @@ -0,0 +1,20 @@ +# -*- 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': '{f6d5ebbd-34f4-487d-9d10-3d34123e3eb9}', + 'contract_ids': ['@mozilla.org/autocomplete/controller;1'], + 'type': 'nsAutoCompleteController', + 'headers': ['/toolkit/components/autocomplete/nsAutoCompleteController.h'], + }, + { + 'cid': '{2ee3039b-2de4-43d9-93b0-649beacff39a}', + 'contract_ids': ['@mozilla.org/autocomplete/simple-result;1'], + 'type': 'nsAutoCompleteSimpleResult', + 'headers': ['/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h'], + }, +] diff --git a/toolkit/components/autocomplete/moz.build b/toolkit/components/autocomplete/moz.build index f3817d642ea0..7b3133e31125 100644 --- a/toolkit/components/autocomplete/moz.build +++ b/toolkit/components/autocomplete/moz.build @@ -22,6 +22,10 @@ UNIFIED_SOURCES += [ 'nsAutoCompleteSimpleResult.cpp', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + FINAL_LIBRARY = 'xul' with Files('**'): diff --git a/toolkit/components/autocomplete/nsAutoCompleteController.cpp b/toolkit/components/autocomplete/nsAutoCompleteController.cpp index de2d4ea2b2b8..25c9a3526894 100644 --- a/toolkit/components/autocomplete/nsAutoCompleteController.cpp +++ b/toolkit/components/autocomplete/nsAutoCompleteController.cpp @@ -9,14 +9,12 @@ #include "nsAutoPtr.h" #include "nsNetCID.h" #include "nsIIOService.h" -#include "nsToolkitCompsCID.h" #include "nsIServiceManager.h" #include "nsReadableUtils.h" #include "nsUnicharUtils.h" #include "nsIScriptSecurityManager.h" #include "nsIObserverService.h" #include "mozilla/Services.h" -#include "mozilla/ModuleUtils.h" #include "mozilla/Unused.h" #include "mozilla/dom/KeyboardEventBinding.h" #include "mozilla/dom/Event.h" @@ -1758,26 +1756,3 @@ nsresult nsAutoCompleteController::MatchIndexToSearch(int32_t aMatchIndex, return NS_OK; } - -NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteController) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteSimpleResult) - -NS_DEFINE_NAMED_CID(NS_AUTOCOMPLETECONTROLLER_CID); -NS_DEFINE_NAMED_CID(NS_AUTOCOMPLETESIMPLERESULT_CID); - -static const mozilla::Module::CIDEntry kAutoCompleteCIDs[] = { - {&kNS_AUTOCOMPLETECONTROLLER_CID, false, nullptr, - nsAutoCompleteControllerConstructor}, - {&kNS_AUTOCOMPLETESIMPLERESULT_CID, false, nullptr, - nsAutoCompleteSimpleResultConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kAutoCompleteContracts[] = { - {NS_AUTOCOMPLETECONTROLLER_CONTRACTID, &kNS_AUTOCOMPLETECONTROLLER_CID}, - {NS_AUTOCOMPLETESIMPLERESULT_CONTRACTID, &kNS_AUTOCOMPLETESIMPLERESULT_CID}, - {nullptr}}; - -static const mozilla::Module kAutoCompleteModule = { - mozilla::Module::kVersion, kAutoCompleteCIDs, kAutoCompleteContracts}; - -NSMODULE_DEFN(tkAutoCompleteModule) = &kAutoCompleteModule; diff --git a/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp b/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp index 4bc70a82fcc8..ddc687d65961 100644 --- a/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp +++ b/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp @@ -16,28 +16,6 @@ NS_IMPL_ISUPPORTS(nsAutoCompleteSimpleResult, nsIAutoCompleteResult, nsIAutoCompleteSimpleResult) -struct AutoCompleteSimpleResultMatch { - AutoCompleteSimpleResultMatch(const nsAString& aValue, - const nsAString& aComment, - const nsAString& aImage, - const nsAString& aStyle, - const nsAString& aFinalCompleteValue, - const nsAString& aLabel) - : mValue(aValue), - mComment(aComment), - mImage(aImage), - mStyle(aStyle), - mFinalCompleteValue(aFinalCompleteValue), - mLabel(aLabel) {} - - nsString mValue; - nsString mComment; - nsString mImage; - nsString mStyle; - nsString mFinalCompleteValue; - nsString mLabel; -}; - nsAutoCompleteSimpleResult::nsAutoCompleteSimpleResult() : mDefaultIndex(-1), mSearchResult(RESULT_NOMATCH) {} diff --git a/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h b/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h index eb8a9610d8c1..14d5cd885a7a 100644 --- a/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h +++ b/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h @@ -13,7 +13,27 @@ #include "nsTArray.h" #include "mozilla/Attributes.h" -struct AutoCompleteSimpleResultMatch; +struct AutoCompleteSimpleResultMatch { + AutoCompleteSimpleResultMatch(const nsAString& aValue, + const nsAString& aComment, + const nsAString& aImage, + const nsAString& aStyle, + const nsAString& aFinalCompleteValue, + const nsAString& aLabel) + : mValue(aValue), + mComment(aComment), + mImage(aImage), + mStyle(aStyle), + mFinalCompleteValue(aFinalCompleteValue), + mLabel(aLabel) {} + + nsString mValue; + nsString mComment; + nsString mImage; + nsString mStyle; + nsString mFinalCompleteValue; + nsString mLabel; +}; class nsAutoCompleteSimpleResult final : public nsIAutoCompleteSimpleResult { public: diff --git a/toolkit/components/browser/build/components.conf b/toolkit/components/browser/build/components.conf new file mode 100644 index 000000000000..a0bdb1303c68 --- /dev/null +++ b/toolkit/components/browser/build/components.conf @@ -0,0 +1,15 @@ +# -*- 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': '{f66bc334-1dd1-11b2-bab2-90e04fe15c19}', + 'contract_ids': ['@mozilla.org/embedding/browser/content-policy;1'], + 'type': 'nsWebBrowserContentPolicy', + 'headers': ['/toolkit/components/browser/nsWebBrowserContentPolicy.h'], + 'categories': {'content-policy': '@mozilla.org/embedding/browser/content-policy;1'}, + }, +] diff --git a/toolkit/components/browser/build/moz.build b/toolkit/components/browser/build/moz.build index cdd0f5a7600e..1be5545b6a65 100644 --- a/toolkit/components/browser/build/moz.build +++ b/toolkit/components/browser/build/moz.build @@ -4,11 +4,8 @@ # 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/. -SOURCES += [ - 'nsWebBrowserModule.cpp', +XPCOM_MANIFESTS += [ + 'components.conf', ] FINAL_LIBRARY = 'xul' -LOCAL_INCLUDES += [ - '..', -] diff --git a/toolkit/components/browser/build/nsWebBrowserModule.cpp b/toolkit/components/browser/build/nsWebBrowserModule.cpp deleted file mode 100644 index 1b28897eb0ce..000000000000 --- a/toolkit/components/browser/build/nsWebBrowserModule.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* 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 "mozilla/ModuleUtils.h" -#include "nsIServiceManager.h" -#include "nsString.h" - -#include "nsEmbedCID.h" - -#include "nsWebBrowser.h" -#include "nsWebBrowserContentPolicy.h" - -// Factory Constructors - -NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebBrowserContentPolicy) - -NS_DEFINE_NAMED_CID(NS_WEBBROWSERCONTENTPOLICY_CID); - -static const mozilla::Module::CIDEntry kWebBrowserCIDs[] = { - {&kNS_WEBBROWSERCONTENTPOLICY_CID, false, nullptr, - nsWebBrowserContentPolicyConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kWebBrowserContracts[] = { - {NS_WEBBROWSERCONTENTPOLICY_CONTRACTID, &kNS_WEBBROWSERCONTENTPOLICY_CID}, - {nullptr}}; - -static const mozilla::Module::CategoryEntry kWebBrowserCategories[] = { - {"content-policy", NS_WEBBROWSERCONTENTPOLICY_CONTRACTID, - NS_WEBBROWSERCONTENTPOLICY_CONTRACTID}, - {nullptr}}; - -static const mozilla::Module kWebBrowserModule = { - mozilla::Module::kVersion, kWebBrowserCIDs, kWebBrowserContracts, - kWebBrowserCategories}; - -NSMODULE_DEFN(Browser_Embedding_Module) = &kWebBrowserModule; diff --git a/toolkit/components/build/nsToolkitCompsCID.h b/toolkit/components/build/nsToolkitCompsCID.h index 0518033013c2..5d621da012e3 100644 --- a/toolkit/components/build/nsToolkitCompsCID.h +++ b/toolkit/components/build/nsToolkitCompsCID.h @@ -53,22 +53,6 @@ } \ } -// {F6D5EBBD-34F4-487d-9D10-3D34123E3EB9} -#define NS_AUTOCOMPLETECONTROLLER_CID \ - { \ - 0xf6d5ebbd, 0x34f4, 0x487d, { \ - 0x9d, 0x10, 0x3d, 0x34, 0x12, 0x3e, 0x3e, 0xb9 \ - } \ - } - -// {2ee3039b-2de4-43d9-93b0-649beacff39a} -#define NS_AUTOCOMPLETESIMPLERESULT_CID \ - { \ - 0x2ee3039b, 0x2de4, 0x43d9, { \ - 0x93, 0xb0, 0x64, 0x9b, 0xea, 0xcf, 0xf3, 0x9a \ - } \ - } - // {7A6F70B6-2BBD-44b5-9304-501352D44AB5} #define NS_AUTOCOMPLETEMDBRESULT_CID \ { \ @@ -77,14 +61,6 @@ } \ } -// {895DB6C7-DBDF-40ea-9F64-B175033243DC} -#define NS_FORMFILLCONTROLLER_CID \ - { \ - 0x895db6c7, 0xdbdf, 0x40ea, { \ - 0x9f, 0x64, 0xb1, 0x75, 0x3, 0x32, 0x43, 0xdc \ - } \ - } - // {59648a91-5a60-4122-8ff2-54b839c84aed} #define NS_GLOBALHISTORY_CID \ { \ diff --git a/toolkit/components/ctypes/components.conf b/toolkit/components/ctypes/components.conf new file mode 100644 index 000000000000..c75efa264b8f --- /dev/null +++ b/toolkit/components/ctypes/components.conf @@ -0,0 +1,14 @@ +# -*- 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': '{0c797702-1c60-4051-9dd7-4d7405605642}', + 'contract_ids': ['@mozilla.org/jsctypes;1'], + 'type': 'mozilla::ctypes::Module', + 'headers': ['/toolkit/components/ctypes/ctypes.h'], + }, +] diff --git a/toolkit/components/ctypes/ctypes.cpp b/toolkit/components/ctypes/ctypes.cpp index 29c1be2b3133..d8f7568b8061 100644 --- a/toolkit/components/ctypes/ctypes.cpp +++ b/toolkit/components/ctypes/ctypes.cpp @@ -6,7 +6,6 @@ #include "ctypes.h" #include "jsapi.h" #include "js/MemoryFunctions.h" -#include "mozilla/ModuleUtils.h" #include "nsMemory.h" #include "nsString.h" #include "nsNativeCharsetUtils.h" @@ -15,15 +14,6 @@ #include "nsZipArchive.h" #include "xpc_make_class.h" -#define JSCTYPES_CONTRACTID "@mozilla.org/jsctypes;1" - -#define JSCTYPES_CID \ - { \ - 0xc797702, 0x1c60, 0x4051, { \ - 0x9d, 0xd7, 0x4d, 0x74, 0x5, 0x60, 0x56, 0x42 \ - } \ - } - namespace mozilla { namespace ctypes { @@ -46,8 +36,6 @@ static char* UnicodeToNative(JSContext* cx, const char16_t* source, static JSCTypesCallbacks sCallbacks = {UnicodeToNative}; -NS_GENERIC_FACTORY_CONSTRUCTOR(Module) - NS_IMPL_ISUPPORTS(Module, nsIXPCScriptable) Module::Module() = default; @@ -112,17 +100,3 @@ Module::Call(nsIXPConnectWrappedNative* wrapper, JSContext* cx, JSObject* obj, } // namespace ctypes } // namespace mozilla - -NS_DEFINE_NAMED_CID(JSCTYPES_CID); - -static const mozilla::Module::CIDEntry kCTypesCIDs[] = { - {&kJSCTYPES_CID, false, nullptr, mozilla::ctypes::ModuleConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kCTypesContracts[] = { - {JSCTYPES_CONTRACTID, &kJSCTYPES_CID}, {nullptr}}; - -static const mozilla::Module kCTypesModule = {mozilla::Module::kVersion, - kCTypesCIDs, kCTypesContracts}; - -NSMODULE_DEFN(jsctypes) = &kCTypesModule; diff --git a/toolkit/components/ctypes/moz.build b/toolkit/components/ctypes/moz.build index c79110eebc36..eadc947d14c8 100644 --- a/toolkit/components/ctypes/moz.build +++ b/toolkit/components/ctypes/moz.build @@ -18,6 +18,10 @@ EXTRA_JS_MODULES += [ 'ctypes.jsm', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + FINAL_LIBRARY = 'xul' with Files('**'): diff --git a/toolkit/components/mediasniffer/components.conf b/toolkit/components/mediasniffer/components.conf new file mode 100644 index 000000000000..583ebad53b8b --- /dev/null +++ b/toolkit/components/mediasniffer/components.conf @@ -0,0 +1,18 @@ +# -*- 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': '{3fdd6c28-5b87-4e3e-8b57-8e83c23c1a6d}', + 'contract_ids': ['@mozilla.org/media/sniffer;1'], + 'type': 'nsMediaSniffer', + 'headers': ['nsMediaSniffer.h'], + 'categories': { + 'content-sniffing-services': '@mozilla.org/media/sniffer;1', + 'net-content-sniffers': '@mozilla.org/media/sniffer;1', + }, + }, +] diff --git a/toolkit/components/mediasniffer/moz.build b/toolkit/components/mediasniffer/moz.build index a8a922fb3d91..205b528be9eb 100644 --- a/toolkit/components/mediasniffer/moz.build +++ b/toolkit/components/mediasniffer/moz.build @@ -13,7 +13,10 @@ EXPORTS += [ UNIFIED_SOURCES += [ 'mp3sniff.c', 'nsMediaSniffer.cpp', - 'nsMediaSnifferModule.cpp', +] + +XPCOM_MANIFESTS += [ + 'components.conf', ] FINAL_LIBRARY = 'xul' diff --git a/toolkit/components/mediasniffer/nsMediaSnifferModule.cpp b/toolkit/components/mediasniffer/nsMediaSnifferModule.cpp deleted file mode 100644 index 1659b989a982..000000000000 --- a/toolkit/components/mediasniffer/nsMediaSnifferModule.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- 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 "mozilla/ModuleUtils.h" - -#include "nsMediaSniffer.h" - -NS_GENERIC_FACTORY_CONSTRUCTOR(nsMediaSniffer) - -NS_DEFINE_NAMED_CID(NS_MEDIA_SNIFFER_CID); - -static const mozilla::Module::CIDEntry kMediaSnifferCIDs[] = { - {&kNS_MEDIA_SNIFFER_CID, false, nullptr, nsMediaSnifferConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kMediaSnifferContracts[] = { - {NS_MEDIA_SNIFFER_CONTRACTID, &kNS_MEDIA_SNIFFER_CID}, {nullptr}}; - -static const mozilla::Module::CategoryEntry kMediaSnifferCategories[] = { - {"content-sniffing-services", NS_MEDIA_SNIFFER_CONTRACTID, - NS_MEDIA_SNIFFER_CONTRACTID}, - {"net-content-sniffers", NS_MEDIA_SNIFFER_CONTRACTID, - NS_MEDIA_SNIFFER_CONTRACTID}, - {nullptr}}; - -static const mozilla::Module kMediaSnifferModule = { - mozilla::Module::kVersion, kMediaSnifferCIDs, kMediaSnifferContracts, - kMediaSnifferCategories}; - -NSMODULE_DEFN(nsMediaSnifferModule) = &kMediaSnifferModule; diff --git a/toolkit/components/mozintl/MozIntlHelper.cpp b/toolkit/components/mozintl/MozIntlHelper.cpp index e69e8da51028..476d0e58a1a7 100644 --- a/toolkit/components/mozintl/MozIntlHelper.cpp +++ b/toolkit/components/mozintl/MozIntlHelper.cpp @@ -7,14 +7,6 @@ #include "jsapi.h" #include "js/PropertySpec.h" #include "js/Wrapper.h" -#include "mozilla/ModuleUtils.h" - -#define MOZ_MOZINTLHELPER_CID \ - { \ - 0xb43c96be, 0x2b3a, 0x4dc4, { \ - 0x90, 0xe9, 0xb0, 0x6d, 0x34, 0x21, 0x9b, 0x68 \ - } \ - } using namespace mozilla; @@ -95,23 +87,3 @@ MozIntlHelper::AddGetLocaleInfo(JS::Handle val, JSContext* cx) { return AddFunctions(cx, val, funcs); } - -NS_GENERIC_FACTORY_CONSTRUCTOR(MozIntlHelper) -NS_DEFINE_NAMED_CID(MOZ_MOZINTLHELPER_CID); - -static const Module::CIDEntry kMozIntlHelperCIDs[] = { - {&kMOZ_MOZINTLHELPER_CID, false, nullptr, MozIntlHelperConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kMozIntlHelperContracts[] = { - {"@mozilla.org/mozintlhelper;1", &kMOZ_MOZINTLHELPER_CID}, {nullptr}}; - -static const mozilla::Module kMozIntlHelperModule = {mozilla::Module::kVersion, - kMozIntlHelperCIDs, - kMozIntlHelperContracts, - nullptr, - nullptr, - nullptr, - nullptr}; - -NSMODULE_DEFN(mozMozIntlHelperModule) = &kMozIntlHelperModule; diff --git a/toolkit/components/mozintl/components.conf b/toolkit/components/mozintl/components.conf new file mode 100644 index 000000000000..d9a5f6964013 --- /dev/null +++ b/toolkit/components/mozintl/components.conf @@ -0,0 +1,14 @@ +# -*- 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': '{b43c96be-2b3a-4dc4-90e9-b06d34219b68}', + 'contract_ids': ['@mozilla.org/mozintlhelper;1'], + 'type': 'mozilla::MozIntlHelper', + 'headers': ['/toolkit/components/mozintl/MozIntlHelper.h'], + }, +] diff --git a/toolkit/components/mozintl/moz.build b/toolkit/components/mozintl/moz.build index 5a7312b9225f..b55cff50ece5 100644 --- a/toolkit/components/mozintl/moz.build +++ b/toolkit/components/mozintl/moz.build @@ -25,4 +25,8 @@ EXTRA_COMPONENTS += [ 'mozIntl.manifest', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + FINAL_LIBRARY = 'xul' diff --git a/toolkit/components/perf/PerfMeasurement.cpp b/toolkit/components/perf/PerfMeasurement.cpp index dc9fafa37eaf..31a1b1ef3ccd 100644 --- a/toolkit/components/perf/PerfMeasurement.cpp +++ b/toolkit/components/perf/PerfMeasurement.cpp @@ -5,27 +5,15 @@ #include "PerfMeasurement.h" #include "jsperf.h" -#include "mozilla/ModuleUtils.h" #include "nsMemory.h" #include "mozilla/Preferences.h" #include "mozJSComponentLoader.h" #include "nsZipArchive.h" #include "xpc_make_class.h" -#define JSPERF_CONTRACTID "@mozilla.org/jsperf;1" - -#define JSPERF_CID \ - { \ - 0x421c38e6, 0xaee0, 0x4509, { \ - 0xa0, 0x25, 0x13, 0x0f, 0x43, 0x78, 0x03, 0x5a \ - } \ - } - namespace mozilla { namespace jsperf { -NS_GENERIC_FACTORY_CONSTRUCTOR(Module) - NS_IMPL_ISUPPORTS(Module, nsIXPCScriptable) Module::Module() = default; @@ -84,17 +72,3 @@ Module::Call(nsIXPConnectWrappedNative* wrapper, JSContext* cx, JSObject* obj, } // namespace jsperf } // namespace mozilla - -NS_DEFINE_NAMED_CID(JSPERF_CID); - -static const mozilla::Module::CIDEntry kPerfCIDs[] = { - {&kJSPERF_CID, false, nullptr, mozilla::jsperf::ModuleConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kPerfContracts[] = { - {JSPERF_CONTRACTID, &kJSPERF_CID}, {nullptr}}; - -static const mozilla::Module kPerfModule = {mozilla::Module::kVersion, - kPerfCIDs, kPerfContracts}; - -NSMODULE_DEFN(jsperf) = &kPerfModule; diff --git a/toolkit/components/perf/components.conf b/toolkit/components/perf/components.conf new file mode 100644 index 000000000000..8f2685b6b010 --- /dev/null +++ b/toolkit/components/perf/components.conf @@ -0,0 +1,14 @@ +# -*- 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': '{421c38e6-aee0-4509-a025-130f4378035a}', + 'contract_ids': ['@mozilla.org/jsperf;1'], + 'type': 'mozilla::jsperf::Module', + 'headers': ['/toolkit/components/perf/PerfMeasurement.h'], + }, +] diff --git a/toolkit/components/perf/moz.build b/toolkit/components/perf/moz.build index 39c601a27b35..49e99b248c46 100644 --- a/toolkit/components/perf/moz.build +++ b/toolkit/components/perf/moz.build @@ -15,6 +15,10 @@ EXTRA_JS_MODULES += [ 'PerfMeasurement.jsm', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + FINAL_LIBRARY = 'xul' LOCAL_INCLUDES += [ diff --git a/toolkit/components/reflect/components.conf b/toolkit/components/reflect/components.conf new file mode 100644 index 000000000000..227be0291947 --- /dev/null +++ b/toolkit/components/reflect/components.conf @@ -0,0 +1,14 @@ +# -*- 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': '{1a817186-357a-47cd-8aea-2850d60e959e}', + 'contract_ids': ['@mozilla.org/jsreflect;1'], + 'type': 'mozilla::reflect::Module', + 'headers': ['/toolkit/components/reflect/reflect.h'], + }, +] diff --git a/toolkit/components/reflect/moz.build b/toolkit/components/reflect/moz.build index 1ca8414cbc7c..7b11f992791a 100644 --- a/toolkit/components/reflect/moz.build +++ b/toolkit/components/reflect/moz.build @@ -15,4 +15,8 @@ EXTRA_JS_MODULES += [ 'reflect.jsm', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + FINAL_LIBRARY = 'xul' diff --git a/toolkit/components/reflect/reflect.cpp b/toolkit/components/reflect/reflect.cpp index 6eceef6e4ee8..3688e7b75acd 100644 --- a/toolkit/components/reflect/reflect.cpp +++ b/toolkit/components/reflect/reflect.cpp @@ -5,26 +5,14 @@ #include "reflect.h" #include "jsapi.h" -#include "mozilla/ModuleUtils.h" #include "nsMemory.h" #include "nsString.h" #include "nsNativeCharsetUtils.h" #include "xpc_make_class.h" -#define JSREFLECT_CONTRACTID "@mozilla.org/jsreflect;1" - -#define JSREFLECT_CID \ - { \ - 0x1a817186, 0x357a, 0x47cd, { \ - 0x8a, 0xea, 0x28, 0x50, 0xd6, 0x0e, 0x95, 0x9e \ - } \ - } - namespace mozilla { namespace reflect { -NS_GENERIC_FACTORY_CONSTRUCTOR(Module) - NS_IMPL_ISUPPORTS(Module, nsIXPCScriptable) Module::Module() = default; @@ -49,17 +37,3 @@ Module::Call(nsIXPConnectWrappedNative* wrapper, JSContext* cx, JSObject* obj, } // namespace reflect } // namespace mozilla - -NS_DEFINE_NAMED_CID(JSREFLECT_CID); - -static const mozilla::Module::CIDEntry kReflectCIDs[] = { - {&kJSREFLECT_CID, false, nullptr, mozilla::reflect::ModuleConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kReflectContracts[] = { - {JSREFLECT_CONTRACTID, &kJSREFLECT_CID}, {nullptr}}; - -static const mozilla::Module kReflectModule = {mozilla::Module::kVersion, - kReflectCIDs, kReflectContracts}; - -NSMODULE_DEFN(jsreflect) = &kReflectModule; diff --git a/toolkit/components/remote/components.conf b/toolkit/components/remote/components.conf new file mode 100644 index 000000000000..df6bc46ea0bf --- /dev/null +++ b/toolkit/components/remote/components.conf @@ -0,0 +1,14 @@ +# -*- 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': '{c0773e90-5799-4eff-ad03-3ebcd85624ac}', + 'contract_ids': ['@mozilla.org/toolkit/remote-service;1'], + 'type': 'nsRemoteService', + 'headers': ['/toolkit/components/remote/nsRemoteService.h'], + }, +] diff --git a/toolkit/components/remote/moz.build b/toolkit/components/remote/moz.build index e71c3e73a9a8..3c3cd773ecf0 100644 --- a/toolkit/components/remote/moz.build +++ b/toolkit/components/remote/moz.build @@ -28,6 +28,10 @@ if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: ] CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS'] + XPCOM_MANIFESTS += [ + 'components.conf', + ] + FINAL_LIBRARY = 'xul' CXXFLAGS += CONFIG['TK_CFLAGS'] diff --git a/toolkit/components/remote/nsRemoteService.cpp b/toolkit/components/remote/nsRemoteService.cpp index 98747ae6e663..3f3169e3fa51 100644 --- a/toolkit/components/remote/nsRemoteService.cpp +++ b/toolkit/components/remote/nsRemoteService.cpp @@ -19,7 +19,6 @@ #include "nsIAppShellService.h" #include "nsAppShellCID.h" #include "nsInterfaceHashtable.h" -#include "mozilla/ModuleUtils.h" #include "nsGTKToolkit.h" #include "nsICommandLineRunner.h" #include "nsCommandLine.h" @@ -182,27 +181,3 @@ const char* nsRemoteService::HandleCommandLine(const char* aBuffer, return "200 executed command"; } - -// {C0773E90-5799-4eff-AD03-3EBCD85624AC} -#define NS_REMOTESERVICE_CID \ - { \ - 0xc0773e90, 0x5799, 0x4eff, { \ - 0xad, 0x3, 0x3e, 0xbc, 0xd8, 0x56, 0x24, 0xac \ - } \ - } - -NS_GENERIC_FACTORY_CONSTRUCTOR(nsRemoteService) -NS_DEFINE_NAMED_CID(NS_REMOTESERVICE_CID); - -static const mozilla::Module::CIDEntry kRemoteCIDs[] = { - {&kNS_REMOTESERVICE_CID, false, nullptr, nsRemoteServiceConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kRemoteContracts[] = { - {"@mozilla.org/toolkit/remote-service;1", &kNS_REMOTESERVICE_CID}, - {nullptr}}; - -static const mozilla::Module kRemoteModule = {mozilla::Module::kVersion, - kRemoteCIDs, kRemoteContracts}; - -NSMODULE_DEFN(RemoteServiceModule) = &kRemoteModule; diff --git a/toolkit/components/satchel/components.conf b/toolkit/components/satchel/components.conf new file mode 100644 index 000000000000..4fa16ac0c945 --- /dev/null +++ b/toolkit/components/satchel/components.conf @@ -0,0 +1,17 @@ +# -*- 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': '{895db6c7-dbdf-40ea-9f64-b175033243dc}', + 'contract_ids': [ + '@mozilla.org/autocomplete/search;1?name=form-history', + '@mozilla.org/satchel/form-fill-controller;1', + ], + 'type': 'nsFormFillController', + 'headers': ['/toolkit/components/satchel/nsFormFillController.h'], + }, +] diff --git a/toolkit/components/satchel/moz.build b/toolkit/components/satchel/moz.build index d34df1cf75a6..d184a756a597 100644 --- a/toolkit/components/satchel/moz.build +++ b/toolkit/components/satchel/moz.build @@ -40,6 +40,10 @@ EXTRA_JS_MODULES += [ 'nsFormAutoCompleteResult.jsm', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + FINAL_LIBRARY = 'xul' JAR_MANIFESTS += ['jar.mn'] diff --git a/toolkit/components/satchel/nsFormFillController.cpp b/toolkit/components/satchel/nsFormFillController.cpp index 1c0a4ea4a884..1cb2b9a21781 100644 --- a/toolkit/components/satchel/nsFormFillController.cpp +++ b/toolkit/components/satchel/nsFormFillController.cpp @@ -34,7 +34,6 @@ #include "nsIPresShell.h" #include "nsRect.h" #include "nsILoginManager.h" -#include "mozilla/ModuleUtils.h" #include "nsToolkitCompsCID.h" #include "nsEmbedCID.h" #include "nsContentUtils.h" @@ -1348,23 +1347,3 @@ int32_t nsFormFillController::GetIndexOfDocShell(nsIDocShell* aDocShell) { return -1; } - -NS_GENERIC_FACTORY_CONSTRUCTOR(nsFormFillController) - -NS_DEFINE_NAMED_CID(NS_FORMFILLCONTROLLER_CID); - -static const mozilla::Module::CIDEntry kSatchelCIDs[] = { - {&kNS_FORMFILLCONTROLLER_CID, false, nullptr, - nsFormFillControllerConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kSatchelContracts[] = { - {"@mozilla.org/satchel/form-fill-controller;1", - &kNS_FORMFILLCONTROLLER_CID}, - {NS_FORMHISTORYAUTOCOMPLETE_CONTRACTID, &kNS_FORMFILLCONTROLLER_CID}, - {nullptr}}; - -static const mozilla::Module kSatchelModule = {mozilla::Module::kVersion, - kSatchelCIDs, kSatchelContracts}; - -NSMODULE_DEFN(satchel) = &kSatchelModule; diff --git a/toolkit/components/telemetry/core/Telemetry.cpp b/toolkit/components/telemetry/core/Telemetry.cpp index 48faab31930f..85a3eff02946 100644 --- a/toolkit/components/telemetry/core/Telemetry.cpp +++ b/toolkit/components/telemetry/core/Telemetry.cpp @@ -27,6 +27,7 @@ #include "mozilla/Atomics.h" #include "mozilla/Attributes.h" #include "mozilla/BackgroundHangMonitor.h" +#include "mozilla/Components.h" #include "mozilla/DebugOnly.h" #include "mozilla/FStream.h" #include "mozilla/IOInterposer.h" @@ -1545,35 +1546,6 @@ bool TelemetryImpl::CanRecordReleaseData() { return CanRecordBase(); } bool TelemetryImpl::CanRecordPrereleaseData() { return CanRecordExtended(); } NS_IMPL_ISUPPORTS(TelemetryImpl, nsITelemetry, nsIMemoryReporter) -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITelemetry, - TelemetryImpl::CreateTelemetryInstance) - -#define NS_TELEMETRY_CID \ - { \ - 0xaea477f2, 0xb3a2, 0x469c, { \ - 0xaa, 0x29, 0x0a, 0x82, 0xd1, 0x32, 0xb8, 0x29 \ - } \ - } -NS_DEFINE_NAMED_CID(NS_TELEMETRY_CID); - -const Module::CIDEntry kTelemetryCIDs[] = { - {&kNS_TELEMETRY_CID, false, nullptr, nsITelemetryConstructor, - Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS}, - {nullptr}}; - -const Module::ContractIDEntry kTelemetryContracts[] = { - {"@mozilla.org/base/telemetry;1", &kNS_TELEMETRY_CID, - Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS}, - {nullptr}}; - -const Module kTelemetryModule = {Module::kVersion, - kTelemetryCIDs, - kTelemetryContracts, - nullptr, - nullptr, - nullptr, - TelemetryImpl::ShutdownTelemetry, - Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS}; NS_IMETHODIMP TelemetryImpl::GetFileIOReports(JSContext* cx, JS::MutableHandleValue ret) { @@ -1833,8 +1805,6 @@ TelemetryImpl::GetAllStores(JSContext* aCx, JS::MutableHandleValue aResult) { // EXTERNALLY VISIBLE FUNCTIONS in no name space // These are NOT listed in Telemetry.h -NSMODULE_DEFN(nsTelemetryModule) = &kTelemetryModule; - /** * The XRE_TelemetryAdd function is to be used by embedding applications * that can't use mozilla::Telemetry::Accumulate() directly. @@ -2143,5 +2113,13 @@ void SetEventRecordingEnabled(const nsACString& aCategory, bool aEnabled) { TelemetryEvent::SetEventRecordingEnabled(aCategory, aEnabled); } +void ShutdownTelemetry() { + TelemetryImpl::ShutdownTelemetry(); +} + } // namespace Telemetry } // namespace mozilla + +NS_IMPL_COMPONENT_FACTORY(nsITelemetry) { + return TelemetryImpl::CreateTelemetryInstance().downcast(); +} diff --git a/toolkit/components/telemetry/core/Telemetry.h b/toolkit/components/telemetry/core/Telemetry.h index a7f56194d198..286040278b36 100644 --- a/toolkit/components/telemetry/core/Telemetry.h +++ b/toolkit/components/telemetry/core/Telemetry.h @@ -43,6 +43,11 @@ struct EventExtraEntry; */ void Init(); +/** + * Shutdown the Telemetry service. + */ +void ShutdownTelemetry(); + /** * Adds sample to a histogram defined in TelemetryHistogramEnums.h * diff --git a/toolkit/components/telemetry/core/components.conf b/toolkit/components/telemetry/core/components.conf new file mode 100644 index 000000000000..edbf2f408700 --- /dev/null +++ b/toolkit/components/telemetry/core/components.conf @@ -0,0 +1,19 @@ +# -*- 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/. + +Headers = ['mozilla/Telemetry.h'] + +UnloadFunc = 'mozilla::Telemetry::ShutdownTelemetry' + +Classes = [ + { + 'cid': '{aea477f2-b3a2-469c-aa29-0a82d132b829}', + 'contract_ids': ['@mozilla.org/base/telemetry;1'], + 'singleton': True, + 'type': 'nsITelemetry', + 'processes': ProcessSelector.ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS, + }, +] diff --git a/toolkit/components/telemetry/moz.build b/toolkit/components/telemetry/moz.build index 70c5b78be941..86769840b14e 100644 --- a/toolkit/components/telemetry/moz.build +++ b/toolkit/components/telemetry/moz.build @@ -93,6 +93,10 @@ if CONFIG['MOZ_GECKO_PROFILER']: 'other/KeyedStackCapturer.cpp' ] +XPCOM_MANIFESTS += [ + 'core/components.conf', +] + EXTRA_COMPONENTS += [ 'TelemetryStartup.js', 'TelemetryStartup.manifest' diff --git a/toolkit/components/thumbnails/components.conf b/toolkit/components/thumbnails/components.conf new file mode 100644 index 000000000000..e39437abd482 --- /dev/null +++ b/toolkit/components/thumbnails/components.conf @@ -0,0 +1,14 @@ +# -*- 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': '{5a4ae9b5-f475-48ae-9dce-0b4c1d347884}', + 'contract_ids': ['@mozilla.org/network/protocol;1?name=moz-page-thumb'], + 'type': 'PageThumbsProtocol', + 'headers': ['/toolkit/components/thumbnails/PageThumbsProtocol.h'], + }, +] diff --git a/toolkit/components/thumbnails/moz.build b/toolkit/components/thumbnails/moz.build index 052a27fd994e..60ef19753101 100644 --- a/toolkit/components/thumbnails/moz.build +++ b/toolkit/components/thumbnails/moz.build @@ -23,7 +23,6 @@ EXTRA_JS_MODULES += [ ] UNIFIED_SOURCES += [ - 'nsPageThumbsModule.cpp', 'PageThumbsProtocol.cpp' ] @@ -35,6 +34,10 @@ LOCAL_INCLUDES += [ '/netwerk/base' ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + XPIDL_MODULE = 'thumbnails' FINAL_LIBRARY = 'xul' diff --git a/toolkit/components/thumbnails/nsPageThumbsModule.cpp b/toolkit/components/thumbnails/nsPageThumbsModule.cpp deleted file mode 100644 index effd333ac9d4..000000000000 --- a/toolkit/components/thumbnails/nsPageThumbsModule.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "mozilla/ModuleUtils.h" -#include "nsIClassInfoImpl.h" - -#include "PageThumbsProtocol.h" - -NS_GENERIC_FACTORY_CONSTRUCTOR(PageThumbsProtocol) -NS_DEFINE_NAMED_CID(PAGETHUMBSPROTOCOL_CID); - -const mozilla::Module::CIDEntry kPageThumbsCIDs[] = { - {&kPAGETHUMBSPROTOCOL_CID, false, nullptr, PageThumbsProtocolConstructor}, - {nullptr}}; - -const mozilla::Module::ContractIDEntry kPageThumbsContracts[] = { - {NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "moz-page-thumb", - &kPAGETHUMBSPROTOCOL_CID}, - {nullptr}}; - -const mozilla::Module kPageThumbsModule = { - mozilla::Module::kVersion, kPageThumbsCIDs, kPageThumbsContracts}; - -NSMODULE_DEFN(nsPageThumbsModule) = &kPageThumbsModule; diff --git a/toolkit/system/gnome/components.conf b/toolkit/system/gnome/components.conf new file mode 100644 index 000000000000..33386b0bd3ca --- /dev/null +++ b/toolkit/system/gnome/components.conf @@ -0,0 +1,45 @@ +# -*- 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/. + +InitFunc = 'mozilla::InitGType' + +Headers = [ + '/toolkit/system/gnome/nsGnomeModule.h', +] + +Classes = [ + { + 'cid': '{e3a1f3c9-3ae1-4b40-a5e0-7b457fc9a9ad}', + 'contract_ids': ['@mozilla.org/gio-service;1'], + 'type': 'nsGIOService', + 'headers': ['/toolkit/system/gnome/nsGIOService.h'], + }, + { + 'cid': '{bfd4a9d8-d886-4161-81ef-8868da114170}', + 'contract_ids': ['@mozilla.org/gsettings-service;1'], + 'type': 'nsGSettingsService', + 'headers': ['/toolkit/system/gnome/nsGSettingsService.h'], + 'init_method': 'Init', + }, + { + 'cid': '{84e11f80-ca55-11dd-ad8b-0800200c9a66}', + 'contract_ids': ['@mozilla.org/system-alerts-service;1'], + 'type': 'nsSystemAlertsService', + 'headers': ['/toolkit/system/gnome/nsSystemAlertsService.h'], + 'init_method': 'Init', + }, +] + +if defined('MOZ_ENABLE_GCONF'): + Classes += [ + { + 'cid': '{d96d5985-a13a-4bdc-9386-ef348d7a97a1}', + 'contract_ids': ['@mozilla.org/gnome-gconf-service;1'], + 'type': 'nsGConfService', + 'headers': ['/toolkit/system/gnome/nsGConfService.h'], + 'init_method': 'Init', + }, + ] diff --git a/toolkit/system/gnome/moz.build b/toolkit/system/gnome/moz.build index 7f7f18a18a09..55e58b6fbb53 100644 --- a/toolkit/system/gnome/moz.build +++ b/toolkit/system/gnome/moz.build @@ -23,6 +23,10 @@ SOURCES += [ 'nsGSettingsService.cpp', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + FINAL_LIBRARY = 'xul' LOCAL_INCLUDES += [ diff --git a/toolkit/system/gnome/nsGConfService.h b/toolkit/system/gnome/nsGConfService.h index 4ec16eacd08b..a2895898c120 100644 --- a/toolkit/system/gnome/nsGConfService.h +++ b/toolkit/system/gnome/nsGConfService.h @@ -7,15 +7,12 @@ #define nsGConfService_h_ #include "nsIGConfService.h" -#include "gconf/gconf-client.h" #include "mozilla/Attributes.h" -#define NS_GCONFSERVICE_CID \ - { \ - 0xd96d5985, 0xa13a, 0x4bdc, { \ - 0x93, 0x86, 0xef, 0x34, 0x8d, 0x7a, 0x97, 0xa1 \ - } \ - } +extern "C" { + struct _GConfClient; + typedef struct _GConfClient GConfClient; +} class nsGConfService final : public nsIGConfService { public: diff --git a/toolkit/system/gnome/nsGnomeModule.cpp b/toolkit/system/gnome/nsGnomeModule.cpp index 5ef3f0ec6cc8..f073bc0d1b68 100644 --- a/toolkit/system/gnome/nsGnomeModule.cpp +++ b/toolkit/system/gnome/nsGnomeModule.cpp @@ -3,58 +3,13 @@ * 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 "nsToolkitCompsCID.h" -#include "mozilla/ModuleUtils.h" +#include "nsGnomeModule.h" #include -#ifdef MOZ_ENABLE_GCONF -# include "nsGConfService.h" -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGConfService, Init) -#endif -#include "nsGIOService.h" -#include "nsGSettingsService.h" -NS_GENERIC_FACTORY_CONSTRUCTOR(nsGIOService) -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGSettingsService, Init) -#include "nsSystemAlertsService.h" -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSystemAlertsService, Init) - -#ifdef MOZ_ENABLE_GCONF -NS_DEFINE_NAMED_CID(NS_GCONFSERVICE_CID); -#endif -NS_DEFINE_NAMED_CID(NS_GIOSERVICE_CID); -NS_DEFINE_NAMED_CID(NS_GSETTINGSSERVICE_CID); -NS_DEFINE_NAMED_CID(NS_SYSTEMALERTSSERVICE_CID); - -static const mozilla::Module::CIDEntry kGnomeCIDs[] = { -#ifdef MOZ_ENABLE_GCONF - {&kNS_GCONFSERVICE_CID, false, nullptr, nsGConfServiceConstructor}, -#endif - {&kNS_GIOSERVICE_CID, false, nullptr, nsGIOServiceConstructor}, - {&kNS_GSETTINGSSERVICE_CID, false, nullptr, nsGSettingsServiceConstructor}, - {&kNS_SYSTEMALERTSSERVICE_CID, false, nullptr, - nsSystemAlertsServiceConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kGnomeContracts[] = { -#ifdef MOZ_ENABLE_GCONF - {NS_GCONFSERVICE_CONTRACTID, &kNS_GCONFSERVICE_CID}, -#endif - {NS_GIOSERVICE_CONTRACTID, &kNS_GIOSERVICE_CID}, - {NS_GSETTINGSSERVICE_CONTRACTID, &kNS_GSETTINGSSERVICE_CID}, - {NS_SYSTEMALERTSERVICE_CONTRACTID, &kNS_SYSTEMALERTSSERVICE_CID}, - {nullptr}}; - -static nsresult InitGType() { +namespace mozilla { +nsresult InitGType() { g_type_init(); return NS_OK; } - -static const mozilla::Module kGnomeModule = {mozilla::Module::kVersion, - kGnomeCIDs, - kGnomeContracts, - nullptr, - nullptr, - InitGType}; - -NSMODULE_DEFN(mozgnome) = &kGnomeModule; +} // namespace mozilla diff --git a/toolkit/system/gnome/nsGnomeModule.h b/toolkit/system/gnome/nsGnomeModule.h new file mode 100644 index 000000000000..2cbe69a35da2 --- /dev/null +++ b/toolkit/system/gnome/nsGnomeModule.h @@ -0,0 +1,10 @@ +/* -*- Mode: C++; tab-width: 2; 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 "nscore.h" + +namespace mozilla { +nsresult InitGType(); +} // namespace mozilla diff --git a/toolkit/system/unixproxy/components.conf b/toolkit/system/unixproxy/components.conf new file mode 100644 index 000000000000..4f8f11c82aa3 --- /dev/null +++ b/toolkit/system/unixproxy/components.conf @@ -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': '{0fa3158c-d5a7-43de-9181-a285e74cf1d4}', + 'contract_ids': ['@mozilla.org/system-proxy-settings;1'], + 'type': 'nsUnixSystemProxySettings', + }, +] diff --git a/toolkit/system/unixproxy/moz.build b/toolkit/system/unixproxy/moz.build index 7689a26c2bd6..f395ebf8576e 100644 --- a/toolkit/system/unixproxy/moz.build +++ b/toolkit/system/unixproxy/moz.build @@ -17,4 +17,8 @@ else: 'nsUnixSystemProxySettings.cpp', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + FINAL_LIBRARY = 'xul' diff --git a/toolkit/system/unixproxy/nsLibProxySettings.cpp b/toolkit/system/unixproxy/nsLibProxySettings.cpp index 86e8e1ba4431..33c60edac162 100644 --- a/toolkit/system/unixproxy/nsLibProxySettings.cpp +++ b/toolkit/system/unixproxy/nsLibProxySettings.cpp @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISystemProxySettings.h" -#include "mozilla/ModuleUtils.h" +#include "mozilla/Components.h" #include "nsIServiceManager.h" #include "nsIURI.h" #include "nsString.h" @@ -22,7 +22,6 @@ class nsUnixSystemProxySettings : public nsISystemProxySettings { NS_DECL_NSISYSTEMPROXYSETTINGS nsUnixSystemProxySettings() { mProxyFactory = nullptr; } - nsresult Init(); private: ~nsUnixSystemProxySettings() { @@ -40,8 +39,6 @@ nsUnixSystemProxySettings::GetMainThreadOnly(bool *aMainThreadOnly) { return NS_OK; } -nsresult nsUnixSystemProxySettings::Init() { return NS_OK; } - nsresult nsUnixSystemProxySettings::GetPACURI(nsACString &aResult) { // Make sure we return an empty result. aResult.Truncate(); @@ -104,27 +101,6 @@ nsresult nsUnixSystemProxySettings::GetProxyForURI(const nsACString &aSpec, return NS_OK; } -/* 0fa3158c-d5a7-43de-9181-a285e74cf1d4 */ -#define NS_UNIXSYSTEMPROXYSERVICE_CID \ - { \ - 0x0fa3158c, 0xd5a7, 0x43de, { \ - 0x91, 0x81, 0xa2, 0x85, 0xe7, 0x4c, 0xf1, 0xd4 \ - } \ - } - -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUnixSystemProxySettings, Init) -NS_DEFINE_NAMED_CID(NS_UNIXSYSTEMPROXYSERVICE_CID); - -static const mozilla::Module::CIDEntry kUnixProxyCIDs[] = { - {&kNS_UNIXSYSTEMPROXYSERVICE_CID, false, nullptr, - nsUnixSystemProxySettingsConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kUnixProxyContracts[] = { - {NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_UNIXSYSTEMPROXYSERVICE_CID}, - {nullptr}}; - -static const mozilla::Module kUnixProxyModule = { - mozilla::Module::kVersion, kUnixProxyCIDs, kUnixProxyContracts}; - -NSMODULE_DEFN(nsUnixProxyModule) = &kUnixProxyModule; +NS_IMPL_COMPONENT_FACTORY(nsUnixSystemProxySettings) { + return do_AddRef(new nsUnixSystemProxySettings()).downcast(); +} diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp index 3e5c15098229..b124d4cdda8d 100644 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISystemProxySettings.h" -#include "mozilla/ModuleUtils.h" +#include "mozilla/Components.h" #include "nsIServiceManager.h" #include "nsIGConfService.h" #include "nsIURI.h" @@ -21,13 +21,15 @@ #include "mozilla/Attributes.h" #include "nsIURI.h" +using namespace mozilla; + class nsUnixSystemProxySettings final : public nsISystemProxySettings { public: NS_DECL_ISUPPORTS NS_DECL_NSISYSTEMPROXYSETTINGS nsUnixSystemProxySettings() : mSchemeProxySettings(4) {} - nsresult Init(); + void Init(); private: ~nsUnixSystemProxySettings() = default; @@ -59,7 +61,7 @@ nsUnixSystemProxySettings::GetMainThreadOnly(bool* aMainThreadOnly) { return NS_OK; } -nsresult nsUnixSystemProxySettings::Init() { +void nsUnixSystemProxySettings::Init() { mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); if (mGSettings) { mGSettings->GetCollectionForSchema( @@ -69,8 +71,6 @@ nsresult nsUnixSystemProxySettings::Init() { if (!mProxySettings) { mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); } - - return NS_OK; } bool nsUnixSystemProxySettings::IsProxyMode(const char* aMode) { @@ -499,27 +499,8 @@ nsresult nsUnixSystemProxySettings::GetProxyForURI(const nsACString& aSpec, return GetProxyFromEnvironment(aScheme, aHost, aPort, aResult); } -/* 0fa3158c-d5a7-43de-9181-a285e74cf1d4 */ -#define NS_UNIXSYSTEMPROXYSERVICE_CID \ - { \ - 0x0fa3158c, 0xd5a7, 0x43de, { \ - 0x91, 0x81, 0xa2, 0x85, 0xe7, 0x4c, 0xf1, 0xd4 \ - } \ - } - -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUnixSystemProxySettings, Init) -NS_DEFINE_NAMED_CID(NS_UNIXSYSTEMPROXYSERVICE_CID); - -static const mozilla::Module::CIDEntry kUnixProxyCIDs[] = { - {&kNS_UNIXSYSTEMPROXYSERVICE_CID, false, nullptr, - nsUnixSystemProxySettingsConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kUnixProxyContracts[] = { - {NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_UNIXSYSTEMPROXYSERVICE_CID}, - {nullptr}}; - -static const mozilla::Module kUnixProxyModule = { - mozilla::Module::kVersion, kUnixProxyCIDs, kUnixProxyContracts}; - -NSMODULE_DEFN(nsUnixProxyModule) = &kUnixProxyModule; +NS_IMPL_COMPONENT_FACTORY(nsUnixSystemProxySettings) { + auto result = MakeRefPtr(); + result->Init(); + return result.forget().downcast(); +}