diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 7e5e5773a745..9994cb518a03 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1738,7 +1738,7 @@ var gBrowserInit = { * The functions scheduled here will fire from idle callbacks * once every window has finished being restored by session * restore, and after the equivalent only-once tasks - * have run (from _scheduleStartupIdleTasks in BrowserGlue.jsm). + * have run (from _scheduleStartupIdleTasks in nsBrowserGlue.js). */ _schedulePerWindowIdleTasks() { // Bail out if the window has been closed in the meantime. diff --git a/browser/base/content/test/performance/browser_startup.js b/browser/base/content/test/performance/browser_startup.js index 147aba91a065..b45a164912eb 100644 --- a/browser/base/content/test/performance/browser_startup.js +++ b/browser/base/content/test/performance/browser_startup.js @@ -24,19 +24,22 @@ const startupPhases = { // Anything loaded during app-startup must have a compelling reason // to run before we have even selected the user profile. // Consider loading your code after first paint instead, - // eg. from BrowserGlue.jsm' _onFirstWindowLoaded method). + // eg. from nsBrowserGlue.js' _onFirstWindowLoaded method). "before profile selection": {whitelist: { + components: new Set([ + "nsBrowserGlue.js", + "MainProcessSingleton.js", + + // Bugs to fix: The following components shouldn't be initialized that early. + "PushComponents.js", // bug 1369436 + ]), modules: new Set([ - "resource:///modules/BrowserGlue.jsm", "resource://gre/modules/AppConstants.jsm", "resource://gre/modules/ActorManagerParent.jsm", "resource://gre/modules/CustomElementsListener.jsm", "resource://gre/modules/ExtensionUtils.jsm", - "resource://gre/modules/MainProcessSingleton.jsm", "resource://gre/modules/XPCOMUtils.jsm", "resource://gre/modules/Services.jsm", - // Bugs to fix: The following components shouldn't be initialized that early. - "resource://gre/modules/PushComponents.jsm", // bug 1369436 ]), }}, diff --git a/browser/base/content/test/performance/browser_startup_content.js b/browser/base/content/test/performance/browser_startup_content.js index 17028cc7c196..bbce161fb925 100644 --- a/browser/base/content/test/performance/browser_startup_content.js +++ b/browser/base/content/test/performance/browser_startup_content.js @@ -18,13 +18,14 @@ const kDumpAllStacks = false; const whitelist = { + components: new Set([ + "ContentProcessSingleton.js", + ]), modules: new Set([ "chrome://mochikit/content/ShutdownLeaksCollector.jsm", "resource://specialpowers/specialpowers.js", "resource://specialpowers/specialpowersAPI.js", - "resource://gre/modules/ContentProcessSingleton.jsm", - // General utilities "resource://gre/modules/AppConstants.jsm", "resource://gre/modules/AsyncShutdown.jsm", @@ -99,8 +100,10 @@ const whitelist = { // required, as opposed to items in the main whitelist, // which are all required. const intermittently_loaded_whitelist = { + components: new Set([ + "nsAsyncShutdown.js", + ]), modules: new Set([ - "resource://gre/modules/nsAsyncShutdown.jsm", "resource://gre/modules/sessionstore/Utils.jsm", ]), frameScripts: new Set([]), diff --git a/browser/base/content/test/static/browser_all_files_referenced.js b/browser/base/content/test/static/browser_all_files_referenced.js index 1cda8293f44f..1db095f682bf 100644 --- a/browser/base/content/test/static/browser_all_files_referenced.js +++ b/browser/base/content/test/static/browser_all_files_referenced.js @@ -643,10 +643,6 @@ add_task(async function checkAllTheFiles() { // Wait for all manifest to be parsed await throttledMapPromises(manifestURIs, parseManifest); - for (let jsm of Components.manager.getComponentJSMs()) { - gReferencesFromCode.set(jsm, null); - } - // manifest.json is a common name, it is used for WebExtension manifests // but also for other things. To tell them apart, we have to actually // read the contents. This will populate gExtensionRoots with all diff --git a/browser/components/BrowserComponents.manifest b/browser/components/BrowserComponents.manifest index 755a839f4014..b1215dae27e2 100644 --- a/browser/components/BrowserComponents.manifest +++ b/browser/components/BrowserComponents.manifest @@ -1,3 +1,28 @@ +# nsBrowserContentHandler.js +component {5d0ce354-df01-421a-83fb-7ead0990c24e} nsBrowserContentHandler.js application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/browser/clh;1 {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +component {47cd0651-b1be-4a0f-b5c4-10e5a573ef71} nsBrowserContentHandler.js application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/browser/final-clh;1 {47cd0651-b1be-4a0f-b5c4-10e5a573ef71} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/uriloader/content-handler;1?type=text/html {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/uriloader/content-handler;1?type=application/vnd.mozilla.xul+xml {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/uriloader/content-handler;1?type=image/svg+xml {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/uriloader/content-handler;1?type=text/rdf {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/uriloader/content-handler;1?type=text/xml {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/uriloader/content-handler;1?type=application/xhtml+xml {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/uriloader/content-handler;1?type=text/css {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/uriloader/content-handler;1?type=text/plain {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/uriloader/content-handler;1?type=image/gif {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/uriloader/content-handler;1?type=image/jpeg {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/uriloader/content-handler;1?type=image/jpg {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/uriloader/content-handler;1?type=image/png {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/uriloader/content-handler;1?type=image/bmp {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/uriloader/content-handler;1?type=image/x-icon {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/uriloader/content-handler;1?type=image/vnd.microsoft.icon {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +contract @mozilla.org/uriloader/content-handler;1?type=application/http-index-format {5d0ce354-df01-421a-83fb-7ead0990c24e} application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +category command-line-handler m-browser @mozilla.org/browser/clh;1 application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +category command-line-handler x-default @mozilla.org/browser/final-clh;1 application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} +category command-line-validator b-browser @mozilla.org/browser/clh;1 application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} + # nsBrowserGlue.js # This component must restrict its registration for the app-startup category @@ -7,4 +32,12 @@ # browser: {ec8030f7-c20a-464f-9b0e-13a3a9e97384} # mobile/android: {aa3c5121-dab2-40e2-81ca-7ea25febc110} +component {eab9012e-5f74-4cbc-b2b5-a590235513cc} nsBrowserGlue.js +contract @mozilla.org/browser/browserglue;1 {eab9012e-5f74-4cbc-b2b5-a590235513cc} category app-startup nsBrowserGlue service,@mozilla.org/browser/browserglue;1 application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} application={aa3c5121-dab2-40e2-81ca-7ea25febc110} +component {d8903bf6-68d5-4e97-bcd1-e4d3012f721a} nsBrowserGlue.js +contract @mozilla.org/content-permission/prompt;1 {d8903bf6-68d5-4e97-bcd1-e4d3012f721a} + +# RegisterProtocolHandler support +component {efbd7b87-9b15-4684-abf0-dc2679daadb1} WebProtocolHandlerRegistrar.js process=main +contract @mozilla.org/embeddor.implemented/web-protocol-handler-registrar;1 {efbd7b87-9b15-4684-abf0-dc2679daadb1} process=main diff --git a/browser/components/about/components.conf b/browser/components/about/components.conf deleted file mode 100644 index 6a17394aff87..000000000000 --- a/browser/components/about/components.conf +++ /dev/null @@ -1,40 +0,0 @@ -# -*- 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/. - -pages = [ - 'blocked', - 'certerror', - 'config', - 'downloads', - 'home', - 'library', - 'newinstall', - 'newtab', - 'pocket-saved', - 'pocket-signup', - 'policies', - 'preferences', - 'privatebrowsing', - 'reader', - 'restartrequired', - 'rights', - 'robots', - 'searchreset', - 'sessionrestore', - 'tabcrashed', - 'welcome', - 'welcomeback', -] - -Classes = [ - { - 'cid': '{7e4bb6ad-2fc4-4dc6-89ef-23e8e5ccf980}', - 'contract_ids': ['@mozilla.org/network/protocol/about;1?what=%s' % page - for page in pages], - 'legacy_constructor': 'mozilla::browser::AboutRedirector::Create', - 'headers': ['/browser/components/about/AboutRedirector.h'], - }, -] diff --git a/browser/components/about/moz.build b/browser/components/about/moz.build index 91140b402268..907c56bdcdcc 100644 --- a/browser/components/about/moz.build +++ b/browser/components/about/moz.build @@ -17,10 +17,6 @@ SOURCES += [ 'AboutRedirector.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - EXTRA_JS_MODULES.aboutpages = [ 'AboutPrivateBrowsingHandler.jsm', ] diff --git a/browser/components/build/components.conf b/browser/components/build/components.conf deleted file mode 100644 index 4d1e7bd8bb01..000000000000 --- a/browser/components/build/components.conf +++ /dev/null @@ -1,67 +0,0 @@ -# -*- 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': '{6deb193c-f87d-4078-bc78-5e64655b4d62}', - 'contract_ids': ['@mozilla.org/browser/directory-provider;1'], - 'type': 'mozilla::browser::DirectoryProvider', - 'headers': ['mozilla/browser/DirectoryProvider.h'], - 'categories': {'xpcom-directory-providers': 'browser-directory-provider'}, - }, -] - -TOOLKIT = buildconfig.substs['MOZ_WIDGET_TOOLKIT'] - -shell_service_contracts = [ - '@mozilla.org/browser/shell-service;1', - '@mozilla.org/toolkit/shell-service;1', -] - -if TOOLKIT == 'gtk3': - Classes += [ - { - 'cid': '{63c7b9f4-0cc8-43f8-b666-0a661655cb73}', - 'contract_ids': shell_service_contracts, - 'type': 'nsGNOMEShellService', - 'headers': ['/browser/components/shell/nsGNOMEShellService.h'], - 'init_method': 'Init', - }, - ] -elif TOOLKIT == 'cocoa': - Classes += [ - { - 'cid': '{6fc66a78-6cbc-4b3f-b7ba-379289b29276}', - 'contract_ids': ['@mozilla.org/mac-attribution;1'], - 'type': 'nsMacAttributionService', - 'headers': ['nsMacAttribution.h'], - }, - ] - -if buildconfig.substs['OS_ARCH'] == 'Darwin': - Classes += [ - { - 'cid': '{63c7b9f4-0cc8-43f8-b666-0a661655cb73}', - 'contract_ids': shell_service_contracts, - 'type': 'nsMacShellService', - 'headers': ['/browser/components/shell/nsMacShellService.h'], - }, - ] -elif buildconfig.substs['OS_ARCH'] == 'WINNT': - Classes += [ - { - 'cid': '{63c7b9f4-0cc8-43f8-b666-0a661655cb73}', - 'contract_ids': shell_service_contracts, - 'type': 'nsWindowsShellService', - 'headers': ['/browser/components/shell/nsWindowsShellService.h'], - }, - { - 'cid': '{93480624-806e-4756-b7cb-0fb7dd746a8f}', - 'contract_ids': ['@mozilla.org/profile/migrator/iehistoryenumerator;1'], - 'type': 'nsIEHistoryEnumerator', - 'headers': ['/browser/components/migration/nsIEHistoryEnumerator.h'], - }, - ] diff --git a/browser/components/build/moz.build b/browser/components/build/moz.build index 50b3b9e61e1a..6584293152c2 100644 --- a/browser/components/build/moz.build +++ b/browser/components/build/moz.build @@ -7,8 +7,12 @@ with Files("**"): BUG_COMPONENT = ("Firefox Build System", "General") -XPCOM_MANIFESTS += [ - 'components.conf', +EXPORTS += [ + 'nsBrowserCompsCID.h', +] + +SOURCES += [ + 'nsModule.cpp', ] Library('browsercomps') diff --git a/browser/components/build/nsBrowserCompsCID.h b/browser/components/build/nsBrowserCompsCID.h index 7a95285ae5e1..71be83278c88 100644 --- a/browser/components/build/nsBrowserCompsCID.h +++ b/browser/components/build/nsBrowserCompsCID.h @@ -40,6 +40,14 @@ } \ } +// 7e4bb6ad-2fc4-4dc6-89ef-23e8e5ccf980 +#define NS_BROWSER_ABOUT_REDIRECTOR_CID \ + { \ + 0x7e4bb6ad, 0x2fc4, 0x4dc6, { \ + 0x89, 0xef, 0x23, 0xe8, 0xe5, 0xcc, 0xf9, 0x80 \ + } \ + } + // {6DEB193C-F87D-4078-BC78-5E64655B4D62} #define NS_BROWSERDIRECTORYPROVIDER_CID \ { \ @@ -47,3 +55,14 @@ 0xbc, 0x78, 0x5e, 0x64, 0x65, 0x5b, 0x4d, 0x62 \ } \ } + +#if defined(MOZ_WIDGET_COCOA) +# define NS_MACATTRIBUTIONSERVICE_CONTRACTID "@mozilla.org/mac-attribution;1" + +# define NS_MACATTRIBUTIONSERVICE_CID \ + { \ + 0x6FC66A78, 0x6CBC, 0x4B3F, { \ + 0xB7, 0xBA, 0x37, 0x92, 0x89, 0xB2, 0x92, 0x76 \ + } \ + } +#endif diff --git a/browser/components/build/nsModule.cpp b/browser/components/build/nsModule.cpp new file mode 100644 index 000000000000..4c60d1ef2a78 --- /dev/null +++ b/browser/components/build/nsModule.cpp @@ -0,0 +1,135 @@ +/* -*- 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 "nsBrowserCompsCID.h" +#include "DirectoryProvider.h" + +#if defined(XP_WIN) +# include "nsWindowsShellService.h" +#elif defined(XP_MACOSX) +# include "nsMacShellService.h" +#elif defined(MOZ_WIDGET_GTK) +# include "nsGNOMEShellService.h" +#endif +#include "nsIToolkitShellService.h" + +#if defined(MOZ_WIDGET_COCOA) +# include "nsMacAttribution.h" +#endif + +#if defined(XP_WIN) +# include "nsIEHistoryEnumerator.h" +#endif + +#include "AboutRedirector.h" +#include "nsIAboutModule.h" + +#include "nsNetCID.h" + +using namespace mozilla::browser; + +///////////////////////////////////////////////////////////////////////////// + +NS_GENERIC_FACTORY_CONSTRUCTOR(DirectoryProvider) +#if defined(XP_WIN) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindowsShellService) +#elif defined(XP_MACOSX) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacShellService) +#elif defined(MOZ_WIDGET_GTK) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGNOMEShellService, Init) +#endif + +#if defined(MOZ_WIDGET_COCOA) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacAttributionService) +#endif + +#if defined(XP_WIN) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsIEHistoryEnumerator) +#endif + +NS_DEFINE_NAMED_CID(NS_BROWSERDIRECTORYPROVIDER_CID); +#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) || defined(XP_MACOSX) +NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID); +#endif +NS_DEFINE_NAMED_CID(NS_BROWSER_ABOUT_REDIRECTOR_CID); +#if defined(XP_WIN) +NS_DEFINE_NAMED_CID(NS_WINIEHISTORYENUMERATOR_CID); +#endif +#if defined(MOZ_WIDGET_COCOA) +NS_DEFINE_NAMED_CID(NS_MACATTRIBUTIONSERVICE_CID); +#endif + +static const mozilla::Module::CIDEntry kBrowserCIDs[] = { + // clang-format off + { &kNS_BROWSERDIRECTORYPROVIDER_CID, false, nullptr, DirectoryProviderConstructor }, +#if defined(XP_WIN) + { &kNS_SHELLSERVICE_CID, false, nullptr, nsWindowsShellServiceConstructor }, +#elif defined(MOZ_WIDGET_GTK) + { &kNS_SHELLSERVICE_CID, false, nullptr, nsGNOMEShellServiceConstructor }, +#elif defined(XP_MACOSX) + { &kNS_SHELLSERVICE_CID, false, nullptr, nsMacShellServiceConstructor }, +#endif + { &kNS_BROWSER_ABOUT_REDIRECTOR_CID, false, nullptr, AboutRedirector::Create }, +#if defined(XP_WIN) + { &kNS_WINIEHISTORYENUMERATOR_CID, false, nullptr, nsIEHistoryEnumeratorConstructor }, +#endif +#if defined(MOZ_WIDGET_COCOA) + { &kNS_MACATTRIBUTIONSERVICE_CID, false, nullptr, nsMacAttributionServiceConstructor }, +#endif + { nullptr } + // clang-format on +}; + +static const mozilla::Module::ContractIDEntry kBrowserContracts[] = { + // clang-format off + { NS_BROWSERDIRECTORYPROVIDER_CONTRACTID, &kNS_BROWSERDIRECTORYPROVIDER_CID }, +#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK) || defined(XP_MACOSX) + { NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID }, + { NS_TOOLKITSHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID }, +#endif + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "blocked", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "certerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "config", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "tabcrashed", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "privatebrowsing", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "rights", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "robots", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "searchreset", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "sessionrestore", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "welcomeback", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "home", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "newtab", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "library", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "preferences", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "downloads", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "reader", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "restartrequired", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "welcome", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "policies", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "pocket-saved", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "pocket-signup", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, + { NS_ABOUT_MODULE_CONTRACTID_PREFIX "newinstall", &kNS_BROWSER_ABOUT_REDIRECTOR_CID }, +#if defined(XP_WIN) + { NS_IEHISTORYENUMERATOR_CONTRACTID, &kNS_WINIEHISTORYENUMERATOR_CID }, +#endif +#if defined(MOZ_WIDGET_COCOA) + { NS_MACATTRIBUTIONSERVICE_CONTRACTID, &kNS_MACATTRIBUTIONSERVICE_CID }, +#endif + { nullptr } + // clang-format on +}; + +static const mozilla::Module::CategoryEntry kBrowserCategories[] = { + {XPCOM_DIRECTORY_PROVIDER_CATEGORY, "browser-directory-provider", + NS_BROWSERDIRECTORYPROVIDER_CONTRACTID}, + {nullptr}}; + +static const mozilla::Module kBrowserModule = {mozilla::Module::kVersion, + kBrowserCIDs, kBrowserContracts, + kBrowserCategories}; + +NSMODULE_DEFN(nsBrowserCompsModule) = &kBrowserModule; diff --git a/browser/components/components.conf b/browser/components/components.conf deleted file mode 100644 index 77040f8e3dda..000000000000 --- a/browser/components/components.conf +++ /dev/null @@ -1,55 +0,0 @@ -# -*- 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': '{5d0ce354-df01-421a-83fb-7ead0990c24e}', - 'contract_ids': [ - '@mozilla.org/browser/clh;1', - '@mozilla.org/uriloader/content-handler;1?type=application/http-index-format', - '@mozilla.org/uriloader/content-handler;1?type=application/vnd.mozilla.xul+xml', - '@mozilla.org/uriloader/content-handler;1?type=application/xhtml+xml', - '@mozilla.org/uriloader/content-handler;1?type=image/bmp', - '@mozilla.org/uriloader/content-handler;1?type=image/gif', - '@mozilla.org/uriloader/content-handler;1?type=image/jpeg', - '@mozilla.org/uriloader/content-handler;1?type=image/jpg', - '@mozilla.org/uriloader/content-handler;1?type=image/png', - '@mozilla.org/uriloader/content-handler;1?type=image/svg+xml', - '@mozilla.org/uriloader/content-handler;1?type=image/vnd.microsoft.icon', - '@mozilla.org/uriloader/content-handler;1?type=image/x-icon', - '@mozilla.org/uriloader/content-handler;1?type=text/css', - '@mozilla.org/uriloader/content-handler;1?type=text/html', - '@mozilla.org/uriloader/content-handler;1?type=text/plain', - '@mozilla.org/uriloader/content-handler;1?type=text/rdf', - '@mozilla.org/uriloader/content-handler;1?type=text/xml', - ], - 'jsm': 'resource:///modules/BrowserContentHandler.jsm', - 'constructor': 'nsBrowserContentHandler', - 'categories': { - 'command-line-handler': 'm-browser', - 'command-line-validator': 'b-browser', - }, - }, - { - 'cid': '{47cd0651-b1be-4a0f-b5c4-10e5a573ef71}', - 'contract_ids': ['@mozilla.org/browser/final-clh;1'], - 'jsm': 'resource:///modules/BrowserContentHandler.jsm', - 'constructor': 'nsDefaultCommandLineHandler', - 'categories': {'command-line-handler': 'x-default'}, - }, - { - 'cid': '{eab9012e-5f74-4cbc-b2b5-a590235513cc}', - 'contract_ids': ['@mozilla.org/browser/browserglue;1'], - 'jsm': 'resource:///modules/BrowserGlue.jsm', - 'constructor': 'BrowserGlue', - }, - { - 'cid': '{d8903bf6-68d5-4e97-bcd1-e4d3012f721a}', - 'contract_ids': ['@mozilla.org/content-permission/prompt;1'], - 'jsm': 'resource:///modules/BrowserGlue.jsm', - 'constructor': 'ContentPermissionPrompt', - }, -] diff --git a/browser/components/migration/360seProfileMigrator.jsm b/browser/components/migration/360seProfileMigrator.js similarity index 99% rename from browser/components/migration/360seProfileMigrator.jsm rename to browser/components/migration/360seProfileMigrator.js index ce17190dd3ef..e9e90af4d63a 100644 --- a/browser/components/migration/360seProfileMigrator.jsm +++ b/browser/components/migration/360seProfileMigrator.js @@ -321,4 +321,4 @@ Qihoo360seProfileMigrator.prototype.classDescription = "360 Secure Browser Profi Qihoo360seProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=360se"; Qihoo360seProfileMigrator.prototype.classID = Components.ID("{d0037b95-296a-4a4e-94b2-c3d075d20ab1}"); -var EXPORTED_SYMBOLS = ["Qihoo360seProfileMigrator"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([Qihoo360seProfileMigrator]); diff --git a/browser/components/migration/BrowserProfileMigrators.manifest b/browser/components/migration/BrowserProfileMigrators.manifest new file mode 100644 index 000000000000..d1365d5ea948 --- /dev/null +++ b/browser/components/migration/BrowserProfileMigrators.manifest @@ -0,0 +1,38 @@ +component {6F8BB968-C14F-4D6F-9733-6C6737B35DCE} ProfileMigrator.js +contract @mozilla.org/toolkit/profile-migrator;1 {6F8BB968-C14F-4D6F-9733-6C6737B35DCE} + +#if defined(XP_WIN) || defined(XP_MACOSX) +component {4bf85aa5-4e21-46ca-825f-f9c51a5e8c76} ChromeProfileMigrator.js +contract @mozilla.org/profile/migrator;1?app=browser&type=canary {4bf85aa5-4e21-46ca-825f-f9c51a5e8c76} +#else +component {47f75963-840b-4950-a1f0-d9c1864f8b8e} ChromeProfileMigrator.js +contract @mozilla.org/profile/migrator;1?app=browser&type=chrome-beta {47f75963-840b-4950-a1f0-d9c1864f8b8e} +component {7370a02a-4886-42c3-a4ec-d48c726ec30a} ChromeProfileMigrator.js +contract @mozilla.org/profile/migrator;1?app=browser&type=chrome-dev {7370a02a-4886-42c3-a4ec-d48c726ec30a} +#endif +component {4cec1de4-1671-4fc3-a53e-6c539dc77a26} ChromeProfileMigrator.js +contract @mozilla.org/profile/migrator;1?app=browser&type=chrome {4cec1de4-1671-4fc3-a53e-6c539dc77a26} +component {8cece922-9720-42de-b7db-7cef88cb07ca} ChromeProfileMigrator.js +contract @mozilla.org/profile/migrator;1?app=browser&type=chromium {8cece922-9720-42de-b7db-7cef88cb07ca} + +component {91185366-ba97-4438-acba-48deaca63386} FirefoxProfileMigrator.js +contract @mozilla.org/profile/migrator;1?app=browser&type=firefox {91185366-ba97-4438-acba-48deaca63386} + +#ifdef HAS_IE_MIGRATOR +component {3d2532e3-4932-4774-b7ba-968f5899d3a4} IEProfileMigrator.js +contract @mozilla.org/profile/migrator;1?app=browser&type=ie {3d2532e3-4932-4774-b7ba-968f5899d3a4} +#endif + +#ifdef HAS_EDGE_MIGRATOR +component {62e8834b-2d17-49f5-96ff-56344903a2ae} EdgeProfileMigrator.js +contract @mozilla.org/profile/migrator;1?app=browser&type=edge {62e8834b-2d17-49f5-96ff-56344903a2ae} +#endif + +#ifdef HAS_SAFARI_MIGRATOR +component {4b609ecf-60b2-4655-9df4-dc149e474da1} SafariProfileMigrator.js +contract @mozilla.org/profile/migrator;1?app=browser&type=safari {4b609ecf-60b2-4655-9df4-dc149e474da1} +#endif +#ifdef HAS_360SE_MIGRATOR +component {d0037b95-296a-4a4e-94b2-c3d075d20ab1} 360seProfileMigrator.js +contract @mozilla.org/profile/migrator;1?app=browser&type=360se {d0037b95-296a-4a4e-94b2-c3d075d20ab1} +#endif diff --git a/browser/components/migration/ChromeProfileMigrator.jsm b/browser/components/migration/ChromeProfileMigrator.js similarity index 98% rename from browser/components/migration/ChromeProfileMigrator.jsm rename to browser/components/migration/ChromeProfileMigrator.js index 930897e7c788..9ba78d1ce7f8 100644 --- a/browser/components/migration/ChromeProfileMigrator.jsm +++ b/browser/components/migration/ChromeProfileMigrator.js @@ -16,6 +16,7 @@ const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.j const {NetUtil} = ChromeUtils.import("resource://gre/modules/NetUtil.jsm"); const {OS} = ChromeUtils.import("resource://gre/modules/osfile.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {ChromeMigrationUtils} = ChromeUtils.import("resource:///modules/ChromeMigrationUtils.jsm"); const {MigrationUtils, MigratorPrototype} = ChromeUtils.import("resource:///modules/MigrationUtils.jsm"); @@ -431,7 +432,7 @@ ChromiumProfileMigrator.prototype.classDescription = "Chromium Profile Migrator" ChromiumProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=chromium"; ChromiumProfileMigrator.prototype.classID = Components.ID("{8cece922-9720-42de-b7db-7cef88cb07ca}"); -var EXPORTED_SYMBOLS = ["ChromeProfileMigrator", "ChromiumProfileMigrator"]; +var componentsArray = [ChromeProfileMigrator, ChromiumProfileMigrator]; /** * Chrome Canary @@ -446,7 +447,7 @@ CanaryProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?ap CanaryProfileMigrator.prototype.classID = Components.ID("{4bf85aa5-4e21-46ca-825f-f9c51a5e8c76}"); if (AppConstants.platform == "win" || AppConstants.platform == "macosx") { - EXPORTED_SYMBOLS.push("CanaryProfileMigrator"); + componentsArray.push(CanaryProfileMigrator); } /** @@ -469,5 +470,7 @@ if (AppConstants.platform != "win" && AppConstants.platform != "macosx") { ChromeBetaMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=chrome-beta"; ChromeBetaMigrator.prototype.classID = Components.ID("{47f75963-840b-4950-a1f0-d9c1864f8b8e}"); - EXPORTED_SYMBOLS.push("ChromeDevMigrator", "ChromeBetaMigrator"); + componentsArray.push(ChromeDevMigrator, ChromeBetaMigrator); } + +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(componentsArray); diff --git a/browser/components/migration/EdgeProfileMigrator.jsm b/browser/components/migration/EdgeProfileMigrator.js similarity index 99% rename from browser/components/migration/EdgeProfileMigrator.jsm rename to browser/components/migration/EdgeProfileMigrator.js index 6f0ed3f290b6..f1d9ffe477a2 100644 --- a/browser/components/migration/EdgeProfileMigrator.jsm +++ b/browser/components/migration/EdgeProfileMigrator.js @@ -496,4 +496,4 @@ EdgeProfileMigrator.prototype.classDescription = "Edge Profile Migrator"; EdgeProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=edge"; EdgeProfileMigrator.prototype.classID = Components.ID("{62e8834b-2d17-49f5-96ff-56344903a2ae}"); -var EXPORTED_SYMBOLS = ["EdgeProfileMigrator"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([EdgeProfileMigrator]); diff --git a/browser/components/migration/FirefoxProfileMigrator.jsm b/browser/components/migration/FirefoxProfileMigrator.js similarity index 98% rename from browser/components/migration/FirefoxProfileMigrator.jsm rename to browser/components/migration/FirefoxProfileMigrator.js index d333833e69a0..0591717e5d06 100644 --- a/browser/components/migration/FirefoxProfileMigrator.jsm +++ b/browser/components/migration/FirefoxProfileMigrator.js @@ -13,6 +13,7 @@ * from the source profile. */ +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {MigrationUtils, MigratorPrototype} = ChromeUtils.import("resource:///modules/MigrationUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); @@ -275,4 +276,4 @@ FirefoxProfileMigrator.prototype.classDescription = "Firefox Profile Migrator"; FirefoxProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=firefox"; FirefoxProfileMigrator.prototype.classID = Components.ID("{91185366-ba97-4438-acba-48deaca63386}"); -var EXPORTED_SYMBOLS = ["FirefoxProfileMigrator"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FirefoxProfileMigrator]); diff --git a/browser/components/migration/IEProfileMigrator.jsm b/browser/components/migration/IEProfileMigrator.js similarity index 99% rename from browser/components/migration/IEProfileMigrator.jsm rename to browser/components/migration/IEProfileMigrator.js index a465753fa195..1f952526c220 100644 --- a/browser/components/migration/IEProfileMigrator.jsm +++ b/browser/components/migration/IEProfileMigrator.js @@ -356,4 +356,4 @@ IEProfileMigrator.prototype.classDescription = "IE Profile Migrator"; IEProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=ie"; IEProfileMigrator.prototype.classID = Components.ID("{3d2532e3-4932-4774-b7ba-968f5899d3a4}"); -var EXPORTED_SYMBOLS = ["IEProfileMigrator"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([IEProfileMigrator]); diff --git a/browser/components/migration/ProfileMigrator.jsm b/browser/components/migration/ProfileMigrator.js similarity index 81% rename from browser/components/migration/ProfileMigrator.jsm rename to browser/components/migration/ProfileMigrator.js index baf3b4197bca..0c5f8069a261 100644 --- a/browser/components/migration/ProfileMigrator.jsm +++ b/browser/components/migration/ProfileMigrator.js @@ -4,6 +4,7 @@ "use strict"; +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {MigrationUtils} = ChromeUtils.import("resource:///modules/MigrationUtils.jsm"); function ProfileMigrator() { @@ -17,4 +18,4 @@ ProfileMigrator.prototype = { classID: Components.ID("6F8BB968-C14F-4D6F-9733-6C6737B35DCE"), }; -var EXPORTED_SYMBOLS = ["ProfileMigrator"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ProfileMigrator]); diff --git a/browser/components/migration/SafariProfileMigrator.jsm b/browser/components/migration/SafariProfileMigrator.js similarity index 99% rename from browser/components/migration/SafariProfileMigrator.jsm rename to browser/components/migration/SafariProfileMigrator.js index f98ae0cc987c..6a859b8dae43 100644 --- a/browser/components/migration/SafariProfileMigrator.jsm +++ b/browser/components/migration/SafariProfileMigrator.js @@ -382,4 +382,4 @@ SafariProfileMigrator.prototype.classDescription = "Safari Profile Migrator"; SafariProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=safari"; SafariProfileMigrator.prototype.classID = Components.ID("{4b609ecf-60b2-4655-9df4-dc149e474da1}"); -var EXPORTED_SYMBOLS = ["SafariProfileMigrator"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SafariProfileMigrator]); diff --git a/browser/components/migration/components.conf b/browser/components/migration/components.conf deleted file mode 100644 index ed53692e6553..000000000000 --- a/browser/components/migration/components.conf +++ /dev/null @@ -1,92 +0,0 @@ -# -*- 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/. - -XP_WIN = buildconfig.substs['OS_ARCH'] == 'WINNT' -XP_MACOSX = buildconfig.substs['MOZ_WIDGET_TOOLKIT'] == 'cocoa' - -Classes = [ - { - 'cid': '{6F8BB968-C14F-4D6F-9733-6C6737B35DCE}', - 'contract_ids': ['@mozilla.org/toolkit/profile-migrator;1'], - 'jsm': 'resource:///modules/ProfileMigrator.jsm', - 'constructor': 'ProfileMigrator', - }, - { - 'cid': '{4cec1de4-1671-4fc3-a53e-6c539dc77a26}', - 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chrome'], - 'jsm': 'resource:///modules/ChromeProfileMigrator.jsm', - 'constructor': 'ChromeProfileMigrator', - }, - { - 'cid': '{8cece922-9720-42de-b7db-7cef88cb07ca}', - 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chromium'], - 'jsm': 'resource:///modules/ChromeProfileMigrator.jsm', - 'constructor': 'ChromiumProfileMigrator', - }, - { - 'cid': '{91185366-ba97-4438-acba-48deaca63386}', - 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=firefox'], - 'jsm': 'resource:///modules/FirefoxProfileMigrator.jsm', - 'constructor': 'FirefoxProfileMigrator', - }, -] - -if XP_WIN or XP_MACOSX: - Classes += [ - { - 'cid': '{4bf85aa5-4e21-46ca-825f-f9c51a5e8c76}', - 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=canary'], - 'jsm': 'resource:///modules/ChromeProfileMigrator.jsm', - 'constructor': 'CanaryProfileMigrator', - }, - ] -else: - Classes += [ - { - 'cid': '{47f75963-840b-4950-a1f0-d9c1864f8b8e}', - 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chrome-beta'], - 'jsm': 'resource:///modules/ChromeProfileMigrator.jsm', - 'constructor': ' ChromeBetaMigrator', - }, - { - 'cid': '{7370a02a-4886-42c3-a4ec-d48c726ec30a}', - 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=chrome-dev'], - 'jsm': 'resource:///modules/ChromeProfileMigrator.jsm', - 'constructor': ' ChromeDevMigrator', - }, - ] - -if XP_WIN: - Classes += [ - { - 'cid': '{3d2532e3-4932-4774-b7ba-968f5899d3a4}', - 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=ie'], - 'jsm': 'resource:///modules/IEProfileMigrator.jsm', - 'constructor': 'IEProfileMigrator', - }, - { - 'cid': '{62e8834b-2d17-49f5-96ff-56344903a2ae}', - 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=edge'], - 'jsm': 'resource:///modules/EdgeProfileMigrator.jsm', - 'constructor': 'EdgeProfileMigrator', - }, - { - 'cid': '{d0037b95-296a-4a4e-94b2-c3d075d20ab1}', - 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=360se'], - 'jsm': 'resource:///modules/360seProfileMigrator.jsm', - 'constructor': 'Qihoo360seProfileMigrator', - }, - ] - -if XP_MACOSX: - Classes += [ - { - 'cid': '{4b609ecf-60b2-4655-9df4-dc149e474da1}', - 'contract_ids': ['@mozilla.org/profile/migrator;1?app=browser&type=safari'], - 'jsm': 'resource:///modules/SafariProfileMigrator.jsm', - 'constructor': 'SafariProfileMigrator', - }, - ] diff --git a/browser/components/migration/moz.build b/browser/components/migration/moz.build index 06e079f31c34..a4240468d3bf 100644 --- a/browser/components/migration/moz.build +++ b/browser/components/migration/moz.build @@ -16,34 +16,43 @@ XPIDL_SOURCES += [ XPIDL_MODULE = 'migration' +EXTRA_COMPONENTS += [ + 'ChromeProfileMigrator.js', + 'FirefoxProfileMigrator.js', + 'ProfileMigrator.js', +] + +EXTRA_PP_COMPONENTS += [ + 'BrowserProfileMigrators.manifest', +] + EXTRA_JS_MODULES += [ 'ChromeMigrationUtils.jsm', - 'ChromeProfileMigrator.jsm', - 'FirefoxProfileMigrator.jsm', 'MigrationUtils.jsm', - 'ProfileMigrator.jsm', ] if CONFIG['OS_ARCH'] == 'WINNT': SOURCES += [ 'nsIEHistoryEnumerator.cpp', ] + EXTRA_COMPONENTS += [ + '360seProfileMigrator.js', + 'EdgeProfileMigrator.js', + 'IEProfileMigrator.js', + ] EXTRA_JS_MODULES += [ - '360seProfileMigrator.jsm', - 'EdgeProfileMigrator.jsm', 'ESEDBReader.jsm', - 'IEProfileMigrator.jsm', 'MSMigrationUtils.jsm', ] + DEFINES['HAS_360SE_MIGRATOR'] = True + DEFINES['HAS_IE_MIGRATOR'] = True + DEFINES['HAS_EDGE_MIGRATOR'] = True if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - EXTRA_JS_MODULES += [ - 'SafariProfileMigrator.jsm', + EXTRA_COMPONENTS += [ + 'SafariProfileMigrator.js', ] - -XPCOM_MANIFESTS += [ - 'components.conf', -] + DEFINES['HAS_SAFARI_MIGRATOR'] = True FINAL_LIBRARY = 'browsercomps' diff --git a/browser/components/moz.build b/browser/components/moz.build index be89e0af6326..d84b2fc3a75b 100644 --- a/browser/components/moz.build +++ b/browser/components/moz.build @@ -74,19 +74,15 @@ XPIDL_SOURCES += [ XPIDL_MODULE = 'browsercompsbase' -XPCOM_MANIFESTS += [ - 'components.conf', -] - EXTRA_COMPONENTS += [ 'BrowserComponents.manifest', + 'nsBrowserContentHandler.js', + 'nsBrowserGlue.js', 'tests/startupRecorder.js', 'tests/testComponents.manifest', ] EXTRA_JS_MODULES += [ - 'BrowserContentHandler.jsm', - 'BrowserGlue.jsm', 'distribution.js', ] diff --git a/browser/components/newtab/NewTabComponents.manifest b/browser/components/newtab/NewTabComponents.manifest new file mode 100644 index 000000000000..42db65acd6f0 --- /dev/null +++ b/browser/components/newtab/NewTabComponents.manifest @@ -0,0 +1,2 @@ +component {dfcd2adc-7867-4d3a-ba70-17501f208142} aboutNewTabService.js +contract @mozilla.org/browser/aboutnewtab-service;1 {dfcd2adc-7867-4d3a-ba70-17501f208142} diff --git a/browser/components/newtab/AboutNewTabService.jsm b/browser/components/newtab/aboutNewTabService.js similarity index 99% rename from browser/components/newtab/AboutNewTabService.jsm rename to browser/components/newtab/aboutNewTabService.js index 81beef18f3c1..db93cde3a6f2 100644 --- a/browser/components/newtab/AboutNewTabService.jsm +++ b/browser/components/newtab/aboutNewTabService.js @@ -361,4 +361,4 @@ AboutNewTabService.prototype = { }, }; -var EXPORTED_SYMBOLS = ["AboutNewTabService"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AboutNewTabService]); diff --git a/browser/components/newtab/components.conf b/browser/components/newtab/components.conf deleted file mode 100644 index b22242f1e2e5..000000000000 --- a/browser/components/newtab/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{dfcd2adc-7867-4d3a-ba70-17501f208142}', - 'contract_ids': ['@mozilla.org/browser/aboutnewtab-service;1'], - 'jsm': 'resource:///modules/AboutNewTabService.jsm', - 'constructor': 'AboutNewTabService', - }, -] diff --git a/browser/components/newtab/moz.build b/browser/components/newtab/moz.build index cfd0ff170cde..0e3d3ea40c55 100644 --- a/browser/components/newtab/moz.build +++ b/browser/components/newtab/moz.build @@ -19,12 +19,9 @@ XPIDL_SOURCES += [ XPIDL_MODULE = 'browser-newtab' -EXTRA_JS_MODULES += [ - 'AboutNewTabService.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'aboutNewTabService.js', + 'NewTabComponents.manifest', ] JAR_MANIFESTS += ['jar.mn'] diff --git a/browser/components/BrowserContentHandler.jsm b/browser/components/nsBrowserContentHandler.js similarity index 98% rename from browser/components/BrowserContentHandler.jsm rename to browser/components/nsBrowserContentHandler.js index c04b6b21cbe7..ecb08a61cd2f 100644 --- a/browser/components/BrowserContentHandler.jsm +++ b/browser/components/nsBrowserContentHandler.js @@ -2,8 +2,6 @@ * 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/. */ -var EXPORTED_SYMBOLS = ["nsBrowserContentHandler", "nsDefaultCommandLineHandler"]; - const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); @@ -180,7 +178,7 @@ function getPostUpdateOverridePage(defaultOverridePage) { /** * Open a browser window. If this is the initial launch, this function will - * attempt to use the navigator:blank window opened by BrowserGlue.jsm during + * attempt to use the navigator:blank window opened by nsBrowserGlue.js during * early startup. * * @param cmdLine @@ -327,12 +325,18 @@ function doSearch(searchTerm, cmdLine) { } function nsBrowserContentHandler() { - if (!gBrowserContentHandler) { - gBrowserContentHandler = this; - } - return gBrowserContentHandler; } nsBrowserContentHandler.prototype = { + classID: Components.ID("{5d0ce354-df01-421a-83fb-7ead0990c24e}"), + + _xpcom_factory: { + createInstance: function bch_factory_ci(outer, iid) { + if (outer) + throw Cr.NS_ERROR_NO_AGGREGATION; + return gBrowserContentHandler.QueryInterface(iid); + }, + }, + /* nsISupports */ QueryInterface: ChromeUtils.generateQI([Ci.nsICommandLineHandler, Ci.nsIBrowserHandler, @@ -729,6 +733,8 @@ function nsDefaultCommandLineHandler() { } nsDefaultCommandLineHandler.prototype = { + classID: Components.ID("{47cd0651-b1be-4a0f-b5c4-10e5a573ef71}"), + /* nsISupports */ QueryInterface: ChromeUtils.generateQI(["nsICommandLineHandler"]), @@ -830,3 +836,6 @@ nsDefaultCommandLineHandler.prototype = { helpInfo: "", }; + +var components = [nsBrowserContentHandler, nsDefaultCommandLineHandler]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components); diff --git a/browser/components/BrowserGlue.jsm b/browser/components/nsBrowserGlue.js similarity index 99% rename from browser/components/BrowserGlue.jsm rename to browser/components/nsBrowserGlue.js index 135ec9f5ebcf..ac96eb54f656 100644 --- a/browser/components/BrowserGlue.jsm +++ b/browser/components/nsBrowserGlue.js @@ -2,8 +2,6 @@ * 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/. */ -var EXPORTED_SYMBOLS = ["BrowserGlue", "ContentPermissionPrompt"]; - const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); @@ -367,7 +365,10 @@ let ACTORS = { TelemetryTimestamps.add("blankWindowShown"); })(); +XPCOMUtils.defineLazyGlobalGetters(this, ["fetch"]); + XPCOMUtils.defineLazyServiceGetters(this, { + WindowsUIUtils: ["@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils"], aboutNewTabService: ["@mozilla.org/browser/aboutnewtab-service;1", "nsIAboutNewTabService"], }); XPCOMUtils.defineLazyGetter(this, "WeaveService", () => @@ -380,6 +381,7 @@ XPCOMUtils.defineLazyModuleGetters(this, { AboutPrivateBrowsingHandler: "resource:///modules/aboutpages/AboutPrivateBrowsingHandler.jsm", AddonManager: "resource://gre/modules/AddonManager.jsm", AppMenuNotifications: "resource://gre/modules/AppMenuNotifications.jsm", + AsyncPrefs: "resource://gre/modules/AsyncPrefs.jsm", AsyncShutdown: "resource://gre/modules/AsyncShutdown.jsm", AutoCompletePopup: "resource://gre/modules/AutoCompletePopup.jsm", Blocklist: "resource://gre/modules/Blocklist.jsm", @@ -387,11 +389,14 @@ XPCOMUtils.defineLazyModuleGetters(this, { BookmarkJSONUtils: "resource://gre/modules/BookmarkJSONUtils.jsm", BrowserUsageTelemetry: "resource:///modules/BrowserUsageTelemetry.jsm", BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm", + ContentClick: "resource:///modules/ContentClick.jsm", ContextualIdentityService: "resource://gre/modules/ContextualIdentityService.jsm", + CustomizableUI: "resource:///modules/CustomizableUI.jsm", DateTimePickerParent: "resource://gre/modules/DateTimePickerParent.jsm", Discovery: "resource:///modules/Discovery.jsm", ExtensionsUI: "resource:///modules/ExtensionsUI.jsm", FileSource: "resource://gre/modules/L10nRegistry.jsm", + FormValidationHandler: "resource:///modules/FormValidationHandler.jsm", FxAccounts: "resource://gre/modules/FxAccounts.jsm", HomePage: "resource:///modules/HomePage.jsm", HybridContentTelemetry: "resource://gre/modules/HybridContentTelemetry.jsm", @@ -400,6 +405,8 @@ XPCOMUtils.defineLazyModuleGetters(this, { LanguagePrompt: "resource://gre/modules/LanguagePrompt.jsm", LightweightThemeManager: "resource://gre/modules/LightweightThemeManager.jsm", LiveBookmarkMigrator: "resource:///modules/LiveBookmarkMigrator.jsm", + LoginHelper: "resource://gre/modules/LoginHelper.jsm", + LoginManagerParent: "resource://gre/modules/LoginManagerParent.jsm", NewTabUtils: "resource://gre/modules/NewTabUtils.jsm", Normandy: "resource://normandy/Normandy.jsm", ObjectUtils: "resource://gre/modules/ObjectUtils.jsm", @@ -408,12 +415,15 @@ XPCOMUtils.defineLazyModuleGetters(this, { PageThumbs: "resource://gre/modules/PageThumbs.jsm", PdfJs: "resource://pdf.js/PdfJs.jsm", PermissionUI: "resource:///modules/PermissionUI.jsm", + PictureInPicture: "resource://gre/modules/PictureInPicture.jsm", PingCentre: "resource:///modules/PingCentre.jsm", PlacesBackups: "resource://gre/modules/PlacesBackups.jsm", PlacesUtils: "resource://gre/modules/PlacesUtils.jsm", PluralForm: "resource://gre/modules/PluralForm.jsm", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm", ProcessHangMonitor: "resource:///modules/ProcessHangMonitor.jsm", + ReaderParent: "resource:///modules/ReaderParent.jsm", + RemotePrompt: "resource:///modules/RemotePrompt.jsm", RemoteSettings: "resource://services-settings/remote-settings.js", SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm", Sanitizer: "resource:///modules/Sanitizer.jsm", @@ -429,17 +439,6 @@ XPCOMUtils.defineLazyModuleGetters(this, { WindowsRegistry: "resource://gre/modules/WindowsRegistry.jsm", }); -// eslint-disable-next-line no-unused-vars -XPCOMUtils.defineLazyModuleGetters(this, { - AsyncPrefs: "resource://gre/modules/AsyncPrefs.jsm", - ContentClick: "resource:///modules/ContentClick.jsm", - FormValidationHandler: "resource:///modules/FormValidationHandler.jsm", - LoginManagerParent: "resource://gre/modules/LoginManagerParent.jsm", - PictureInPicture: "resource://gre/modules/PictureInPicture.jsm", - ReaderParent: "resource:///modules/ReaderParent.jsm", - RemotePrompt: "resource:///modules/RemotePrompt.jsm", -}); - /* global ContentPrefServiceParent:false, ContentSearch:false, UpdateListener:false, webrtcUI:false */ @@ -467,6 +466,7 @@ if (AppConstants.MOZ_CRASHREPORTER) { XPCOMUtils.defineLazyModuleGetters(this, { PluginCrashReporter: "resource:///modules/ContentCrashHandlers.jsm", UnsubmittedCrashHandler: "resource:///modules/ContentCrashHandlers.jsm", + CrashSubmit: "resource://gre/modules/CrashSubmit.jsm", }); } @@ -2985,8 +2985,13 @@ BrowserGlue.prototype = { } }, + // for XPCOM + classID: Components.ID("{eab9012e-5f74-4cbc-b2b5-a590235513cc}"), + QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]), + + _xpcom_factory: XPCOMUtils.generateSingletonFactory(BrowserGlue), }; var ContentBlockingCategoriesPrefs = { @@ -3484,6 +3489,9 @@ var JawsScreenReaderVersionCheck = { }, }; +var components = [BrowserGlue, ContentPermissionPrompt]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components); + // Listen for UITour messages. // Do it here instead of the UITour module itself so that the UITour module is lazy loaded // when the first message is received. diff --git a/browser/components/payments/components.conf b/browser/components/payments/components.conf deleted file mode 100644 index d6a4eb1efcfa..000000000000 --- a/browser/components/payments/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{01f8bd55-9017-438b-85ec-7c15d2b35cdc}', - 'contract_ids': ['@mozilla.org/dom/payments/payment-ui-service;1'], - 'jsm': 'resource:///modules/PaymentUIService.jsm', - 'constructor': 'PaymentUIService', - }, -] diff --git a/browser/components/payments/moz.build b/browser/components/payments/moz.build index 1b4604c754db..b1bf7fb7527e 100644 --- a/browser/components/payments/moz.build +++ b/browser/components/payments/moz.build @@ -9,12 +9,9 @@ BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini'] with Files('**'): BUG_COMPONENT = ('Firefox', 'WebPayments UI') -EXTRA_JS_MODULES += [ - 'PaymentUIService.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'payments.manifest', + 'paymentUIService.js', ] JAR_MANIFESTS += ['jar.mn'] diff --git a/browser/components/payments/PaymentUIService.jsm b/browser/components/payments/paymentUIService.js similarity index 99% rename from browser/components/payments/PaymentUIService.jsm rename to browser/components/payments/paymentUIService.js index 760f137d210c..81f8d7fbd3c2 100644 --- a/browser/components/payments/PaymentUIService.jsm +++ b/browser/components/payments/paymentUIService.js @@ -301,4 +301,4 @@ PaymentUIService.prototype = { }, }; -var EXPORTED_SYMBOLS = ["PaymentUIService"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PaymentUIService]); diff --git a/browser/components/payments/payments.manifest b/browser/components/payments/payments.manifest new file mode 100644 index 000000000000..5d66076a538b --- /dev/null +++ b/browser/components/payments/payments.manifest @@ -0,0 +1,2 @@ +component {01f8bd55-9017-438b-85ec-7c15d2b35cdc} paymentUIService.js +contract @mozilla.org/dom/payments/payment-ui-service;1 {01f8bd55-9017-438b-85ec-7c15d2b35cdc} diff --git a/browser/components/preferences/in-content/tests/browser_advanced_update.js b/browser/components/preferences/in-content/tests/browser_advanced_update.js index 42301456eadb..3dd06570306e 100644 --- a/browser/components/preferences/in-content/tests/browser_advanced_update.js +++ b/browser/components/preferences/in-content/tests/browser_advanced_update.js @@ -14,6 +14,8 @@ const mockUpdateManager = { _originalClassId: "", + _originalFactory: null, + QueryInterface: ChromeUtils.generateQI([Ci.nsIUpdateManager]), createInstance(outer, iiD) { @@ -27,6 +29,8 @@ const mockUpdateManager = { let registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); if (!registrar.isCIDRegistered(this._mockClassId)) { this._originalClassId = registrar.contractIDToCID(this.contractId); + this._originalFactory = Cm.getClassObject(Cc[this.contractId], Ci.nsIFactory); + registrar.unregisterFactory(this._originalClassId, this._originalFactory); registrar.registerFactory(this._mockClassId, "Unregister after testing", this.contractId, this); } }, @@ -34,7 +38,7 @@ const mockUpdateManager = { unregister() { let registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); registrar.unregisterFactory(this._mockClassId, this); - registrar.registerFactory(this._originalClassId, "", this.contractId, null); + registrar.registerFactory(this._originalClassId, "", this.contractId, this._originalFactory); }, get updateCount() { diff --git a/browser/components/protocolhandler/WebProtocolHandlerRegistrar.jsm b/browser/components/protocolhandler/WebProtocolHandlerRegistrar.js similarity index 96% rename from browser/components/protocolhandler/WebProtocolHandlerRegistrar.jsm rename to browser/components/protocolhandler/WebProtocolHandlerRegistrar.js index cdb7702e3a0c..5b8b5fc3d2bf 100644 --- a/browser/components/protocolhandler/WebProtocolHandlerRegistrar.jsm +++ b/browser/components/protocolhandler/WebProtocolHandlerRegistrar.js @@ -3,9 +3,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/. */ -var EXPORTED_SYMBOLS = ["WebProtocolHandlerRegistrar"]; - const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const STRING_BUNDLE_URI = "chrome://browser/locale/feeds/subscribe.properties"; @@ -147,8 +146,13 @@ WebProtocolHandlerRegistrar.prototype = { [addButton]); }, + classID: Components.ID("{efbd7b87-9b15-4684-abf0-dc2679daadb1}"), + /** * See nsISupports */ QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProtocolHandlerRegistrar]), }; + +this.NSGetFactory = + XPCOMUtils.generateNSGetFactory([WebProtocolHandlerRegistrar]); diff --git a/browser/components/protocolhandler/components.conf b/browser/components/protocolhandler/components.conf deleted file mode 100644 index a0495ad0127f..000000000000 --- a/browser/components/protocolhandler/components.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -*- 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': '{efbd7b87-9b15-4684-abf0-dc2679daadb1}', - 'contract_ids': ['@mozilla.org/embeddor.implemented/web-protocol-handler-registrar;1'], - 'jsm': 'resource:///modules/WebProtocolHandlerRegistrar.jsm', - 'constructor': 'WebProtocolHandlerRegistrar', - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, -] diff --git a/browser/components/protocolhandler/moz.build b/browser/components/protocolhandler/moz.build index 480b07ecdf3a..bc7c00c6c3a7 100644 --- a/browser/components/protocolhandler/moz.build +++ b/browser/components/protocolhandler/moz.build @@ -7,12 +7,8 @@ MOCHITEST_MANIFESTS += ['test/mochitest.ini'] BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini'] -EXTRA_JS_MODULES += [ - 'WebProtocolHandlerRegistrar.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'WebProtocolHandlerRegistrar.js', ] with Files('**'): diff --git a/browser/components/shell/nsWindowsShellService.cpp b/browser/components/shell/nsWindowsShellService.cpp index b8b7c1122288..b5d9ff41ea82 100644 --- a/browser/components/shell/nsWindowsShellService.cpp +++ b/browser/components/shell/nsWindowsShellService.cpp @@ -21,6 +21,7 @@ #include "nsShellService.h" #include "nsIProcess.h" #include "nsICategoryManager.h" +#include "nsBrowserCompsCID.h" #include "nsDirectoryServiceUtils.h" #include "nsAppDirectoryServiceDefs.h" #include "nsDirectoryServiceDefs.h" diff --git a/browser/components/tests/browser/browser_bug538331.js b/browser/components/tests/browser/browser_bug538331.js index f659d8c6ce37..f88c3a54461c 100644 --- a/browser/components/tests/browser/browser_bug538331.js +++ b/browser/components/tests/browser/browser_bug538331.js @@ -265,7 +265,7 @@ function testDefaultArgs() { testShowNotification(); } -// BrowserGlue.jsm _showUpdateNotification notification tests +// nsBrowserGlue.js _showUpdateNotification notification tests const BG_NOTIFY_TESTS = [ { description: "'silent showNotification' actions should not display a notification", @@ -292,7 +292,7 @@ const BG_NOTIFY_TESTS = [ ]; // Test showing a notification after an update -// _showUpdateNotification in BrowserGlue.jsm +// _showUpdateNotification in nsBrowserGlue.js function testShowNotification() { // Catches any windows opened by these tests (e.g. alert windows) and closes // them diff --git a/browser/components/tests/startupRecorder.js b/browser/components/tests/startupRecorder.js index 737cbe40432b..0ec120d1dbb1 100644 --- a/browser/components/tests/startupRecorder.js +++ b/browser/components/tests/startupRecorder.js @@ -79,7 +79,7 @@ startupRecorder.prototype = { if (topic == "app-startup") { // We can't ensure our observer will be called first or last, so the list of // topics we observe here should avoid the topics used to trigger things - // during startup (eg. the topics observed by BrowserGlue.jsm). + // during startup (eg. the topics observed by nsBrowserGlue.js). let topics = [ "profile-do-change", // This catches stuff loaded during app-startup "toplevel-window-ready", // Catches stuff from final-ui-startup diff --git a/browser/extensions/pdfjs/components.conf b/browser/extensions/pdfjs/components.conf deleted file mode 100644 index 8bbc6698e1d2..000000000000 --- a/browser/extensions/pdfjs/components.conf +++ /dev/null @@ -1,17 +0,0 @@ -# -*- 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': '{d0c5195d-e798-49d4-b1d3-9324328b2291}', - 'contract_ids': [ - '@mozilla.org/streamconv;1?from=application/pdf&to=*/*', - '@mozilla.org/streamconv;1?from=application/pdf&to=text/html', - ], - 'jsm': 'resource:///modules/pdfjs.js', - 'constructor': 'StreamConverterFactory', - }, -] diff --git a/browser/extensions/pdfjs/content/PdfJs.jsm b/browser/extensions/pdfjs/content/PdfJs.jsm index f3c7a7a6713e..cbeb4e1b1c73 100644 --- a/browser/extensions/pdfjs/content/PdfJs.jsm +++ b/browser/extensions/pdfjs/content/PdfJs.jsm @@ -109,7 +109,7 @@ var PdfJs = { earlyInit() { // Note: Please keep this in sync with the duplicated logic in - // BrowserGlue.jsm. + // nsBrowserGlue.js. Services.ppmm.sharedData.set("pdfjs.enabled", this.checkEnabled()); }, diff --git a/browser/extensions/pdfjs/moz.build b/browser/extensions/pdfjs/moz.build index a248e89a24bc..c203fe8df685 100644 --- a/browser/extensions/pdfjs/moz.build +++ b/browser/extensions/pdfjs/moz.build @@ -11,10 +11,7 @@ BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] JAR_MANIFESTS += ['jar.mn'] -EXTRA_JS_MODULES += [ +EXTRA_COMPONENTS += [ 'pdfjs.js', -] - -XPCOM_MANIFESTS += [ - 'components.conf', + 'pdfjs.manifest', ] diff --git a/browser/extensions/pdfjs/pdfjs.js b/browser/extensions/pdfjs/pdfjs.js index 4bd8f09269c8..5e04eeeb6714 100644 --- a/browser/extensions/pdfjs/pdfjs.js +++ b/browser/extensions/pdfjs/pdfjs.js @@ -16,6 +16,7 @@ "use strict"; const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); ChromeUtils.defineModuleGetter(this, "PdfStreamConverter", "resource://pdf.js/PdfStreamConverter.jsm"); @@ -27,5 +28,10 @@ function StreamConverterFactory() { } throw Cr.NS_ERROR_FACTORY_NOT_REGISTERED; } +StreamConverterFactory.prototype = { + // properties required for XPCOM registration: + classID: Components.ID("{d0c5195d-e798-49d4-b1d3-9324328b2291}"), + classDescription: "pdf.js Component", +}; -var EXPORTED_SYMBOLS = ["StreamConverterFactory"]; +var NSGetFactory = XPCOMUtils.generateNSGetFactory([StreamConverterFactory]); diff --git a/browser/extensions/pdfjs/pdfjs.manifest b/browser/extensions/pdfjs/pdfjs.manifest new file mode 100644 index 000000000000..a4fbbf5bac53 --- /dev/null +++ b/browser/extensions/pdfjs/pdfjs.manifest @@ -0,0 +1,3 @@ +component {d0c5195d-e798-49d4-b1d3-9324328b2291} pdfjs.js +contract @mozilla.org/streamconv;1?from=application/pdf&to=*/* {d0c5195d-e798-49d4-b1d3-9324328b2291} +contract @mozilla.org/streamconv;1?from=application/pdf&to=text/html {d0c5195d-e798-49d4-b1d3-9324328b2291} diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 45836f1f8277..1793b1c9825f 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -160,30 +160,169 @@ #endif ; JavaScript components +@RESPATH@/components/ConsoleAPI.manifest +@RESPATH@/components/ConsoleAPIStorage.js +@RESPATH@/components/BrowserElementParent.manifest +@RESPATH@/components/BrowserElementParent.js +@RESPATH@/components/UAOverridesBootstrapper.js +@RESPATH@/components/UAOverridesBootstrapper.manifest +@RESPATH@/components/WellKnownOpportunisticUtils.js +@RESPATH@/components/WellKnownOpportunisticUtils.manifest +#ifndef XP_MACOSX +; OSX uses native platform impl. Windows, Linux, and Android uses fallback JS impl. +@BINPATH@/components/nsDNSServiceDiscovery.manifest +@BINPATH@/components/nsDNSServiceDiscovery.js +#endif @RESPATH@/browser/components/BrowserComponents.manifest +@RESPATH@/browser/components/nsBrowserContentHandler.js +@RESPATH@/browser/components/nsBrowserGlue.js +@RESPATH@/browser/components/devtools-startup.manifest +@RESPATH@/browser/components/devtools-startup.js +@RESPATH@/browser/components/aboutdebugging-registration.js +@RESPATH@/browser/components/aboutdebugging.manifest +#ifdef NIGHTLY_BUILD +@RESPATH@/browser/components/aboutdebugging-new-registration.js +@RESPATH@/browser/components/aboutdebugging-new.manifest +#endif +@RESPATH@/browser/components/aboutdevtools-registration.js +@RESPATH@/browser/components/aboutdevtools.manifest +@RESPATH@/browser/components/aboutdevtoolstoolbox-registration.js +@RESPATH@/browser/components/aboutdevtoolstoolbox.manifest +@RESPATH@/browser/components/aboutNewTabService.js +@RESPATH@/browser/components/NewTabComponents.manifest @RESPATH@/browser/components/EnterprisePolicies.js @RESPATH@/browser/components/EnterprisePoliciesContent.js @RESPATH@/browser/components/EnterprisePolicies.manifest +@RESPATH@/browser/components/WebProtocolHandlerRegistrar.js +@RESPATH@/components/Downloads.manifest +@RESPATH@/components/DownloadLegacy.js +@RESPATH@/components/PageThumbsComponents.manifest +@RESPATH@/components/crashmonitor.manifest +@RESPATH@/components/nsCrashMonitor.js @RESPATH@/components/toolkitsearch.manifest +@RESPATH@/components/nsSearchService.js +@RESPATH@/components/nsSearchSuggestions.js +@RESPATH@/components/nsSidebar.js +#ifdef NIGHTLY_BUILD +@RESPATH@/browser/components/payments.manifest +@RESPATH@/browser/components/paymentUIService.js +#endif +@RESPATH@/components/passwordmgr.manifest +@RESPATH@/components/nsLoginInfo.js +@RESPATH@/components/nsLoginManager.js +@RESPATH@/components/nsLoginManagerPrompter.js +@RESPATH@/components/storage-json.js +@RESPATH@/components/crypto-SDR.js +@RESPATH@/components/TooltipTextProvider.js +@RESPATH@/components/TooltipTextProvider.manifest @RESPATH@/components/WebVTT.manifest @RESPATH@/components/WebVTTParserWrapper.js +@RESPATH@/components/nsHelperAppDlg.manifest +@RESPATH@/components/nsHelperAppDlg.js +@RESPATH@/components/NetworkGeolocationProvider.manifest +@RESPATH@/components/NetworkGeolocationProvider.js @RESPATH@/components/extensions.manifest +@RESPATH@/components/addonManager.js +@RESPATH@/components/amContentHandler.js +@RESPATH@/components/amInstallTrigger.js +@RESPATH@/components/amWebAPI.js #ifdef MOZ_UPDATER @RESPATH@/components/nsUpdateService.manifest +@RESPATH@/components/nsUpdateService.js +@RESPATH@/components/nsUpdateServiceStub.js #endif +@RESPATH@/components/nsUpdateTimerManager.manifest +@RESPATH@/components/nsUpdateTimerManager.js +@RESPATH@/components/utils.manifest +@RESPATH@/components/simpleServices.js @RESPATH@/components/ProcessSingleton.manifest +@RESPATH@/components/MainProcessSingleton.js +@RESPATH@/components/ContentProcessSingleton.js +@RESPATH@/components/nsURLFormatter.manifest +@RESPATH@/components/nsURLFormatter.js +@RESPATH@/components/toolkitplaces.manifest +@RESPATH@/components/nsTaggingService.js +@RESPATH@/components/UnifiedComplete.js +@RESPATH@/components/nsPlacesExpiration.js +@RESPATH@/components/PageIconProtocolHandler.js +@RESPATH@/components/PlacesCategoriesStarter.js +@RESPATH@/components/ColorAnalyzer.js +@RESPATH@/components/PageThumbsStorageService.js +@RESPATH@/components/mozProtocolHandler.js +@RESPATH@/components/mozProtocolHandler.manifest +@RESPATH@/components/nsDefaultCLH.manifest +@RESPATH@/components/nsDefaultCLH.js +@RESPATH@/components/ContentPrefService2.manifest +@RESPATH@/components/ContentPrefService2.js +@RESPATH@/components/nsContentDispatchChooser.manifest +@RESPATH@/components/nsContentDispatchChooser.js @RESPATH@/components/HandlerService.manifest @RESPATH@/components/HandlerService.js +@RESPATH@/components/nsWebHandlerApp.manifest +@RESPATH@/components/nsWebHandlerApp.js +@RESPATH@/components/satchel.manifest +@RESPATH@/components/nsFormAutoComplete.js +@RESPATH@/components/FormHistoryStartup.js +@RESPATH@/components/nsInputListAutoComplete.js +@RESPATH@/components/contentAreaDropListener.manifest +@RESPATH@/components/contentAreaDropListener.js +@RESPATH@/browser/components/BrowserProfileMigrators.manifest +@RESPATH@/browser/components/ProfileMigrator.js +@RESPATH@/browser/components/ChromeProfileMigrator.js +@RESPATH@/browser/components/FirefoxProfileMigrator.js +#ifdef XP_WIN +@RESPATH@/browser/components/360seProfileMigrator.js +@RESPATH@/browser/components/EdgeProfileMigrator.js +@RESPATH@/browser/components/IEProfileMigrator.js +#endif #ifdef XP_MACOSX +@RESPATH@/browser/components/SafariProfileMigrator.js @RESPATH@/browser/components/MacTouchBar.manifest @RESPATH@/browser/components/MacTouchBar.js #endif +@RESPATH@/components/nsPrompter.manifest +@RESPATH@/components/nsPrompter.js @RESPATH@/components/SyncComponents.manifest +@RESPATH@/components/Weave.js +@RESPATH@/components/FxAccountsComponents.manifest +@RESPATH@/components/FxAccountsPush.js +@RESPATH@/components/CaptivePortalDetectComponents.manifest +@RESPATH@/components/captivedetect.js @RESPATH@/components/servicesComponents.manifest @RESPATH@/components/servicesSettings.manifest +@RESPATH@/components/RemoteSettingsComponents.js @RESPATH@/components/cryptoComponents.manifest +@RESPATH@/components/TelemetryStartup.js +@RESPATH@/components/TelemetryStartup.manifest +@RESPATH@/components/XULStore.js +@RESPATH@/components/XULStore.manifest +@RESPATH@/components/recording-cmdline.js +@RESPATH@/components/recording-cmdline.manifest +@RESPATH@/components/htmlMenuBuilder.js +@RESPATH@/components/htmlMenuBuilder.manifest +@RESPATH@/components/NotificationStorage.js +@RESPATH@/components/NotificationStorage.manifest +@RESPATH@/components/Push.js @RESPATH@/components/Push.manifest +@RESPATH@/components/PushComponents.js + +@RESPATH@/components/remotebrowserutils.manifest +@RESPATH@/components/RemoteWebNavigation.js + +@RESPATH@/components/ProcessSelector.js +@RESPATH@/components/ProcessSelector.manifest + +@RESPATH@/components/SlowScriptDebug.manifest +@RESPATH@/components/SlowScriptDebug.js + +@RESPATH@/components/ClearDataService.manifest +@RESPATH@/components/ClearDataService.js + +#ifdef MOZ_WEBRTC +@RESPATH@/components/PeerConnection.js +@RESPATH@/components/PeerConnection.manifest +#endif ; Remote control protocol #ifdef ENABLE_MARIONETTE @@ -194,6 +333,17 @@ @RESPATH@/defaults/pref/marionette.js #endif +@RESPATH@/components/nsAsyncShutdown.manifest +@RESPATH@/components/nsAsyncShutdown.js + +@RESPATH@/components/BuiltinProviders.manifest +@RESPATH@/components/PresentationControlService.js +@RESPATH@/components/PresentationDataChannelSessionTransport.js +@RESPATH@/components/PresentationDataChannelSessionTransport.manifest + +@RESPATH@/components/mozIntl.manifest +@RESPATH@/components/mozIntl.js + #if defined(ENABLE_TESTS) && defined(MOZ_DEBUG) @RESPATH@/components/TestInterfaceJS.js @RESPATH@/components/TestInterfaceJS.manifest @@ -209,12 +359,26 @@ @RESPATH@/components/extensions-toolkit.manifest @RESPATH@/browser/components/extensions-browser.manifest +; [Normandy] +@RESPATH@/components/shield.manifest +@RESPATH@/components/shield-content-process.js + +; [PDF Viewer] +@RESPATH@/browser/components/pdfjs.manifest +@RESPATH@/browser/components/pdfjs.js + ; Modules @RESPATH@/browser/modules/* @RESPATH@/modules/* @RESPATH@/browser/actors/* @RESPATH@/actors/* +; Safe Browsing +@RESPATH@/components/nsURLClassifier.manifest +@RESPATH@/components/nsUrlClassifierHashCompleter.js +@RESPATH@/components/nsUrlClassifierListManager.js +@RESPATH@/components/nsUrlClassifierLib.js + ; Security Reports @RESPATH@/components/SecurityReporter.manifest @RESPATH@/components/SecurityReporter.js @@ -400,6 +564,8 @@ bin/libfreebl_32int64_3.so ; [Crash Reporter] ; #ifdef MOZ_CRASHREPORTER +@RESPATH@/components/CrashService.manifest +@RESPATH@/components/CrashService.js #ifdef XP_MACOSX @BINPATH@/crashreporter.app/ #else @@ -421,6 +587,7 @@ bin/libfreebl_32int64_3.so @BINPATH@/pingsender@BIN_SUFFIX@ ; Shutdown Terminator +@RESPATH@/components/nsTerminatorTelemetry.js @RESPATH@/components/terminator.manifest #ifdef LLVM_SYMBOLIZER @@ -440,6 +607,12 @@ bin/libfreebl_32int64_3.so @RESPATH@/gmp-clearkey/0.1/@DLL_PREFIX@clearkey@DLL_SUFFIX@ @RESPATH@/gmp-clearkey/0.1/manifest.json +; gfx +#ifdef XP_WIN +@RESPATH@/components/GfxSanityTest.manifest +@RESPATH@/components/SanityTest.js +#endif + #ifdef MOZ_DMD ; DMD @RESPATH@/dmd.py @@ -452,6 +625,13 @@ bin/libfreebl_32int64_3.so #endif #endif +; NOTE: This must match the config checks in +; /toolkit/components/backgroundhangmonitor/moz.build. +#if defined(NIGHTLY_BUILD) && !defined(MOZ_DEBUG) && !defined(MOZ_TSAN) && !defined(MOZ_ASAN) +@RESPATH@/components/BHRTelemetryService.js +@RESPATH@/components/BHRTelemetryService.manifest +#endif + #ifdef PKG_LOCALE_MANIFEST #include @PKG_LOCALE_MANIFEST@ #endif diff --git a/browser/modules/ContentClick.jsm b/browser/modules/ContentClick.jsm index 6d90a4713f72..0ee3bf71c21a 100644 --- a/browser/modules/ContentClick.jsm +++ b/browser/modules/ContentClick.jsm @@ -15,7 +15,7 @@ ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils", "resource://gre/modules/PrivateBrowsingUtils.jsm"); var ContentClick = { - // Listeners are added in BrowserGlue.jsm + // Listeners are added in nsBrowserGlue.js receiveMessage(message) { switch (message.name) { case "Content:Click": diff --git a/browser/modules/ContentSearch.jsm b/browser/modules/ContentSearch.jsm index e606e96d0bf9..c193e5ebbca4 100644 --- a/browser/modules/ContentSearch.jsm +++ b/browser/modules/ContentSearch.jsm @@ -153,7 +153,7 @@ var ContentSearch = { }); }, - // Listeners and observers are added in BrowserGlue.jsm + // Listeners and observers are added in nsBrowserGlue.js receiveMessage(msg) { // Add a temporary event handler that exists only while the message is in // the event queue. If the message's source docshell changes browsers in diff --git a/browser/modules/FormValidationHandler.jsm b/browser/modules/FormValidationHandler.jsm index d9724f92db41..26bb1e95ae86 100644 --- a/browser/modules/FormValidationHandler.jsm +++ b/browser/modules/FormValidationHandler.jsm @@ -32,7 +32,7 @@ var FormValidationHandler = * Events */ - // Listeners are added in BrowserGlue.jsm + // Listeners are added in nsBrowserGlue.js receiveMessage(aMessage) { let window = aMessage.target.ownerGlobal; let json = aMessage.json; diff --git a/browser/modules/ReaderParent.jsm b/browser/modules/ReaderParent.jsm index 10e3b9e1b05f..8bef7e541d56 100644 --- a/browser/modules/ReaderParent.jsm +++ b/browser/modules/ReaderParent.jsm @@ -15,7 +15,7 @@ ChromeUtils.defineModuleGetter(this, "ReaderMode", "resource://gre/modules/Reade const gStringBundle = Services.strings.createBundle("chrome://global/locale/aboutReader.properties"); var ReaderParent = { - // Listeners are added in BrowserGlue.jsm + // Listeners are added in nsBrowserGlue.js receiveMessage(message) { switch (message.name) { case "Reader:FaviconRequest": { diff --git a/browser/modules/RemotePrompt.jsm b/browser/modules/RemotePrompt.jsm index 4c0c0a04ac79..ab612cd36807 100644 --- a/browser/modules/RemotePrompt.jsm +++ b/browser/modules/RemotePrompt.jsm @@ -13,7 +13,7 @@ ChromeUtils.defineModuleGetter(this, "Services", "resource://gre/modules/Services.jsm"); var RemotePrompt = { - // Listeners are added in BrowserGlue.jsm + // Listeners are added in nsBrowserGlue.js receiveMessage(message) { switch (message.name) { case "Prompt:Open": diff --git a/browser/modules/webrtcUI.jsm b/browser/modules/webrtcUI.jsm index c98e623e94b2..ed999ae02cdd 100644 --- a/browser/modules/webrtcUI.jsm +++ b/browser/modules/webrtcUI.jsm @@ -201,7 +201,7 @@ var webrtcUI = { return this.emitter.off(...args); }, - // Listeners and observers are registered in BrowserGlue.jsm + // Listeners and observers are registered in nsBrowserGlue.js receiveMessage(aMessage) { switch (aMessage.name) { case "rtcpeer:Request": { diff --git a/browser/themes/shared/compacttheme.inc.css b/browser/themes/shared/compacttheme.inc.css index 453c94d4a86f..59dad5bd9b68 100644 --- a/browser/themes/shared/compacttheme.inc.css +++ b/browser/themes/shared/compacttheme.inc.css @@ -14,7 +14,7 @@ :root:-moz-lwtheme-brighttext { /* !important to override LightweightThemeManager.addBuiltInTheme in - BrowserGlue.jsm */ + nsBrowserGlue.js */ --autocomplete-popup-background: #2A2A2E !important; --autocomplete-popup-highlight-background: #0060DF; } diff --git a/build/docs/defining-xpcom-components.rst b/build/docs/defining-xpcom-components.rst index 2621ad7d1f36..790007febb76 100644 --- a/build/docs/defining-xpcom-components.rst +++ b/build/docs/defining-xpcom-components.rst @@ -102,12 +102,6 @@ Class definitions may have the following properties: This property is incompatible with ``legacy_constructor``. -``jsm`` (optional) - If provided, must be the URL of a JavaScript module which contains a - JavaScript implementation of the component. The ``constructor`` property - must contain the name of an exported function which can be constructed to - create a new instance of the component. - ``legacy_constructor`` (optional) This property is deprecated, and should not be used in new code. diff --git a/chrome/test/unit/test_data_protocol_registration.js b/chrome/test/unit/test_data_protocol_registration.js index 6677b21bd3d4..a16b3963ac63 100644 --- a/chrome/test/unit/test_data_protocol_registration.js +++ b/chrome/test/unit/test_data_protocol_registration.js @@ -55,6 +55,7 @@ function run_test() { factory: Components.manager.getClassObject(Cc[factory.contractID], Ci.nsIFactory), }); old_factories_inds.push(true); + registrar.unregisterFactory(old_factories[i].CID, old_factories[i].factory); } else { dump(factory.scheme + " has never been registered. Registering..."); old_factories.push({CID: "", factory: null}); @@ -94,7 +95,7 @@ function run_test() { if (ind) { let old_factory = old_factories[i]; - registrar.registerFactory(old_factory.CID, factory.scheme, factory.contractID, null); + registrar.registerFactory(old_factory.CID, factory.scheme, factory.contractID, old_factory.factory); } } } diff --git a/chrome/test/unit/test_no_remote_registration.js b/chrome/test/unit/test_no_remote_registration.js index 78838c091783..e39a0dad7bac 100644 --- a/chrome/test/unit/test_no_remote_registration.js +++ b/chrome/test/unit/test_no_remote_registration.js @@ -125,6 +125,7 @@ function run_test() { dump(XULAppInfoFactory.scheme + " is already registered. Storing currently registered object for restoration later."); old_factory.CID = registrar.contractIDToCID(XULAppInfoFactory.contractID); old_factory.factory = Components.manager.getClassObject(Cc[XULAppInfoFactory.contractID], Ci.nsIFactory); + registrar.unregisterFactory(old_factory.CID, old_factory.factory); } else { dump(XULAppInfoFactory.scheme + " has never been registered. Registering..."); } @@ -213,6 +214,6 @@ function run_test() { // Unregister XULAppInfoFactory registrar.unregisterFactory(XULAppInfoFactory.CID, XULAppInfoFactory); if (old_factory.factory != null) { - registrar.registerFactory(old_factory.CID, "", XULAppInfoFactory.contractID, null); + registrar.registerFactory(old_factory.CID, "", XULAppInfoFactory.contractID, old_factory.factory); } } diff --git a/devtools/platform/components.conf b/devtools/platform/components.conf deleted file mode 100644 index 7e7d451b832c..000000000000 --- a/devtools/platform/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{ec5aa99c-7abb-4142-ac5f-aab2419e38e2}', - 'contract_ids': ['@mozilla.org/jsinspector;1'], - 'type': 'mozilla::jsinspector::nsJSInspector', - 'headers': ['/devtools/platform/nsJSInspector.h'], - }, -] diff --git a/devtools/platform/moz.build b/devtools/platform/moz.build index 349f5554029c..5aad20065ea7 100644 --- a/devtools/platform/moz.build +++ b/devtools/platform/moz.build @@ -16,8 +16,4 @@ SOURCES += [ 'nsJSInspector.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - FINAL_LIBRARY = 'xul' diff --git a/devtools/platform/nsJSInspector.cpp b/devtools/platform/nsJSInspector.cpp index e4a1e92130f3..298f61121e46 100644 --- a/devtools/platform/nsJSInspector.cpp +++ b/devtools/platform/nsJSInspector.cpp @@ -8,6 +8,7 @@ #include "nsThreadUtils.h" #include "jsfriendapi.h" #include "mozilla/HoldDropJSObjects.h" +#include "mozilla/ModuleUtils.h" #include "mozilla/dom/ScriptSettings.h" #include "nsServiceManagerUtils.h" #include "nsMemory.h" @@ -26,6 +27,8 @@ namespace mozilla { namespace jsinspector { +NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSInspector) + NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsJSInspector) NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_ENTRY(nsIJSInspector) @@ -118,3 +121,18 @@ nsJSInspector::GetLastNestRequestor(JS::MutableHandle out) { } // namespace jsinspector } // namespace mozilla + +NS_DEFINE_NAMED_CID(JSINSPECTOR_CID); + +static const mozilla::Module::CIDEntry kJSInspectorCIDs[] = { + {&kJSINSPECTOR_CID, false, nullptr, + mozilla::jsinspector::nsJSInspectorConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kJSInspectorContracts[] = { + {JSINSPECTOR_CONTRACTID, &kJSINSPECTOR_CID}, {nullptr}}; + +static const mozilla::Module kJSInspectorModule = { + mozilla::Module::kVersion, kJSInspectorCIDs, kJSInspectorContracts}; + +NSMODULE_DEFN(jsinspector) = &kJSInspectorModule; diff --git a/devtools/startup/AboutDebuggingNewRegistration.jsm b/devtools/startup/aboutdebugging-new-registration.js similarity index 89% rename from devtools/startup/AboutDebuggingNewRegistration.jsm rename to devtools/startup/aboutdebugging-new-registration.js index a8d65a138778..6d90f3895bb3 100644 --- a/devtools/startup/AboutDebuggingNewRegistration.jsm +++ b/devtools/startup/aboutdebugging-new-registration.js @@ -8,6 +8,7 @@ // open the new about:debugging when going to about:debugging-new, without having to flip // the preference. This allows running both versions of about:debugging side by side to // compare them. +const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); const { nsIAboutModule } = Ci; @@ -37,4 +38,6 @@ AboutDebuggingNew.prototype = { }, }; -var EXPORTED_SYMBOLS = ["AboutDebuggingNew"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ + AboutDebuggingNew, +]); diff --git a/devtools/startup/aboutdebugging-new.manifest b/devtools/startup/aboutdebugging-new.manifest new file mode 100644 index 000000000000..6c44cb2f5ba2 --- /dev/null +++ b/devtools/startup/aboutdebugging-new.manifest @@ -0,0 +1,2 @@ +component {610e4e26-26bd-4a7d-aebc-69211d5a3be0} aboutdebugging-new-registration.js +contract @mozilla.org/network/protocol/about;1?what=debugging-new {610e4e26-26bd-4a7d-aebc-69211d5a3be0} diff --git a/devtools/startup/AboutDebuggingRegistration.jsm b/devtools/startup/aboutdebugging-registration.js similarity index 90% rename from devtools/startup/AboutDebuggingRegistration.jsm rename to devtools/startup/aboutdebugging-registration.js index 6a50e34bee57..94aeb1a342bc 100644 --- a/devtools/startup/AboutDebuggingRegistration.jsm +++ b/devtools/startup/aboutdebugging-registration.js @@ -8,6 +8,7 @@ // workers and tabs by launching a dedicated DevTools toolbox for the selected target. // If DevTools are not installed, this about page will display a shim landing page // encouraging the user to download and install DevTools. +const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); const { nsIAboutModule } = Ci; @@ -39,4 +40,6 @@ AboutDebugging.prototype = { }, }; -var EXPORTED_SYMBOLS = ["AboutDebugging"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ + AboutDebugging, +]); diff --git a/devtools/startup/aboutdebugging.manifest b/devtools/startup/aboutdebugging.manifest new file mode 100644 index 000000000000..4626430f38f2 --- /dev/null +++ b/devtools/startup/aboutdebugging.manifest @@ -0,0 +1,2 @@ +component {1060afaf-dc9e-43da-8646-23a2faf48493} aboutdebugging-registration.js +contract @mozilla.org/network/protocol/about;1?what=debugging {1060afaf-dc9e-43da-8646-23a2faf48493} \ No newline at end of file diff --git a/devtools/startup/aboutdevtools/AboutDevToolsRegistration.jsm b/devtools/startup/aboutdevtools/aboutdevtools-registration.js similarity index 87% rename from devtools/startup/aboutdevtools/AboutDevToolsRegistration.jsm rename to devtools/startup/aboutdevtools/aboutdevtools-registration.js index 37f7e4e9ab6b..f7d17f4eebf3 100644 --- a/devtools/startup/aboutdevtools/AboutDevToolsRegistration.jsm +++ b/devtools/startup/aboutdevtools/aboutdevtools-registration.js @@ -6,6 +6,7 @@ // Register the about:devtools URL, that is opened whenever a user attempts to open // DevTools for the first time. +const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); const { nsIAboutModule } = Ci; @@ -34,4 +35,6 @@ AboutDevtools.prototype = { }, }; -var EXPORTED_SYMBOLS = ["AboutDevtools"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ + AboutDevtools, +]); diff --git a/devtools/startup/aboutdevtools/aboutdevtools.manifest b/devtools/startup/aboutdevtools/aboutdevtools.manifest new file mode 100644 index 000000000000..05cd3dee87ee --- /dev/null +++ b/devtools/startup/aboutdevtools/aboutdevtools.manifest @@ -0,0 +1,2 @@ +component {3a16d383-92bd-4c24-ac10-0e2bd66883ab} aboutdevtools-registration.js +contract @mozilla.org/network/protocol/about;1?what=devtools {3a16d383-92bd-4c24-ac10-0e2bd66883ab} diff --git a/devtools/startup/aboutdevtools/components.conf b/devtools/startup/aboutdevtools/components.conf deleted file mode 100644 index e9ea6846f810..000000000000 --- a/devtools/startup/aboutdevtools/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{3a16d383-92bd-4c24-ac10-0e2bd66883ab}', - 'contract_ids': ['@mozilla.org/network/protocol/about;1?what=devtools'], - 'jsm': 'resource:///modules/AboutDevToolsRegistration.jsm', - 'constructor': 'AboutDevtools', - }, -] diff --git a/devtools/startup/aboutdevtools/moz.build b/devtools/startup/aboutdevtools/moz.build index 772fc9c1fea9..1816a74035dd 100644 --- a/devtools/startup/aboutdevtools/moz.build +++ b/devtools/startup/aboutdevtools/moz.build @@ -4,12 +4,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/. -EXTRA_JS_MODULES += [ - 'AboutDevToolsRegistration.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'aboutdevtools-registration.js', + 'aboutdevtools.manifest', ] BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] diff --git a/devtools/startup/AboutDevToolsToolboxRegistration.jsm b/devtools/startup/aboutdevtoolstoolbox-registration.js similarity index 88% rename from devtools/startup/AboutDevToolsToolboxRegistration.jsm rename to devtools/startup/aboutdevtoolstoolbox-registration.js index 4f6df05f02b5..a1bf914d21d4 100644 --- a/devtools/startup/AboutDevToolsToolboxRegistration.jsm +++ b/devtools/startup/aboutdevtoolstoolbox-registration.js @@ -7,6 +7,7 @@ // Register about:devtools-toolbox which allows to open a devtools toolbox // in a Firefox tab or a custom html iframe in browser.html +const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); const { nsIAboutModule } = Ci; @@ -34,4 +35,6 @@ AboutDevtoolsToolbox.prototype = { }, }; -var EXPORTED_SYMBOLS = ["AboutDevtoolsToolbox"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ + AboutDevtoolsToolbox, +]); diff --git a/devtools/startup/aboutdevtoolstoolbox.manifest b/devtools/startup/aboutdevtoolstoolbox.manifest new file mode 100644 index 000000000000..dab423222ab5 --- /dev/null +++ b/devtools/startup/aboutdevtoolstoolbox.manifest @@ -0,0 +1,2 @@ +component {11342911-3135-45a8-8d71-737a2b0ad469} aboutdevtoolstoolbox-registration.js +contract @mozilla.org/network/protocol/about;1?what=devtools-toolbox {11342911-3135-45a8-8d71-737a2b0ad469} \ No newline at end of file diff --git a/devtools/startup/components.conf b/devtools/startup/components.conf deleted file mode 100644 index 4976e28bede5..000000000000 --- a/devtools/startup/components.conf +++ /dev/null @@ -1,40 +0,0 @@ -# -*- 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 = [] - -if buildconfig.substs['MOZ_DEVTOOLS'] == 'all': - Classes += [ - { - 'cid': '{9e9a9283-0ce9-4e4a-8f1c-ba129a032c32}', - 'contract_ids': ['@mozilla.org/devtools/startup-clh;1'], - 'jsm': 'resource:///modules/DevToolsStartup.jsm', - 'constructor': 'DevToolsStartup', - 'categories': {'command-line-handler': 'm-devtools'}, - }, - { - 'cid': '{1060afaf-dc9e-43da-8646-23a2faf48493}', - 'contract_ids': ['@mozilla.org/network/protocol/about;1?what=debugging'], - 'jsm': 'resource:///modules/AboutDebuggingRegistration.jsm', - 'constructor': 'AboutDebugging', - }, - { - 'cid': '{11342911-3135-45a8-8d71-737a2b0ad469}', - 'contract_ids': ['@mozilla.org/network/protocol/about;1?what=devtools-toolbox'], - 'jsm': 'resource:///modules/AboutDevToolsToolboxRegistration.jsm', - 'constructor': 'AboutDevtoolsToolbox', - }, - ] - -if defined('NIGHTLY_BUILD'): - Classes += [ - { - 'cid': '{610e4e26-26bd-4a7d-aebc-69211d5a3be0}', - 'contract_ids': ['@mozilla.org/network/protocol/about;1?what=debugging-new'], - 'jsm': 'resource:///modules/AboutDebuggingNewRegistration.jsm', - 'constructor': 'AboutDebuggingNew', - }, - ] diff --git a/devtools/startup/DevToolsStartup.jsm b/devtools/startup/devtools-startup.js similarity index 99% rename from devtools/startup/DevToolsStartup.jsm rename to devtools/startup/devtools-startup.js index 3d5003b5bdff..c557646859e0 100644 --- a/devtools/startup/DevToolsStartup.jsm +++ b/devtools/startup/devtools-startup.js @@ -1007,4 +1007,5 @@ const JsonView = { }, }; -var EXPORTED_SYMBOLS = ["DevToolsStartup"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory( + [DevToolsStartup]); diff --git a/devtools/startup/devtools-startup.manifest b/devtools/startup/devtools-startup.manifest new file mode 100644 index 000000000000..ac9583d2614a --- /dev/null +++ b/devtools/startup/devtools-startup.manifest @@ -0,0 +1,3 @@ +component {9e9a9283-0ce9-4e4a-8f1c-ba129a032c32} devtools-startup.js +contract @mozilla.org/devtools/startup-clh;1 {9e9a9283-0ce9-4e4a-8f1c-ba129a032c32} +category command-line-handler m-devtools @mozilla.org/devtools/startup-clh;1 diff --git a/devtools/startup/moz.build b/devtools/startup/moz.build index 22e9462bd7fe..a44f6130a347 100644 --- a/devtools/startup/moz.build +++ b/devtools/startup/moz.build @@ -12,10 +12,13 @@ DIRS += [ # Register the startup components only for 'all' builds. if CONFIG['MOZ_DEVTOOLS'] == 'all': - EXTRA_JS_MODULES += [ - 'AboutDebuggingRegistration.jsm', - 'AboutDevToolsToolboxRegistration.jsm', - 'DevToolsStartup.jsm', + EXTRA_COMPONENTS += [ + 'aboutdebugging-registration.js', + 'aboutdebugging.manifest', + 'aboutdevtoolstoolbox-registration.js', + 'aboutdevtoolstoolbox.manifest', + 'devtools-startup.js', + 'devtools-startup.manifest', ] DIRS += [ @@ -25,13 +28,10 @@ if CONFIG['MOZ_DEVTOOLS'] == 'all': if CONFIG['NIGHTLY_BUILD']: EXTRA_COMPONENTS += [ - 'AboutDebuggingNewRegistration.jsm', + 'aboutdebugging-new-registration.js', + 'aboutdebugging-new.manifest', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini'] if CONFIG['MOZ_BUILD_APP'] != 'mobile/android': diff --git a/dom/base/ProcessSelector.jsm b/dom/base/ProcessSelector.js similarity index 91% rename from dom/base/ProcessSelector.jsm rename to dom/base/ProcessSelector.js index b525921273f8..0f2982a3330e 100644 --- a/dom/base/ProcessSelector.jsm +++ b/dom/base/ProcessSelector.js @@ -2,6 +2,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/. */ +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); + // Fills up aProcesses until max and then selects randomly from the available // ones. function RandomSelector() { @@ -66,4 +68,5 @@ MinTabSelector.prototype = { }, }; -var EXPORTED_SYMBOLS = ["RandomSelector", "MinTabSelector"] +var components = [RandomSelector, MinTabSelector]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components); diff --git a/dom/base/ProcessSelector.manifest b/dom/base/ProcessSelector.manifest new file mode 100644 index 000000000000..c9f485ee4e3d --- /dev/null +++ b/dom/base/ProcessSelector.manifest @@ -0,0 +1,3 @@ +component {c616fcfd-9737-41f1-aa74-cee72a38f91b} ProcessSelector.js +component {2dc08eaf-6eef-4394-b1df-a3a927c1290b} ProcessSelector.js +contract @mozilla.org/ipc/processselector;1 {2dc08eaf-6eef-4394-b1df-a3a927c1290b} diff --git a/dom/base/SlowScriptDebug.jsm b/dom/base/SlowScriptDebug.js similarity index 71% rename from dom/base/SlowScriptDebug.jsm rename to dom/base/SlowScriptDebug.js index 70b7b7c73cd2..4c61884a8a85 100644 --- a/dom/base/SlowScriptDebug.jsm +++ b/dom/base/SlowScriptDebug.js @@ -4,10 +4,14 @@ "use strict"; +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); + function SlowScriptDebug() { } SlowScriptDebug.prototype = { + classID: Components.ID("{e740ddb4-18b4-4aac-8ae1-9b0f4320769d}"), classDescription: "Slow script debug handler", + contractID: "@mozilla.org/dom/slow-script-debug;1", QueryInterface: ChromeUtils.generateQI([Ci.nsISlowScriptDebug]), get activationHandler() { return this._activationHandler; }, @@ -17,4 +21,4 @@ SlowScriptDebug.prototype = { set remoteActivationHandler(cb) { return this._remoteActivationHandler = cb; }, }; -var EXPORTED_SYMBOLS = ["SlowScriptDebug"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SlowScriptDebug]); diff --git a/dom/base/SlowScriptDebug.manifest b/dom/base/SlowScriptDebug.manifest new file mode 100644 index 000000000000..f84fd837dfd0 --- /dev/null +++ b/dom/base/SlowScriptDebug.manifest @@ -0,0 +1,2 @@ +component {e740ddb4-18b4-4aac-8ae1-9b0f4320769d} SlowScriptDebug.js +contract @mozilla.org/dom/slow-script-debug;1 {e740ddb4-18b4-4aac-8ae1-9b0f4320769d} diff --git a/dom/base/components.conf b/dom/base/components.conf deleted file mode 100644 index f179d1370208..000000000000 --- a/dom/base/components.conf +++ /dev/null @@ -1,31 +0,0 @@ -# -*- 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': '{1f34bc80-1bc7-11d6-a384-d705dd0746fc}', - 'contract_ids': ['@mozilla.org/content/dropped-link-handler;1'], - 'jsm': 'resource://gre/modules/ContentAreaDropListener.jsm', - 'constructor': 'ContentAreaDropListener', - }, - { - 'cid': '{c616fcfd-9737-41f1-aa74-cee72a38f91b}', - 'jsm': 'resource://gre/modules/ProcessSelector.jsm', - 'constructor': 'RandomSelector', - }, - { - 'cid': '{2dc08eaf-6eef-4394-b1df-a3a927c1290b}', - 'contract_ids': ['@mozilla.org/ipc/processselector;1'], - 'jsm': 'resource://gre/modules/ProcessSelector.jsm', - 'constructor': 'MinTabSelector', - }, - { - 'cid': '{e740ddb4-18b4-4aac-8ae1-9b0f4320769d}', - 'contract_ids': ['@mozilla.org/dom/slow-script-debug;1'], - 'jsm': 'resource://gre/modules/SlowScriptDebug.jsm', - 'constructor': 'SlowScriptDebug', - }, -] diff --git a/dom/base/ContentAreaDropListener.jsm b/dom/base/contentAreaDropListener.js similarity index 98% rename from dom/base/ContentAreaDropListener.jsm rename to dom/base/contentAreaDropListener.js index b31071dcbc6d..cf9224292d69 100644 --- a/dom/base/ContentAreaDropListener.jsm +++ b/dom/base/contentAreaDropListener.js @@ -3,6 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {OS} = ChromeUtils.import("resource://gre/modules/osfile.jsm"); // This component is used for handling dragover and drop of urls. @@ -314,4 +315,5 @@ ContentAreaDropListener.prototype = } }; -var EXPORTED_SYMBOLS = ["ContentAreaDropListener"]; +var components = [ContentAreaDropListener]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components); diff --git a/dom/base/contentAreaDropListener.manifest b/dom/base/contentAreaDropListener.manifest new file mode 100644 index 000000000000..8e6878b9b4a9 --- /dev/null +++ b/dom/base/contentAreaDropListener.manifest @@ -0,0 +1,2 @@ +component {1f34bc80-1bc7-11d6-a384-d705dd0746fc} contentAreaDropListener.js +contract @mozilla.org/content/dropped-link-handler;1 {1f34bc80-1bc7-11d6-a384-d705dd0746fc} diff --git a/dom/base/moz.build b/dom/base/moz.build index 492ffb56d90d..8cbd77df31e4 100644 --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -452,16 +452,18 @@ if CONFIG['INTEL_ARCHITECTURE']: SOURCES += ['nsTextFragmentSSE2.cpp'] SOURCES['nsTextFragmentSSE2.cpp'].flags += CONFIG['SSE2_FLAGS'] -EXTRA_JS_MODULES += [ - 'ContentAreaDropListener.jsm', - 'DOMRequestHelper.jsm', - 'IndexedDBHelper.jsm', - 'ProcessSelector.jsm', - 'SlowScriptDebug.jsm', +EXTRA_COMPONENTS += [ + 'contentAreaDropListener.js', + 'contentAreaDropListener.manifest', + 'ProcessSelector.js', + 'ProcessSelector.manifest', + 'SlowScriptDebug.js', + 'SlowScriptDebug.manifest', ] -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_JS_MODULES += [ + 'DOMRequestHelper.jsm', + 'IndexedDBHelper.jsm', ] LOCAL_INCLUDES += [ diff --git a/dom/base/test/test_bug715041.xul b/dom/base/test/test_bug715041.xul index 7b2539027de9..cd031614ee07 100644 --- a/dom/base/test/test_bug715041.xul +++ b/dom/base/test/test_bug715041.xul @@ -720,7 +720,7 @@ target="_blank">Mozilla Bug 715041 } try { - componentMgr.registerFactory(oldIdleServiceCID, "Re registering old idle service", idleServiceContractID, null); + componentMgr.registerFactory(oldIdleServiceCID, "Re registering old idle service", idleServiceContractID, oldIdleServiceFactoryObj); } catch(err) { dump("test_bug715041.xul: ShiftLocalTimerBackCleanUp() Failed to register factory, original idle service!\n"); @@ -784,6 +784,13 @@ target="_blank">Mozilla Bug 715041 dump("test_bug715041.xul: Failed to convert ID to CID for old idle service.\n"); } + try { + componentMgr.unregisterFactory(oldIdleServiceCID, oldIdleServiceFactoryObj); + } + catch(err) { + dump("test_bug715041.xul: Failed to unregister old idle service factory object!\n"); + } + try { componentMgr.registerFactory(idleServiceCID, "Test Simple Idle/Back Notifications", idleServiceContractID, idleServiceObj); } diff --git a/dom/base/test/test_bug715041_removal.xul b/dom/base/test/test_bug715041_removal.xul index edbe5f275c86..e0eebe1edb29 100644 --- a/dom/base/test/test_bug715041_removal.xul +++ b/dom/base/test/test_bug715041_removal.xul @@ -765,7 +765,7 @@ target="_blank">Mozilla Bug 715041 } try { - componentMgr.registerFactory(oldIdleServiceCID, "Re registering old idle service", idleServiceContractID, null); + componentMgr.registerFactory(oldIdleServiceCID, "Re registering old idle service", idleServiceContractID, oldIdleServiceFactoryObj); } catch(err) { dump("test_bug715041_removal.xul: RemoveLastAddLastCleanUp() Failed to register factory, original idle service!\n"); @@ -812,6 +812,13 @@ target="_blank">Mozilla Bug 715041 dump("test_bug715041._removalxul: Failed to convert ID to CID for old idle service.\n"); } + try { + componentMgr.unregisterFactory(oldIdleServiceCID, oldIdleServiceFactoryObj); + } + catch(err) { + dump("test_bug715041_removal.xul: Failed to unregister old idle service factory object!\n"); + } + try { componentMgr.registerFactory(idleServiceCID, "Test Simple Idle/Back Notifications", idleServiceContractID, idleServiceObj); } diff --git a/dom/browser-element/BrowserElementParent.jsm b/dom/browser-element/BrowserElementParent.js similarity index 99% rename from dom/browser-element/BrowserElementParent.jsm rename to dom/browser-element/BrowserElementParent.js index 3f8a9ca4be8d..61430db9078c 100644 --- a/dom/browser-element/BrowserElementParent.jsm +++ b/dom/browser-element/BrowserElementParent.js @@ -10,6 +10,7 @@ */ const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {BrowserElementPromptService} = ChromeUtils.import("resource://gre/modules/BrowserElementPromptService.jsm"); function debug(msg) { @@ -621,4 +622,4 @@ BrowserElementParent.prototype = { }, }; -var EXPORTED_SYMBOLS = ["BrowserElementParent"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([BrowserElementParent]); diff --git a/dom/browser-element/BrowserElementParent.manifest b/dom/browser-element/BrowserElementParent.manifest new file mode 100644 index 000000000000..547ff7f3dc48 --- /dev/null +++ b/dom/browser-element/BrowserElementParent.manifest @@ -0,0 +1,2 @@ +component {9f171ac4-0939-4ef8-b360-3408aedc3060} BrowserElementParent.js +contract @mozilla.org/dom/browser-element-api;1 {9f171ac4-0939-4ef8-b360-3408aedc3060} diff --git a/dom/browser-element/BrowserElementPromptService.jsm b/dom/browser-element/BrowserElementPromptService.jsm index 9a42729c3f72..f99f6b543207 100644 --- a/dom/browser-element/BrowserElementPromptService.jsm +++ b/dom/browser-element/BrowserElementPromptService.jsm @@ -596,6 +596,8 @@ var BrowserElementPromptService = { return; } + Cm.unregisterFactory(oldCID, oldFactory); + var oldInstance = oldFactory.createInstance(null, Ci.nsIPromptFactory); var newInstance = new BrowserElementPromptFactory(oldInstance); diff --git a/dom/browser-element/components.conf b/dom/browser-element/components.conf deleted file mode 100644 index a29f7dc66aed..000000000000 --- a/dom/browser-element/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{9f171ac4-0939-4ef8-b360-3408aedc3060}', - 'contract_ids': ['@mozilla.org/dom/browser-element-api;1'], - 'jsm': 'resource://gre/modules/BrowserElementParent.jsm', - 'constructor': 'BrowserElementParent', - }, -] diff --git a/dom/browser-element/moz.build b/dom/browser-element/moz.build index 5ca4ab983b88..1f267d905ecf 100644 --- a/dom/browser-element/moz.build +++ b/dom/browser-element/moz.build @@ -21,13 +21,13 @@ XPIDL_SOURCES += [ XPIDL_MODULE = 'browser-element' -EXTRA_JS_MODULES += [ - 'BrowserElementParent.jsm', - 'BrowserElementPromptService.jsm', +EXTRA_COMPONENTS += [ + 'BrowserElementParent.js', + 'BrowserElementParent.manifest', ] -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_JS_MODULES += [ + 'BrowserElementPromptService.jsm', ] LOCAL_INCLUDES += [ diff --git a/dom/console/ConsoleAPI.manifest b/dom/console/ConsoleAPI.manifest new file mode 100644 index 000000000000..56e0768a729e --- /dev/null +++ b/dom/console/ConsoleAPI.manifest @@ -0,0 +1,2 @@ +component {96cf7855-dfa9-4c6d-8276-f9705b4890f2} ConsoleAPIStorage.js +contract @mozilla.org/consoleAPI-storage;1 {96cf7855-dfa9-4c6d-8276-f9705b4890f2} diff --git a/dom/console/ConsoleAPIStorage.jsm b/dom/console/ConsoleAPIStorage.js similarity index 94% rename from dom/console/ConsoleAPIStorage.jsm rename to dom/console/ConsoleAPIStorage.js index db6e9128487b..19cf212ea0d8 100644 --- a/dom/console/ConsoleAPIStorage.jsm +++ b/dom/console/ConsoleAPIStorage.js @@ -4,8 +4,12 @@ "use strict"; +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); +// This constant tells how many messages to process in a single timer execution. +const MESSAGES_IN_INTERVAL = 1500; + const STORAGE_MAX_EVENTS = 1000; var _consoleStorage = new Map(); @@ -138,4 +142,4 @@ ConsoleAPIStorageService.prototype = { }, }; -var EXPORTED_SYMBOLS = ["ConsoleAPIStorageService"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ConsoleAPIStorageService]); diff --git a/dom/console/components.conf b/dom/console/components.conf deleted file mode 100644 index 864bb7686c8f..000000000000 --- a/dom/console/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{96cf7855-dfa9-4c6d-8276-f9705b4890f2}', - 'contract_ids': ['@mozilla.org/consoleAPI-storage;1'], - 'jsm': 'resource://gre/modules/ConsoleAPIStorage.jsm', - 'constructor': 'ConsoleAPIStorageService', - }, -] diff --git a/dom/console/moz.build b/dom/console/moz.build index 31f2c6ad6d92..3dd737737420 100644 --- a/dom/console/moz.build +++ b/dom/console/moz.build @@ -34,12 +34,9 @@ UNIFIED_SOURCES += [ 'ConsoleUtils.cpp', ] -EXTRA_JS_MODULES += [ - 'ConsoleAPIStorage.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'ConsoleAPI.manifest', + 'ConsoleAPIStorage.js', ] LOCAL_INCLUDES += [ diff --git a/dom/file/uri/BlobURLProtocolHandler.cpp b/dom/file/uri/BlobURLProtocolHandler.cpp index b722ff8ee7cf..b0547b5e185c 100644 --- a/dom/file/uri/BlobURLProtocolHandler.cpp +++ b/dom/file/uri/BlobURLProtocolHandler.cpp @@ -17,6 +17,7 @@ #include "mozilla/dom/MediaSource.h" #include "mozilla/ipc/IPCStreamUtils.h" #include "mozilla/LoadInfo.h" +#include "mozilla/ModuleUtils.h" #include "mozilla/NullPrincipal.h" #include "mozilla/Preferences.h" #include "mozilla/SystemGroup.h" @@ -907,6 +908,33 @@ nsresult NS_GetSourceForMediaSourceURI(nsIURI* aURI, MediaSource** aSource) { namespace mozilla { namespace dom { +#define NS_BLOBPROTOCOLHANDLER_CID \ + { \ + 0xb43964aa, 0xa078, 0x44b2, { \ + 0xb0, 0x6b, 0xfd, 0x4d, 0x1b, 0x17, 0x2e, 0x66 \ + } \ + } + +NS_GENERIC_FACTORY_CONSTRUCTOR(BlobURLProtocolHandler) + +NS_DEFINE_NAMED_CID(NS_BLOBPROTOCOLHANDLER_CID); + +static const Module::CIDEntry kBlobURLProtocolHandlerCIDs[] = { + {&kNS_BLOBPROTOCOLHANDLER_CID, false, nullptr, + BlobURLProtocolHandlerConstructor}, + {nullptr}}; + +static const Module::ContractIDEntry kBlobURLProtocolHandlerContracts[] = { + {NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX BLOBURI_SCHEME, + &kNS_BLOBPROTOCOLHANDLER_CID}, + {nullptr}}; + +static const Module kBlobURLProtocolHandlerModule = { + Module::kVersion, kBlobURLProtocolHandlerCIDs, + kBlobURLProtocolHandlerContracts}; + +NSMODULE_DEFN(BlobURLProtocolHandler) = &kBlobURLProtocolHandlerModule; + bool IsType(nsIURI* aUri, DataInfo::ObjectType aType) { DataInfo* info = GetDataInfoFromURI(aUri); if (!info) { diff --git a/dom/file/uri/FontTableURIProtocolHandler.cpp b/dom/file/uri/FontTableURIProtocolHandler.cpp index 6245352527a0..3dd37f1822e8 100644 --- a/dom/file/uri/FontTableURIProtocolHandler.cpp +++ b/dom/file/uri/FontTableURIProtocolHandler.cpp @@ -5,10 +5,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "FontTableURIProtocolHandler.h" -#include "nsIURIMutator.h" -#include "nsIUUIDGenerator.h" +#include "mozilla/ModuleUtils.h" #include "nsNetUtil.h" -#include "nsSimpleURI.h" using namespace mozilla; using namespace mozilla::dom; @@ -114,3 +112,31 @@ FontTableURIProtocolHandler::NewURI(const nsACString &aSpec, uri.forget(aResult); return NS_OK; } + +#define NS_FONTTABLEPROTOCOLHANDLER_CID \ + { \ + 0x3fc8f04e, 0xd719, 0x43ca, { \ + 0x9a, 0xd0, 0x18, 0xee, 0x32, 0x02, 0x11, 0xf2 \ + } \ + } + +NS_GENERIC_FACTORY_CONSTRUCTOR(FontTableURIProtocolHandler) + +NS_DEFINE_NAMED_CID(NS_FONTTABLEPROTOCOLHANDLER_CID); + +static const mozilla::Module::CIDEntry FontTableURIProtocolHandlerCIDs[] = { + {&kNS_FONTTABLEPROTOCOLHANDLER_CID, false, nullptr, + FontTableURIProtocolHandlerConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry + FontTableURIProtocolHandlerContracts[] = { + {NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX FONTTABLEURI_SCHEME, + &kNS_FONTTABLEPROTOCOLHANDLER_CID}, + {nullptr}}; + +static const mozilla::Module FontTableURIProtocolHandlerModule = { + mozilla::Module::kVersion, FontTableURIProtocolHandlerCIDs, + FontTableURIProtocolHandlerContracts}; + +NSMODULE_DEFN(FontTableURIProtocolHandler) = &FontTableURIProtocolHandlerModule; diff --git a/dom/file/uri/components.conf b/dom/file/uri/components.conf deleted file mode 100644 index 67b7f799bb66..000000000000 --- a/dom/file/uri/components.conf +++ /dev/null @@ -1,20 +0,0 @@ -# -*- 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': '{3fc8f04e-d719-43ca-9ad0-18ee320211f2}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=moz-fonttable'], - 'type': 'mozilla::dom::FontTableURIProtocolHandler', - 'headers': ['mozilla/dom/FontTableURIProtocolHandler.h'], - }, - { - 'cid': '{b43964aa-a078-44b2-b06b-fd4d1b172e66}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=blob'], - 'type': 'mozilla::dom::BlobURLProtocolHandler', - 'headers': ['mozilla/dom/BlobURLProtocolHandler.h'], - }, -] diff --git a/dom/file/uri/moz.build b/dom/file/uri/moz.build index bfd9c4e6024c..1bf3b9ccc673 100644 --- a/dom/file/uri/moz.build +++ b/dom/file/uri/moz.build @@ -20,10 +20,6 @@ UNIFIED_SOURCES += [ 'FontTableURIProtocolHandler.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - LOCAL_INCLUDES += [ '/dom/file', '/netwerk/base', diff --git a/dom/html/components.conf b/dom/html/components.conf deleted file mode 100644 index 6016f2eee70b..000000000000 --- a/dom/html/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{51c65f5d-0de5-4edc-9058-60e50cef77f8}', - 'contract_ids': ['@mozilla.org/content/html-menu-builder;1'], - 'jsm': 'resource://gre/modules/HTMLMenuBuilder.jsm', - 'constructor': 'HTMLMenuBuilder', - }, -] diff --git a/dom/html/HTMLMenuBuilder.jsm b/dom/html/htmlMenuBuilder.js similarity index 95% rename from dom/html/HTMLMenuBuilder.jsm rename to dom/html/htmlMenuBuilder.js index dfa02c146cb2..5e5b759b87e6 100644 --- a/dom/html/HTMLMenuBuilder.jsm +++ b/dom/html/htmlMenuBuilder.js @@ -4,6 +4,8 @@ // This component is used to build the menus for the HTML contextmenu attribute. +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); + // A global value that is used to identify each menu item. It is // incremented with each one that is found. var gGeneratedId = 1; @@ -129,4 +131,4 @@ HTMLMenuBuilder.prototype = } }; -var EXPORTED_SYMBOLS = ["HTMLMenuBuilder"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([HTMLMenuBuilder]); diff --git a/dom/html/htmlMenuBuilder.manifest b/dom/html/htmlMenuBuilder.manifest new file mode 100644 index 000000000000..b245f8fe2de5 --- /dev/null +++ b/dom/html/htmlMenuBuilder.manifest @@ -0,0 +1,3 @@ +component {51c65f5d-0de5-4edc-9058-60e50cef77f8} htmlMenuBuilder.js +contract @mozilla.org/content/html-menu-builder;1 {51c65f5d-0de5-4edc-9058-60e50cef77f8} + diff --git a/dom/html/moz.build b/dom/html/moz.build index ee1f0bbe76ce..f486cb40a772 100644 --- a/dom/html/moz.build +++ b/dom/html/moz.build @@ -227,12 +227,9 @@ SOURCES += [ 'PluginDocument.cpp', ] -EXTRA_JS_MODULES += [ - 'HTMLMenuBuilder.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'htmlMenuBuilder.js', + 'htmlMenuBuilder.manifest' ] include('/ipc/chromium/chromium-config.mozbuild') diff --git a/dom/media/PeerConnection.jsm b/dom/media/PeerConnection.js similarity index 99% rename from dom/media/PeerConnection.jsm rename to dom/media/PeerConnection.js index 9087d6e4d66d..01e805c1f184 100644 --- a/dom/media/PeerConnection.jsm +++ b/dom/media/PeerConnection.js @@ -6,15 +6,19 @@ "use strict"; const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); ChromeUtils.defineModuleGetter(this, "PeerConnectionIdp", "resource://gre/modules/media/PeerConnectionIdp.jsm"); ChromeUtils.defineModuleGetter(this, "convertToRTCStatsReport", "resource://gre/modules/media/RTCStatsReport.jsm"); +ChromeUtils.defineModuleGetter(this, "AppConstants", + "resource://gre/modules/AppConstants.jsm"); const PC_CONTRACT = "@mozilla.org/dom/peerconnection;1"; const PC_OBS_CONTRACT = "@mozilla.org/dom/peerconnectionobserver;1"; const PC_ICE_CONTRACT = "@mozilla.org/dom/rtcicecandidate;1"; const PC_SESSION_CONTRACT = "@mozilla.org/dom/rtcsessiondescription;1"; +const PC_MANAGER_CONTRACT = "@mozilla.org/dom/peerconnectionmanager;1"; const PC_STATS_CONTRACT = "@mozilla.org/dom/rtcstatsreport;1"; const PC_STATIC_CONTRACT = "@mozilla.org/dom/peerconnectionstatic;1"; const PC_SENDER_CONTRACT = "@mozilla.org/dom/rtpsender;1"; @@ -2381,16 +2385,17 @@ setupPrototype(CreateOfferRequest, { QueryInterface: ChromeUtils.generateQI([]), }); -var EXPORTED_SYMBOLS = - ["GlobalPCList", - "RTCDTMFSender", - "RTCIceCandidate", - "RTCSessionDescription", - "RTCPeerConnection", - "RTCPeerConnectionStatic", - "RTCRtpReceiver", - "RTCRtpSender", - "RTCRtpTransceiver", - "RTCStatsReport", - "PeerConnectionObserver", - "CreateOfferRequest"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory( + [GlobalPCList, + RTCDTMFSender, + RTCIceCandidate, + RTCSessionDescription, + RTCPeerConnection, + RTCPeerConnectionStatic, + RTCRtpReceiver, + RTCRtpSender, + RTCRtpTransceiver, + RTCStatsReport, + PeerConnectionObserver, + CreateOfferRequest] +); diff --git a/dom/media/PeerConnection.manifest b/dom/media/PeerConnection.manifest new file mode 100644 index 000000000000..8edd721acb9b --- /dev/null +++ b/dom/media/PeerConnection.manifest @@ -0,0 +1,23 @@ +component {bdc2e533-b308-4708-ac8e-a8bfade6d851} PeerConnection.js +component {d1748d4c-7f6a-4dc5-add6-d55b7678537e} PeerConnection.js +component {02b9970c-433d-4cc2-923d-f7028ac66073} PeerConnection.js +component {1775081b-b62d-4954-8ffe-a067bbf508a7} PeerConnection.js +component {7293e901-2be3-4c02-b4bd-cbef6fc24f78} PeerConnection.js +component {7fe6e18b-0da3-4056-bf3b-440ef3809e06} PeerConnection.js +component {0fb47c47-a205-4583-a9fc-cbadf8c95880} PeerConnection.js +component {4fff5d46-d827-4cd4-a970-8fd53977440e} PeerConnection.js +component {d974b814-8fde-411c-8c45-b86791b81030} PeerConnection.js +component {74b2122d-65a8-4824-aa9e-3d664cb75dc2} PeerConnection.js +component {3610C242-654E-11E6-8EC0-6D1BE389A607} PeerConnection.js + +contract @mozilla.org/dom/peerconnection;1 {bdc2e533-b308-4708-ac8e-a8bfade6d851} +contract @mozilla.org/dom/peerconnectionobserver;1 {d1748d4c-7f6a-4dc5-add6-d55b7678537e} +contract @mozilla.org/dom/rtcdtmfsender;1 {3610C242-654E-11E6-8EC0-6D1BE389A607} +contract @mozilla.org/dom/rtcicecandidate;1 {02b9970c-433d-4cc2-923d-f7028ac66073} +contract @mozilla.org/dom/rtcsessiondescription;1 {1775081b-b62d-4954-8ffe-a067bbf508a7} +contract @mozilla.org/dom/peerconnectionmanager;1 {7293e901-2be3-4c02-b4bd-cbef6fc24f78} +contract @mozilla.org/dom/rtcstatsreport;1 {7fe6e18b-0da3-4056-bf3b-440ef3809e06} +contract @mozilla.org/dom/peerconnectionstatic;1 {0fb47c47-a205-4583-a9fc-cbadf8c95880} +contract @mozilla.org/dom/rtpsender;1 {4fff5d46-d827-4cd4-a970-8fd53977440e} +contract @mozilla.org/dom/rtpreceiver;1 {d974b814-8fde-411c-8c45-b86791b81030} +contract @mozilla.org/dom/createofferrequest;1 {74b2122d-65a8-4824-aa9e-3d664cb75dc2} diff --git a/dom/media/bridge/MediaModule.cpp b/dom/media/bridge/MediaModule.cpp index ff67751f1003..8203f635781e 100644 --- a/dom/media/bridge/MediaModule.cpp +++ b/dom/media/bridge/MediaModule.cpp @@ -2,15 +2,58 @@ * 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/Components.h" +#include "mozilla/ModuleUtils.h" +#include "nsIClassInfoImpl.h" #ifdef MOZ_WEBRTC + # include "PeerConnectionImpl.h" -using namespace mozilla; +# define PEERCONNECTION_CID \ + { \ + 0xb93af7a1, 0x3411, 0x44a8, { \ + 0xbd, 0x0a, 0x8a, 0xf3, 0xdd, 0xe4, 0xd8, 0xd8 \ + } \ + } -NS_IMPL_COMPONENT_FACTORY(mozilla::PeerConnectionImpl) { - return do_AddRef(new PeerConnectionImpl()).downcast(); -} +# define PEERCONNECTION_CONTRACTID "@mozilla.org/peerconnection;1" + +# include "stun_socket_filter.h" + +NS_DEFINE_NAMED_CID(NS_STUN_UDP_SOCKET_FILTER_HANDLER_CID) +NS_DEFINE_NAMED_CID(NS_STUN_TCP_SOCKET_FILTER_HANDLER_CID) + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsStunUDPSocketFilterHandler) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsStunTCPSocketFilterHandler) + +namespace mozilla { +// Factory defined in mozilla::, defines mozilla::PeerConnectionImplConstructor +NS_GENERIC_FACTORY_CONSTRUCTOR(PeerConnectionImpl) +} // namespace mozilla + +// Defines kPEERCONNECTION_CID +NS_DEFINE_NAMED_CID(PEERCONNECTION_CID); + +static const mozilla::Module::CIDEntry kCIDs[] = { + {&kPEERCONNECTION_CID, false, nullptr, + mozilla::PeerConnectionImplConstructor}, + {&kNS_STUN_UDP_SOCKET_FILTER_HANDLER_CID, false, nullptr, + nsStunUDPSocketFilterHandlerConstructor}, + {&kNS_STUN_TCP_SOCKET_FILTER_HANDLER_CID, false, nullptr, + nsStunTCPSocketFilterHandlerConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kContracts[] = { + {PEERCONNECTION_CONTRACTID, &kPEERCONNECTION_CID}, + {NS_STUN_UDP_SOCKET_FILTER_HANDLER_CONTRACTID, + &kNS_STUN_UDP_SOCKET_FILTER_HANDLER_CID}, + {NS_STUN_TCP_SOCKET_FILTER_HANDLER_CONTRACTID, + &kNS_STUN_TCP_SOCKET_FILTER_HANDLER_CID}, + {nullptr}}; + +static const mozilla::Module kModule = {mozilla::Module::kVersion, kCIDs, + kContracts}; + +NSMODULE_DEFN(peerconnection) = &kModule; #endif diff --git a/dom/media/bridge/components.conf b/dom/media/bridge/components.conf deleted file mode 100644 index 14b93269f42e..000000000000 --- a/dom/media/bridge/components.conf +++ /dev/null @@ -1,25 +0,0 @@ -# -*- 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': '{b93af7a1-3411-44a8-bd0a-8af3dde4d8d8}', - 'contract_ids': ['@mozilla.org/peerconnection;1'], - 'type': 'mozilla::PeerConnectionImpl', - }, - { - 'cid': '{9fea635a-2fc2-4d08-9721-d238d3f52f92}', - 'contract_ids': ['@mozilla.org/network/tcp-filter-handler;1?name=stun'], - 'type': 'nsStunTCPSocketFilterHandler', - 'headers': ['mtransport/stun_socket_filter.h'], - }, - { - 'cid': '{3e43ee93-829e-4ea6-a34e-62d9e4c9f993}', - 'contract_ids': ['@mozilla.org/network/udp-filter-handler;1?name=stun'], - 'type': 'nsStunUDPSocketFilterHandler', - 'headers': ['mtransport/stun_socket_filter.h'], - }, -] diff --git a/dom/media/bridge/moz.build b/dom/media/bridge/moz.build index 972c2f22b2e6..72356d7e4bdb 100644 --- a/dom/media/bridge/moz.build +++ b/dom/media/bridge/moz.build @@ -26,11 +26,6 @@ LOCAL_INCLUDES += [ '/media/webrtc/trunk/', ] -if CONFIG['MOZ_WEBRTC']: - XPCOM_MANIFESTS += [ - 'components.conf', - ] - FINAL_LIBRARY = 'xul' if CONFIG['CC_TYPE'] in ('clang', 'gcc'): diff --git a/dom/media/components.conf b/dom/media/components.conf deleted file mode 100644 index 599c6686a177..000000000000 --- a/dom/media/components.conf +++ /dev/null @@ -1,74 +0,0 @@ -# -*- 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': '{bdc2e533-b308-4708-ac8e-a8bfade6d851}', - 'contract_ids': ['@mozilla.org/dom/peerconnection;1'], - 'jsm': 'resource://gre/modules/media/PeerConnection.jsm', - 'constructor': 'RTCPeerConnection', - }, - { - 'cid': '{d1748d4c-7f6a-4dc5-add6-d55b7678537e}', - 'contract_ids': ['@mozilla.org/dom/peerconnectionobserver;1'], - 'jsm': 'resource://gre/modules/media/PeerConnection.jsm', - 'constructor': 'PeerConnectionObserver', - }, - { - 'cid': '{3610C242-654E-11E6-8EC0-6D1BE389A607}', - 'contract_ids': ['@mozilla.org/dom/rtcdtmfsender;1'], - 'jsm': 'resource://gre/modules/media/PeerConnection.jsm', - 'constructor': 'RTCDTMFSender', - }, - { - 'cid': '{02b9970c-433d-4cc2-923d-f7028ac66073}', - 'contract_ids': ['@mozilla.org/dom/rtcicecandidate;1'], - 'jsm': 'resource://gre/modules/media/PeerConnection.jsm', - 'constructor': 'RTCIceCandidate', - }, - { - 'cid': '{1775081b-b62d-4954-8ffe-a067bbf508a7}', - 'contract_ids': ['@mozilla.org/dom/rtcsessiondescription;1'], - 'jsm': 'resource://gre/modules/media/PeerConnection.jsm', - 'constructor': 'RTCSessionDescription', - }, - { - 'cid': '{7293e901-2be3-4c02-b4bd-cbef6fc24f78}', - 'contract_ids': ['@mozilla.org/dom/peerconnectionmanager;1'], - 'jsm': 'resource://gre/modules/media/PeerConnection.jsm', - 'constructor': 'GlobalPCList', - }, - { - 'cid': '{7fe6e18b-0da3-4056-bf3b-440ef3809e06}', - 'contract_ids': ['@mozilla.org/dom/rtcstatsreport;1'], - 'jsm': 'resource://gre/modules/media/PeerConnection.jsm', - 'constructor': 'RTCStatsReport', - }, - { - 'cid': '{0fb47c47-a205-4583-a9fc-cbadf8c95880}', - 'contract_ids': ['@mozilla.org/dom/peerconnectionstatic;1'], - 'jsm': 'resource://gre/modules/media/PeerConnection.jsm', - 'constructor': 'RTCPeerConnectionStatic', - }, - { - 'cid': '{4fff5d46-d827-4cd4-a970-8fd53977440e}', - 'contract_ids': ['@mozilla.org/dom/rtpsender;1'], - 'jsm': 'resource://gre/modules/media/PeerConnection.jsm', - 'constructor': 'RTCRtpSender', - }, - { - 'cid': '{d974b814-8fde-411c-8c45-b86791b81030}', - 'contract_ids': ['@mozilla.org/dom/rtpreceiver;1'], - 'jsm': 'resource://gre/modules/media/PeerConnection.jsm', - 'constructor': 'RTCRtpReceiver', - }, - { - 'cid': '{74b2122d-65a8-4824-aa9e-3d664cb75dc2}', - 'contract_ids': ['@mozilla.org/dom/createofferrequest;1'], - 'jsm': 'resource://gre/modules/media/PeerConnection.jsm', - 'constructor': 'CreateOfferRequest', - }, -] diff --git a/dom/media/moz.build b/dom/media/moz.build index 7a9877acbccb..1cbaa8fbc9f7 100644 --- a/dom/media/moz.build +++ b/dom/media/moz.build @@ -307,14 +307,10 @@ SOURCES += [ if CONFIG['CC_TYPE'] in ('clang', 'clang-cl', 'gcc'): SOURCES['DecoderTraits.cpp'].flags += ['-Wno-error=multichar'] -if CONFIG['MOZ_WEBRTC']: - XPCOM_MANIFESTS += [ - 'components.conf', - ] - - EXTRA_JS_MODULES.media += [ - 'PeerConnection.jsm', - ] +EXTRA_COMPONENTS += [ + 'PeerConnection.js', + 'PeerConnection.manifest', +] EXTRA_JS_MODULES.media += [ 'IdpSandbox.jsm', diff --git a/dom/media/webspeech/synth/moz.build b/dom/media/webspeech/synth/moz.build index ab1136dbec29..696881c83822 100644 --- a/dom/media/webspeech/synth/moz.build +++ b/dom/media/webspeech/synth/moz.build @@ -38,13 +38,10 @@ if CONFIG['MOZ_WEBSPEECH']: if CONFIG['MOZ_WEBSPEECH_TEST_BACKEND']: UNIFIED_SOURCES += [ + 'test/FakeSynthModule.cpp', 'test/nsFakeSynthServices.cpp' ] - XPCOM_MANIFESTS += [ - 'test/components.conf', - ] - if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': DIRS += ['windows'] diff --git a/dom/media/webspeech/synth/speechd/SpeechDispatcherModule.cpp b/dom/media/webspeech/synth/speechd/SpeechDispatcherModule.cpp new file mode 100644 index 000000000000..4bf356bc846d --- /dev/null +++ b/dom/media/webspeech/synth/speechd/SpeechDispatcherModule.cpp @@ -0,0 +1,54 @@ +/* -*- 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 "nsIClassInfoImpl.h" +#include "SpeechDispatcherService.h" + +using namespace mozilla::dom; + +#define SPEECHDISPATCHERSERVICE_CID \ + { \ + 0x8817b1cf, 0x5ada, 0x43bf, { \ + 0xbd, 0x73, 0x60, 0x76, 0x57, 0x70, 0x3d, 0x0d \ + } \ + } + +#define SPEECHDISPATCHERSERVICE_CONTRACTID \ + "@mozilla.org/synthspeechdispatcher;1" + +// Defines SpeechDispatcherServiceConstructor +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR( + SpeechDispatcherService, SpeechDispatcherService::GetInstanceForService) + +// Defines kSPEECHDISPATCHERSERVICE_CID +NS_DEFINE_NAMED_CID(SPEECHDISPATCHERSERVICE_CID); + +static const mozilla::Module::CIDEntry kCIDs[] = { + {&kSPEECHDISPATCHERSERVICE_CID, true, nullptr, + SpeechDispatcherServiceConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kContracts[] = { + {SPEECHDISPATCHERSERVICE_CONTRACTID, &kSPEECHDISPATCHERSERVICE_CID}, + {nullptr}}; + +static const mozilla::Module::CategoryEntry kCategories[] = { + {"speech-synth-started", "SpeechDispatcher Speech Synth", + SPEECHDISPATCHERSERVICE_CONTRACTID}, + {nullptr}}; + +static const mozilla::Module kModule = { + mozilla::Module::kVersion, + kCIDs, + kContracts, + kCategories, + nullptr, + nullptr, + nullptr, +}; + +NSMODULE_DEFN(synthspeechdispatcher) = &kModule; diff --git a/dom/media/webspeech/synth/speechd/components.conf b/dom/media/webspeech/synth/speechd/components.conf deleted file mode 100644 index 56b01ba5cbc5..000000000000 --- a/dom/media/webspeech/synth/speechd/components.conf +++ /dev/null @@ -1,17 +0,0 @@ -# -*- 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': '{8817b1cf-5ada-43bf-bd73-607657703d0d}', - 'contract_ids': ['@mozilla.org/synthspeechdispatcher;1'], - 'singleton': True, - 'type': 'mozilla::dom::SpeechDispatcherService', - 'headers': ['/dom/media/webspeech/synth/speechd/SpeechDispatcherService.h'], - 'constructor': 'mozilla::dom::SpeechDispatcherService::GetInstanceForService', - 'categories': {"speech-synth-started": 'SpeechDispatcher Speech Synth'}, - }, -] diff --git a/dom/media/webspeech/synth/speechd/moz.build b/dom/media/webspeech/synth/speechd/moz.build index 5dc831883d6c..51d675c10a48 100644 --- a/dom/media/webspeech/synth/speechd/moz.build +++ b/dom/media/webspeech/synth/speechd/moz.build @@ -5,13 +5,9 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. UNIFIED_SOURCES += [ + 'SpeechDispatcherModule.cpp', 'SpeechDispatcherService.cpp' ] - -XPCOM_MANIFESTS += [ - 'components.conf', -] - include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' diff --git a/dom/media/webspeech/synth/test/FakeSynthModule.cpp b/dom/media/webspeech/synth/test/FakeSynthModule.cpp new file mode 100644 index 000000000000..c195748f3922 --- /dev/null +++ b/dom/media/webspeech/synth/test/FakeSynthModule.cpp @@ -0,0 +1,45 @@ +/* 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 "nsIClassInfoImpl.h" + +#include "nsFakeSynthServices.h" + +using namespace mozilla::dom; + +#define FAKESYNTHSERVICE_CID \ + { \ + 0xe7d52d9e, 0xc148, 0x47d8, { \ + 0xab, 0x2a, 0x95, 0xd7, 0xf4, 0x0e, 0xa5, 0x3d \ + } \ + } + +#define FAKESYNTHSERVICE_CONTRACTID "@mozilla.org/fakesynth;1" + +// Defines nsFakeSynthServicesConstructor +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR( + nsFakeSynthServices, nsFakeSynthServices::GetInstanceForService) + +// Defines kFAKESYNTHSERVICE_CID +NS_DEFINE_NAMED_CID(FAKESYNTHSERVICE_CID); + +static const mozilla::Module::CIDEntry kCIDs[] = { + {&kFAKESYNTHSERVICE_CID, true, nullptr, nsFakeSynthServicesConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kContracts[] = { + {FAKESYNTHSERVICE_CONTRACTID, &kFAKESYNTHSERVICE_CID}, {nullptr}}; + +static const mozilla::Module::CategoryEntry kCategories[] = { + {"speech-synth-started", "Fake Speech Synth", FAKESYNTHSERVICE_CONTRACTID}, + {nullptr}}; + +static void UnloadFakeSynthmodule() { nsFakeSynthServices::Shutdown(); } + +static const mozilla::Module kModule = { + mozilla::Module::kVersion, kCIDs, kContracts, kCategories, nullptr, nullptr, + UnloadFakeSynthmodule}; + +NSMODULE_DEFN(fakesynth) = &kModule; diff --git a/dom/media/webspeech/synth/test/components.conf b/dom/media/webspeech/synth/test/components.conf deleted file mode 100644 index f37e4eafae77..000000000000 --- a/dom/media/webspeech/synth/test/components.conf +++ /dev/null @@ -1,17 +0,0 @@ -# -*- 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': '{e7d52d9e-c148-47d8-ab2a-95d7f40ea53d}', - 'contract_ids': ['@mozilla.org/fakesynth;1'], - 'singleton': True, - 'type': 'mozilla::dom::nsFakeSynthServices', - 'headers': ['/dom/media/webspeech/synth/test/nsFakeSynthServices.h'], - 'constructor': 'mozilla::dom::nsFakeSynthServices::GetInstanceForService', - 'categories': {'speech-synth-started': 'Fake Speech Synth'}, - }, -] diff --git a/dom/media/webspeech/synth/test/nsFakeSynthServices.cpp b/dom/media/webspeech/synth/test/nsFakeSynthServices.cpp index e1d6a2bb4028..2c7db5ec4ee0 100644 --- a/dom/media/webspeech/synth/test/nsFakeSynthServices.cpp +++ b/dom/media/webspeech/synth/test/nsFakeSynthServices.cpp @@ -10,7 +10,6 @@ #include "SharedBuffer.h" #include "nsISimpleEnumerator.h" -#include "mozilla/ClearOnShutdown.h" #include "mozilla/dom/nsSynthVoiceRegistry.h" #include "mozilla/dom/nsSpeechTask.h" @@ -274,7 +273,6 @@ nsFakeSynthServices* nsFakeSynthServices::GetInstance() { if (!sSingleton) { sSingleton = new nsFakeSynthServices(); - ClearOnShutdown(&sSingleton); } return sSingleton; @@ -286,5 +284,13 @@ nsFakeSynthServices::GetInstanceForService() { return picoService.forget(); } +void nsFakeSynthServices::Shutdown() { + if (!sSingleton) { + return; + } + + sSingleton = nullptr; +} + } // namespace dom } // namespace mozilla diff --git a/dom/media/webspeech/synth/test/nsFakeSynthServices.h b/dom/media/webspeech/synth/test/nsFakeSynthServices.h index 872ad0bb9fdb..9d059bc899f7 100644 --- a/dom/media/webspeech/synth/test/nsFakeSynthServices.h +++ b/dom/media/webspeech/synth/test/nsFakeSynthServices.h @@ -29,6 +29,8 @@ class nsFakeSynthServices : public nsIObserver { static already_AddRefed GetInstanceForService(); + static void Shutdown(); + private: virtual ~nsFakeSynthServices() = default; diff --git a/dom/notification/NotificationStorage.jsm b/dom/notification/NotificationStorage.js similarity index 93% rename from dom/notification/NotificationStorage.jsm rename to dom/notification/NotificationStorage.js index 8ab3e28df531..8d93e9ebe93c 100644 --- a/dom/notification/NotificationStorage.jsm +++ b/dom/notification/NotificationStorage.js @@ -7,6 +7,11 @@ const DEBUG = false; function debug(s) { dump("-*- NotificationStorage.js: " + s + "\n"); } +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); + +const NOTIFICATIONSTORAGE_CID = "{37f819b0-0b5c-11e3-8ffd-0800200c9a66}"; +const NOTIFICATIONSTORAGE_CONTRACTID = "@mozilla.org/notificationStorage;1"; + ChromeUtils.defineModuleGetter(this, "Services", "resource://gre/modules/Services.jsm"); @@ -186,8 +191,10 @@ NotificationStorage.prototype = { } }, + classID : Components.ID(NOTIFICATIONSTORAGE_CID), + contractID : NOTIFICATIONSTORAGE_CONTRACTID, QueryInterface: ChromeUtils.generateQI([Ci.nsINotificationStorage]), }; -var EXPORTED_SYMBOLS = ["NotificationStorage"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([NotificationStorage]); diff --git a/dom/notification/NotificationStorage.manifest b/dom/notification/NotificationStorage.manifest new file mode 100644 index 000000000000..34c5c51388de --- /dev/null +++ b/dom/notification/NotificationStorage.manifest @@ -0,0 +1,3 @@ +# NotificationStorage.js +component {37f819b0-0b5c-11e3-8ffd-0800200c9a66} NotificationStorage.js +contract @mozilla.org/notificationStorage;1 {37f819b0-0b5c-11e3-8ffd-0800200c9a66} diff --git a/dom/notification/components.conf b/dom/notification/components.conf deleted file mode 100644 index 1dd88b4fb102..000000000000 --- a/dom/notification/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{37f819b0-0b5c-11e3-8ffd-0800200c9a66}', - 'contract_ids': ['@mozilla.org/notificationStorage;1'], - 'jsm': 'resource://gre/modules/NotificationStorage.jsm', - 'constructor': 'NotificationStorage', - }, -] diff --git a/dom/notification/moz.build b/dom/notification/moz.build index 9cec7f14fe58..c3587316bb7b 100644 --- a/dom/notification/moz.build +++ b/dom/notification/moz.build @@ -7,13 +7,13 @@ with Files("**"): BUG_COMPONENT = ("Toolkit", "Notifications and Alerts") -EXTRA_JS_MODULES += [ - 'NotificationDB.jsm', - 'NotificationStorage.jsm', +EXTRA_COMPONENTS += [ + 'NotificationStorage.js', + 'NotificationStorage.manifest', ] -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_JS_MODULES += [ + 'NotificationDB.jsm' ] EXPORTS.mozilla.dom += [ diff --git a/dom/payments/PaymentRequestModule.cpp b/dom/payments/PaymentRequestModule.cpp new file mode 100644 index 000000000000..197e7ef75819 --- /dev/null +++ b/dom/payments/PaymentRequestModule.cpp @@ -0,0 +1,112 @@ +/* -*- 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 "PaymentActionResponse.h" +#include "PaymentRequestData.h" +#include "PaymentRequestService.h" + +using mozilla::dom::BasicCardMethodChangeDetails; +using mozilla::dom::BasicCardResponseData; +using mozilla::dom::GeneralMethodChangeDetails; +using mozilla::dom::GeneralResponseData; +using mozilla::dom::PaymentAbortActionResponse; +using mozilla::dom::PaymentCanMakeActionResponse; +using mozilla::dom::PaymentCompleteActionResponse; +using mozilla::dom::PaymentRequestService; +using mozilla::dom::PaymentShowActionResponse; +using mozilla::dom::payments::PaymentAddress; + +NS_GENERIC_FACTORY_CONSTRUCTOR(GeneralResponseData) +NS_GENERIC_FACTORY_CONSTRUCTOR(BasicCardResponseData) +NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentCanMakeActionResponse) +NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentAbortActionResponse) +NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentShowActionResponse) +NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentCompleteActionResponse) +NS_GENERIC_FACTORY_CONSTRUCTOR(GeneralMethodChangeDetails) +NS_GENERIC_FACTORY_CONSTRUCTOR(BasicCardMethodChangeDetails) +NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentAddress) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(PaymentRequestService, + PaymentRequestService::GetSingleton) + +NS_DEFINE_NAMED_CID(NS_GENERAL_RESPONSE_DATA_CID); +NS_DEFINE_NAMED_CID(NS_BASICCARD_RESPONSE_DATA_CID); +NS_DEFINE_NAMED_CID(NS_PAYMENT_CANMAKE_ACTION_RESPONSE_CID); +NS_DEFINE_NAMED_CID(NS_PAYMENT_ABORT_ACTION_RESPONSE_CID); +NS_DEFINE_NAMED_CID(NS_PAYMENT_SHOW_ACTION_RESPONSE_CID); +NS_DEFINE_NAMED_CID(NS_PAYMENT_COMPLETE_ACTION_RESPONSE_CID); +NS_DEFINE_NAMED_CID(NS_GENERAL_CHANGE_DETAILS_CID); +NS_DEFINE_NAMED_CID(NS_BASICCARD_CHANGE_DETAILS_CID); +NS_DEFINE_NAMED_CID(NS_PAYMENT_ADDRESS_CID); +NS_DEFINE_NAMED_CID(NS_PAYMENT_REQUEST_SERVICE_CID); + +static const mozilla::Module::CIDEntry kPaymentRequestCIDs[] = { + {&kNS_GENERAL_RESPONSE_DATA_CID, false, nullptr, + GeneralResponseDataConstructor}, + {&kNS_BASICCARD_RESPONSE_DATA_CID, false, nullptr, + BasicCardResponseDataConstructor}, + {&kNS_PAYMENT_CANMAKE_ACTION_RESPONSE_CID, false, nullptr, + PaymentCanMakeActionResponseConstructor}, + {&kNS_PAYMENT_ABORT_ACTION_RESPONSE_CID, false, nullptr, + PaymentAbortActionResponseConstructor}, + {&kNS_PAYMENT_SHOW_ACTION_RESPONSE_CID, false, nullptr, + PaymentShowActionResponseConstructor}, + {&kNS_PAYMENT_COMPLETE_ACTION_RESPONSE_CID, false, nullptr, + PaymentCompleteActionResponseConstructor}, + {&kNS_GENERAL_CHANGE_DETAILS_CID, false, nullptr, + GeneralMethodChangeDetailsConstructor}, + {&kNS_BASICCARD_CHANGE_DETAILS_CID, false, nullptr, + BasicCardMethodChangeDetailsConstructor}, + {&kNS_PAYMENT_ADDRESS_CID, false, nullptr, PaymentAddressConstructor}, + {&kNS_PAYMENT_REQUEST_SERVICE_CID, true, nullptr, + PaymentRequestServiceConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kPaymentRequestContracts[] = { + {NS_GENERAL_RESPONSE_DATA_CONTRACT_ID, &kNS_GENERAL_RESPONSE_DATA_CID}, + {NS_BASICCARD_RESPONSE_DATA_CONTRACT_ID, &kNS_BASICCARD_RESPONSE_DATA_CID}, + {NS_PAYMENT_CANMAKE_ACTION_RESPONSE_CONTRACT_ID, + &kNS_PAYMENT_CANMAKE_ACTION_RESPONSE_CID}, + {NS_PAYMENT_ABORT_ACTION_RESPONSE_CONTRACT_ID, + &kNS_PAYMENT_ABORT_ACTION_RESPONSE_CID}, + {NS_PAYMENT_SHOW_ACTION_RESPONSE_CONTRACT_ID, + &kNS_PAYMENT_SHOW_ACTION_RESPONSE_CID}, + {NS_PAYMENT_COMPLETE_ACTION_RESPONSE_CONTRACT_ID, + &kNS_PAYMENT_COMPLETE_ACTION_RESPONSE_CID}, + {NS_GENERAL_CHANGE_DETAILS_CONTRACT_ID, &kNS_GENERAL_CHANGE_DETAILS_CID}, + {NS_BASICCARD_CHANGE_DETAILS_CONTRACT_ID, + &kNS_BASICCARD_CHANGE_DETAILS_CID}, + {NS_PAYMENT_ADDRESS_CONTRACT_ID, &kNS_PAYMENT_ADDRESS_CID}, + {NS_PAYMENT_REQUEST_SERVICE_CONTRACT_ID, &kNS_PAYMENT_REQUEST_SERVICE_CID}, + {nullptr}}; + +static const mozilla::Module::CategoryEntry kPaymentRequestCategories[] = { + {"payment-request", "GeneralResponseData", + NS_GENERAL_RESPONSE_DATA_CONTRACT_ID}, + {"payment-request", "BasicCardResponseData", + NS_BASICCARD_RESPONSE_DATA_CONTRACT_ID}, + {"payment-request", "PaymentCanMakeActionResponse", + NS_PAYMENT_CANMAKE_ACTION_RESPONSE_CONTRACT_ID}, + {"payment-request", "PaymentAbortActionResponse", + NS_PAYMENT_ABORT_ACTION_RESPONSE_CONTRACT_ID}, + {"payment-request", "PaymentShowActionResponse", + NS_PAYMENT_SHOW_ACTION_RESPONSE_CONTRACT_ID}, + {"payment-request", "PaymentCompleteActionResponse", + NS_PAYMENT_COMPLETE_ACTION_RESPONSE_CONTRACT_ID}, + {"payment-request", "GeneralMethodChangeDetails", + NS_GENERAL_CHANGE_DETAILS_CONTRACT_ID}, + {"payment-request", "BasicCardMethodChangeDetails", + NS_BASICCARD_CHANGE_DETAILS_CONTRACT_ID}, + {"payment-request", "PaymentAddress", NS_PAYMENT_ADDRESS_CONTRACT_ID}, + {"payment-request", "PaymentRequestService", + NS_PAYMENT_REQUEST_SERVICE_CONTRACT_ID}, + {nullptr}}; + +static const mozilla::Module kPaymentRequestModule = { + mozilla::Module::kVersion, kPaymentRequestCIDs, kPaymentRequestContracts, + kPaymentRequestCategories}; + +NSMODULE_DEFN(PaymentRequestModule) = &kPaymentRequestModule; diff --git a/dom/payments/components.conf b/dom/payments/components.conf deleted file mode 100644 index ec88da3bee9d..000000000000 --- a/dom/payments/components.conf +++ /dev/null @@ -1,80 +0,0 @@ -# -*- 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': '{5296f79e-15ea-40c3-8196-19cfa64d328c}', - 'contract_ids': ['@mozilla.org/dom/payments/basiccard-change-details;1'], - 'type': 'mozilla::dom::BasicCardMethodChangeDetails', - 'headers': ['/dom/payments/PaymentActionResponse.h'], - 'categories': {'payment-request': 'BasicCardMethodChangeDetails'}, - }, - { - 'cid': '{0d55a5e6-d185-44f0-b992-a8e1321e4bce}', - 'contract_ids': ['@mozilla.org/dom/payments/basiccard-response-data;1'], - 'type': 'mozilla::dom::BasicCardResponseData', - 'headers': ['/dom/payments/PaymentActionResponse.h'], - 'categories': {'payment-request': 'BasicCardResponseData'}, - }, - { - 'cid': '{e031267e-bec8-4f3c-b0b1-396b77ca260c}', - 'contract_ids': ['@mozilla.org/dom/payments/general-change-details;1'], - 'type': 'mozilla::dom::GeneralMethodChangeDetails', - 'headers': ['/dom/payments/PaymentActionResponse.h'], - 'categories': {'payment-request': 'GeneralMethodChangeDetails'}, - }, - { - 'cid': '{b986773e-2b30-4ed2-b8fe-6a96631c8000}', - 'contract_ids': ['@mozilla.org/dom/payments/general-response-data;1'], - 'type': 'mozilla::dom::GeneralResponseData', - 'headers': ['/dom/payments/PaymentActionResponse.h'], - 'categories': {'payment-request': 'GeneralResponseData'}, - }, - { - 'cid': '{8c72bcdb-0c37-4786-a9e5-510afa2f8ede}', - 'contract_ids': ['@mozilla.org/dom/payments/payment-abort-action-response;1'], - 'type': 'mozilla::dom::PaymentAbortActionResponse', - 'headers': ['/dom/payments/PaymentActionResponse.h'], - 'categories': {'payment-request': 'PaymentAbortActionResponse'}, - }, - { - 'cid': '{49a02241-7e48-477a-9345-9f246925dcb3}', - 'contract_ids': ['@mozilla.org/dom/payments/payment-address;1'], - 'type': 'mozilla::dom::payments::PaymentAddress', - 'headers': ['PaymentRequestData.h'], - 'categories': {'payment-request': 'PaymentAddress'}, - }, - { - 'cid': '{52fc3f9f-c0cb-4874-b3d4-ee4b6e9cbe9c}', - 'contract_ids': ['@mozilla.org/dom/payments/payment-canmake-action-response;1'], - 'type': 'mozilla::dom::PaymentCanMakeActionResponse', - 'headers': ['/dom/payments/PaymentActionResponse.h'], - 'categories': {'payment-request': 'PaymentCanMakeActionResponse'}, - }, - { - 'cid': '{62c01e69-9ca4-4060-99e4-b95f628c8e6d}', - 'contract_ids': ['@mozilla.org/dom/payments/payment-complete-action-response;1'], - 'type': 'mozilla::dom::PaymentCompleteActionResponse', - 'headers': ['/dom/payments/PaymentActionResponse.h'], - 'categories': {'payment-request': 'PaymentCompleteActionResponse'}, - }, - { - 'cid': '{cccd665f-edf3-41fc-ab9b-fc55b37340aa}', - 'contract_ids': ['@mozilla.org/dom/payments/payment-request-service;1'], - 'singleton': True, - 'type': 'mozilla::dom::PaymentRequestService', - 'headers': ['PaymentRequestService.h'], - 'constructor': 'mozilla::dom::PaymentRequestService::GetSingleton', - 'categories': {'payment-request': 'PaymentRequestService'}, - }, - { - 'cid': '{184385cb-2d35-4b99-a9a3-7c780bf66b9b}', - 'contract_ids': ['@mozilla.org/dom/payments/payment-show-action-response;1'], - 'type': 'mozilla::dom::PaymentShowActionResponse', - 'headers': ['/dom/payments/PaymentActionResponse.h'], - 'categories': {'payment-request': 'PaymentShowActionResponse'}, - }, -] diff --git a/dom/payments/moz.build b/dom/payments/moz.build index 8cd2bf67f5b7..3801a7f14012 100644 --- a/dom/payments/moz.build +++ b/dom/payments/moz.build @@ -32,16 +32,13 @@ UNIFIED_SOURCES += [ 'PaymentRequest.cpp', 'PaymentRequestData.cpp', 'PaymentRequestManager.cpp', + 'PaymentRequestModule.cpp', 'PaymentRequestService.cpp', 'PaymentRequestUpdateEvent.cpp', 'PaymentRequestUtils.cpp', 'PaymentResponse.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' diff --git a/dom/plugins/base/components.conf b/dom/plugins/base/components.conf deleted file mode 100644 index 4b90c78f4416..000000000000 --- a/dom/plugins/base/components.conf +++ /dev/null @@ -1,16 +0,0 @@ -# -*- 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': '{23e8fd98-a625-4b08-be1a-f7cc18a5b106}', - 'contract_ids': ['@mozilla.org/plugin/host;1'], - 'singleton': True, - 'type': 'nsPluginHost', - 'headers': ['nsPluginHost.h'], - 'constructor': 'nsPluginHost::GetInst', - }, -] diff --git a/dom/plugins/base/moz.build b/dom/plugins/base/moz.build index b9a3e67b3009..57027479efee 100644 --- a/dom/plugins/base/moz.build +++ b/dom/plugins/base/moz.build @@ -38,6 +38,7 @@ UNIFIED_SOURCES += [ 'nsNPAPIPluginInstance.cpp', 'nsNPAPIPluginStreamListener.cpp', 'nsPluginInstanceOwner.cpp', + 'nsPluginModule.cpp', 'nsPluginStreamListenerPeer.cpp', 'nsPluginTags.cpp', ] @@ -66,10 +67,6 @@ else: 'nsPluginsDirUnix.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - LOCAL_INCLUDES += [ '/dom/base', '/dom/plugins/ipc', diff --git a/dom/plugins/base/nsPluginModule.cpp b/dom/plugins/base/nsPluginModule.cpp new file mode 100644 index 000000000000..4648a7567aae --- /dev/null +++ b/dom/plugins/base/nsPluginModule.cpp @@ -0,0 +1,22 @@ +/* -*- 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 "mozilla/ModuleUtils.h" +#include "nsPluginHost.h" +#include "nsPluginsCID.h" + +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsPluginHost, nsPluginHost::GetInst) +NS_DEFINE_NAMED_CID(NS_PLUGIN_HOST_CID); + +static const mozilla::Module::CIDEntry kPluginCIDs[] = { + {&kNS_PLUGIN_HOST_CID, false, nullptr, nsPluginHostConstructor}, {nullptr}}; + +static const mozilla::Module::ContractIDEntry kPluginContracts[] = { + {MOZ_PLUGIN_HOST_CONTRACTID, &kNS_PLUGIN_HOST_CID}, {nullptr}}; + +static const mozilla::Module kPluginModule = {mozilla::Module::kVersion, + kPluginCIDs, kPluginContracts}; + +NSMODULE_DEFN(nsPluginModule) = &kPluginModule; diff --git a/dom/presentation/PresentationDataChannelSessionTransport.jsm b/dom/presentation/PresentationDataChannelSessionTransport.js similarity index 97% rename from dom/presentation/PresentationDataChannelSessionTransport.jsm rename to dom/presentation/PresentationDataChannelSessionTransport.js index 577eb0bb5ac8..9eb603eb3af3 100644 --- a/dom/presentation/PresentationDataChannelSessionTransport.jsm +++ b/dom/presentation/PresentationDataChannelSessionTransport.js @@ -4,6 +4,7 @@ "use strict"; +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); // Bug 1228209 - plan to remove this eventually @@ -371,4 +372,5 @@ PresentationTransport.prototype = { }, }; -var EXPORTED_SYMBOLS = ["PresentationTransportBuilder", "PresentationTransport"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PresentationTransportBuilder, + PresentationTransport]); diff --git a/dom/presentation/PresentationDataChannelSessionTransport.manifest b/dom/presentation/PresentationDataChannelSessionTransport.manifest new file mode 100644 index 000000000000..6838f675faac --- /dev/null +++ b/dom/presentation/PresentationDataChannelSessionTransport.manifest @@ -0,0 +1,6 @@ +# PresentationDataChannelSessionTransport.js +component {dd2bbf2f-3399-4389-8f5f-d382afb8b2d6} PresentationDataChannelSessionTransport.js +contract @mozilla.org/presentation/datachanneltransport;1 {dd2bbf2f-3399-4389-8f5f-d382afb8b2d6} + +component {215b2f62-46e2-4004-a3d1-6858e56c20f3} PresentationDataChannelSessionTransport.js +contract @mozilla.org/presentation/datachanneltransportbuilder;1 {215b2f62-46e2-4004-a3d1-6858e56c20f3} diff --git a/dom/presentation/PresentationNetworkHelper.jsm b/dom/presentation/PresentationNetworkHelper.js similarity index 74% rename from dom/presentation/PresentationNetworkHelper.jsm rename to dom/presentation/PresentationNetworkHelper.js index 19785b36ee88..0bd6853d3340 100644 --- a/dom/presentation/PresentationNetworkHelper.jsm +++ b/dom/presentation/PresentationNetworkHelper.js @@ -6,10 +6,14 @@ "use strict"; const {EventDispatcher} = ChromeUtils.import("resource://gre/modules/Messaging.jsm"); +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); + +const NETWORKHELPER_CID = Components.ID("{5fb96caa-6d49-4f6b-9a4b-65dd0d51f92d}"); function PresentationNetworkHelper() {} PresentationNetworkHelper.prototype = { + classID: NETWORKHELPER_CID, QueryInterface: ChromeUtils.generateQI([Ci.nsIPresentationNetworkHelper]), getWifiIPAddress(aListener) { @@ -19,4 +23,4 @@ PresentationNetworkHelper.prototype = { }, }; -var EXPORTED_SYMBOLS = ["PresentationNetworkHelper"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PresentationNetworkHelper]); diff --git a/dom/presentation/PresentationNetworkHelper.manifest b/dom/presentation/PresentationNetworkHelper.manifest new file mode 100644 index 000000000000..a061cef08f32 --- /dev/null +++ b/dom/presentation/PresentationNetworkHelper.manifest @@ -0,0 +1,3 @@ +# PresentationNetworkHelper.js +component {5fb96caa-6d49-4f6b-9a4b-65dd0d51f92d} PresentationNetworkHelper.js +contract @mozilla.org/presentation-device/networkHelper;1 {5fb96caa-6d49-4f6b-9a4b-65dd0d51f92d} diff --git a/dom/presentation/components.conf b/dom/presentation/components.conf deleted file mode 100644 index a20b93c77328..000000000000 --- a/dom/presentation/components.conf +++ /dev/null @@ -1,30 +0,0 @@ -# -*- 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': '{dd2bbf2f-3399-4389-8f5f-d382afb8b2d6}', - 'contract_ids': ['@mozilla.org/presentation/datachanneltransport;1'], - 'jsm': 'resource://gre/modules/PresentationDataChannelSessionTransport.jsm', - 'constructor': 'PresentationTransport', - }, - { - 'cid': '{215b2f62-46e2-4004-a3d1-6858e56c20f3}', - 'contract_ids': ['@mozilla.org/presentation/datachanneltransportbuilder;1'], - 'jsm': 'resource://gre/modules/PresentationDataChannelSessionTransport.jsm', - 'constructor': 'PresentationTransportBuilder', - }, -] - -if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] == 'android': - Classes += [ - { - 'cid': '{5fb96caa-6d49-4f6b-9a4b-65dd0d51f92d}', - 'contract_ids': ['@mozilla.org/presentation-device/networkHelper;1'], - 'jsm': 'resource://gre/modules/PresentationNetworkHelper.jsm', - 'constructor': 'PresentationNetworkHelper', - }, - ] diff --git a/dom/presentation/moz.build b/dom/presentation/moz.build index b5c8dbd0b8bf..851a299b138a 100644 --- a/dom/presentation/moz.build +++ b/dom/presentation/moz.build @@ -60,17 +60,15 @@ UNIFIED_SOURCES += [ 'PresentationTransportBuilderConstructor.cpp' ] -EXTRA_JS_MODULES += [ - 'PresentationDataChannelSessionTransport.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'PresentationDataChannelSessionTransport.js', + 'PresentationDataChannelSessionTransport.manifest', ] if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': - EXTRA_JS_MODULES += [ - 'PresentationNetworkHelper.jsm', + EXTRA_COMPONENTS += [ + 'PresentationNetworkHelper.js', + 'PresentationNetworkHelper.manifest', ] IPDL_SOURCES += [ diff --git a/dom/presentation/provider/AndroidCastDeviceProvider.jsm b/dom/presentation/provider/AndroidCastDeviceProvider.js similarity index 98% rename from dom/presentation/provider/AndroidCastDeviceProvider.jsm rename to dom/presentation/provider/AndroidCastDeviceProvider.js index b56c7df8c116..85b302d40268 100644 --- a/dom/presentation/provider/AndroidCastDeviceProvider.jsm +++ b/dom/presentation/provider/AndroidCastDeviceProvider.js @@ -5,6 +5,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); const {EventDispatcher} = ChromeUtils.import("resource://gre/modules/Messaging.jsm"); @@ -459,4 +460,4 @@ AndroidCastDeviceProvider.prototype = { Ci.nsIPresentationDeviceProvider]), }; -var EXPORTED_SYMBOLS = ["AndroidCastDeviceProvider"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AndroidCastDeviceProvider]); diff --git a/dom/presentation/provider/AndroidCastDeviceProvider.manifest b/dom/presentation/provider/AndroidCastDeviceProvider.manifest new file mode 100644 index 000000000000..db2aa101b6e8 --- /dev/null +++ b/dom/presentation/provider/AndroidCastDeviceProvider.manifest @@ -0,0 +1,4 @@ +# AndroidCastDeviceProvider.js +component {7394f24c-dbc3-48c8-8a47-cd10169b7c6b} AndroidCastDeviceProvider.js +contract @mozilla.org/presentation-device/android-cast-device-provider;1 {7394f24c-dbc3-48c8-8a47-cd10169b7c6b} +category presentation-device-provider AndroidCastDeviceProvider @mozilla.org/presentation-device/android-cast-device-provider;1 diff --git a/dom/presentation/provider/BuiltinProviders.manifest b/dom/presentation/provider/BuiltinProviders.manifest new file mode 100644 index 000000000000..0ba7bcaa704f --- /dev/null +++ b/dom/presentation/provider/BuiltinProviders.manifest @@ -0,0 +1,2 @@ +component {f4079b8b-ede5-4b90-a112-5b415a931deb} PresentationControlService.js +contract @mozilla.org/presentation/control-service;1 {f4079b8b-ede5-4b90-a112-5b415a931deb} diff --git a/dom/presentation/provider/PresentationControlService.jsm b/dom/presentation/provider/PresentationControlService.js similarity index 99% rename from dom/presentation/provider/PresentationControlService.jsm rename to dom/presentation/provider/PresentationControlService.js index 8bff617d28ae..44f4c101d547 100644 --- a/dom/presentation/provider/PresentationControlService.jsm +++ b/dom/presentation/provider/PresentationControlService.js @@ -3,6 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); const {NetUtil} = ChromeUtils.import("resource://gre/modules/NetUtil.jsm"); const {clearTimeout, setTimeout} = ChromeUtils.import("resource://gre/modules/Timer.jsm"); @@ -946,4 +947,4 @@ TCPControlChannel.prototype = { Ci.nsIStreamListener]), }; -var EXPORTED_SYMBOLS = ["PresentationControlService"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PresentationControlService]); // jshint ignore:line diff --git a/dom/presentation/provider/PresentationDeviceProviderModule.cpp b/dom/presentation/provider/PresentationDeviceProviderModule.cpp new file mode 100644 index 000000000000..4afa3c08d3ec --- /dev/null +++ b/dom/presentation/provider/PresentationDeviceProviderModule.cpp @@ -0,0 +1,49 @@ +/* -*- 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 "MulticastDNSDeviceProvider.h" +#include "mozilla/ModuleUtils.h" + +#define MULTICAST_DNS_PROVIDER_CID \ + { \ + 0x814f947a, 0x52f7, 0x41c9, { \ + 0x94, 0xa1, 0x36, 0x84, 0x79, 0x72, 0x84, 0xac \ + } \ + } + +#define MULTICAST_DNS_PROVIDER_CONTRACT_ID \ + "@mozilla.org/presentation-device/multicastdns-provider;1" + +using mozilla::dom::presentation::MulticastDNSDeviceProvider; + +NS_GENERIC_FACTORY_CONSTRUCTOR(MulticastDNSDeviceProvider) +NS_DEFINE_NAMED_CID(MULTICAST_DNS_PROVIDER_CID); + +static const mozilla::Module::CIDEntry kPresentationDeviceProviderCIDs[] = { + {&kMULTICAST_DNS_PROVIDER_CID, false, nullptr, + MulticastDNSDeviceProviderConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry + kPresentationDeviceProviderContracts[] = { + {MULTICAST_DNS_PROVIDER_CONTRACT_ID, &kMULTICAST_DNS_PROVIDER_CID}, + {nullptr}}; + +static const mozilla::Module::CategoryEntry + kPresentationDeviceProviderCategories[] = { +#if defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_ANDROID) + {PRESENTATION_DEVICE_PROVIDER_CATEGORY, "MulticastDNSDeviceProvider", + MULTICAST_DNS_PROVIDER_CONTRACT_ID}, +#endif + {nullptr}}; + +static const mozilla::Module kPresentationDeviceProviderModule = { + mozilla::Module::kVersion, kPresentationDeviceProviderCIDs, + kPresentationDeviceProviderContracts, + kPresentationDeviceProviderCategories}; + +NSMODULE_DEFN(PresentationDeviceProviderModule) = + &kPresentationDeviceProviderModule; diff --git a/dom/presentation/provider/components.conf b/dom/presentation/provider/components.conf deleted file mode 100644 index 5fdb76829f76..000000000000 --- a/dom/presentation/provider/components.conf +++ /dev/null @@ -1,37 +0,0 @@ -# -*- 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/. - -categories = {} - -if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'android'): - categories["presentation-device-provider"] = "MulticastDNSDeviceProvider" - -Classes = [ - { - 'cid': '{814f947a-52f7-41c9-94a1-3684797284ac}', - 'contract_ids': ['@mozilla.org/presentation-device/multicastdns-provider;1'], - 'type': 'mozilla::dom::presentation::MulticastDNSDeviceProvider', - 'headers': ['/dom/presentation/provider/MulticastDNSDeviceProvider.h'], - 'categories': categories, - }, - { - 'cid': '{f4079b8b-ede5-4b90-a112-5b415a931deb}', - 'contract_ids': ['@mozilla.org/presentation/control-service;1'], - 'jsm': 'resource://gre/modules/PresentationControlService.jsm', - 'constructor': 'PresentationControlService', - }, -] - -if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] == 'android': - Classes += [ - { - 'cid': '{7394f24c-dbc3-48c8-8a47-cd10169b7c6b}', - 'contract_ids': ['@mozilla.org/presentation-device/android-cast-device-provider;1'], - 'jsm': 'resource://gre/modules/AndroidCastDeviceProvider.jsm', - 'constructor': 'AndroidCastDeviceProvider', - 'categories': {'presentation-device-provider': 'AndroidCastDeviceProvider'}, - }, - ] diff --git a/dom/presentation/provider/moz.build b/dom/presentation/provider/moz.build index cc152217ff4a..0a26a5b48c83 100644 --- a/dom/presentation/provider/moz.build +++ b/dom/presentation/provider/moz.build @@ -4,17 +4,15 @@ # 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/. -EXTRA_JS_MODULES += [ - 'PresentationControlService.jsm' +EXTRA_COMPONENTS += [ + 'BuiltinProviders.manifest', + 'PresentationControlService.js' ] UNIFIED_SOURCES += [ 'DeviceProviderHelpers.cpp', 'MulticastDNSDeviceProvider.cpp', -] - -XPCOM_MANIFESTS += [ - 'components.conf', + 'PresentationDeviceProviderModule.cpp', ] EXTRA_JS_MODULES.presentation += [ @@ -24,9 +22,10 @@ EXTRA_JS_MODULES.presentation += [ ] if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': - EXTRA_JS_MODULES += [ + EXTRA_COMPONENTS += [ # For android presentation device - 'AndroidCastDeviceProvider.jsm', + 'AndroidCastDeviceProvider.js', + 'AndroidCastDeviceProvider.manifest', ] include('/ipc/chromium/chromium-config.mozbuild') diff --git a/dom/presentation/tests/mochitest/PresentationSessionFrameScript.js b/dom/presentation/tests/mochitest/PresentationSessionFrameScript.js index d4148c3d3d88..482323cc6358 100644 --- a/dom/presentation/tests/mochitest/PresentationSessionFrameScript.js +++ b/dom/presentation/tests/mochitest/PresentationSessionFrameScript.js @@ -185,6 +185,9 @@ function loadPrivilegedScriptTest() { originalClassId = ""; originalFactory = null; } + if (originalFactory) { + registrar.unregisterFactory(originalClassId, originalFactory); + } registrar.registerFactory(mockedClassId, "", contractId, mockedFactory); } @@ -199,7 +202,7 @@ function loadPrivilegedScriptTest() { if (originalFactory) { var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); registrar.unregisterFactory(mockedClassId, mockedFactory); - registrar.registerFactory(originalClassId, "", contractId, null); + registrar.registerFactory(originalClassId, "", contractId, originalFactory); } } diff --git a/dom/presentation/tests/xpcshell/test_multicast_dns_device_provider.js b/dom/presentation/tests/xpcshell/test_multicast_dns_device_provider.js index beb8592e530b..2a9d08c27aa3 100644 --- a/dom/presentation/tests/xpcshell/test_multicast_dns_device_provider.js +++ b/dom/presentation/tests/xpcshell/test_multicast_dns_device_provider.js @@ -100,7 +100,7 @@ ContractHook.prototype = { this.unregister(); let prevContract = this.hookedMap.get(this._contractID).pop(); - if (prevContract.classID) { + if (prevContract.factory) { registrar.registerFactory(prevContract.classID, "", this._contractID, @@ -120,11 +120,7 @@ ContractHook.prototype = { } if (factory) { - try { - registrar.unregisterFactory(classID, factory); - } catch (e) { - factory = null; - } + registrar.unregisterFactory(classID, factory); } return { classID, factory }; diff --git a/dom/push/Push.jsm b/dom/push/Push.js similarity index 99% rename from dom/push/Push.jsm rename to dom/push/Push.js index e633175e13f1..f55a03a61301 100644 --- a/dom/push/Push.jsm +++ b/dom/push/Push.js @@ -285,4 +285,4 @@ PushSubscriptionCallback.prototype = { }, }; -var EXPORTED_SYMBOLS = ["Push"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([Push]); diff --git a/dom/push/Push.manifest b/dom/push/Push.manifest index bcd4a4adeee5..cdea13e5edc3 100644 --- a/dom/push/Push.manifest +++ b/dom/push/Push.manifest @@ -1,3 +1,10 @@ +# DOM API +component {cde1d019-fad8-4044-b141-65fb4fb7a245} Push.js +contract @mozilla.org/push/PushManager;1 {cde1d019-fad8-4044-b141-65fb4fb7a245} + +# XPCOM components. +component {daaa8d73-677e-4233-8acd-2c404bd01658} PushComponents.js +contract @mozilla.org/push/Service;1 {daaa8d73-677e-4233-8acd-2c404bd01658} category app-startup PushServiceParent @mozilla.org/push/Service;1 process=main # For immediate loading of PushService instead of delayed loading. diff --git a/dom/push/PushComponents.jsm b/dom/push/PushComponents.js similarity index 97% rename from dom/push/PushComponents.jsm rename to dom/push/PushComponents.js index 89d0910c31a3..1b711d6c85f8 100644 --- a/dom/push/PushComponents.jsm +++ b/dom/push/PushComponents.js @@ -113,13 +113,7 @@ PushServiceBase.prototype = { * `PushService.jsm` at startup and calls its methods directly. It also * receives and responds to requests from the content process. */ -let parentInstance; function PushServiceParent() { - if (parentInstance) { - return parentInstance; - } - parentInstance = this; - PushServiceBase.call(this); } @@ -129,6 +123,8 @@ XPCOMUtils.defineLazyServiceGetter(PushServiceParent.prototype, "_mm", "@mozilla.org/parentprocessmessagemanager;1", "nsISupports"); Object.assign(PushServiceParent.prototype, { + _xpcom_factory: XPCOMUtils.generateSingletonFactory(PushServiceParent), + _messages: [ "Push:Register", "Push:Registration", @@ -310,7 +306,6 @@ Object.defineProperty(PushServiceParent.prototype, "service", { }, }); -let contentInstance; /** * The content process implementation of `nsIPushService`. This version * uses the child message manager to forward calls to the parent process. @@ -318,11 +313,6 @@ let contentInstance; * message containing the result. */ function PushServiceContent() { - if (contentInstance) { - return contentInstance; - } - contentInstance = this; - PushServiceBase.apply(this, arguments); this._requests = new Map(); this._requestId = 0; @@ -335,6 +325,8 @@ XPCOMUtils.defineLazyServiceGetter(PushServiceContent.prototype, "nsISupports"); Object.assign(PushServiceContent.prototype, { + _xpcom_factory: XPCOMUtils.generateSingletonFactory(PushServiceContent), + _messages: [ "PushService:Register:OK", "PushService:Register:KO", @@ -556,8 +548,8 @@ PushSubscription.prototype = { }, }; -// Export the correct implementation depending on whether we're running in -// the parent or content process. -let Service = isParent ? PushServiceParent : PushServiceContent; - -var EXPORTED_SYMBOLS = ["Service"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ + // Export the correct implementation depending on whether we're running in + // the parent or content process. + isParent ? PushServiceParent : PushServiceContent, +]); diff --git a/dom/push/components.conf b/dom/push/components.conf deleted file mode 100644 index 20e25aa71090..000000000000 --- a/dom/push/components.conf +++ /dev/null @@ -1,20 +0,0 @@ -# -*- 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': '{cde1d019-fad8-4044-b141-65fb4fb7a245}', - 'contract_ids': ['@mozilla.org/push/PushManager;1'], - 'jsm': 'resource://gre/modules/Push.jsm', - 'constructor': 'Push', - }, - { - 'cid': '{daaa8d73-677e-4233-8acd-2c404bd01658}', - 'contract_ids': ['@mozilla.org/push/Service;1'], - 'jsm': 'resource://gre/modules/PushComponents.jsm', - 'constructor': 'Service', - }, -] diff --git a/dom/push/moz.build b/dom/push/moz.build index 01e57286d5e6..1f83687f6585 100644 --- a/dom/push/moz.build +++ b/dom/push/moz.build @@ -7,13 +7,13 @@ with Files("**"): BUG_COMPONENT = ("Core", "DOM: Push Notifications") EXTRA_COMPONENTS += [ + 'Push.js', 'Push.manifest', + 'PushComponents.js', ] EXTRA_JS_MODULES += [ - 'Push.jsm', 'PushBroadcastService.jsm', - 'PushComponents.jsm', 'PushCrypto.jsm', 'PushDB.jsm', 'PushRecord.jsm', @@ -32,10 +32,6 @@ else: 'PushServiceAndroidGCM.jsm', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - MOCHITEST_MANIFESTS += [ 'test/mochitest.ini', ] diff --git a/dom/system/NetworkGeolocationProvider.jsm b/dom/system/NetworkGeolocationProvider.js similarity index 99% rename from dom/system/NetworkGeolocationProvider.jsm rename to dom/system/NetworkGeolocationProvider.js index 9f55213e701a..21a4479eb34f 100644 --- a/dom/system/NetworkGeolocationProvider.jsm +++ b/dom/system/NetworkGeolocationProvider.js @@ -418,4 +418,4 @@ WifiGeoPositionProvider.prototype = { }, }; -var EXPORTED_SYMBOLS = ["WifiGeoPositionProvider"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([WifiGeoPositionProvider]); diff --git a/dom/system/NetworkGeolocationProvider.manifest b/dom/system/NetworkGeolocationProvider.manifest new file mode 100644 index 000000000000..3ba4ba06ee9a --- /dev/null +++ b/dom/system/NetworkGeolocationProvider.manifest @@ -0,0 +1,3 @@ +component {77DA64D3-7458-4920-9491-86CC9914F904} NetworkGeolocationProvider.js +contract @mozilla.org/geolocation/provider;1 {77DA64D3-7458-4920-9491-86CC9914F904} +contract @mozilla.org/geolocation/mls-provider;1 {77DA64D3-7458-4920-9491-86CC9914F904} diff --git a/dom/system/components.conf b/dom/system/components.conf deleted file mode 100644 index f140297186ba..000000000000 --- a/dom/system/components.conf +++ /dev/null @@ -1,17 +0,0 @@ -# -*- 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': '{77DA64D3-7458-4920-9491-86CC9914F904}', - 'contract_ids': [ - '@mozilla.org/geolocation/provider;1', - '@mozilla.org/geolocation/mls-provider;1', - ], - 'jsm': 'resource://gre/modules/NetworkGeolocationProvider.jsm', - 'constructor': 'WifiGeoPositionProvider', - }, -] diff --git a/dom/system/moz.build b/dom/system/moz.build index 79437886a616..fa5110a0b674 100644 --- a/dom/system/moz.build +++ b/dom/system/moz.build @@ -79,12 +79,9 @@ UNIFIED_SOURCES += [ 'OSFileConstants.cpp', ] -EXTRA_JS_MODULES += [ - 'NetworkGeolocationProvider.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'NetworkGeolocationProvider.js', + 'NetworkGeolocationProvider.manifest', ] include('/ipc/chromium/chromium-config.mozbuild') diff --git a/extensions/cookie/components.conf b/extensions/cookie/components.conf deleted file mode 100644 index 1e0075b1e52e..000000000000 --- a/extensions/cookie/components.conf +++ /dev/null @@ -1,22 +0,0 @@ -# -*- 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 = [ - '/extensions/cookie/nsCookieModule.h', -] - -UnloadFunc = 'mozilla::CookieModuleDtor' - -Classes = [ - { - 'cid': '{4f6b5e00-0c36-11d5-a535-0010a401eb10}', - 'contract_ids': ['@mozilla.org/permissionmanager;1'], - 'singleton': True, - 'type': 'nsIPermissionManager', - 'constructor': 'nsPermissionManager::GetXPCOMSingleton', - 'headers': ['/extensions/cookie/nsPermissionManager.h'], - }, -] diff --git a/extensions/cookie/moz.build b/extensions/cookie/moz.build index 079150c156fd..51f906e00777 100644 --- a/extensions/cookie/moz.build +++ b/extensions/cookie/moz.build @@ -17,10 +17,6 @@ UNIFIED_SOURCES += [ 'nsPermissionManager.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - LOCAL_INCLUDES += [ '/caps', ] diff --git a/extensions/cookie/nsCookieModule.cpp b/extensions/cookie/nsCookieModule.cpp index 63c2db62bdeb..310b2e5b8eff 100644 --- a/extensions/cookie/nsCookieModule.cpp +++ b/extensions/cookie/nsCookieModule.cpp @@ -3,10 +3,35 @@ * 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 "nsPermissionManager.h" +#include "nsICategoryManager.h" #include "nsCookiePermission.h" +#include "nsString.h" -namespace mozilla { +// Define the constructor function for the objects +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPermissionManager, + nsPermissionManager::GetXPCOMSingleton) -void CookieModuleDtor() { nsCookiePermission::Shutdown(); } +NS_DEFINE_NAMED_CID(NS_PERMISSIONMANAGER_CID); -} // namespace mozilla +static const mozilla::Module::CIDEntry kCookieCIDs[] = { + {&kNS_PERMISSIONMANAGER_CID, false, nullptr, + nsIPermissionManagerConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kCookieContracts[] = { + {NS_PERMISSIONMANAGER_CONTRACTID, &kNS_PERMISSIONMANAGER_CID}, {nullptr}}; + +static void CookieModuleDtor() { nsCookiePermission::Shutdown(); } + +static const mozilla::Module kCookieModule = {mozilla::Module::kVersion, + kCookieCIDs, + kCookieContracts, + nullptr, + nullptr, + nullptr, + CookieModuleDtor}; + +NSMODULE_DEFN(nsCookieModule) = &kCookieModule; diff --git a/extensions/cookie/nsCookieModule.h b/extensions/cookie/nsCookieModule.h deleted file mode 100644 index a654a1c85707..000000000000 --- a/extensions/cookie/nsCookieModule.h +++ /dev/null @@ -1,19 +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/. */ - -#ifndef nsCookieModule_h -#define nsCookieModule_h - -#include "nscore.h" - -namespace mozilla { - -void CookieModuleDtor(); - -} // namespace mozilla - -#endif - diff --git a/extensions/cookie/test/unit/test_permmanager_migrate_4-7_no_history.js b/extensions/cookie/test/unit/test_permmanager_migrate_4-7_no_history.js index f4e2788f6504..6adea7d0ec92 100644 --- a/extensions/cookie/test/unit/test_permmanager_migrate_4-7_no_history.js +++ b/extensions/cookie/test/unit/test_permmanager_migrate_4-7_no_history.js @@ -23,11 +23,12 @@ var newClassID = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenera var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); var oldClassID = registrar.contractIDToCID(CONTRACT_ID); var oldFactory = Components.manager.getClassObject(Cc[CONTRACT_ID], Ci.nsIFactory); +registrar.unregisterFactory(oldClassID, oldFactory); registrar.registerFactory(newClassID, "", CONTRACT_ID, factory); function cleanupFactory() { registrar.unregisterFactory(newClassID, factory); - registrar.registerFactory(oldClassID, "", CONTRACT_ID, null); + registrar.registerFactory(oldClassID, "", CONTRACT_ID, oldFactory); } function GetPermissionsFile(profile) diff --git a/extensions/permissions/components.conf b/extensions/permissions/components.conf deleted file mode 100644 index ed04a893b32b..000000000000 --- a/extensions/permissions/components.conf +++ /dev/null @@ -1,16 +0,0 @@ -# -*- 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': '{4ca6b67b-5cc7-4e71-a98a-97af1c134862}', - 'contract_ids': ['@mozilla.org/permissions/contentblocker;1'], - 'type': 'nsContentBlocker', - 'headers': ['/extensions/permissions/nsContentBlocker.h'], - 'init_method': 'Init', - 'categories': {'content-policy': '@mozilla.org/permissions/contentblocker;1'}, - }, -] diff --git a/extensions/permissions/moz.build b/extensions/permissions/moz.build index 6860583da840..14bc17b5c748 100644 --- a/extensions/permissions/moz.build +++ b/extensions/permissions/moz.build @@ -6,10 +6,7 @@ UNIFIED_SOURCES += [ 'nsContentBlocker.cpp', -] - -XPCOM_MANIFESTS += [ - 'components.conf', + 'nsModuleFactory.cpp', ] FINAL_LIBRARY = 'xul' diff --git a/extensions/permissions/nsModuleFactory.cpp b/extensions/permissions/nsModuleFactory.cpp new file mode 100644 index 000000000000..3ed08e918a4d --- /dev/null +++ b/extensions/permissions/nsModuleFactory.cpp @@ -0,0 +1,31 @@ +/* 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 "nsContentBlocker.h" +#include "nsString.h" + +// Define the constructor function for the objects +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsContentBlocker, Init) + +NS_DEFINE_NAMED_CID(NS_CONTENTBLOCKER_CID); + +static const mozilla::Module::CIDEntry kPermissionsCIDs[] = { + {&kNS_CONTENTBLOCKER_CID, false, nullptr, nsContentBlockerConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kPermissionsContracts[] = { + {NS_CONTENTBLOCKER_CONTRACTID, &kNS_CONTENTBLOCKER_CID}, {nullptr}}; + +static const mozilla::Module::CategoryEntry kPermissionsCategories[] = { + {"content-policy", NS_CONTENTBLOCKER_CONTRACTID, + NS_CONTENTBLOCKER_CONTRACTID}, + {nullptr}}; + +static const mozilla::Module kPermissionsModule = { + mozilla::Module::kVersion, kPermissionsCIDs, kPermissionsContracts, + kPermissionsCategories}; + +NSMODULE_DEFN(nsPermissionsModule) = &kPermissionsModule; diff --git a/extensions/pref/autoconfig/src/components.conf b/extensions/pref/autoconfig/src/components.conf deleted file mode 100644 index 789a44b2e39b..000000000000 --- a/extensions/pref/autoconfig/src/components.conf +++ /dev/null @@ -1,16 +0,0 @@ -# -*- 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': '{ba5bc4c6-1dd1-11b2-bb89-b844c6ec0339}', - 'contract_ids': ['@mozilla.org/readconfig;1'], - 'type': 'nsReadConfig', - 'headers': ['/extensions/pref/autoconfig/src/nsReadConfig.h'], - 'init_method': 'Init', - 'categories': {'pref-config-startup': 'ReadConfig Module'}, - }, -] diff --git a/extensions/pref/autoconfig/src/moz.build b/extensions/pref/autoconfig/src/moz.build index cb697f0c6615..3417269f0793 100644 --- a/extensions/pref/autoconfig/src/moz.build +++ b/extensions/pref/autoconfig/src/moz.build @@ -6,14 +6,11 @@ UNIFIED_SOURCES += [ 'nsAutoConfig.cpp', + 'nsConfigFactory.cpp', 'nsJSConfigTriggers.cpp', 'nsReadConfig.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - FINAL_LIBRARY = 'xul' FINAL_TARGET_FILES.defaults.autoconfig += [ diff --git a/extensions/pref/autoconfig/src/nsConfigFactory.cpp b/extensions/pref/autoconfig/src/nsConfigFactory.cpp new file mode 100644 index 000000000000..3ad82ecbc7ac --- /dev/null +++ b/extensions/pref/autoconfig/src/nsConfigFactory.cpp @@ -0,0 +1,37 @@ +/* -*- 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 "mozilla/ModuleUtils.h" +#include "nsReadConfig.h" +#include "nsIAppStartupNotifier.h" + +#define NS_READCONFIG_CID \ + { \ + 0xba5bc4c6, 0x1dd1, 0x11b2, { \ + 0xbb, 0x89, 0xb8, 0x44, 0xc6, 0xec, 0x03, 0x39 \ + } \ + } + +#define NS_READCONFIG_CONTRACTID "@mozilla.org/readconfig;1" + +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsReadConfig, Init) + +NS_DEFINE_NAMED_CID(NS_READCONFIG_CID); + +static const mozilla::Module::CIDEntry kAutoConfigCIDs[] = { + {&kNS_READCONFIG_CID, false, nullptr, nsReadConfigConstructor}, {nullptr}}; + +static const mozilla::Module::ContractIDEntry kAutoConfigContracts[] = { + {NS_READCONFIG_CONTRACTID, &kNS_READCONFIG_CID}, {nullptr}}; + +static const mozilla::Module::CategoryEntry kAutoConfigCategories[] = { + {"pref-config-startup", "ReadConfig Module", NS_READCONFIG_CONTRACTID}, + {nullptr}}; + +static const mozilla::Module kAutoConfigModule = { + mozilla::Module::kVersion, kAutoConfigCIDs, kAutoConfigContracts, + kAutoConfigCategories}; + +NSMODULE_DEFN(nsAutoConfigModule) = &kAutoConfigModule; diff --git a/extensions/spellcheck/hunspell/glue/mozHunspell.cpp b/extensions/spellcheck/hunspell/glue/mozHunspell.cpp index 9f60f2269d78..e2d985c247ab 100644 --- a/extensions/spellcheck/hunspell/glue/mozHunspell.cpp +++ b/extensions/spellcheck/hunspell/glue/mozHunspell.cpp @@ -72,7 +72,6 @@ #include "nsIPrefBranch.h" #include "nsNetUtil.h" #include "mozilla/dom/ContentParent.h" -#include "mozilla/Components.h" using mozilla::dom::ContentParent; using namespace mozilla; @@ -91,14 +90,6 @@ NS_INTERFACE_MAP_END NS_IMPL_CYCLE_COLLECTION(mozHunspell, mPersonalDictionary) -NS_IMPL_COMPONENT_FACTORY(mozHunspell) { - auto hunspell = MakeRefPtr(); - if (NS_SUCCEEDED(hunspell->Init())) { - return hunspell.forget().downcast(); - } - return nullptr; -} - template <> mozilla::CountingAllocatorBase::AmountType mozilla::CountingAllocatorBase::sAmount(0); diff --git a/extensions/spellcheck/src/components.conf b/extensions/spellcheck/src/components.conf deleted file mode 100644 index 7fc73c1a1714..000000000000 --- a/extensions/spellcheck/src/components.conf +++ /dev/null @@ -1,20 +0,0 @@ -# -*- 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': '{56c778e4-1bee-45f3-a689-886692a97fe7}', - 'contract_ids': ['@mozilla.org/spellchecker/engine;1'], - 'type': 'mozHunspell', - }, - { - 'cid': '{7ef52eaf-b7e1-462b-87e2-5d1dbaca9048}', - 'contract_ids': ['@mozilla.org/spellchecker/personaldictionary;1'], - 'type': 'mozPersonalDictionary', - 'headers': ['/extensions/spellcheck/src/mozPersonalDictionary.h'], - 'init_method': 'Init', - }, -] diff --git a/extensions/spellcheck/src/moz.build b/extensions/spellcheck/src/moz.build index 1fa03d1c566b..3eabf96c4a5f 100644 --- a/extensions/spellcheck/src/moz.build +++ b/extensions/spellcheck/src/moz.build @@ -11,10 +11,7 @@ UNIFIED_SOURCES += [ 'mozInlineSpellWordUtil.cpp', 'mozPersonalDictionary.cpp', 'mozSpellChecker.cpp', -] - -XPCOM_MANIFESTS += [ - 'components.conf', + 'mozSpellCheckerFactory.cpp', ] FINAL_LIBRARY = 'xul' diff --git a/extensions/spellcheck/src/mozSpellCheckerFactory.cpp b/extensions/spellcheck/src/mozSpellCheckerFactory.cpp new file mode 100644 index 000000000000..4b7dff4266c6 --- /dev/null +++ b/extensions/spellcheck/src/mozSpellCheckerFactory.cpp @@ -0,0 +1,31 @@ +/* -*- 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 "mozHunspell.h" +#include "mozPersonalDictionary.h" +#include "nsIFile.h" + +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(mozHunspell, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(mozPersonalDictionary, Init) + +NS_DEFINE_NAMED_CID(MOZ_HUNSPELL_CID); +NS_DEFINE_NAMED_CID(MOZ_PERSONALDICTIONARY_CID); + +static const mozilla::Module::CIDEntry kSpellcheckCIDs[] = { + {&kMOZ_HUNSPELL_CID, false, nullptr, mozHunspellConstructor}, + {&kMOZ_PERSONALDICTIONARY_CID, false, nullptr, + mozPersonalDictionaryConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kSpellcheckContracts[] = { + {MOZ_HUNSPELL_CONTRACTID, &kMOZ_HUNSPELL_CID}, + {MOZ_PERSONALDICTIONARY_CONTRACTID, &kMOZ_PERSONALDICTIONARY_CID}, + {nullptr}}; + +const mozilla::Module kSpellcheckModule = { + mozilla::Module::kVersion, kSpellcheckCIDs, kSpellcheckContracts, nullptr}; + +NSMODULE_DEFN(mozSpellCheckerModule) = &kSpellcheckModule; diff --git a/gfx/src/components.conf b/gfx/src/components.conf deleted file mode 100644 index d1c5d69351b1..000000000000 --- a/gfx/src/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{a6cf9115-15b3-11d2-932e-00805f8add32}', - 'contract_ids': ['@mozilla.org/gfx/fontenumerator;1'], - 'type': 'nsThebesFontEnumerator', - 'headers': ['/gfx/src/nsThebesFontEnumerator.h'], - }, -] diff --git a/gfx/src/moz.build b/gfx/src/moz.build index 75aea035e3c3..8c0e6b9a089a 100644 --- a/gfx/src/moz.build +++ b/gfx/src/moz.build @@ -68,6 +68,7 @@ UNIFIED_SOURCES += [ 'nsRect.cpp', 'nsRegion.cpp', 'nsThebesFontEnumerator.cpp', + 'nsThebesGfxFactory.cpp', 'nsTransform2D.cpp', 'TiledRegion.cpp', ] @@ -77,10 +78,6 @@ SOURCES += [ 'nsDeviceContext.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - include('/ipc/chromium/chromium-config.mozbuild') LOCAL_INCLUDES += [ diff --git a/gfx/src/nsThebesGfxFactory.cpp b/gfx/src/nsThebesGfxFactory.cpp new file mode 100644 index 000000000000..301876541d7d --- /dev/null +++ b/gfx/src/nsThebesGfxFactory.cpp @@ -0,0 +1,40 @@ +/* -*- 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 "gfxPlatform.h" // for gfxPlatform +#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2 +#include "mozilla/Attributes.h" // for final +#include "mozilla/Module.h" // for Module, Module::CIDEntry, etc +#include "mozilla/ModuleUtils.h" +#include "mozilla/mozalloc.h" // for operator new +#include "nsCOMPtr.h" // for nsCOMPtr +#include "nsError.h" // for NS_ERROR_NO_AGGREGATION, etc +#include "nsGfxCIID.h" // for NS_FONT_ENUMERATOR_CID, etc +#include "nsID.h" // for NS_DEFINE_NAMED_CID, etc +#include "nsISupports.h" // for NS_DECL_ISUPPORTS, etc +#include "nsThebesFontEnumerator.h" // for nsThebesFontEnumerator + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsThebesFontEnumerator) + +NS_DEFINE_NAMED_CID(NS_FONT_ENUMERATOR_CID); + +static const mozilla::Module::CIDEntry kThebesCIDs[] = { + {&kNS_FONT_ENUMERATOR_CID, false, nullptr, + nsThebesFontEnumeratorConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kThebesContracts[] = { + {"@mozilla.org/gfx/fontenumerator;1", &kNS_FONT_ENUMERATOR_CID}, {nullptr}}; + +static const mozilla::Module kThebesModule = {mozilla::Module::kVersion, + kThebesCIDs, + kThebesContracts, + nullptr, + nullptr, + nullptr, + nullptr}; + +NSMODULE_DEFN(nsGfxModule) = &kThebesModule; diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 47870bdb5065..be4e9598a712 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -1548,10 +1548,6 @@ void gfxPlatform::PopulateScreenInfo() { nsCOMPtr manager = do_GetService("@mozilla.org/gfx/screenmanager;1"); MOZ_ASSERT(manager, "failed to get nsIScreenManager"); - if (!manager) { - // This can happen in xpcshell, for instance - return; - } nsCOMPtr screen; manager->GetPrimaryScreen(getter_AddRefs(screen)); diff --git a/image/build/components.conf b/image/build/components.conf deleted file mode 100644 index 929f8bbe0107..000000000000 --- a/image/build/components.conf +++ /dev/null @@ -1,66 +0,0 @@ -# -*- 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 = [ - '/image/build/nsImageModule.h', -] - -InitFunc = 'mozilla::image::EnsureModuleInitialized' -# This is called by LayoutModuleDtor to ensure it happens at the right time -# during shutdown. -# UnloadFunc = 'mozilla::image::ShutdownModule' - -Classes = [ - # XXX We would like to get rid of the imgLoader factory constructor. See the - # comment documenting the imgLoader constructor. - { - 'cid': '{c1354898-e3fe-4602-88a7-c4520c21cb4e}', - 'contract_ids': [ - '@mozilla.org/image/cache;1', - '@mozilla.org/image/loader;1', - ], - 'type': 'imgLoader', - 'headers': ['imgLoader.h'], - 'init_method': 'Init', - 'categories': {'content-sniffing-services': '@mozilla.org/image/loader;1'}, - }, - { - 'cid': '{20557898-1dd2-11b2-8f65-9c462ee2bc95}', - 'contract_ids': ['@mozilla.org/image/request;1'], - 'type': 'imgRequestProxy', - 'headers': ['imgRequestProxy.h'], - }, - { - 'cid': '{3d8fa16d-c9e1-4b50-bdef-2c7ae249967a}', - 'contract_ids': ['@mozilla.org/image/tools;1'], - 'type': 'mozilla::image::imgTools', - 'headers': ['/image/imgTools.h'], - }, - { - 'cid': '{13a5320c-4c91-4fa4-bd16-b081a3ba8c0b}', - 'contract_ids': ['@mozilla.org/image/encoder;2?type=image/bmp'], - 'type': 'nsBMPEncoder', - 'headers': ['/image/encoders/bmp/nsBMPEncoder.h'], - }, - { - 'cid': '{92ae3ab2-8968-41b1-8709-b6123bceaf21}', - 'contract_ids': ['@mozilla.org/image/encoder;2?type=image/vnd.microsoft.icon'], - 'type': 'nsICOEncoder', - 'headers': ['/image/encoders/ico/nsICOEncoder.h'], - }, - { - 'cid': '{ac2bb8fe-eeeb-4572-b40f-be03932b56e0}', - 'contract_ids': ['@mozilla.org/image/encoder;2?type=image/jpeg'], - 'type': 'nsJPEGEncoder', - 'headers': ['/image/encoders/jpeg/nsJPEGEncoder.h'], - }, - { - 'cid': '{38d1592e-b81e-432b-86f8-471878bbfe07}', - 'contract_ids': ['@mozilla.org/image/encoder;2?type=image/png'], - 'type': 'nsPNGEncoder', - 'headers': ['/image/encoders/png/nsPNGEncoder.h'], - }, -] diff --git a/image/build/moz.build b/image/build/moz.build index c1ea68486c0b..78db731c751c 100644 --- a/image/build/moz.build +++ b/image/build/moz.build @@ -12,10 +12,6 @@ SOURCES += [ 'nsImageModule.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - FINAL_LIBRARY = 'xul' LOCAL_INCLUDES += [ '/image', diff --git a/image/build/nsImageModule.cpp b/image/build/nsImageModule.cpp index a7e0fefabd7a..9e03e51ad571 100644 --- a/image/build/nsImageModule.cpp +++ b/image/build/nsImageModule.cpp @@ -7,17 +7,132 @@ #include "nsImageModule.h" #include "mozilla/ModuleUtils.h" +#include "nsMimeTypes.h" #include "DecodePool.h" #include "ImageFactory.h" #include "ShutdownTracker.h" #include "SurfaceCache.h" +#include "SurfacePipe.h" #include "gfxPrefs.h" #include "imgLoader.h" +#include "imgRequest.h" +#include "imgRequestProxy.h" +#include "imgTools.h" +#include "nsICOEncoder.h" +#include "nsPNGEncoder.h" +#include "nsJPEGEncoder.h" +#include "nsBMPEncoder.h" + +// objects that just require generic constructors using namespace mozilla::image; +// XXX We would like to get rid of the imgLoader factory constructor. See the +// comment documenting the imgLoader constructor. +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(imgLoader, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(imgRequestProxy) +NS_GENERIC_FACTORY_CONSTRUCTOR(imgTools) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsICOEncoder) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsJPEGEncoder) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsPNGEncoder) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsBMPEncoder) +NS_DEFINE_NAMED_CID(NS_IMGLOADER_CID); +NS_DEFINE_NAMED_CID(NS_IMGREQUESTPROXY_CID); +NS_DEFINE_NAMED_CID(NS_IMGTOOLS_CID); +NS_DEFINE_NAMED_CID(NS_ICOENCODER_CID); +NS_DEFINE_NAMED_CID(NS_JPEGENCODER_CID); +NS_DEFINE_NAMED_CID(NS_PNGENCODER_CID); +NS_DEFINE_NAMED_CID(NS_BMPENCODER_CID); + +static const mozilla::Module::CIDEntry kImageCIDs[] = { + { + &kNS_IMGLOADER_CID, + false, + nullptr, + imgLoaderConstructor, + }, + { + &kNS_IMGREQUESTPROXY_CID, + false, + nullptr, + imgRequestProxyConstructor, + }, + { + &kNS_IMGTOOLS_CID, + false, + nullptr, + imgToolsConstructor, + }, + { + &kNS_ICOENCODER_CID, + false, + nullptr, + nsICOEncoderConstructor, + }, + { + &kNS_JPEGENCODER_CID, + false, + nullptr, + nsJPEGEncoderConstructor, + }, + { + &kNS_PNGENCODER_CID, + false, + nullptr, + nsPNGEncoderConstructor, + }, + { + &kNS_BMPENCODER_CID, + false, + nullptr, + nsBMPEncoderConstructor, + }, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kImageContracts[] = { + {"@mozilla.org/image/cache;1", &kNS_IMGLOADER_CID}, + {"@mozilla.org/image/loader;1", &kNS_IMGLOADER_CID}, + {"@mozilla.org/image/request;1", &kNS_IMGREQUESTPROXY_CID}, + {"@mozilla.org/image/tools;1", &kNS_IMGTOOLS_CID}, + {"@mozilla.org/image/encoder;2?type=" IMAGE_ICO_MS, &kNS_ICOENCODER_CID}, + {"@mozilla.org/image/encoder;2?type=" IMAGE_JPEG, &kNS_JPEGENCODER_CID}, + {"@mozilla.org/image/encoder;2?type=" IMAGE_PNG, &kNS_PNGENCODER_CID}, + {"@mozilla.org/image/encoder;2?type=" IMAGE_BMP, &kNS_BMPENCODER_CID}, + {nullptr}}; + +static const mozilla::Module::CategoryEntry kImageCategories[] = { + {"Gecko-Content-Viewers", IMAGE_GIF, + "@mozilla.org/content/document-loader-factory;1"}, + {"Gecko-Content-Viewers", IMAGE_JPEG, + "@mozilla.org/content/document-loader-factory;1"}, + {"Gecko-Content-Viewers", IMAGE_PJPEG, + "@mozilla.org/content/document-loader-factory;1"}, + {"Gecko-Content-Viewers", IMAGE_JPG, + "@mozilla.org/content/document-loader-factory;1"}, + {"Gecko-Content-Viewers", IMAGE_ICO, + "@mozilla.org/content/document-loader-factory;1"}, + {"Gecko-Content-Viewers", IMAGE_ICO_MS, + "@mozilla.org/content/document-loader-factory;1"}, + {"Gecko-Content-Viewers", IMAGE_BMP, + "@mozilla.org/content/document-loader-factory;1"}, + {"Gecko-Content-Viewers", IMAGE_BMP_MS, + "@mozilla.org/content/document-loader-factory;1"}, + {"Gecko-Content-Viewers", IMAGE_ICON_MS, + "@mozilla.org/content/document-loader-factory;1"}, + {"Gecko-Content-Viewers", IMAGE_PNG, + "@mozilla.org/content/document-loader-factory;1"}, + {"Gecko-Content-Viewers", IMAGE_APNG, + "@mozilla.org/content/document-loader-factory;1"}, + {"Gecko-Content-Viewers", IMAGE_X_PNG, + "@mozilla.org/content/document-loader-factory;1"}, + {"Gecko-Content-Viewers", IMAGE_WEBP, + "@mozilla.org/content/document-loader-factory;1"}, + {"content-sniffing-services", "@mozilla.org/image/loader;1", + "@mozilla.org/image/loader;1"}, + {nullptr}}; + static bool sInitialized = false; nsresult mozilla::image::EnsureModuleInitialized() { MOZ_ASSERT(NS_IsMainThread()); @@ -46,3 +161,14 @@ void mozilla::image::ShutdownModule() { mozilla::image::SurfaceCache::Shutdown(); sInitialized = false; } + +static const mozilla::Module kImageModule = { + mozilla::Module::kVersion, kImageCIDs, kImageContracts, kImageCategories, + nullptr, mozilla::image::EnsureModuleInitialized, + // We need to be careful about shutdown ordering to avoid intermittent + // crashes when hashtable enumeration decides to destroy modules in an + // unfortunate order. So our shutdown is invoked explicitly during layout + // module shutdown. + nullptr}; + +NSMODULE_DEFN(nsImageLib2Module) = &kImageModule; diff --git a/image/decoders/icon/components.conf b/image/decoders/icon/components.conf deleted file mode 100644 index e374e7b60cb7..000000000000 --- a/image/decoders/icon/components.conf +++ /dev/null @@ -1,19 +0,0 @@ -# -*- 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': '{d0f9db12-249c-11d5-9905-001083010e9b}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=moz-icon'], - 'type': 'nsIconProtocolHandler', - 'headers': ['/image/decoders/icon/nsIconProtocolHandler.h'], - }, - { - 'cid': '{1460df3b-774c-4205-8349-838e507c3ef9}', - 'type': 'nsMozIconURI::Mutator', - 'headers': ['/image/decoders/icon/nsIconURI.h'], - }, -] diff --git a/image/decoders/icon/moz.build b/image/decoders/icon/moz.build index 71679c116d47..9c6106fa7db6 100644 --- a/image/decoders/icon/moz.build +++ b/image/decoders/icon/moz.build @@ -5,14 +5,11 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. UNIFIED_SOURCES += [ + 'nsIconModule.cpp', 'nsIconProtocolHandler.cpp', 'nsIconURI.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - FINAL_LIBRARY = 'xul' include('/ipc/chromium/chromium-config.mozbuild') diff --git a/image/decoders/icon/nsIconModule.cpp b/image/decoders/icon/nsIconModule.cpp new file mode 100644 index 000000000000..b99c06ba639b --- /dev/null +++ b/image/decoders/icon/nsIconModule.cpp @@ -0,0 +1,49 @@ +/* -*- 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 "mozilla/ModuleUtils.h" +#include "nsServiceManagerUtils.h" + +#include "nsIconProtocolHandler.h" +#include "nsIconURI.h" +#include "nsIconChannel.h" + +// objects that just require generic constructors +//***************************************************************************** +// Protocol CIDs + +#define NS_ICONPROTOCOL_CID \ + { \ + 0xd0f9db12, 0x249c, 0x11d5, { 0x99, 0x5, 0x0, 0x10, 0x83, 0x1, 0xe, 0x9b } \ + } + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsIconProtocolHandler) +typedef nsMozIconURI::Mutator nsMozIconURIMutator; +NS_GENERIC_FACTORY_CONSTRUCTOR(nsMozIconURIMutator) + +NS_DEFINE_NAMED_CID(NS_ICONPROTOCOL_CID); +NS_DEFINE_NAMED_CID(NS_MOZICONURIMUTATOR_CID); + +static const mozilla::Module::CIDEntry kIconCIDs[] = { + {&kNS_ICONPROTOCOL_CID, false, nullptr, nsIconProtocolHandlerConstructor}, + {&kNS_MOZICONURIMUTATOR_CID, false, nullptr, + nsMozIconURIMutatorConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kIconContracts[] = { + {NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "moz-icon", &kNS_ICONPROTOCOL_CID}, + {nullptr}}; + +static const mozilla::Module::CategoryEntry kIconCategories[] = {{nullptr}}; + +static void IconDecoderModuleDtor() {} + +static const mozilla::Module kIconModule = { + mozilla::Module::kVersion, kIconCIDs, kIconContracts, + kIconCategories, nullptr, nullptr, + IconDecoderModuleDtor}; + +NSMODULE_DEFN(nsIconDecoderModule) = &kIconModule; diff --git a/intl/build/components.conf b/intl/build/components.conf deleted file mode 100644 index 92f4fb28b407..000000000000 --- a/intl/build/components.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -*- 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': '{d85a17c1-aa7c-11d2-9b8c-00805f8a16d9}', - 'contract_ids': ['@mozilla.org/intl/stringbundle;1'], - 'type': 'nsStringBundleService', - 'headers': ['/intl/strres/nsStringBundleService.h'], - 'init_method': 'Init', - }, -] diff --git a/intl/build/moz.build b/intl/build/moz.build index 10e71f0aee53..7c392c84a8d5 100644 --- a/intl/build/moz.build +++ b/intl/build/moz.build @@ -4,8 +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/. -XPCOM_MANIFESTS += [ - 'components.conf', +SOURCES += [ + 'nsI18nModule.cpp', ] FINAL_LIBRARY = 'xul' diff --git a/intl/build/nsI18nModule.cpp b/intl/build/nsI18nModule.cpp new file mode 100644 index 000000000000..99e9824dd0c4 --- /dev/null +++ b/intl/build/nsI18nModule.cpp @@ -0,0 +1,48 @@ +/* -*- 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" + +// string bundles (intl) +#include "nsStringBundleService.h" + +// locale +#include "nsLocaleConstructors.h" + +// uconv + +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStringBundleService, Init) + +NS_DEFINE_NAMED_CID(MOZ_LOCALESERVICE_CID); +NS_DEFINE_NAMED_CID(MOZ_OSPREFERENCES_CID); +NS_DEFINE_NAMED_CID(NS_STRINGBUNDLESERVICE_CID); +NS_DEFINE_NAMED_CID(NS_COLLATIONFACTORY_CID); + +static const mozilla::Module::CIDEntry kIntlCIDs[] = { + {&kMOZ_LOCALESERVICE_CID, false, nullptr, + mozilla::intl::LocaleServiceConstructor}, + {&kMOZ_OSPREFERENCES_CID, false, nullptr, + mozilla::intl::OSPreferencesConstructor}, + {&kNS_STRINGBUNDLESERVICE_CID, false, nullptr, + nsStringBundleServiceConstructor}, + {&kNS_COLLATIONFACTORY_CID, false, nullptr, nsCollationFactoryConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kIntlContracts[] = { + {MOZ_LOCALESERVICE_CONTRACTID, &kMOZ_LOCALESERVICE_CID}, + {MOZ_OSPREFERENCES_CONTRACTID, &kMOZ_OSPREFERENCES_CID}, + {NS_STRINGBUNDLE_CONTRACTID, &kNS_STRINGBUNDLESERVICE_CID}, + {NS_COLLATIONFACTORY_CONTRACTID, &kNS_COLLATIONFACTORY_CID}, + {nullptr}}; + +static const mozilla::Module kIntlModule = {mozilla::Module::kVersion, + kIntlCIDs, + kIntlContracts, + nullptr, + nullptr, + nullptr, + nullptr}; + +NSMODULE_DEFN(nsI18nModule) = &kIntlModule; diff --git a/intl/locale/components.conf b/intl/locale/components.conf deleted file mode 100644 index 49a103d01b57..000000000000 --- a/intl/locale/components.conf +++ /dev/null @@ -1,30 +0,0 @@ -# -*- 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': '{92735ff4-6384-4ad6-8508-757010e149ee}', - 'contract_ids': ['@mozilla.org/intl/localeservice;1'], - 'singleton': True, - 'type': 'mozilla::intl::LocaleService', - 'headers': ['mozilla/intl/LocaleService.h'], - 'constructor': 'mozilla::intl::LocaleService::GetInstanceAddRefed', - }, - { - 'cid': '{65944815-e9ae-48bd-a2bf-f1108720950c}', - 'contract_ids': ['@mozilla.org/intl/ospreferences;1'], - 'singleton': True, - 'type': 'mozilla::intl::OSPreferences', - 'headers': ['mozilla/intl/OSPreferences.h'], - 'constructor': 'mozilla::intl::OSPreferences::GetInstanceAddRefed', - }, - { - 'cid': '{a1b72850-a999-11d2-9119-006008a6edf6}', - 'contract_ids': ['@mozilla.org/intl/collation-factory;1'], - 'type': 'nsCollationFactory', - 'headers': ['/intl/locale/nsCollationFactory.h'], - }, -] diff --git a/intl/locale/moz.build b/intl/locale/moz.build index fe97934a33af..5264d5d2a802 100644 --- a/intl/locale/moz.build +++ b/intl/locale/moz.build @@ -53,10 +53,6 @@ EXTRA_JS_MODULES += [ 'PluralForm.jsm', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - FINAL_LIBRARY = 'xul' LOCAL_INCLUDES += [ diff --git a/intl/uconv/components.conf b/intl/uconv/components.conf deleted file mode 100644 index 581f436c01ff..000000000000 --- a/intl/uconv/components.conf +++ /dev/null @@ -1,32 +0,0 @@ -# -*- 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': '{2bc2ad62-ad5d-4b7b-a9db-f74ae203c527}', - 'contract_ids': ['@mozilla.org/intl/converter-input-stream;1'], - 'type': 'nsConverterInputStream', - 'headers': ['nsConverterInputStream.h'], - }, - { - 'cid': '{ff8780a5-bbb1-4bc5-8ee7-057e7bc5c925}', - 'contract_ids': ['@mozilla.org/intl/converter-output-stream;1'], - 'type': 'nsConverterOutputStream', - 'headers': ['/intl/uconv/nsConverterOutputStream.h'], - }, - { - 'cid': '{0a698c44-3bff-11d4-9649-00c0ca135b4e}', - 'contract_ids': ['@mozilla.org/intl/scriptableunicodeconverter'], - 'type': 'nsScriptableUnicodeConverter', - 'headers': ['/intl/uconv/nsScriptableUConv.h'], - }, - { - 'cid': '{8b042e22-6f87-11d3-b3c8-00805f8a6670}', - 'contract_ids': ['@mozilla.org/intl/texttosuburi;1'], - 'type': 'nsTextToSubURI', - 'headers': ['/intl/uconv/nsTextToSubURI.h'], - }, -] diff --git a/intl/uconv/moz.build b/intl/uconv/moz.build index 3784ac29ba2c..ff7405f35588 100644 --- a/intl/uconv/moz.build +++ b/intl/uconv/moz.build @@ -22,10 +22,7 @@ UNIFIED_SOURCES += [ 'nsConverterOutputStream.cpp', 'nsScriptableUConv.cpp', 'nsTextToSubURI.cpp', -] - -XPCOM_MANIFESTS += [ - 'components.conf', + 'nsUConvModule.cpp', ] FINAL_LIBRARY = 'xul' diff --git a/intl/uconv/nsUConvModule.cpp b/intl/uconv/nsUConvModule.cpp new file mode 100644 index 000000000000..3e0cbfc93e72 --- /dev/null +++ b/intl/uconv/nsUConvModule.cpp @@ -0,0 +1,50 @@ +/* -*- 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 "mozilla/ModuleUtils.h" + +#include "nsTextToSubURI.h" +#include "nsConverterInputStream.h" +#include "nsConverterOutputStream.h" +#include "nsScriptableUConv.h" +#include "nsIOutputStream.h" +#include "nsITextToSubURI.h" + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsTextToSubURI) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsConverterInputStream) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsConverterOutputStream) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptableUnicodeConverter) + +NS_DEFINE_NAMED_CID(NS_TEXTTOSUBURI_CID); +NS_DEFINE_NAMED_CID(NS_CONVERTERINPUTSTREAM_CID); +NS_DEFINE_NAMED_CID(NS_CONVERTEROUTPUTSTREAM_CID); +NS_DEFINE_NAMED_CID(NS_ISCRIPTABLEUNICODECONVERTER_CID); + +static const mozilla::Module::CIDEntry kUConvCIDs[] = { + {&kNS_TEXTTOSUBURI_CID, false, nullptr, nsTextToSubURIConstructor}, + {&kNS_CONVERTERINPUTSTREAM_CID, false, nullptr, + nsConverterInputStreamConstructor}, + {&kNS_CONVERTEROUTPUTSTREAM_CID, false, nullptr, + nsConverterOutputStreamConstructor}, + {&kNS_ISCRIPTABLEUNICODECONVERTER_CID, false, nullptr, + nsScriptableUnicodeConverterConstructor}, + {nullptr}, +}; + +static const mozilla::Module::ContractIDEntry kUConvContracts[] = { + {NS_ITEXTTOSUBURI_CONTRACTID, &kNS_TEXTTOSUBURI_CID}, + {NS_CONVERTERINPUTSTREAM_CONTRACTID, &kNS_CONVERTERINPUTSTREAM_CID}, + {"@mozilla.org/intl/converter-output-stream;1", + &kNS_CONVERTEROUTPUTSTREAM_CID}, + {NS_ISCRIPTABLEUNICODECONVERTER_CONTRACTID, + &kNS_ISCRIPTABLEUNICODECONVERTER_CID}, + {nullptr}}; + +static const mozilla::Module kUConvModule = { + mozilla::Module::kVersion, + kUConvCIDs, + kUConvContracts, +}; + +NSMODULE_DEFN(nsUConvModule) = &kUConvModule; diff --git a/js/ductwork/debugger/JSDebugger.cpp b/js/ductwork/debugger/JSDebugger.cpp index 4fcb1a681897..9e6af1b54af2 100644 --- a/js/ductwork/debugger/JSDebugger.cpp +++ b/js/ductwork/debugger/JSDebugger.cpp @@ -10,6 +10,7 @@ #include "jsapi.h" #include "jsfriendapi.h" #include "js/Wrapper.h" +#include "mozilla/ModuleUtils.h" #include "nsServiceManagerUtils.h" #include "nsMemory.h" @@ -25,6 +26,8 @@ namespace mozilla { namespace jsdebugger { +NS_GENERIC_FACTORY_CONSTRUCTOR(JSDebugger) + NS_IMPL_ISUPPORTS(JSDebugger, IJSDebugger) JSDebugger::JSDebugger() {} @@ -72,3 +75,18 @@ JSDebugger::AddClass(JS::Handle global, JSContext* cx) { } // namespace jsdebugger } // namespace mozilla + +NS_DEFINE_NAMED_CID(JSDEBUGGER_CID); + +static const mozilla::Module::CIDEntry kJSDebuggerCIDs[] = { + {&kJSDEBUGGER_CID, false, nullptr, + mozilla::jsdebugger::JSDebuggerConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kJSDebuggerContracts[] = { + {JSDEBUGGER_CONTRACTID, &kJSDEBUGGER_CID}, {nullptr}}; + +static const mozilla::Module kJSDebuggerModule = { + mozilla::Module::kVersion, kJSDebuggerCIDs, kJSDebuggerContracts}; + +NSMODULE_DEFN(jsdebugger) = &kJSDebuggerModule; diff --git a/js/ductwork/debugger/components.conf b/js/ductwork/debugger/components.conf deleted file mode 100644 index 16d3c450dc40..000000000000 --- a/js/ductwork/debugger/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{0365cbd5-d46e-4e94-a39f-83b63cd1a963}', - 'contract_ids': ['@mozilla.org/jsdebugger;1'], - 'type': 'mozilla::jsdebugger::JSDebugger', - 'headers': ['/js/ductwork/debugger/JSDebugger.h'], - }, -] diff --git a/js/ductwork/debugger/moz.build b/js/ductwork/debugger/moz.build index 6309c202c231..0fb85f8b86ef 100644 --- a/js/ductwork/debugger/moz.build +++ b/js/ductwork/debugger/moz.build @@ -19,10 +19,6 @@ SOURCES += [ 'JSDebugger.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - EXTRA_JS_MODULES += [ 'jsdebugger.jsm', ] diff --git a/layout/build/components.conf b/layout/build/components.conf index a5ba38f99926..1330799aaa52 100644 --- a/layout/build/components.conf +++ b/layout/build/components.conf @@ -37,20 +37,6 @@ content_types = [ 'text/rdf', 'text/vtt', 'text/xml', - - 'image/apng', - 'image/bmp', - 'image/gif', - 'image/icon', - 'image/jpeg', - 'image/jpg', - 'image/pjpeg', - 'image/png', - 'image/vnd.microsoft.icon', - 'image/webp', - 'image/x-icon', - 'image/x-ms-bmp', - 'image/x-png', ] if defined('MOZ_WEBM'): diff --git a/layout/tools/recording/components.conf b/layout/tools/recording/components.conf deleted file mode 100644 index 31f191623a05..000000000000 --- a/layout/tools/recording/components.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -*- 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': '{86FB70EC-90FF-45AD-A1C1-F77D3C1184E9}', - 'contract_ids': ['@mozilla.org/commandlinehandler/general-startup;1?type=recording'], - 'jsm': 'resource://gre/modules/RecordingCmdLine.jsm', - 'constructor': 'RecordingCmdLineHandler', - 'categories': {'command-line-handler': 'm-recording'}, - }, -] diff --git a/layout/tools/recording/moz.build b/layout/tools/recording/moz.build index b1bef97ad07b..74b7e9a6d7bb 100644 --- a/layout/tools/recording/moz.build +++ b/layout/tools/recording/moz.build @@ -4,12 +4,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/. -EXTRA_JS_MODULES += [ - 'RecordingCmdLine.jsm', +EXTRA_COMPONENTS += [ + 'recording-cmdline.js', + 'recording-cmdline.manifest', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - -JAR_MANIFESTS += ['jar.mn'] +JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/layout/tools/recording/RecordingCmdLine.jsm b/layout/tools/recording/recording-cmdline.js similarity index 85% rename from layout/tools/recording/RecordingCmdLine.jsm rename to layout/tools/recording/recording-cmdline.js index e3cb99016c18..15ac1aa7ce6a 100644 --- a/layout/tools/recording/RecordingCmdLine.jsm +++ b/layout/tools/recording/recording-cmdline.js @@ -2,12 +2,20 @@ * 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/. */ +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); + +const nsISupports = Ci.nsISupports; + +const nsICommandLine = Ci.nsICommandLine; const nsICommandLineHandler = Ci.nsICommandLineHandler; +const nsISupportsString = Ci.nsISupportsString; const nsIWindowWatcher = Ci.nsIWindowWatcher; function RecordingCmdLineHandler() {} RecordingCmdLineHandler.prototype = { + classID: Components.ID('{86FB70EC-90FF-45AD-A1C1-F77D3C1184E9}'), + /* nsISupports */ QueryInterface: ChromeUtils.generateQI([nsICommandLineHandler]), @@ -63,4 +71,4 @@ RecordingCmdLineHandler.prototype = " --recording-output Specify destination file for a drawing recording.\n" }; -var EXPORTED_SYMBOLS = ["RecordingCmdLineHandler"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RecordingCmdLineHandler]); diff --git a/layout/tools/recording/recording-cmdline.manifest b/layout/tools/recording/recording-cmdline.manifest new file mode 100644 index 000000000000..7b4216721687 --- /dev/null +++ b/layout/tools/recording/recording-cmdline.manifest @@ -0,0 +1,3 @@ +component {86FB70EC-90FF-45AD-A1C1-F77D3C1184E9} recording-cmdline.js +contract @mozilla.org/commandlinehandler/general-startup;1?type=recording {86FB70EC-90FF-45AD-A1C1-F77D3C1184E9} +category command-line-handler m-recording @mozilla.org/commandlinehandler/general-startup;1?type=recording diff --git a/mobile/android/components/BrowserCLH.js b/mobile/android/components/BrowserCLH.js index 9768d9e2aaf6..4f340c120ab4 100644 --- a/mobile/android/components/BrowserCLH.js +++ b/mobile/android/components/BrowserCLH.js @@ -86,16 +86,14 @@ BrowserCLH.prototype = { GeckoViewUtils.addLazyGetter(this, "LoginManagerParent", { module: "resource://gre/modules/LoginManagerParent.jsm", mm: [ - // PLEASE KEEP THIS LIST IN SYNC WITH THE DESKTOP LIST IN - // BrowserGlue.jsm + // PLEASE KEEP THIS LIST IN SYNC WITH THE DESKTOP LIST IN nsBrowserGlue.js "RemoteLogins:findLogins", "RemoteLogins:findRecipes", "RemoteLogins:onFormSubmit", "RemoteLogins:autoCompleteLogins", "RemoteLogins:removeLogin", "RemoteLogins:insecureLoginFormPresent", - // PLEASE KEEP THIS LIST IN SYNC WITH THE DESKTOP LIST IN - // BrowserGlue.jsm + // PLEASE KEEP THIS LIST IN SYNC WITH THE DESKTOP LIST IN nsBrowserGlue.js ], }); GeckoViewUtils.addLazyGetter(this, "LoginManagerContent", { diff --git a/mobile/android/installer/package-manifest.in b/mobile/android/installer/package-manifest.in index 99f233c1a81a..e98c307faa1e 100644 --- a/mobile/android/installer/package-manifest.in +++ b/mobile/android/installer/package-manifest.in @@ -101,14 +101,47 @@ @BINPATH@/components/components.manifest ; JavaScript components +@BINPATH@/components/ConsoleAPI.manifest +@BINPATH@/components/ConsoleAPIStorage.js +@BINPATH@/components/NotificationStorage.js +@BINPATH@/components/NotificationStorage.manifest #ifdef MOZ_ANDROID_GCM +@BINPATH@/components/Push.js @BINPATH@/components/Push.manifest +@BINPATH@/components/PushComponents.js +#endif +@BINPATH@/components/BrowserElementParent.manifest +@BINPATH@/components/BrowserElementParent.js +@BINPATH@/components/UAOverridesBootstrapper.js +@BINPATH@/components/UAOverridesBootstrapper.manifest +@BINPATH@/components/WellKnownOpportunisticUtils.js +@BINPATH@/components/WellKnownOpportunisticUtils.manifest +@BINPATH@/components/mozProtocolHandler.js +@BINPATH@/components/mozProtocolHandler.manifest +#ifndef MOZ_GECKOVIEW_JAR +@BINPATH@/components/nsDNSServiceDiscovery.manifest +@BINPATH@/components/nsDNSServiceDiscovery.js #endif @BINPATH@/components/toolkitsearch.manifest +@BINPATH@/components/nsSearchService.js +@BINPATH@/components/nsSidebar.js +@BINPATH@/components/passwordmgr.manifest +@BINPATH@/components/nsLoginInfo.js +@BINPATH@/components/nsLoginManager.js +@BINPATH@/components/nsLoginManagerPrompter.js +@BINPATH@/components/storage-mozStorage.js +@BINPATH@/components/crypto-SDR.js +@BINPATH@/components/TooltipTextProvider.js +@BINPATH@/components/TooltipTextProvider.manifest +@BINPATH@/components/NetworkGeolocationProvider.manifest +@BINPATH@/components/NetworkGeolocationProvider.js @BINPATH@/components/extensions.manifest +@BINPATH@/components/addonManager.js #ifndef MOZ_GECKOVIEW_JAR +@BINPATH@/components/utils.manifest +@BINPATH@/components/simpleServices.js @BINPATH@/components/amContentHandler.js @BINPATH@/components/amWebAPI.js @BINPATH@/components/amInstallTrigger.js @@ -123,14 +156,55 @@ #ifndef MOZ_GECKOVIEW_JAR #ifdef MOZ_UPDATER @BINPATH@/components/nsUpdateService.manifest +@BINPATH@/components/nsUpdateService.js +@BINPATH@/components/nsUpdateServiceStub.js #endif #endif +@BINPATH@/components/ClearDataService.manifest +@BINPATH@/components/ClearDataService.js + +@BINPATH@/components/nsUpdateTimerManager.manifest +@BINPATH@/components/nsUpdateTimerManager.js + @BINPATH@/components/ProcessSingleton.manifest +@BINPATH@/components/MainProcessSingleton.js +@BINPATH@/components/ContentProcessSingleton.js +@BINPATH@/components/nsURLFormatter.manifest +@BINPATH@/components/nsURLFormatter.js +@BINPATH@/components/ContentPrefService2.manifest +@BINPATH@/components/ContentPrefService2.js @BINPATH@/components/HandlerService.manifest @BINPATH@/components/HandlerService.js +@BINPATH@/components/nsWebHandlerApp.manifest +@BINPATH@/components/nsWebHandlerApp.js +@BINPATH@/components/satchel.manifest +@BINPATH@/components/nsFormAutoComplete.js +@BINPATH@/components/FormHistoryStartup.js +@BINPATH@/components/nsInputListAutoComplete.js +@BINPATH@/components/contentAreaDropListener.manifest +@BINPATH@/components/contentAreaDropListener.js @BINPATH@/components/servicesComponents.manifest @BINPATH@/components/servicesSettings.manifest +@BINPATH@/components/RemoteSettingsComponents.js + +#ifndef MOZ_GECKOVIEW_JAR +@BINPATH@/components/TelemetryStartup.js +@BINPATH@/components/TelemetryStartup.manifest +#endif + +@BINPATH@/components/XULStore.js +@BINPATH@/components/XULStore.manifest +@BINPATH@/components/htmlMenuBuilder.js +@BINPATH@/components/htmlMenuBuilder.manifest + +#ifdef MOZ_WEBRTC +@BINPATH@/components/PeerConnection.js +@BINPATH@/components/PeerConnection.manifest +#endif + +@BINPATH@/components/CaptivePortalDetectComponents.manifest +@BINPATH@/components/captivedetect.js #if defined(ENABLE_TESTS) && defined(MOZ_DEBUG) @BINPATH@/components/TestInterfaceJS.js @@ -138,10 +212,36 @@ @BINPATH@/components/TestInterfaceJSMaplike.js #endif +@BINPATH@/components/nsAsyncShutdown.manifest +@BINPATH@/components/nsAsyncShutdown.js + +@BINPATH@/components/Downloads.manifest +@BINPATH@/components/DownloadLegacy.js + +#ifndef MOZ_GECKOVIEW_JAR +@BINPATH@/components/BuiltinProviders.manifest +@BINPATH@/components/PresentationControlService.js +@BINPATH@/components/PresentationNetworkHelper.js +@BINPATH@/components/PresentationNetworkHelper.manifest +@BINPATH@/components/PresentationDataChannelSessionTransport.js +@BINPATH@/components/PresentationDataChannelSessionTransport.manifest +@BINPATH@/components/AndroidCastDeviceProvider.manifest +@BINPATH@/components/AndroidCastDeviceProvider.js +#endif + +@BINPATH@/components/mozIntl.manifest +@BINPATH@/components/mozIntl.js + ; Modules @BINPATH@/modules/* @BINPATH@/actors/* +; Safe Browsing +@BINPATH@/components/nsURLClassifier.manifest +@BINPATH@/components/nsUrlClassifierHashCompleter.js +@BINPATH@/components/nsUrlClassifierListManager.js +@BINPATH@/components/nsUrlClassifierLib.js + ; Security Reports @BINPATH@/components/SecurityReporter.manifest @BINPATH@/components/SecurityReporter.js @@ -225,6 +325,9 @@ @BINPATH@/crashreporter-override.ini #endif +@BINPATH@/components/RemoteWebNavigation.js +@BINPATH@/components/remotebrowserutils.manifest + [mobile] @BINPATH@/chrome/geckoview@JAREXT@ @BINPATH@/chrome/geckoview.manifest @@ -248,6 +351,7 @@ @BINPATH@/components/ImageBlockingPolicy.js @BINPATH@/components/DirectoryProvider.js @BINPATH@/components/FilePicker.js +@BINPATH@/components/FxAccountsPush.js @BINPATH@/components/HelperAppDialog.js @BINPATH@/components/LoginManagerPrompter.js @BINPATH@/components/MobileComponents.manifest @@ -272,3 +376,10 @@ #ifdef PKG_LOCALE_MANIFEST #include @PKG_LOCALE_MANIFEST@ #endif + +; NOTE: This must match the config checks in +; /toolkit/components/backgroundhangmonitor/moz.build. +#if defined(NIGHTLY_BUILD) && !defined(MOZ_DEBUG) && !defined(MOZ_TSAN) && !defined(MOZ_ASAN) +@BINPATH@/components/BHRTelemetryService.js +@BINPATH@/components/BHRTelemetryService.manifest +#endif diff --git a/modules/libjar/components.conf b/modules/libjar/components.conf deleted file mode 100644 index 928689fc8b3b..000000000000 --- a/modules/libjar/components.conf +++ /dev/null @@ -1,38 +0,0 @@ -# -*- 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': '{88e2fd0b-f7f4-480c-9483-7846b00e8dad}', - 'contract_ids': ['@mozilla.org/libjar/zip-reader;1'], - 'type': 'nsJAR', - 'headers': ['/modules/libjar/nsJAR.h'], - }, - { - 'cid': '{c7e410d4-85f2-11d3-9f63-006008a6efe9}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=jar'], - 'singleton': True, - 'type': 'nsJARProtocolHandler', - 'headers': ['/modules/libjar/nsJARProtocolHandler.h'], - 'constructor': 'nsJARProtocolHandler::GetSingleton', - }, - { - 'cid': '{245abae2-b947-4ded-a46d-9829d3cca462}', - 'type': 'nsJARURI::Mutator', - 'headers': ['nsJARURI.h'], - }, - { - 'cid': '{19d9161b-a2a9-4518-b2c9-fcb8296d6dcd}', - 'type': 'nsJARURI::Mutator', - 'headers': ['nsJARURI.h'], - }, - { - 'cid': '{608b7f6f-4b60-40d6-87ed-d933bf53d8c1}', - 'contract_ids': ['@mozilla.org/libjar/zip-reader-cache;1'], - 'type': 'nsZipReaderCache', - 'headers': ['/modules/libjar/nsJAR.h'], - }, -] diff --git a/modules/libjar/moz.build b/modules/libjar/moz.build index 3f6777633968..589181b5daac 100644 --- a/modules/libjar/moz.build +++ b/modules/libjar/moz.build @@ -32,16 +32,13 @@ EXPORTS += [ UNIFIED_SOURCES += [ 'nsJAR.cpp', 'nsJARChannel.cpp', + 'nsJARFactory.cpp', 'nsJARInputStream.cpp', 'nsJARProtocolHandler.cpp', 'nsJARURI.cpp', 'nsZipArchive.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' diff --git a/modules/libjar/nsJARFactory.cpp b/modules/libjar/nsJARFactory.cpp new file mode 100644 index 000000000000..be5425373cf2 --- /dev/null +++ b/modules/libjar/nsJARFactory.cpp @@ -0,0 +1,57 @@ +/* -*- 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 + +#include "nscore.h" + +#include "nsIComponentManager.h" +#include "nsIServiceManager.h" +#include "nsCOMPtr.h" +#include "mozilla/ModuleUtils.h" +#include "nsIJARFactory.h" +#include "nsJARProtocolHandler.h" +#include "nsJARURI.h" +#include "nsJAR.h" + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsJAR) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsZipReaderCache) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsJARProtocolHandler, + nsJARProtocolHandler::GetSingleton) + +typedef nsJARURI::Mutator nsJARURIMutator; +NS_GENERIC_FACTORY_CONSTRUCTOR(nsJARURIMutator) + +NS_DEFINE_NAMED_CID(NS_ZIPREADER_CID); +NS_DEFINE_NAMED_CID(NS_ZIPREADERCACHE_CID); +NS_DEFINE_NAMED_CID(NS_JARPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_JARURI_CID); +NS_DEFINE_NAMED_CID(NS_JARURIMUTATOR_CID); + +static const mozilla::Module::CIDEntry kJARCIDs[] = { + {&kNS_ZIPREADER_CID, false, nullptr, nsJARConstructor}, + {&kNS_ZIPREADERCACHE_CID, false, nullptr, nsZipReaderCacheConstructor}, + {&kNS_JARPROTOCOLHANDLER_CID, false, nullptr, + nsJARProtocolHandlerConstructor}, + {&kNS_JARURI_CID, false, nullptr, + nsJARURIMutatorConstructor}, // do_CreateInstance returns mutator + {&kNS_JARURIMUTATOR_CID, false, nullptr, nsJARURIMutatorConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kJARContracts[] = { + {"@mozilla.org/libjar/zip-reader;1", &kNS_ZIPREADER_CID}, + {"@mozilla.org/libjar/zip-reader-cache;1", &kNS_ZIPREADERCACHE_CID}, + {NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "jar", &kNS_JARPROTOCOLHANDLER_CID}, + {nullptr}}; + +static const mozilla::Module kJARModule = {mozilla::Module::kVersion, + kJARCIDs, + kJARContracts, + nullptr, + nullptr, + nullptr, + nullptr}; + +NSMODULE_DEFN(nsJarModule) = &kJARModule; diff --git a/modules/libjar/zipwriter/ZipWriterModule.cpp b/modules/libjar/zipwriter/ZipWriterModule.cpp new file mode 100644 index 000000000000..a7ae36ea9f59 --- /dev/null +++ b/modules/libjar/zipwriter/ZipWriterModule.cpp @@ -0,0 +1,36 @@ +/* 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 "nsDeflateConverter.h" +#include "nsZipWriter.h" + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeflateConverter) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsZipWriter) + +NS_DEFINE_NAMED_CID(DEFLATECONVERTER_CID); +NS_DEFINE_NAMED_CID(ZIPWRITER_CID); + +static const mozilla::Module::CIDEntry kZipWriterCIDs[] = { + {&kDEFLATECONVERTER_CID, false, nullptr, nsDeflateConverterConstructor}, + {&kZIPWRITER_CID, false, nullptr, nsZipWriterConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kZipWriterContracts[] = { + {"@mozilla.org/streamconv;1?from=uncompressed&to=deflate", + &kDEFLATECONVERTER_CID}, + {"@mozilla.org/streamconv;1?from=uncompressed&to=gzip", + &kDEFLATECONVERTER_CID}, + {"@mozilla.org/streamconv;1?from=uncompressed&to=x-gzip", + &kDEFLATECONVERTER_CID}, + {"@mozilla.org/streamconv;1?from=uncompressed&to=rawdeflate", + &kDEFLATECONVERTER_CID}, + {ZIPWRITER_CONTRACTID, &kZIPWRITER_CID}, + {nullptr}}; + +static const mozilla::Module kZipWriterModule = { + mozilla::Module::kVersion, kZipWriterCIDs, kZipWriterContracts}; + +NSMODULE_DEFN(ZipWriterModule) = &kZipWriterModule; diff --git a/modules/libjar/zipwriter/components.conf b/modules/libjar/zipwriter/components.conf deleted file mode 100644 index 14ea6a7e4ab2..000000000000 --- a/modules/libjar/zipwriter/components.conf +++ /dev/null @@ -1,25 +0,0 @@ -# -*- 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': '{461cd5dd-73c6-47a4-8cc3-603b37d84a61}', - 'contract_ids': [ - '@mozilla.org/streamconv;1?from=uncompressed&to=deflate', - '@mozilla.org/streamconv;1?from=uncompressed&to=gzip', - '@mozilla.org/streamconv;1?from=uncompressed&to=rawdeflate', - '@mozilla.org/streamconv;1?from=uncompressed&to=x-gzip', - ], - 'type': 'nsDeflateConverter', - 'headers': ['/modules/libjar/zipwriter/nsDeflateConverter.h'], - }, - { - 'cid': '{430d416c-a722-4ad1-be98-d9a445f85e3f}', - 'contract_ids': ['@mozilla.org/zipwriter;1'], - 'type': 'nsZipWriter', - 'headers': ['/modules/libjar/zipwriter/nsZipWriter.h'], - }, -] diff --git a/modules/libjar/zipwriter/moz.build b/modules/libjar/zipwriter/moz.build index 44512cd45579..e874867c6df3 100644 --- a/modules/libjar/zipwriter/moz.build +++ b/modules/libjar/zipwriter/moz.build @@ -18,10 +18,7 @@ UNIFIED_SOURCES += [ 'nsZipHeader.cpp', 'nsZipWriter.cpp', 'StreamFunctions.cpp', -] - -XPCOM_MANIFESTS += [ - 'components.conf', + 'ZipWriterModule.cpp', ] FINAL_LIBRARY = 'xul' diff --git a/modules/libjar/zipwriter/nsDeflateConverter.h b/modules/libjar/zipwriter/nsDeflateConverter.h index 52571fb4a45c..51ffc24545ba 100644 --- a/modules/libjar/zipwriter/nsDeflateConverter.h +++ b/modules/libjar/zipwriter/nsDeflateConverter.h @@ -19,10 +19,10 @@ } \ } +#define ZIP_BUFLEN (4 * 1024 - 1) + class nsDeflateConverter final : public nsIStreamConverter { public: - static constexpr size_t kZipBufLen = (4 * 1024 - 1); - NS_DECL_ISUPPORTS NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSISTREAMLISTENER @@ -49,7 +49,7 @@ class nsDeflateConverter final : public nsIStreamConverter { nsCOMPtr mListener; nsCOMPtr mContext; z_stream mZstream; - unsigned char mWriteBuffer[kZipBufLen]; + unsigned char mWriteBuffer[ZIP_BUFLEN]; nsresult Init(); nsresult PushAvailableData(nsIRequest *aRequest, nsISupports *aContext); diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp index aad344bd3149..8b87f36dc519 100644 --- a/modules/libpref/Preferences.cpp +++ b/modules/libpref/Preferences.cpp @@ -17,13 +17,13 @@ #include "mozilla/ArenaAllocator.h" #include "mozilla/ArrayUtils.h" #include "mozilla/Attributes.h" -#include "mozilla/Components.h" #include "mozilla/dom/PContent.h" #include "mozilla/HashFunctions.h" #include "mozilla/HashTable.h" #include "mozilla/Logging.h" #include "mozilla/Maybe.h" #include "mozilla/MemoryReporting.h" +#include "mozilla/ModuleUtils.h" #include "mozilla/Omnijar.h" #include "mozilla/Preferences.h" #include "mozilla/ResultExtensions.h" @@ -5409,16 +5409,35 @@ static void InitVarCachePref(const nsACString& aName, float* aCache, // Module and factory stuff //=========================================================================== -NS_IMPL_COMPONENT_FACTORY(nsPrefLocalizedString) { - auto str = MakeRefPtr(); - if (NS_SUCCEEDED(str->Init())) { - return str.forget().downcast(); - } - return nullptr; -} +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Preferences, + Preferences::GetInstanceForService) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefLocalizedString, Init) -namespace mozilla { +static NS_DEFINE_CID(kPrefServiceCID, NS_PREFSERVICE_CID); +static NS_DEFINE_CID(kPrefLocalizedStringCID, NS_PREFLOCALIZEDSTRING_CID); -void UnloadPrefsModule() { Preferences::Shutdown(); } +static mozilla::Module::CIDEntry kPrefCIDs[] = { + {&kPrefServiceCID, true, nullptr, PreferencesConstructor, + Module::ALLOW_IN_SOCKET_PROCESS}, + {&kPrefLocalizedStringCID, false, nullptr, + nsPrefLocalizedStringConstructor}, + {nullptr}}; -} +static mozilla::Module::ContractIDEntry kPrefContracts[] = { + {NS_PREFSERVICE_CONTRACTID, &kPrefServiceCID, + Module::ALLOW_IN_SOCKET_PROCESS}, + {NS_PREFLOCALIZEDSTRING_CONTRACTID, &kPrefLocalizedStringCID}, + {nullptr}}; + +static void UnloadPrefsModule() { Preferences::Shutdown(); } + +static const mozilla::Module kPrefModule = {mozilla::Module::kVersion, + kPrefCIDs, + kPrefContracts, + nullptr, + nullptr, + nullptr, + UnloadPrefsModule, + Module::ALLOW_IN_SOCKET_PROCESS}; + +NSMODULE_DEFN(nsPrefModule) = &kPrefModule; diff --git a/modules/libpref/Preferences.h b/modules/libpref/Preferences.h index 14e0b95b314d..68a58022edb6 100644 --- a/modules/libpref/Preferences.h +++ b/modules/libpref/Preferences.h @@ -33,8 +33,6 @@ class nsPrefBranch; namespace mozilla { -void UnloadPrefsModule(); - // A typesafe version of PrefChangeFunc, with its data argument type deduced // from the type of the argument passed to RegisterCallback. // diff --git a/modules/libpref/components.conf b/modules/libpref/components.conf deleted file mode 100644 index 4b8dff423af0..000000000000 --- a/modules/libpref/components.conf +++ /dev/null @@ -1,27 +0,0 @@ -# -*- 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/Preferences.h', -] - -UnloadFunc = 'mozilla::UnloadPrefsModule' - -Classes = [ - { - 'cid': '{91ca2441-050f-4f7c-9df8-75b40ea40156}', - 'contract_ids': ['@mozilla.org/preferences-service;1'], - 'singleton': True, - 'type': 'mozilla::Preferences', - 'headers': ['mozilla/Preferences.h'], - 'constructor': 'mozilla::Preferences::GetInstanceForService', - }, - { - 'cid': '{064d9cee-1dd2-11b2-83e3-d25ab0193c26}', - 'contract_ids': ['@mozilla.org/pref-localizedstring;1'], - 'type': 'nsPrefLocalizedString', - }, -] diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build index f7055f38df49..4e6694cd220e 100644 --- a/modules/libpref/moz.build +++ b/modules/libpref/moz.build @@ -36,10 +36,6 @@ UNIFIED_SOURCES += [ 'SharedPrefMap.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' diff --git a/netwerk/dns/mdns/libmdns/components.conf b/netwerk/dns/mdns/libmdns/components.conf deleted file mode 100644 index 6e64140c820e..000000000000 --- a/netwerk/dns/mdns/libmdns/components.conf +++ /dev/null @@ -1,24 +0,0 @@ -# -*- 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': '{14a50f2b-7ff6-48a5-88e3-615fd111f5d3}', - 'contract_ids': ['@mozilla.org/toolkit/components/mdnsresponder/dns-info;1'], - 'type': 'mozilla::net::nsDNSServiceInfo', - 'headers': ['/netwerk/dns/mdns/libmdns/nsDNSServiceInfo.h'], - }, -] - -if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] != 'cocoa': - Classes += [ - { - 'cid': '{f9346d98-f27a-4e89-b744-493843416480}', - 'contract_ids': ['@mozilla.org/toolkit/components/mdnsresponder/dns-sd;1'], - 'jsm': 'resource://gre/modules/DNSServiceDiscovery.jsm', - 'constructor': 'nsDNSServiceDiscovery', - }, - ] diff --git a/netwerk/dns/mdns/libmdns/moz.build b/netwerk/dns/mdns/libmdns/moz.build index 8f80e16da8a5..fee67758dd63 100644 --- a/netwerk/dns/mdns/libmdns/moz.build +++ b/netwerk/dns/mdns/libmdns/moz.build @@ -16,8 +16,12 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': ] else: + EXTRA_COMPONENTS += [ + 'nsDNSServiceDiscovery.js', + 'nsDNSServiceDiscovery.manifest', + ] + EXTRA_JS_MODULES += [ - 'DNSServiceDiscovery.jsm', 'fallback/DataReader.jsm', 'fallback/DataWriter.jsm', 'fallback/DNSPacket.jsm', @@ -27,10 +31,6 @@ else: 'fallback/MulticastDNS.jsm', ] - XPCOM_MANIFESTS += [ - 'components.conf', - ] - if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android': EXTRA_JS_MODULES += [ 'MulticastDNSAndroid.jsm', @@ -38,10 +38,7 @@ else: UNIFIED_SOURCES += [ 'nsDNSServiceInfo.cpp', -] - -XPCOM_MANIFESTS += [ - 'components.conf', + 'nsMulticastDNSModule.cpp', ] include('/ipc/chromium/chromium-config.mozbuild') diff --git a/netwerk/dns/mdns/libmdns/DNSServiceDiscovery.jsm b/netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.js similarity index 94% rename from netwerk/dns/mdns/libmdns/DNSServiceDiscovery.jsm rename to netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.js index 8c5f82682e2b..e4c22d127886 100644 --- a/netwerk/dns/mdns/libmdns/DNSServiceDiscovery.jsm +++ b/netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.js @@ -5,12 +5,15 @@ const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {MulticastDNS} = ChromeUtils.import( (AppConstants.platform == "android" && !Services.prefs.getBoolPref("network.mdns.use_js_fallback")) ? "resource://gre/modules/MulticastDNSAndroid.jsm" : "resource://gre/modules/MulticastDNS.jsm"); +const DNSSERVICEDISCOVERY_CID = Components.ID("{f9346d98-f27a-4e89-b744-493843416480}"); +const DNSSERVICEDISCOVERY_CONTRACT_ID = "@mozilla.org/toolkit/components/mdnsresponder/dns-sd;1"; const DNSSERVICEINFO_CONTRACT_ID = "@mozilla.org/toolkit/components/mdnsresponder/dns-info;1"; function log(aMsg) { @@ -131,6 +134,7 @@ function nsDNSServiceDiscovery() { } nsDNSServiceDiscovery.prototype = { + classID: DNSSERVICEDISCOVERY_CID, QueryInterface: ChromeUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIDNSServiceDiscovery]), startDiscovery(aServiceType, aListener) { @@ -175,7 +179,7 @@ nsDNSServiceDiscovery.prototype = { }, }; -var EXPORTED_SYMBOLS = ["nsDNSServiceDiscovery"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsDNSServiceDiscovery]); function _toPropertyBag2(obj) { if (obj.QueryInterface) { diff --git a/netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.manifest b/netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.manifest new file mode 100644 index 000000000000..c17e719f25fa --- /dev/null +++ b/netwerk/dns/mdns/libmdns/nsDNSServiceDiscovery.manifest @@ -0,0 +1,3 @@ +# nsDNSServiceDiscovery.js +component {f9346d98-f27a-4e89-b744-493843416480} nsDNSServiceDiscovery.js +contract @mozilla.org/toolkit/components/mdnsresponder/dns-sd;1 {f9346d98-f27a-4e89-b744-493843416480} diff --git a/netwerk/dns/mdns/libmdns/nsMulticastDNSModule.cpp b/netwerk/dns/mdns/libmdns/nsMulticastDNSModule.cpp new file mode 100644 index 000000000000..3a108abcbc66 --- /dev/null +++ b/netwerk/dns/mdns/libmdns/nsMulticastDNSModule.cpp @@ -0,0 +1,63 @@ +/* -*- 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/. */ + +#if defined(MOZ_WIDGET_COCOA) +# define ENABLE_DNS_SERVICE_DISCOVERY +#endif + +#include "mozilla/ModuleUtils.h" + +#ifdef ENABLE_DNS_SERVICE_DISCOVERY +# include "nsDNSServiceDiscovery.h" +#endif + +#include "nsDNSServiceInfo.h" + +#ifdef ENABLE_DNS_SERVICE_DISCOVERY +using mozilla::net::nsDNSServiceDiscovery; +# define DNSSERVICEDISCOVERY_CID \ + { \ + 0x8df43d23, 0xd3f9, 0x4dd5, { \ + 0xb9, 0x65, 0xde, 0x2c, 0xa3, 0xf6, 0xa4, 0x2c \ + } \ + } +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDNSServiceDiscovery, Init) +NS_DEFINE_NAMED_CID(DNSSERVICEDISCOVERY_CID); +#endif // ENABLE_DNS_SERVICE_DISCOVERY + +using mozilla::net::nsDNSServiceInfo; +#define DNSSERVICEINFO_CID \ + { \ + 0x14a50f2b, 0x7ff6, 0x48a5, { \ + 0x88, 0xe3, 0x61, 0x5f, 0xd1, 0x11, 0xf5, 0xd3 \ + } \ + } +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDNSServiceInfo) +NS_DEFINE_NAMED_CID(DNSSERVICEINFO_CID); + +static const mozilla::Module::CIDEntry knsDNSServiceDiscoveryCIDs[] = { +#ifdef ENABLE_DNS_SERVICE_DISCOVERY + {&kDNSSERVICEDISCOVERY_CID, false, nullptr, + nsDNSServiceDiscoveryConstructor}, +#endif + {&kDNSSERVICEINFO_CID, false, nullptr, nsDNSServiceInfoConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry + knsDNSServiceDiscoveryContracts[] = { +#ifdef ENABLE_DNS_SERVICE_DISCOVERY + {DNSSERVICEDISCOVERY_CONTRACT_ID, &kDNSSERVICEDISCOVERY_CID}, +#endif + {DNSSERVICEINFO_CONTRACT_ID, &kDNSSERVICEINFO_CID}, + {nullptr}}; + +static const mozilla::Module::CategoryEntry knsDNSServiceDiscoveryCategories[] = + {{nullptr}}; + +static const mozilla::Module knsDNSServiceDiscoveryModule = { + mozilla::Module::kVersion, knsDNSServiceDiscoveryCIDs, + knsDNSServiceDiscoveryContracts, knsDNSServiceDiscoveryCategories}; + +NSMODULE_DEFN(nsDNSServiceDiscoveryModule) = &knsDNSServiceDiscoveryModule; diff --git a/netwerk/protocol/gio/components.conf b/netwerk/protocol/gio/components.conf deleted file mode 100644 index a8b9a50fb17e..000000000000 --- a/netwerk/protocol/gio/components.conf +++ /dev/null @@ -1,13 +0,0 @@ -# -*- 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': '{ee706783-3af8-4d19-9e84-e2ebfe213480}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=moz-gio'], - 'type': 'nsGIOProtocolHandler', - }, -] diff --git a/netwerk/protocol/gio/moz.build b/netwerk/protocol/gio/moz.build index 268d125dd3fc..7a45898537ca 100644 --- a/netwerk/protocol/gio/moz.build +++ b/netwerk/protocol/gio/moz.build @@ -8,10 +8,6 @@ SOURCES += [ 'nsGIOProtocolHandler.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - FINAL_LIBRARY = 'xul' CXXFLAGS += CONFIG['TK_CFLAGS'] diff --git a/netwerk/protocol/gio/nsGIOProtocolHandler.cpp b/netwerk/protocol/gio/nsGIOProtocolHandler.cpp index c34f209aee55..85ef0ab9ba05 100644 --- a/netwerk/protocol/gio/nsGIOProtocolHandler.cpp +++ b/netwerk/protocol/gio/nsGIOProtocolHandler.cpp @@ -7,7 +7,7 @@ * This code is based on original Mozilla gnome-vfs extension. It implements * input stream provided by GVFS/GIO. */ -#include "mozilla/Components.h" +#include "mozilla/ModuleUtils.h" #include "mozilla/NullPrincipal.h" #include "nsIPrefService.h" #include "nsIPrefBranch.h" @@ -32,8 +32,6 @@ #include #include -using namespace mozilla; - #define MOZ_GIO_SCHEME "moz-gio" #define MOZ_GIO_SUPPORTED_PROTOCOLS "network.gio.supported-protocols" @@ -847,14 +845,6 @@ class nsGIOProtocolHandler final : public nsIProtocolHandler, NS_IMPL_ISUPPORTS(nsGIOProtocolHandler, nsIProtocolHandler, nsIObserver) -NS_IMPL_COMPONENT_FACTORY(nsGIOProtocolHandler) { - auto inst = MakeRefPtr(); - if (NS_SUCCEEDED(inst->Init())) { - return inst.forget().downcast(); - } - return nullptr; -} - nsresult nsGIOProtocolHandler::Init() { nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); if (prefs) { @@ -1023,3 +1013,30 @@ nsGIOProtocolHandler::Observe(nsISupports *aSubject, const char *aTopic, } return NS_OK; } + +//----------------------------------------------------------------------------- + +#define NS_GIOPROTOCOLHANDLER_CID \ + { /* ee706783-3af8-4d19-9e84-e2ebfe213480 */ \ + 0xee706783, 0x3af8, 0x4d19, { \ + 0x9e, 0x84, 0xe2, 0xeb, 0xfe, 0x21, 0x34, 0x80 \ + } \ + } + +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGIOProtocolHandler, Init) +NS_DEFINE_NAMED_CID(NS_GIOPROTOCOLHANDLER_CID); + +static const mozilla::Module::CIDEntry kVFSCIDs[] = { + {&kNS_GIOPROTOCOLHANDLER_CID, false, nullptr, + nsGIOProtocolHandlerConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kVFSContracts[] = { + {NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX MOZ_GIO_SCHEME, + &kNS_GIOPROTOCOLHANDLER_CID}, + {nullptr}}; + +static const mozilla::Module kVFSModule = {mozilla::Module::kVersion, kVFSCIDs, + kVFSContracts}; + +NSMODULE_DEFN(nsGIOModule) = &kVFSModule; diff --git a/netwerk/protocol/http/UAOverridesBootstrapper.jsm b/netwerk/protocol/http/UAOverridesBootstrapper.js similarity index 83% rename from netwerk/protocol/http/UAOverridesBootstrapper.jsm rename to netwerk/protocol/http/UAOverridesBootstrapper.js index 26672ea49847..7f1467621a25 100644 --- a/netwerk/protocol/http/UAOverridesBootstrapper.jsm +++ b/netwerk/protocol/http/UAOverridesBootstrapper.js @@ -4,6 +4,7 @@ "use strict"; +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); const {UserAgentOverrides} = ChromeUtils.import("resource://gre/modules/UserAgentOverrides.jsm"); @@ -28,4 +29,5 @@ UAOverridesBootstrapper.prototype = { classID: Components.ID("{965b0ca8-155b-11e7-93ae-92361f002671}"), }; -var EXPORTED_SYMBOLS = ["UAOverridesBootstrapper"]; +const components = [UAOverridesBootstrapper]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components); diff --git a/netwerk/protocol/http/UAOverridesBootstrapper.manifest b/netwerk/protocol/http/UAOverridesBootstrapper.manifest new file mode 100644 index 000000000000..979095949ee3 --- /dev/null +++ b/netwerk/protocol/http/UAOverridesBootstrapper.manifest @@ -0,0 +1,3 @@ +# UAOverridesBootstrapper.js +component {965b0ca8-155b-11e7-93ae-92361f002671} UAOverridesBootstrapper.js process=main +contract @mozilla.org/network/ua-overrides-bootstrapper;1 {965b0ca8-155b-11e7-93ae-92361f002671} process=main diff --git a/netwerk/protocol/http/WellKnownOpportunisticUtils.jsm b/netwerk/protocol/http/WellKnownOpportunisticUtils.js similarity index 64% rename from netwerk/protocol/http/WellKnownOpportunisticUtils.jsm rename to netwerk/protocol/http/WellKnownOpportunisticUtils.js index d4854f42916a..dcbca96a3711 100644 --- a/netwerk/protocol/http/WellKnownOpportunisticUtils.jsm +++ b/netwerk/protocol/http/WellKnownOpportunisticUtils.js @@ -5,6 +5,11 @@ "use strict"; +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); + +const WELLKNOWNOPPORTUNISTICUTILS_CONTRACTID = "@mozilla.org/network/well-known-opportunistic-utils;1"; +const WELLKNOWNOPPORTUNISTICUTILS_CID = Components.ID("{b4f96c89-5238-450c-8bda-e12c26f1d150}"); + function WellKnownOpportunisticUtils() { this.valid = false; this.mixed = false; @@ -12,6 +17,9 @@ function WellKnownOpportunisticUtils() { } WellKnownOpportunisticUtils.prototype = { + classID: WELLKNOWNOPPORTUNISTICUTILS_CID, + contractID: WELLKNOWNOPPORTUNISTICUTILS_CONTRACTID, + classDescription: "Well-Known Opportunistic Utils", QueryInterface: ChromeUtils.generateQI([Ci.nsIWellKnownOpportunisticUtils]), verify(aJSON, aOrigin, aAlternatePort) { @@ -30,4 +38,4 @@ WellKnownOpportunisticUtils.prototype = { }, }; -var EXPORTED_SYMBOLS = ["WellKnownOpportunisticUtils"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([WellKnownOpportunisticUtils]); diff --git a/netwerk/protocol/http/WellKnownOpportunisticUtils.manifest b/netwerk/protocol/http/WellKnownOpportunisticUtils.manifest new file mode 100644 index 000000000000..645358e43542 --- /dev/null +++ b/netwerk/protocol/http/WellKnownOpportunisticUtils.manifest @@ -0,0 +1,3 @@ +# WellKnownOpportunisticUtils.js +component {b4f96c89-5238-450c-8bda-e12c26f1d150} WellKnownOpportunisticUtils.js +contract @mozilla.org/network/well-known-opportunistic-utils;1 {b4f96c89-5238-450c-8bda-e12c26f1d150} diff --git a/netwerk/protocol/http/components.conf b/netwerk/protocol/http/components.conf deleted file mode 100644 index d91e9741510e..000000000000 --- a/netwerk/protocol/http/components.conf +++ /dev/null @@ -1,21 +0,0 @@ -# -*- 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': '{965b0ca8-155b-11e7-93ae-92361f002671}', - 'contract_ids': ['@mozilla.org/network/ua-overrides-bootstrapper;1'], - 'jsm': 'resource://gre/modules/UAOverridesBootstrapper.jsm', - 'constructor': 'UAOverridesBootstrapper', - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - { - 'cid': '{b4f96c89-5238-450c-8bda-e12c26f1d150}', - 'contract_ids': ['@mozilla.org/network/well-known-opportunistic-utils;1'], - 'jsm': 'resource://gre/modules/WellKnownOpportunisticUtils.jsm', - 'constructor': 'WellKnownOpportunisticUtils', - }, -] diff --git a/netwerk/protocol/http/moz.build b/netwerk/protocol/http/moz.build index ed43baba1a32..73a475882e9a 100644 --- a/netwerk/protocol/http/moz.build +++ b/netwerk/protocol/http/moz.build @@ -138,13 +138,11 @@ LOCAL_INCLUDES += [ '/netwerk/url-classifier', ] -EXTRA_JS_MODULES += [ - 'UAOverridesBootstrapper.jsm', - 'WellKnownOpportunisticUtils.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'UAOverridesBootstrapper.js', + 'UAOverridesBootstrapper.manifest', + 'WellKnownOpportunisticUtils.js', + 'WellKnownOpportunisticUtils.manifest', ] if CONFIG['OS_TARGET'] == 'Darwin': diff --git a/parser/htmlparser/components.conf b/parser/htmlparser/components.conf deleted file mode 100644 index bf00428c4055..000000000000 --- a/parser/htmlparser/components.conf +++ /dev/null @@ -1,20 +0,0 @@ -# -*- 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 = [ - 'nsHTMLTags.h', -] - -UnloadFunc = 'nsHTMLTags::ReleaseTable' - -Classes = [ - { - 'cid': '{2ce606b0-bee6-11d1-aad9-00805f8a3e14}', - 'contract_ids': [], - 'type': 'nsParser', - 'headers': ['/parser/htmlparser/nsParser.h'], - }, -] diff --git a/parser/htmlparser/moz.build b/parser/htmlparser/moz.build index a582f967de8f..46d61831431d 100644 --- a/parser/htmlparser/moz.build +++ b/parser/htmlparser/moz.build @@ -46,10 +46,6 @@ UNIFIED_SOURCES += [ 'nsScannerString.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - FINAL_LIBRARY = 'xul' if CONFIG['CC_TYPE'] in ('clang', 'gcc'): diff --git a/python/mozbuild/mozbuild/test/codecoverage/test_lcov_rewrite.py b/python/mozbuild/mozbuild/test/codecoverage/test_lcov_rewrite.py index b1b72438a6d4..90e4f2b5268f 100644 --- a/python/mozbuild/mozbuild/test/codecoverage/test_lcov_rewrite.py +++ b/python/mozbuild/mozbuild/test/codecoverage/test_lcov_rewrite.py @@ -289,6 +289,10 @@ class TestUrlFinder(unittest.TestCase): 'path1', None ], + 'dist/bin/browser/components/nsBrowserGlue.js': [ + 'path2', + None + ], 'dist/bin/browser/features/firefox@getpocket.com/bootstrap.js': [ 'path4', None @@ -330,6 +334,7 @@ class TestUrlFinder(unittest.TestCase): paths = [ ('jar:file:///home/worker/workspace/build/application/' + app_name + '/' + omnijar_name + '!/components/MainProcessSingleton.js', 'path1'), + ('jar:file:///home/worker/workspace/build/application/' + app_name + '/browser/' + omnijar_name + '!/components/nsBrowserGlue.js', 'path2'), ('jar:file:///home/worker/workspace/build/application/' + app_name + '/browser/features/firefox@getpocket.com.xpi!/bootstrap.js', 'path4'), ] diff --git a/security/manager/pki/components.conf b/security/manager/pki/components.conf deleted file mode 100644 index 4850e1f17d8d..000000000000 --- a/security/manager/pki/components.conf +++ /dev/null @@ -1,27 +0,0 @@ -# -*- 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': '{4bfaa9f0-1dd2-11b2-afae-a82cbaa0b606}', - 'contract_ids': ['@mozilla.org/security/nsASN1Tree;1'], - 'type': 'nsNSSASN1Tree', - 'headers': ['/security/manager/pki/nsASN1Tree.h'], - }, - { - 'cid': '{518e071f-1dd2-11b2-937e-c45f14def778}', - 'contract_ids': [ - '@mozilla.org/nsCertificateDialogs;1', - '@mozilla.org/nsClientAuthDialogs;1', - '@mozilla.org/nsGeneratingKeypairInfoDialogs;1', - '@mozilla.org/nsTokenDialogs;1', - '@mozilla.org/nsTokenPasswordDialogs;1', - ], - 'type': 'nsNSSDialogs', - 'headers': ['/security/manager/pki/nsNSSDialogs.h'], - 'init_method': 'Init', - }, -] diff --git a/security/manager/pki/moz.build b/security/manager/pki/moz.build index 93e5205f3a40..7c3081d4ca61 100644 --- a/security/manager/pki/moz.build +++ b/security/manager/pki/moz.build @@ -16,10 +16,7 @@ UNIFIED_SOURCES += [ 'nsASN1Tree.cpp', 'nsNSSDialogHelper.cpp', 'nsNSSDialogs.cpp', -] - -XPCOM_MANIFESTS += [ - 'components.conf', + 'nsPKIModule.cpp', ] LOCAL_INCLUDES += [ diff --git a/security/manager/pki/nsPKIModule.cpp b/security/manager/pki/nsPKIModule.cpp new file mode 100644 index 000000000000..ca081ad09dad --- /dev/null +++ b/security/manager/pki/nsPKIModule.cpp @@ -0,0 +1,34 @@ +/* -*- 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 "mozilla/ModuleUtils.h" +#include "nsASN1Tree.h" +#include "nsNSSDialogs.h" + +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNSSDialogs, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsNSSASN1Tree) + +NS_DEFINE_NAMED_CID(NS_NSSDIALOGS_CID); +NS_DEFINE_NAMED_CID(NS_NSSASN1OUTINER_CID); + +static const mozilla::Module::CIDEntry kPKICIDs[] = { + {&kNS_NSSDIALOGS_CID, false, nullptr, nsNSSDialogsConstructor}, + {&kNS_NSSASN1OUTINER_CID, false, nullptr, nsNSSASN1TreeConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kPKIContracts[] = { + {NS_TOKENPASSWORDSDIALOG_CONTRACTID, &kNS_NSSDIALOGS_CID}, + {NS_CERTIFICATEDIALOGS_CONTRACTID, &kNS_NSSDIALOGS_CID}, + {NS_CLIENTAUTHDIALOGS_CONTRACTID, &kNS_NSSDIALOGS_CID}, + {NS_TOKENDIALOGS_CONTRACTID, &kNS_NSSDIALOGS_CID}, + {NS_GENERATINGKEYPAIRINFODIALOGS_CONTRACTID, &kNS_NSSDIALOGS_CID}, + {NS_ASN1TREE_CONTRACTID, &kNS_NSSASN1OUTINER_CID}, + {nullptr}}; + +static const mozilla::Module kPKIModule = {mozilla::Module::kVersion, kPKICIDs, + kPKIContracts}; + +NSMODULE_DEFN(PKI) = &kPKIModule; diff --git a/security/sandbox/common/SandboxSettings.cpp b/security/sandbox/common/SandboxSettings.cpp index 7e437953e264..11c55d3cdb20 100644 --- a/security/sandbox/common/SandboxSettings.cpp +++ b/security/sandbox/common/SandboxSettings.cpp @@ -6,13 +6,11 @@ #include "mozISandboxSettings.h" -#include "mozilla/Components.h" +#include "mozilla/ModuleUtils.h" #include "mozilla/Preferences.h" #include "prenv.h" -using namespace mozilla; - namespace mozilla { int GetEffectiveContentSandboxLevel() { @@ -74,9 +72,20 @@ NS_IMETHODIMP SandboxSettings::GetEffectiveContentSandboxLevel( return NS_OK; } +NS_GENERIC_FACTORY_CONSTRUCTOR(SandboxSettings) + +NS_DEFINE_NAMED_CID(MOZ_SANDBOX_SETTINGS_CID); + +static const mozilla::Module::CIDEntry kSandboxSettingsCIDs[] = { + {&kMOZ_SANDBOX_SETTINGS_CID, false, nullptr, SandboxSettingsConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kSandboxSettingsContracts[] = { + {MOZ_SANDBOX_SETTINGS_CONTRACTID, &kMOZ_SANDBOX_SETTINGS_CID}, {nullptr}}; + +static const mozilla::Module kSandboxSettingsModule = { + mozilla::Module::kVersion, kSandboxSettingsCIDs, kSandboxSettingsContracts}; + +NSMODULE_DEFN(SandboxSettingsModule) = &kSandboxSettingsModule; + } // namespace mozilla - - -NS_IMPL_COMPONENT_FACTORY(mozISandboxSettings) { - return MakeAndAddRef().downcast(); -} diff --git a/security/sandbox/common/components.conf b/security/sandbox/common/components.conf deleted file mode 100644 index fe8b07ca9699..000000000000 --- a/security/sandbox/common/components.conf +++ /dev/null @@ -1,13 +0,0 @@ -# -*- 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': '{5516303d-9007-45a0-94b9-940ef134a6e2}', - 'contract_ids': ['@mozilla.org/sandbox/sandbox-settings;1'], - 'type': 'mozISandboxSettings', - }, -] diff --git a/security/sandbox/common/moz.build b/security/sandbox/common/moz.build index 10c1cf63f8f7..a2fcba4cad22 100644 --- a/security/sandbox/common/moz.build +++ b/security/sandbox/common/moz.build @@ -9,10 +9,6 @@ with Files('**'): UNIFIED_SOURCES += ['SandboxSettings.cpp'] -XPCOM_MANIFESTS += [ - 'components.conf', -] - XPIDL_SOURCES += [ 'mozISandboxSettings.idl', ] diff --git a/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp b/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp index d2d64037f452..4db5b3a31915 100644 --- a/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp +++ b/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp @@ -10,14 +10,12 @@ #include #include "mozilla/Assertions.h" -#include "mozilla/Components.h" +#include "mozilla/ModuleUtils.h" #include "nsCOMPtr.h" #include "nsPrintfCString.h" #include "nsTArray.h" #include "nsXULAppAPI.h" -using namespace mozilla; - namespace mozilla { class SandboxReportWrapper final : public mozISandboxReport { @@ -183,8 +181,21 @@ NS_IMETHODIMP SandboxReporterWrapper::Snapshot( return NS_OK; } -} // namespace mozilla +NS_GENERIC_FACTORY_CONSTRUCTOR(SandboxReporterWrapper) -NS_IMPL_COMPONENT_FACTORY(mozISandboxReporter) { - return MakeAndAddRef().downcast(); -} +NS_DEFINE_NAMED_CID(MOZ_SANDBOX_REPORTER_CID); + +static const mozilla::Module::CIDEntry kSandboxReporterCIDs[] = { + {&kMOZ_SANDBOX_REPORTER_CID, false, nullptr, + SandboxReporterWrapperConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kSandboxReporterContracts[] = { + {MOZ_SANDBOX_REPORTER_CONTRACTID, &kMOZ_SANDBOX_REPORTER_CID}, {nullptr}}; + +static const mozilla::Module kSandboxReporterModule = { + mozilla::Module::kVersion, kSandboxReporterCIDs, kSandboxReporterContracts}; + +NSMODULE_DEFN(SandboxReporterModule) = &kSandboxReporterModule; + +} // namespace mozilla diff --git a/security/sandbox/linux/reporter/components.conf b/security/sandbox/linux/reporter/components.conf deleted file mode 100644 index 7bd278f3498e..000000000000 --- a/security/sandbox/linux/reporter/components.conf +++ /dev/null @@ -1,13 +0,0 @@ -# -*- 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': '{5118a6f9-2493-4f97-9552-620663e03cb3}', - 'contract_ids': ['@mozilla.org/sandbox/syscall-reporter;1'], - 'type': 'mozISandboxReporter', - }, -] diff --git a/security/sandbox/linux/reporter/moz.build b/security/sandbox/linux/reporter/moz.build index 0a9c5cf3de50..5244b494d8fc 100644 --- a/security/sandbox/linux/reporter/moz.build +++ b/security/sandbox/linux/reporter/moz.build @@ -14,10 +14,6 @@ SOURCES += [ 'SandboxReporterWrappers.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - LOCAL_INCLUDES += [ '/security/sandbox/linux', # SandboxLogging.h ] diff --git a/services/crypto/component/IdentityCryptoService.cpp b/services/crypto/component/IdentityCryptoService.cpp index de1f7032753d..11668c579ec4 100644 --- a/services/crypto/component/IdentityCryptoService.cpp +++ b/services/crypto/component/IdentityCryptoService.cpp @@ -5,6 +5,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsIIdentityCryptoService.h" +#include "mozilla/ModuleUtils.h" #include "nsServiceManagerUtils.h" #include "nsIThread.h" #include "nsThreadUtils.h" @@ -13,7 +14,6 @@ #include "nsString.h" #include "mozilla/ArrayUtils.h" // ArrayLength #include "mozilla/Base64.h" -#include "mozilla/Components.h" #include "ScopedNSSTypes.h" #include "NSSErrorsService.h" @@ -449,14 +449,31 @@ SignRunnable::Run() { return NS_OK; } -} // unnamed namespace // XPCOM module registration -NS_IMPL_COMPONENT_FACTORY(nsIIdentityCryptoService) { - auto inst = MakeRefPtr(); - if (NS_SUCCEEDED(inst->Init())) { - return inst.forget().downcast(); +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(IdentityCryptoService, Init) + +#define NS_IDENTITYCRYPTOSERVICE_CID \ + { \ + 0xbea13a3a, 0x44e8, 0x4d7f, { \ + 0xa0, 0xa2, 0x2c, 0x67, 0xf8, 0x4e, 0x3a, 0x97 \ + } \ } - return nullptr; -} + +NS_DEFINE_NAMED_CID(NS_IDENTITYCRYPTOSERVICE_CID); + +const mozilla::Module::CIDEntry kCIDs[] = { + {&kNS_IDENTITYCRYPTOSERVICE_CID, false, nullptr, + IdentityCryptoServiceConstructor}, + {nullptr}}; + +const mozilla::Module::ContractIDEntry kContracts[] = { + {"@mozilla.org/identity/crypto-service;1", &kNS_IDENTITYCRYPTOSERVICE_CID}, + {nullptr}}; + +const mozilla::Module kModule = {mozilla::Module::kVersion, kCIDs, kContracts}; + +} // unnamed namespace + +NSMODULE_DEFN(identity) = &kModule; diff --git a/services/crypto/component/components.conf b/services/crypto/component/components.conf deleted file mode 100644 index 49a4b74d7a54..000000000000 --- a/services/crypto/component/components.conf +++ /dev/null @@ -1,13 +0,0 @@ -# -*- 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': '{bea13a3a-44e8-4d7f-a0a2-2c67f84e3a97}', - 'contract_ids': ['@mozilla.org/identity/crypto-service;1'], - 'type': 'nsIIdentityCryptoService', - }, -] diff --git a/services/crypto/component/moz.build b/services/crypto/component/moz.build index b6db8c8fea8c..e91868118810 100644 --- a/services/crypto/component/moz.build +++ b/services/crypto/component/moz.build @@ -14,8 +14,4 @@ SOURCES += [ 'IdentityCryptoService.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - FINAL_LIBRARY = 'xul' diff --git a/services/fxaccounts/FxAccountsComponents.manifest b/services/fxaccounts/FxAccountsComponents.manifest new file mode 100644 index 000000000000..baa58d117ad0 --- /dev/null +++ b/services/fxaccounts/FxAccountsComponents.manifest @@ -0,0 +1,4 @@ +# FxAccountsPush.js +component {1b7db999-2ecd-4abf-bb95-a726896798ca} FxAccountsPush.js process=main +contract @mozilla.org/fxaccounts/push;1 {1b7db999-2ecd-4abf-bb95-a726896798ca} process=main +category push chrome://fxa-device-update @mozilla.org/fxaccounts/push;1 diff --git a/services/fxaccounts/FxAccountsPush.jsm b/services/fxaccounts/FxAccountsPush.js similarity index 96% rename from services/fxaccounts/FxAccountsPush.jsm rename to services/fxaccounts/FxAccountsPush.js index 3a4e3e0b5e64..ea0482d5dd05 100644 --- a/services/fxaccounts/FxAccountsPush.jsm +++ b/services/fxaccounts/FxAccountsPush.js @@ -2,9 +2,12 @@ * 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/. */ +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); const {FXA_PUSH_SCOPE_ACCOUNT_UPDATE, ONLOGOUT_NOTIFICATION, ON_ACCOUNT_DESTROYED_NOTIFICATION, ON_ACCOUNT_STATE_CHANGE_NOTIFICATION, ON_COLLECTION_CHANGED_NOTIFICATION, ON_COMMAND_RECEIVED_NOTIFICATION, ON_DEVICE_CONNECTED_NOTIFICATION, ON_DEVICE_DISCONNECTED_NOTIFICATION, ON_PASSWORD_CHANGED_NOTIFICATION, ON_PASSWORD_RESET_NOTIFICATION, ON_PROFILE_CHANGE_NOTIFICATION, ON_PROFILE_UPDATED_NOTIFICATION, ON_VERIFY_LOGIN_NOTIFICATION, log} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); +XPCOMUtils.defineLazyGlobalGetters(this, ["URL"]); + /** * FxAccountsPushService manages Push notifications for Firefox Accounts in the browser * @@ -265,4 +268,6 @@ FxAccountsPushService.prototype = { }, }; -var EXPORTED_SYMBOLS = ["FxAccountsPushService"]; +// Service registration below registers with FxAccountsComponents.manifest +const components = [FxAccountsPushService]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components); diff --git a/services/fxaccounts/components.conf b/services/fxaccounts/components.conf deleted file mode 100644 index 74fb0bcf3eb1..000000000000 --- a/services/fxaccounts/components.conf +++ /dev/null @@ -1,16 +0,0 @@ -# -*- 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': '{1b7db999-2ecd-4abf-bb95-a726896798ca}', - 'contract_ids': ['@mozilla.org/fxaccounts/push;1'], - 'jsm': 'resource://gre/modules/FxAccountsPush.jsm', - 'constructor': 'FxAccountsPushService', - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - 'categories': {'push': 'chrome://fxa-device-update'}, - }, -] diff --git a/services/fxaccounts/moz.build b/services/fxaccounts/moz.build index 46336b6c7317..3a4d0d9ba62a 100644 --- a/services/fxaccounts/moz.build +++ b/services/fxaccounts/moz.build @@ -15,6 +15,11 @@ BROWSER_CHROME_MANIFESTS += ['tests/browser/browser.ini'] XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell/xpcshell.ini'] +EXTRA_COMPONENTS += [ + 'FxAccountsComponents.manifest', + 'FxAccountsPush.js', +] + EXTRA_JS_MODULES += [ 'Credentials.jsm', 'FxAccounts.jsm', @@ -25,11 +30,6 @@ EXTRA_JS_MODULES += [ 'FxAccountsOAuthGrantClient.jsm', 'FxAccountsProfile.jsm', 'FxAccountsProfileClient.jsm', - 'FxAccountsPush.jsm', 'FxAccountsStorage.jsm', 'FxAccountsWebChannel.jsm', ] - -XPCOM_MANIFESTS += [ - 'components.conf', -] diff --git a/services/fxaccounts/tests/xpcshell/test_push_service.js b/services/fxaccounts/tests/xpcshell/test_push_service.js index 046d0d5bc89b..8396a16ecf4e 100644 --- a/services/fxaccounts/tests/xpcshell/test_push_service.js +++ b/services/fxaccounts/tests/xpcshell/test_push_service.js @@ -11,7 +11,7 @@ const {FXA_PUSH_SCOPE_ACCOUNT_UPDATE, ONLOGOUT_NOTIFICATION, ON_ACCOUNT_DESTROYED_NOTIFICATION, ON_DEVICE_CONNECTED_NOTIFICATION, ON_DEVICE_DISCONNECTED_NOTIFICATION, ON_PASSWORD_CHANGED_NOTIFICATION, ON_PASSWORD_RESET_NOTIFICATION, ON_PROFILE_CHANGE_NOTIFICATION, ON_PROFILE_UPDATED_NOTIFICATION, ON_VERIFY_LOGIN_NOTIFICATION, log} = ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js"); let importScope = {}; -Services.scriptloader.loadSubScript("resource://gre/modules/FxAccountsPush.jsm", importScope); +Services.scriptloader.loadSubScript("resource://gre/components/FxAccountsPush.js", importScope); const FxAccountsPushService = importScope.FxAccountsPushService; XPCOMUtils.defineLazyServiceGetter(this, "pushService", diff --git a/services/settings/RemoteSettingsComponents.jsm b/services/settings/RemoteSettingsComponents.js similarity index 84% rename from services/settings/RemoteSettingsComponents.jsm rename to services/settings/RemoteSettingsComponents.js index 050494e16489..27d059672220 100644 --- a/services/settings/RemoteSettingsComponents.jsm +++ b/services/settings/RemoteSettingsComponents.js @@ -7,6 +7,7 @@ var EXPORTED_SYMBOLS = [ "RemoteSettingsTimer", ]; +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); ChromeUtils.defineModuleGetter(this, "RemoteSettings", "resource://services-settings/remote-settings.js"); @@ -23,3 +24,5 @@ RemoteSettingsTimer.prototype = { .catch(e => Cu.reportError(e)); }, }; + +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RemoteSettingsTimer]); diff --git a/services/settings/components.conf b/services/settings/components.conf deleted file mode 100644 index 9a737802eeab..000000000000 --- a/services/settings/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{5e756573-234a-49ea-bbe4-59ec7a70657d}', - 'contract_ids': ['@mozilla.org/services/settings;1'], - 'jsm': 'resource://services-settings/RemoteSettingsComponents.jsm', - 'constructor': 'RemoteSettingsTimer', - }, -] diff --git a/services/settings/moz.build b/services/settings/moz.build index a051352f0042..44ffe317d909 100644 --- a/services/settings/moz.build +++ b/services/settings/moz.build @@ -10,20 +10,16 @@ DIRS += [ ] EXTRA_COMPONENTS += [ + 'RemoteSettingsComponents.js', 'servicesSettings.manifest', ] EXTRA_JS_MODULES['services-settings'] += [ 'remote-settings.js', 'RemoteSettingsClient.jsm', - 'RemoteSettingsComponents.jsm', 'RemoteSettingsWorker.js', 'RemoteSettingsWorker.jsm', 'Utils.jsm', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] diff --git a/services/settings/servicesSettings.manifest b/services/settings/servicesSettings.manifest index b6502b8d34df..8e74e9af5a71 100644 --- a/services/settings/servicesSettings.manifest +++ b/services/settings/servicesSettings.manifest @@ -2,4 +2,6 @@ resource services-settings resource://gre/modules/services-settings/ # Schedule polling of remote settings changes +component {5e756573-234a-49ea-bbe4-59ec7a70657d} RemoteSettingsComponents.js +contract @mozilla.org/services/settings;1 {5e756573-234a-49ea-bbe4-59ec7a70657d} category update-timer RemoteSettingsComponents @mozilla.org/services/settings;1,getService,services-settings-poll-changes,services.settings.poll_interval,86400 diff --git a/services/sync/SyncComponents.manifest b/services/sync/SyncComponents.manifest index 68c36cd80f75..faeafd8b6d4b 100644 --- a/services/sync/SyncComponents.manifest +++ b/services/sync/SyncComponents.manifest @@ -1,3 +1,9 @@ +# Weave.js +component {74b89fb0-f200-4ae8-a3ec-dd164117f6de} Weave.js +contract @mozilla.org/weave/service;1 {74b89fb0-f200-4ae8-a3ec-dd164117f6de} +component {d28f8a0b-95da-48f4-b712-caf37097be41} Weave.js +contract @mozilla.org/network/protocol/about;1?what=sync-log {d28f8a0b-95da-48f4-b712-caf37097be41} + # Register resource aliases # (Note, for tests these are also set up in addResourceAlias) resource services-sync resource://gre/modules/services-sync/ diff --git a/services/sync/Weave.jsm b/services/sync/Weave.js similarity index 95% rename from services/sync/Weave.jsm rename to services/sync/Weave.js index 3b658050d108..ba02c3c70cc8 100644 --- a/services/sync/Weave.jsm +++ b/services/sync/Weave.js @@ -6,6 +6,9 @@ const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm") const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); ChromeUtils.defineModuleGetter(this, "FileUtils", "resource://gre/modules/FileUtils.jsm"); +XPCOMUtils.defineLazyGetter(this, "Utils", () => { + return ChromeUtils.import("resource://services-sync/util.js", {}).Utils; +}); XPCOMUtils.defineLazyPreferenceGetter(this, "syncUsername", "services.sync.username"); @@ -154,4 +157,5 @@ AboutWeaveLog.prototype = { }, }; -var EXPORTED_SYMBOLS = ["WeaveService", "AboutWeaveLog"]; +const components = [WeaveService, AboutWeaveLog]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components); diff --git a/services/sync/components.conf b/services/sync/components.conf deleted file mode 100644 index 9dae05ac2ba7..000000000000 --- a/services/sync/components.conf +++ /dev/null @@ -1,20 +0,0 @@ -# -*- 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': '{74b89fb0-f200-4ae8-a3ec-dd164117f6de}', - 'contract_ids': ['@mozilla.org/weave/service;1'], - 'jsm': 'resource://services-sync/Weave.jsm', - 'constructor': 'WeaveService', - }, - { - 'cid': '{d28f8a0b-95da-48f4-b712-caf37097be41}', - 'contract_ids': ['@mozilla.org/network/protocol/about;1?what=sync-log'], - 'jsm': 'resource://services-sync/Weave.jsm', - 'constructor': 'AboutWeaveLog', - }, -] diff --git a/services/sync/moz.build b/services/sync/moz.build index d86b3a49e104..4d1dcb50c531 100644 --- a/services/sync/moz.build +++ b/services/sync/moz.build @@ -13,6 +13,7 @@ XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini'] EXTRA_COMPONENTS += [ 'SyncComponents.manifest', + 'Weave.js', ] EXTRA_JS_MODULES['services-sync'] += [ @@ -38,7 +39,6 @@ EXTRA_JS_MODULES['services-sync'] += [ 'modules/telemetry.js', 'modules/UIState.jsm', 'modules/util.js', - 'Weave.jsm', ] EXTRA_JS_MODULES['services-sync'].engines += [ @@ -58,10 +58,6 @@ EXTRA_JS_MODULES['services-sync'].stages += [ 'modules/stages/enginesync.js', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - TESTING_JS_MODULES.services.sync += [ 'modules-testing/fakeservices.js', 'modules-testing/fxa_utils.js', diff --git a/storage/build/components.conf b/storage/build/components.conf deleted file mode 100644 index 13eb8b4bd9de..000000000000 --- a/storage/build/components.conf +++ /dev/null @@ -1,25 +0,0 @@ -# -*- 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': '{bbbb1d61-438f-4436-92ed-8308e5830fb0}', - 'contract_ids': ['@mozilla.org/storage/service;1'], - 'singleton': True, - 'type': 'mozilla::storage::Service', - 'headers': ['/storage/mozStorageService.h'], - 'constructor': 'mozilla::storage::Service::getSingleton', - }, - { - 'cid': '{3b667ee0-d2da-4ccc-9c3d-95f2ca6a8b4c}', - 'contract_ids': ['@mozilla.org/storage/vacuum;1'], - 'singleton': True, - 'type': 'mozilla::storage::VacuumManager', - 'headers': ['/storage/VacuumManager.h'], - 'constructor': 'mozilla::storage::VacuumManager::getSingleton', - 'categories': {'idle-daily': 'MozStorage Vacuum Manager'}, - }, -] diff --git a/storage/build/moz.build b/storage/build/moz.build index 27c61326d3d3..284cd7e3f574 100644 --- a/storage/build/moz.build +++ b/storage/build/moz.build @@ -8,10 +8,14 @@ EXPORTS += [ 'mozStorageCID.h', ] -XPCOM_MANIFESTS += [ - 'components.conf', +SOURCES += [ + 'mozStorageModule.cpp', ] FINAL_LIBRARY = 'xul' +LOCAL_INCLUDES += [ + '..', +] + CXXFLAGS += CONFIG['SQLITE_CFLAGS'] diff --git a/storage/build/mozStorageModule.cpp b/storage/build/mozStorageModule.cpp new file mode 100644 index 000000000000..e57c7e4a80a4 --- /dev/null +++ b/storage/build/mozStorageModule.cpp @@ -0,0 +1,48 @@ +/* -*- 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 "nsCOMPtr.h" +#include "mozilla/ModuleUtils.h" + +#include "mozStorageService.h" +#include "mozStorageConnection.h" +#include "VacuumManager.h" + +#include "mozStorageCID.h" + +namespace mozilla { +namespace storage { + +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Service, Service::getSingleton) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(VacuumManager, + VacuumManager::getSingleton) + +} // namespace storage +} // namespace mozilla + +NS_DEFINE_NAMED_CID(MOZ_STORAGE_SERVICE_CID); +NS_DEFINE_NAMED_CID(VACUUMMANAGER_CID); + +static const mozilla::Module::CIDEntry kStorageCIDs[] = { + {&kMOZ_STORAGE_SERVICE_CID, false, nullptr, + mozilla::storage::ServiceConstructor}, + {&kVACUUMMANAGER_CID, false, nullptr, + mozilla::storage::VacuumManagerConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kStorageContracts[] = { + {MOZ_STORAGE_SERVICE_CONTRACTID, &kMOZ_STORAGE_SERVICE_CID}, + {VACUUMMANAGER_CONTRACTID, &kVACUUMMANAGER_CID}, + {nullptr}}; + +static const mozilla::Module::CategoryEntry kStorageCategories[] = { + {"idle-daily", "MozStorage Vacuum Manager", VACUUMMANAGER_CONTRACTID}, + {nullptr}}; + +static const mozilla::Module kStorageModule = {mozilla::Module::kVersion, + kStorageCIDs, kStorageContracts, + kStorageCategories}; + +NSMODULE_DEFN(mozStorageModule) = &kStorageModule; diff --git a/testing/mochitest/tests/SimpleTest/MockObjects.js b/testing/mochitest/tests/SimpleTest/MockObjects.js index e8293bfd9f4b..3f9d0de9378f 100644 --- a/testing/mochitest/tests/SimpleTest/MockObjects.js +++ b/testing/mochitest/tests/SimpleTest/MockObjects.js @@ -33,7 +33,7 @@ MockObjectRegisterer.prototype = { * to ensure that unregister() is called. */ register: function MOR_register() { - if (this._originalCID) + if (this._originalFactory) throw new Exception("Invalid object state when calling register()"); // Define a factory that creates a new object using the given constructor. @@ -56,11 +56,13 @@ MockObjectRegisterer.prototype = { this._mockFactory = SpecialPowers.wrapCallbackObject(this._mockFactory); } - var retVal = SpecialPowers.swapFactoryRegistration(null, this._contractID, this._mockFactory); + var retVal = SpecialPowers.swapFactoryRegistration(null, this._contractID, this._mockFactory, this._originalFactory); if ('error' in retVal) { throw new Exception("ERROR: " + retVal.error); + } else if (!isChrome) { + this._originalFactory = SpecialPowers.wrap(retVal).originalFactory; } else { - this._originalCID = retVal.originalCID; + this._originalFactory = retVal.originalFactory; } }, @@ -68,14 +70,14 @@ MockObjectRegisterer.prototype = { * Restores the original factory. */ unregister: function MOR_unregister() { - if (!this._originalCID) + if (!this._originalFactory) throw new Exception("Invalid object state when calling unregister()"); // Free references to the mock factory. - SpecialPowers.swapFactoryRegistration(this._originalCID, this._contractID); + SpecialPowers.swapFactoryRegistration(null, this._contractID, this._originalFactory, this._mockFactory); // Allow registering a mock factory again later. - this._originalCID = null; + this._originalFactory = null; this._mockFactory = null; }, @@ -84,7 +86,7 @@ MockObjectRegisterer.prototype = { /** * The factory of the component being replaced. */ - _originalCID: null, + _originalFactory: null, /** * The nsIFactory that was automatically generated by this object. diff --git a/testing/specialpowers/content/MockColorPicker.jsm b/testing/specialpowers/content/MockColorPicker.jsm index 41cd85997510..6193ffb83c9a 100644 --- a/testing/specialpowers/content/MockColorPicker.jsm +++ b/testing/specialpowers/content/MockColorPicker.jsm @@ -13,7 +13,7 @@ const CONTRACT_ID = "@mozilla.org/colorpicker;1"; Cu.forcePermissiveCOWs(); var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); -var oldClassID = ""; +var oldClassID = "", oldFactory = null; var newClassID = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator).generateUUID(); var newFactory = function(window) { return { @@ -36,11 +36,16 @@ var MockColorPicker = { if (!registrar.isCIDRegistered(newClassID)) { try { oldClassID = registrar.contractIDToCID(CONTRACT_ID); + oldFactory = Cm.getClassObject(Cc[CONTRACT_ID], Ci.nsIFactory); } catch (ex) { oldClassID = ""; + oldFactory = null; dump("TEST-INFO | can't get colorpicker registered component, " + "assuming there is none"); } + if (oldClassID != "" && oldFactory != null) { + registrar.unregisterFactory(oldClassID, oldFactory); + } registrar.registerFactory(newClassID, "", CONTRACT_ID, this.factory); } }, @@ -58,8 +63,8 @@ var MockColorPicker = { this.factory = null; registrar.unregisterFactory(newClassID, previousFactory); - if (oldClassID != "") { - registrar.registerFactory(oldClassID, "", CONTRACT_ID, null); + if (oldClassID != "" && oldFactory != null) { + registrar.registerFactory(oldClassID, "", CONTRACT_ID, oldFactory); } }, }; diff --git a/testing/specialpowers/content/MockFilePicker.jsm b/testing/specialpowers/content/MockFilePicker.jsm index 27e7703233ca..42f5fdba5bd4 100644 --- a/testing/specialpowers/content/MockFilePicker.jsm +++ b/testing/specialpowers/content/MockFilePicker.jsm @@ -17,7 +17,7 @@ const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); Cu.forcePermissiveCOWs(); var registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar); -var oldClassID; +var oldClassID, oldFactory; var newClassID = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator).generateUUID(); var newFactory = function(window) { return { @@ -59,6 +59,8 @@ var MockFilePicker = { this.factory = newFactory(window); if (!registrar.isCIDRegistered(newClassID)) { oldClassID = registrar.contractIDToCID(CONTRACT_ID); + oldFactory = Cm.getClassObject(Cc[CONTRACT_ID], Ci.nsIFactory); + registrar.unregisterFactory(oldClassID, oldFactory); registrar.registerFactory(newClassID, "", CONTRACT_ID, this.factory); } }, @@ -82,9 +84,9 @@ var MockFilePicker = { var previousFactory = this.factory; this.reset(); this.factory = null; - if (oldClassID) { + if (oldFactory) { registrar.unregisterFactory(newClassID, previousFactory); - registrar.registerFactory(oldClassID, "", CONTRACT_ID, null); + registrar.registerFactory(oldClassID, "", CONTRACT_ID, oldFactory); } }, diff --git a/testing/specialpowers/content/specialpowersAPI.js b/testing/specialpowers/content/specialpowersAPI.js index 750af80899df..35ce5b25a0f0 100644 --- a/testing/specialpowers/content/specialpowersAPI.js +++ b/testing/specialpowers/content/specialpowersAPI.js @@ -1798,28 +1798,36 @@ SpecialPowersAPI.prototype = { return Services.clipboard.supportsSelectionClipboard(); }, - swapFactoryRegistration(cid, contractID, newFactory) { + swapFactoryRegistration(cid, contractID, newFactory, oldFactory) { newFactory = Cu.waiveXrays(newFactory); + oldFactory = Cu.waiveXrays(oldFactory); var componentRegistrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); - var currentCID = componentRegistrar.contractIDToCID(contractID); - var currentFactory = Components.manager.getClassObject(Cc[contractID], - Ci.nsIFactory); - if (cid) { - componentRegistrar.unregisterFactory(currentCID, currentFactory); - } else { - let uuidGenerator = Cc["@mozilla.org/uuid-generator;1"] - .getService(Ci.nsIUUIDGenerator); - cid = uuidGenerator.generateUUID(); + var unregisterFactory = newFactory; + var registerFactory = oldFactory; + + if (cid == null) { + if (contractID != null) { + cid = componentRegistrar.contractIDToCID(contractID); + oldFactory = Components.manager.getClassObject(Cc[contractID], + Ci.nsIFactory); + } else { + return {"error": "trying to register a new contract ID: Missing contractID"}; + } + + unregisterFactory = oldFactory; + registerFactory = newFactory; } + componentRegistrar.unregisterFactory(cid, + unregisterFactory); // Restore the original factory. componentRegistrar.registerFactory(cid, "", contractID, - newFactory); - return {"originalCID": currentCID}; + registerFactory); + return {"cid": cid, "originalFactory": oldFactory}; }, _getElement(aWindow, id) { diff --git a/testing/xpcshell/head.js b/testing/xpcshell/head.js index 8a1fa0485494..0eeb0d289bed 100644 --- a/testing/xpcshell/head.js +++ b/testing/xpcshell/head.js @@ -231,11 +231,6 @@ function _do_quit() { _quit = true; } -// This is useless, except to the extent that it has the side-effect of -// initializing the widget module, which some tests unfortunately -// accidentally rely on. -void Cc["@mozilla.org/widget/transferable;1"].createInstance(); - /** * Overrides idleService with a mock. Idle is commonly used for maintenance * tasks, thus if a test uses a service that requires the idle service, it will @@ -257,6 +252,12 @@ var _fakeIdleService = { activate: function FIS_activate() { if (!this.originalCID) { + // This is useless, except to the extent that it has the + // side-effect of initializing the widget module, which some + // callers unfortunately accidentally rely on. + void Components.manager.getClassObject(Cc[this.contractID], + Ci.nsIFactory); + this.originalCID = this.registrar.contractIDToCID(this.contractID); // Replace with the mock. this.registrar.registerFactory(this.CID, "Fake Idle Service", diff --git a/toolkit/components/asyncshutdown/components.conf b/toolkit/components/asyncshutdown/components.conf deleted file mode 100644 index 37a8539cff09..000000000000 --- a/toolkit/components/asyncshutdown/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{35c496de-a115-475d-93b5-ffa3f3ae6fe3}', - 'contract_ids': ['@mozilla.org/async-shutdown-service;1'], - 'jsm': 'resource://gre/modules/nsAsyncShutdown.jsm', - 'constructor': 'nsAsyncShutdownService', - }, -] diff --git a/toolkit/components/asyncshutdown/moz.build b/toolkit/components/asyncshutdown/moz.build index de601f409c8c..79a4c44c7009 100644 --- a/toolkit/components/asyncshutdown/moz.build +++ b/toolkit/components/asyncshutdown/moz.build @@ -14,11 +14,11 @@ XPIDL_SOURCES += [ EXTRA_JS_MODULES += [ 'AsyncShutdown.jsm', - 'nsAsyncShutdown.jsm', ] -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'nsAsyncShutdown.js', + 'nsAsyncShutdown.manifest', ] with Files('**'): diff --git a/toolkit/components/asyncshutdown/nsAsyncShutdown.jsm b/toolkit/components/asyncshutdown/nsAsyncShutdown.js similarity index 92% rename from toolkit/components/asyncshutdown/nsAsyncShutdown.jsm rename to toolkit/components/asyncshutdown/nsAsyncShutdown.js index 1f544f3939ae..89e983b87003 100644 --- a/toolkit/components/asyncshutdown/nsAsyncShutdown.jsm +++ b/toolkit/components/asyncshutdown/nsAsyncShutdown.js @@ -8,6 +8,7 @@ "use strict"; +var XPCOMUtils = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm", {}).XPCOMUtils; ChromeUtils.defineModuleGetter(this, "AsyncShutdown", "resource://gre/modules/AsyncShutdown.jsm"); @@ -173,7 +174,9 @@ nsAsyncShutdownClient.prototype = { return this._moduleClient.removeBlocker(moduleBlocker); }, + /* ........ QueryInterface .............. */ QueryInterface: ChromeUtils.generateQI([Ci.nsIAsyncShutdownBarrier]), + classID: Components.ID("{314e9e96-cc37-4d5c-843b-54709ce11426}"), }; /** @@ -203,7 +206,9 @@ nsAsyncShutdownBarrier.prototype = { // By specification, _moduleBarrier.wait() cannot reject. }, + /* ........ QueryInterface .............. */ QueryInterface: ChromeUtils.generateQI([Ci.nsIAsyncShutdownBarrier]), + classID: Components.ID("{29a0e8b5-9111-4c09-a0eb-76cd02bf20fa}"), }; function nsAsyncShutdownService() { @@ -248,7 +253,14 @@ nsAsyncShutdownService.prototype = { return new nsAsyncShutdownBarrier(new AsyncShutdown.Barrier(name)); }, + /* ........ QueryInterface .............. */ QueryInterface: ChromeUtils.generateQI([Ci.nsIAsyncShutdownService]), + classID: Components.ID("{35c496de-a115-475d-93b5-ffa3f3ae6fe3}"), }; -var EXPORTED_SYMBOLS = ["nsAsyncShutdownService"]; + +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ + nsAsyncShutdownService, + nsAsyncShutdownBarrier, + nsAsyncShutdownClient, +]); diff --git a/toolkit/components/asyncshutdown/nsAsyncShutdown.manifest b/toolkit/components/asyncshutdown/nsAsyncShutdown.manifest new file mode 100644 index 000000000000..67f247902ff0 --- /dev/null +++ b/toolkit/components/asyncshutdown/nsAsyncShutdown.manifest @@ -0,0 +1,2 @@ +component {35c496de-a115-475d-93b5-ffa3f3ae6fe3} nsAsyncShutdown.js +contract @mozilla.org/async-shutdown-service;1 {35c496de-a115-475d-93b5-ffa3f3ae6fe3} diff --git a/toolkit/components/autocomplete/components.conf b/toolkit/components/autocomplete/components.conf deleted file mode 100644 index 432a6309edee..000000000000 --- a/toolkit/components/autocomplete/components.conf +++ /dev/null @@ -1,20 +0,0 @@ -# -*- 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 7b3133e31125..f3817d642ea0 100644 --- a/toolkit/components/autocomplete/moz.build +++ b/toolkit/components/autocomplete/moz.build @@ -22,10 +22,6 @@ 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 25c9a3526894..de2d4ea2b2b8 100644 --- a/toolkit/components/autocomplete/nsAutoCompleteController.cpp +++ b/toolkit/components/autocomplete/nsAutoCompleteController.cpp @@ -9,12 +9,14 @@ #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" @@ -1756,3 +1758,26 @@ 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 ddc687d65961..4bc70a82fcc8 100644 --- a/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp +++ b/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp @@ -16,6 +16,28 @@ 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 14d5cd885a7a..eb8a9610d8c1 100644 --- a/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h +++ b/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h @@ -13,27 +13,7 @@ #include "nsTArray.h" #include "mozilla/Attributes.h" -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; -}; +struct AutoCompleteSimpleResultMatch; class nsAutoCompleteSimpleResult final : public nsIAutoCompleteSimpleResult { public: diff --git a/toolkit/components/backgroundhangmonitor/BHRTelemetryService.jsm b/toolkit/components/backgroundhangmonitor/BHRTelemetryService.js similarity index 96% rename from toolkit/components/backgroundhangmonitor/BHRTelemetryService.jsm rename to toolkit/components/backgroundhangmonitor/BHRTelemetryService.js index bb7bfd2846a9..d826c07be0bb 100644 --- a/toolkit/components/backgroundhangmonitor/BHRTelemetryService.jsm +++ b/toolkit/components/backgroundhangmonitor/BHRTelemetryService.js @@ -4,6 +4,7 @@ "use strict"; +ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm", this); ChromeUtils.import("resource://gre/modules/Services.jsm", this); ChromeUtils.defineModuleGetter(this, "TelemetryController", @@ -122,4 +123,4 @@ BHRTelemetryService.prototype = Object.freeze({ }, }); -var EXPORTED_SYMBOLS = ["BHRTelemetryService"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([BHRTelemetryService]); diff --git a/toolkit/components/backgroundhangmonitor/BHRTelemetryService.manifest b/toolkit/components/backgroundhangmonitor/BHRTelemetryService.manifest new file mode 100644 index 000000000000..ab768a36f063 --- /dev/null +++ b/toolkit/components/backgroundhangmonitor/BHRTelemetryService.manifest @@ -0,0 +1,3 @@ +component {117c8cdf-69e6-4f31-a439-b8a654c67127} BHRTelemetryService.js process=main +contract @mozilla.org/bhr-telemetry-service;1 {117c8cdf-69e6-4f31-a439-b8a654c67127} process=main +category profile-after-change BHRTelemetryService @mozilla.org/bhr-telemetry-service;1 process=main \ No newline at end of file diff --git a/toolkit/components/backgroundhangmonitor/components.conf b/toolkit/components/backgroundhangmonitor/components.conf deleted file mode 100644 index aec771b006f9..000000000000 --- a/toolkit/components/backgroundhangmonitor/components.conf +++ /dev/null @@ -1,16 +0,0 @@ -# -*- 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': '{117c8cdf-69e6-4f31-a439-b8a654c67127}', - 'contract_ids': ['@mozilla.org/bhr-telemetry-service;1'], - 'jsm': 'resource://gre/modules/BHRTelemetryService.jsm', - 'constructor': 'BHRTelemetryService', - 'categories': {'profile-after-change': 'BHRTelemetryService'}, - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, -] diff --git a/toolkit/components/backgroundhangmonitor/moz.build b/toolkit/components/backgroundhangmonitor/moz.build index d9ea26a5fedf..217f03289ed0 100644 --- a/toolkit/components/backgroundhangmonitor/moz.build +++ b/toolkit/components/backgroundhangmonitor/moz.build @@ -18,12 +18,9 @@ if CONFIG['NIGHTLY_BUILD'] and \ not CONFIG['MOZ_ASAN']: DEFINES['MOZ_ENABLE_BACKGROUND_HANG_MONITOR'] = 1 - EXTRA_JS_MODULES += [ - 'BHRTelemetryService.jsm', - ] - - XPCOM_MANIFESTS += [ - 'components.conf', + EXTRA_COMPONENTS += [ + 'BHRTelemetryService.js', + 'BHRTelemetryService.manifest', ] XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell.ini'] diff --git a/toolkit/components/browser/build/components.conf b/toolkit/components/browser/build/components.conf deleted file mode 100644 index a0bdb1303c68..000000000000 --- a/toolkit/components/browser/build/components.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -*- 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 1be5545b6a65..cdd0f5a7600e 100644 --- a/toolkit/components/browser/build/moz.build +++ b/toolkit/components/browser/build/moz.build @@ -4,8 +4,11 @@ # 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/. -XPCOM_MANIFESTS += [ - 'components.conf', +SOURCES += [ + 'nsWebBrowserModule.cpp', ] FINAL_LIBRARY = 'xul' +LOCAL_INCLUDES += [ + '..', +] diff --git a/toolkit/components/browser/build/nsWebBrowserModule.cpp b/toolkit/components/browser/build/nsWebBrowserModule.cpp new file mode 100644 index 000000000000..1b28897eb0ce --- /dev/null +++ b/toolkit/components/browser/build/nsWebBrowserModule.cpp @@ -0,0 +1,40 @@ +/* -*- 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 5d621da012e3..0518033013c2 100644 --- a/toolkit/components/build/nsToolkitCompsCID.h +++ b/toolkit/components/build/nsToolkitCompsCID.h @@ -53,6 +53,22 @@ } \ } +// {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 \ { \ @@ -61,6 +77,14 @@ } \ } +// {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/captivedetect/CaptivePortalDetectComponents.manifest b/toolkit/components/captivedetect/CaptivePortalDetectComponents.manifest new file mode 100644 index 000000000000..490545c82b3c --- /dev/null +++ b/toolkit/components/captivedetect/CaptivePortalDetectComponents.manifest @@ -0,0 +1,2 @@ +component {d9cd00ba-aa4d-47b1-8792-b1fe0cd35060} captivedetect.js +contract @mozilla.org/toolkit/captive-detector;1 {d9cd00ba-aa4d-47b1-8792-b1fe0cd35060} diff --git a/toolkit/components/captivedetect/CaptiveDetect.jsm b/toolkit/components/captivedetect/captivedetect.js similarity index 99% rename from toolkit/components/captivedetect/CaptiveDetect.jsm rename to toolkit/components/captivedetect/captivedetect.js index 1fe72a381013..45fc248fdb8d 100644 --- a/toolkit/components/captivedetect/CaptiveDetect.jsm +++ b/toolkit/components/captivedetect/captivedetect.js @@ -442,7 +442,6 @@ CaptivePortalDetector.prototype = { }, }; -/* globals debug: true */ var debug; if (DEBUG) { debug = function(s) { @@ -452,4 +451,4 @@ if (DEBUG) { debug = function(s) {}; } -var EXPORTED_SYMBOLS = ["CaptivePortalDetector"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([CaptivePortalDetector]); diff --git a/toolkit/components/captivedetect/components.conf b/toolkit/components/captivedetect/components.conf deleted file mode 100644 index d247f1aa7f6d..000000000000 --- a/toolkit/components/captivedetect/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{d9cd00ba-aa4d-47b1-8792-b1fe0cd35060}', - 'contract_ids': ['@mozilla.org/toolkit/captive-detector;1'], - 'jsm': 'resource://gre/modules/CaptiveDetect.jsm', - 'constructor': 'CaptivePortalDetector', - }, -] diff --git a/toolkit/components/captivedetect/moz.build b/toolkit/components/captivedetect/moz.build index 4e40a213ff63..18d57c374e6e 100644 --- a/toolkit/components/captivedetect/moz.build +++ b/toolkit/components/captivedetect/moz.build @@ -15,10 +15,8 @@ XPIDL_SOURCES += [ XPIDL_MODULE = 'captivedetect' -EXTRA_JS_MODULES += [ - 'CaptiveDetect.jsm', +EXTRA_COMPONENTS += [ + 'captivedetect.js', + 'CaptivePortalDetectComponents.manifest', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] diff --git a/toolkit/components/cleardata/ClearDataService.jsm b/toolkit/components/cleardata/ClearDataService.js similarity index 99% rename from toolkit/components/cleardata/ClearDataService.jsm rename to toolkit/components/cleardata/ClearDataService.js index 5fde1df5825e..1d60ba071a21 100644 --- a/toolkit/components/cleardata/ClearDataService.jsm +++ b/toolkit/components/cleardata/ClearDataService.js @@ -907,4 +907,4 @@ ClearDataService.prototype = Object.freeze({ }, }); -var EXPORTED_SYMBOLS = ["ClearDataService"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ClearDataService]); diff --git a/toolkit/components/cleardata/ClearDataService.manifest b/toolkit/components/cleardata/ClearDataService.manifest new file mode 100644 index 000000000000..14d41349eb85 --- /dev/null +++ b/toolkit/components/cleardata/ClearDataService.manifest @@ -0,0 +1,2 @@ +component {0c06583d-7dd8-4293-b1a5-912205f779aa} ClearDataService.js +contract @mozilla.org/clear-data-service;1 {0c06583d-7dd8-4293-b1a5-912205f779aa} diff --git a/toolkit/components/cleardata/components.conf b/toolkit/components/cleardata/components.conf deleted file mode 100644 index d3f5799a909f..000000000000 --- a/toolkit/components/cleardata/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{0c06583d-7dd8-4293-b1a5-912205f779aa}', - 'contract_ids': ['@mozilla.org/clear-data-service;1'], - 'jsm': 'resource://gre/modules/ClearDataService.jsm', - 'constructor': 'ClearDataService', - }, -] diff --git a/toolkit/components/cleardata/moz.build b/toolkit/components/cleardata/moz.build index 762ad01557b3..df21175ddc9b 100644 --- a/toolkit/components/cleardata/moz.build +++ b/toolkit/components/cleardata/moz.build @@ -10,13 +10,13 @@ XPIDL_SOURCES += [ XPIDL_MODULE = 'toolkit_cleardata' -EXTRA_JS_MODULES += [ - 'ClearDataService.jsm', - 'ServiceWorkerCleanUp.jsm', +EXTRA_COMPONENTS += [ + 'ClearDataService.js', + 'ClearDataService.manifest', ] -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_JS_MODULES += [ + 'ServiceWorkerCleanUp.jsm', ] XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini'] diff --git a/toolkit/components/components.conf b/toolkit/components/components.conf deleted file mode 100644 index 48311a1b57a7..000000000000 --- a/toolkit/components/components.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -*- 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': '{6ebc941a-f2ff-4d56-b3b6-f7d0b9d73344}', - 'contract_ids': ['@mozilla.org/toolkit/default-clh;1'], - 'jsm': 'resource://gre/modules/DefaultCLH.jsm', - 'constructor': 'nsDefaultCLH', - 'categories': {'command-line-handler': 'y-default'}, - }, -] diff --git a/toolkit/components/contentprefs/ContentPrefService2.jsm b/toolkit/components/contentprefs/ContentPrefService2.js similarity index 99% rename from toolkit/components/contentprefs/ContentPrefService2.jsm rename to toolkit/components/contentprefs/ContentPrefService2.js index 86ad89c49e27..cfb66e0c1eaa 100644 --- a/toolkit/components/contentprefs/ContentPrefService2.jsm +++ b/toolkit/components/contentprefs/ContentPrefService2.js @@ -2,6 +2,7 @@ * 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/. */ +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); const {ContentPref, cbHandleCompletion, cbHandleError, cbHandleResult} = ChromeUtils.import("resource://gre/modules/ContentPrefUtils.jsm"); const {ContentPrefStore} = ChromeUtils.import("resource://gre/modules/ContentPrefStore.jsm"); @@ -1242,4 +1243,5 @@ function invalidArg(msg) { // XPCOM Plumbing -var EXPORTED_SYMBOLS = ["ContentPrefService2"]; +var components = [ContentPrefService2]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components); diff --git a/toolkit/components/contentprefs/ContentPrefService2.manifest b/toolkit/components/contentprefs/ContentPrefService2.manifest new file mode 100644 index 000000000000..d966f1699d24 --- /dev/null +++ b/toolkit/components/contentprefs/ContentPrefService2.manifest @@ -0,0 +1,3 @@ +component {e3f772f3-023f-4b32-b074-36cf0fd5d414} ContentPrefService2.js +contract @mozilla.org/content-pref/service;1 {e3f772f3-023f-4b32-b074-36cf0fd5d414} + diff --git a/toolkit/components/contentprefs/ContentPrefServiceParent.jsm b/toolkit/components/contentprefs/ContentPrefServiceParent.jsm index fbd0a6953eb6..cac460158eff 100644 --- a/toolkit/components/contentprefs/ContentPrefServiceParent.jsm +++ b/toolkit/components/contentprefs/ContentPrefServiceParent.jsm @@ -29,7 +29,7 @@ var ContentPrefServiceParent = { globalMM.addMessageListener("child-process-shutdown", this); }, - // Only called on Android. Listeners are added in BrowserGlue.jsm on other + // Only called on Android. Listeners are added in nsBrowserGlue.js on other // platforms. init() { let globalMM = Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(); @@ -106,7 +106,7 @@ var ContentPrefServiceParent = { } }, - // Listeners are added in BrowserGlue.jsm + // Listeners are added in nsBrowserGlue.js receiveMessage(msg) { if (msg.name != "ContentPrefs:FunctionCall") { this.handleObserverChange(msg); diff --git a/toolkit/components/contentprefs/components.conf b/toolkit/components/contentprefs/components.conf deleted file mode 100644 index 748436e706b6..000000000000 --- a/toolkit/components/contentprefs/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{e3f772f3-023f-4b32-b074-36cf0fd5d414}', - 'contract_ids': ['@mozilla.org/content-pref/service;1'], - 'jsm': 'resource://gre/modules/ContentPrefService2.jsm', - 'constructor': 'ContentPrefService2', - }, -] diff --git a/toolkit/components/contentprefs/moz.build b/toolkit/components/contentprefs/moz.build index 4762e2cc525d..a70cb04419b0 100644 --- a/toolkit/components/contentprefs/moz.build +++ b/toolkit/components/contentprefs/moz.build @@ -12,17 +12,17 @@ MOCHITEST_MANIFESTS += [ 'tests/mochitest/mochitest.ini' ] +EXTRA_COMPONENTS += [ + 'ContentPrefService2.js', + 'ContentPrefService2.manifest', +] + EXTRA_JS_MODULES += [ - 'ContentPrefService2.jsm', 'ContentPrefServiceChild.jsm', 'ContentPrefServiceParent.jsm', 'ContentPrefStore.jsm', 'ContentPrefUtils.jsm', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - with Files('**'): BUG_COMPONENT = ('Toolkit', 'Preferences') diff --git a/toolkit/components/crashes/CrashService.jsm b/toolkit/components/crashes/CrashService.js similarity index 97% rename from toolkit/components/crashes/CrashService.jsm rename to toolkit/components/crashes/CrashService.js index 7f1648bc9d59..155ffc25ab3d 100644 --- a/toolkit/components/crashes/CrashService.jsm +++ b/toolkit/components/crashes/CrashService.js @@ -8,7 +8,9 @@ ChromeUtils.import("resource://gre/modules/AppConstants.jsm", this); ChromeUtils.import("resource://gre/modules/AsyncShutdown.jsm", this); const {parseKeyValuePairs} = ChromeUtils.import("resource://gre/modules/KeyValueParser.jsm"); ChromeUtils.import("resource://gre/modules/osfile.jsm", this); +ChromeUtils.import("resource://gre/modules/PromiseUtils.jsm", this); ChromeUtils.import("resource://gre/modules/Services.jsm", this); +ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm", this); // Set to true if the application is quitting var gQuitting = false; @@ -261,4 +263,4 @@ CrashService.prototype = Object.freeze({ }, }); -var EXPORTED_SYMBOLS = ["CrashService"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([CrashService]); diff --git a/toolkit/components/crashes/CrashService.manifest b/toolkit/components/crashes/CrashService.manifest new file mode 100644 index 000000000000..ed45109feab6 --- /dev/null +++ b/toolkit/components/crashes/CrashService.manifest @@ -0,0 +1,3 @@ +component {92668367-1b17-4190-86b2-1061b2179744} CrashService.js +contract @mozilla.org/crashservice;1 {92668367-1b17-4190-86b2-1061b2179744} +category profile-after-change CrashService @mozilla.org/crashservice;1 diff --git a/toolkit/components/crashes/components.conf b/toolkit/components/crashes/components.conf deleted file mode 100644 index cdc7c6e1f9b0..000000000000 --- a/toolkit/components/crashes/components.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -*- 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': '{92668367-1b17-4190-86b2-1061b2179744}', - 'contract_ids': ['@mozilla.org/crashservice;1'], - 'jsm': 'resource://gre/modules/CrashService.jsm', - 'constructor': 'CrashService', - 'categories': {'profile-after-change': 'CrashService'}, - }, -] diff --git a/toolkit/components/crashes/moz.build b/toolkit/components/crashes/moz.build index 264383889dab..e84bc8f889c0 100644 --- a/toolkit/components/crashes/moz.build +++ b/toolkit/components/crashes/moz.build @@ -16,13 +16,13 @@ XPIDL_SOURCES += [ ] if CONFIG['MOZ_CRASHREPORTER']: - EXTRA_JS_MODULES += [ - 'CrashManager.jsm', - 'CrashService.jsm', + EXTRA_COMPONENTS += [ + 'CrashService.js', + 'CrashService.manifest', ] - XPCOM_MANIFESTS += [ - 'components.conf', + EXTRA_JS_MODULES += [ + 'CrashManager.jsm', ] TESTING_JS_MODULES += [ diff --git a/toolkit/components/crashmonitor/components.conf b/toolkit/components/crashmonitor/components.conf deleted file mode 100644 index 72e08d63c515..000000000000 --- a/toolkit/components/crashmonitor/components.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -*- 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': '{d9d75e86-8f17-4c57-993e-f738f0d86d42}', - 'contract_ids': ['@mozilla.org/toolkit/crashmonitor;1'], - 'jsm': 'resource://gre/modules/nsCrashMonitor.jsm', - 'constructor': 'CrashMonitor', - 'categories': {'profile-after-change': 'CrashMonitor'}, - }, -] diff --git a/toolkit/components/crashmonitor/crashmonitor.manifest b/toolkit/components/crashmonitor/crashmonitor.manifest new file mode 100644 index 000000000000..59e336f82a6a --- /dev/null +++ b/toolkit/components/crashmonitor/crashmonitor.manifest @@ -0,0 +1,3 @@ +component {d9d75e86-8f17-4c57-993e-f738f0d86d42} nsCrashMonitor.js +contract @mozilla.org/toolkit/crashmonitor;1 {d9d75e86-8f17-4c57-993e-f738f0d86d42} +category profile-after-change CrashMonitor @mozilla.org/toolkit/crashmonitor;1 diff --git a/toolkit/components/crashmonitor/moz.build b/toolkit/components/crashmonitor/moz.build index 5d7b5086eb1e..df2876762fe5 100644 --- a/toolkit/components/crashmonitor/moz.build +++ b/toolkit/components/crashmonitor/moz.build @@ -11,9 +11,9 @@ XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] EXTRA_JS_MODULES += [ 'CrashMonitor.jsm', - 'nsCrashMonitor.jsm', ] -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'crashmonitor.manifest', + 'nsCrashMonitor.js', ] diff --git a/toolkit/components/crashmonitor/nsCrashMonitor.jsm b/toolkit/components/crashmonitor/nsCrashMonitor.js similarity index 81% rename from toolkit/components/crashmonitor/nsCrashMonitor.jsm rename to toolkit/components/crashmonitor/nsCrashMonitor.js index 0ccef5a48573..9704939fb968 100644 --- a/toolkit/components/crashmonitor/nsCrashMonitor.jsm +++ b/toolkit/components/crashmonitor/nsCrashMonitor.js @@ -2,6 +2,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/. */ +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); + var MonitorAPI = ChromeUtils.import("resource://gre/modules/CrashMonitor.jsm").CrashMonitor; function CrashMonitor() {} @@ -21,4 +23,4 @@ CrashMonitor.prototype = { }, }; -var EXPORTED_SYMBOLS = ["CrashMonitor"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([CrashMonitor]); diff --git a/toolkit/components/ctypes/components.conf b/toolkit/components/ctypes/components.conf deleted file mode 100644 index c75efa264b8f..000000000000 --- a/toolkit/components/ctypes/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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 d8f7568b8061..29c1be2b3133 100644 --- a/toolkit/components/ctypes/ctypes.cpp +++ b/toolkit/components/ctypes/ctypes.cpp @@ -6,6 +6,7 @@ #include "ctypes.h" #include "jsapi.h" #include "js/MemoryFunctions.h" +#include "mozilla/ModuleUtils.h" #include "nsMemory.h" #include "nsString.h" #include "nsNativeCharsetUtils.h" @@ -14,6 +15,15 @@ #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 { @@ -36,6 +46,8 @@ 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; @@ -100,3 +112,17 @@ 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 eadc947d14c8..c79110eebc36 100644 --- a/toolkit/components/ctypes/moz.build +++ b/toolkit/components/ctypes/moz.build @@ -18,10 +18,6 @@ EXTRA_JS_MODULES += [ 'ctypes.jsm', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - FINAL_LIBRARY = 'xul' with Files('**'): diff --git a/toolkit/components/downloads/DownloadLegacy.jsm b/toolkit/components/downloads/DownloadLegacy.js similarity index 98% rename from toolkit/components/downloads/DownloadLegacy.jsm rename to toolkit/components/downloads/DownloadLegacy.js index 2795f75f0c84..18f501a4222f 100644 --- a/toolkit/components/downloads/DownloadLegacy.jsm +++ b/toolkit/components/downloads/DownloadLegacy.js @@ -14,6 +14,8 @@ "use strict"; +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); + ChromeUtils.defineModuleGetter(this, "Downloads", "resource://gre/modules/Downloads.jsm"); @@ -316,4 +318,4 @@ DownloadLegacyTransfer.prototype = { _signatureInfo: null, }; -var EXPORTED_SYMBOLS = ["DownloadLegacyTransfer"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DownloadLegacyTransfer]); diff --git a/toolkit/components/downloads/Downloads.manifest b/toolkit/components/downloads/Downloads.manifest new file mode 100644 index 000000000000..03d4ed4a63ff --- /dev/null +++ b/toolkit/components/downloads/Downloads.manifest @@ -0,0 +1,2 @@ +component {1b4c85df-cbdd-4bb6-b04e-613caece083c} DownloadLegacy.js +contract @mozilla.org/transfer;1 {1b4c85df-cbdd-4bb6-b04e-613caece083c} diff --git a/toolkit/components/downloads/components.conf b/toolkit/components/downloads/components.conf deleted file mode 100644 index 8ba27d55105e..000000000000 --- a/toolkit/components/downloads/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{1b4c85df-cbdd-4bb6-b04e-613caece083c}', - 'contract_ids': ['@mozilla.org/transfer;1'], - 'jsm': 'resource://gre/modules/DownloadLegacy.jsm', - 'constructor': 'DownloadLegacyTransfer', - }, -] diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build index 493c1a442ece..e7011d0413ec 100644 --- a/toolkit/components/downloads/moz.build +++ b/toolkit/components/downloads/moz.build @@ -24,10 +24,14 @@ SOURCES += [ 'DownloadPlatform.cpp', ] +EXTRA_COMPONENTS += [ + 'DownloadLegacy.js', + 'Downloads.manifest', +] + EXTRA_JS_MODULES += [ 'DownloadCore.jsm', 'DownloadIntegration.jsm', - 'DownloadLegacy.jsm', 'DownloadList.jsm', 'DownloadPaths.jsm', 'Downloads.jsm', @@ -35,10 +39,6 @@ EXTRA_JS_MODULES += [ 'DownloadUIHelper.jsm', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - if CONFIG['MOZ_PLACES']: EXTRA_JS_MODULES += [ 'DownloadHistory.jsm', diff --git a/toolkit/components/gfx/GfxSanityTest.manifest b/toolkit/components/gfx/GfxSanityTest.manifest new file mode 100644 index 000000000000..b9febc498722 --- /dev/null +++ b/toolkit/components/gfx/GfxSanityTest.manifest @@ -0,0 +1,3 @@ +component {f3a8ca4d-4c83-456b-aee2-6a2cbf11e9bd} SanityTest.js process=main +contract @mozilla.org/sanity-test;1 {f3a8ca4d-4c83-456b-aee2-6a2cbf11e9bd} process=main +category profile-after-change SanityTest @mozilla.org/sanity-test;1 process=main diff --git a/toolkit/components/gfx/SanityTest.jsm b/toolkit/components/gfx/SanityTest.js similarity index 98% rename from toolkit/components/gfx/SanityTest.jsm rename to toolkit/components/gfx/SanityTest.js index 687d0dd626ea..8ea5ed6c2720 100644 --- a/toolkit/components/gfx/SanityTest.jsm +++ b/toolkit/components/gfx/SanityTest.js @@ -5,10 +5,12 @@ "use strict"; const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); ChromeUtils.defineModuleGetter(this, "AppConstants", "resource://gre/modules/AppConstants.jsm"); +const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"; const FRAME_SCRIPT_URL = "chrome://gfxsanity/content/gfxFrameScript.js"; const PAGE_WIDTH = 160; @@ -384,4 +386,4 @@ SanityTest.prototype = { }, }; -var EXPORTED_SYMBOLS = ["SanityTest"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SanityTest]); diff --git a/toolkit/components/gfx/components.conf b/toolkit/components/gfx/components.conf deleted file mode 100644 index 616c044abe1f..000000000000 --- a/toolkit/components/gfx/components.conf +++ /dev/null @@ -1,16 +0,0 @@ -# -*- 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': '{f3a8ca4d-4c83-456b-aee2-6a2cbf11e9bd}', - 'contract_ids': ['@mozilla.org/sanity-test;1'], - 'jsm': 'resource://gre/modules/SanityTest.jsm', - 'constructor': 'SanityTest', - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - 'categories': {'profile-after-change': 'SanityTest'}, - }, -] diff --git a/toolkit/components/gfx/moz.build b/toolkit/components/gfx/moz.build index 03b89cd0bf29..27725f4d7155 100644 --- a/toolkit/components/gfx/moz.build +++ b/toolkit/components/gfx/moz.build @@ -7,12 +7,9 @@ with Files('**'): BUG_COMPONENT = ('Core', 'Graphics') -EXTRA_JS_MODULES += [ - 'SanityTest.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'GfxSanityTest.manifest', + 'SanityTest.js', ] JAR_MANIFESTS += ['jar.mn'] diff --git a/toolkit/components/mediasniffer/components.conf b/toolkit/components/mediasniffer/components.conf deleted file mode 100644 index 583ebad53b8b..000000000000 --- a/toolkit/components/mediasniffer/components.conf +++ /dev/null @@ -1,18 +0,0 @@ -# -*- 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 205b528be9eb..a8a922fb3d91 100644 --- a/toolkit/components/mediasniffer/moz.build +++ b/toolkit/components/mediasniffer/moz.build @@ -13,10 +13,7 @@ EXPORTS += [ UNIFIED_SOURCES += [ 'mp3sniff.c', 'nsMediaSniffer.cpp', -] - -XPCOM_MANIFESTS += [ - 'components.conf', + 'nsMediaSnifferModule.cpp', ] FINAL_LIBRARY = 'xul' diff --git a/toolkit/components/mediasniffer/nsMediaSnifferModule.cpp b/toolkit/components/mediasniffer/nsMediaSnifferModule.cpp new file mode 100644 index 000000000000..1659b989a982 --- /dev/null +++ b/toolkit/components/mediasniffer/nsMediaSnifferModule.cpp @@ -0,0 +1,32 @@ +/* -*- 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/moz.build b/toolkit/components/moz.build index 59aa552f078f..e92b82eb448b 100644 --- a/toolkit/components/moz.build +++ b/toolkit/components/moz.build @@ -110,12 +110,9 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': DIRS += ['gfx'] if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android': - EXTRA_JS_MODULES += [ - 'DefaultCLH.jsm', - ] - - XPCOM_MANIFESTS += [ - 'components.conf', + EXTRA_COMPONENTS += [ + 'nsDefaultCLH.js', + 'nsDefaultCLH.manifest', ] if CONFIG['MOZ_BUILD_APP'] == 'browser': diff --git a/toolkit/components/mozintl/MozIntlHelper.cpp b/toolkit/components/mozintl/MozIntlHelper.cpp index 476d0e58a1a7..e69e8da51028 100644 --- a/toolkit/components/mozintl/MozIntlHelper.cpp +++ b/toolkit/components/mozintl/MozIntlHelper.cpp @@ -7,6 +7,14 @@ #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; @@ -87,3 +95,23 @@ 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 deleted file mode 100644 index 7f9aebf54558..000000000000 --- a/toolkit/components/mozintl/components.conf +++ /dev/null @@ -1,20 +0,0 @@ -# -*- 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'], - }, - { - 'cid': '{35ec195a-e8d0-4300-83af-c8a2cc84b4a3}', - 'contract_ids': ['@mozilla.org/mozintl;1'], - 'jsm': 'resource://gre/modules/mozIntl.jsm', - 'constructor': 'MozIntl', - }, -] diff --git a/toolkit/components/mozintl/moz.build b/toolkit/components/mozintl/moz.build index 92b1fc54b28f..5a7312b9225f 100644 --- a/toolkit/components/mozintl/moz.build +++ b/toolkit/components/mozintl/moz.build @@ -20,12 +20,9 @@ SOURCES += [ 'MozIntlHelper.cpp', ] -EXTRA_JS_MODULES += [ - 'mozIntl.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'mozIntl.js', + 'mozIntl.manifest', ] FINAL_LIBRARY = 'xul' diff --git a/toolkit/components/mozintl/mozIntl.jsm b/toolkit/components/mozintl/mozIntl.js similarity index 98% rename from toolkit/components/mozintl/mozIntl.jsm rename to toolkit/components/mozintl/mozIntl.js index 867cee691bc0..94ee94930dfa 100644 --- a/toolkit/components/mozintl/mozIntl.jsm +++ b/toolkit/components/mozintl/mozIntl.js @@ -2,6 +2,7 @@ * 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/. */ +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); const { LocalizationSync } = ChromeUtils.import("resource://gre/modules/Localization.jsm", null); @@ -508,4 +509,5 @@ class MozIntl { MozIntl.prototype.classID = Components.ID("{35ec195a-e8d0-4300-83af-c8a2cc84b4a3}"); MozIntl.prototype.QueryInterface = ChromeUtils.generateQI([Ci.mozIMozIntl]); -var EXPORTED_SYMBOLS = ["MozIntl"]; +var components = [MozIntl]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components); diff --git a/toolkit/components/mozintl/mozIntl.manifest b/toolkit/components/mozintl/mozIntl.manifest new file mode 100644 index 000000000000..9ac9fed76724 --- /dev/null +++ b/toolkit/components/mozintl/mozIntl.manifest @@ -0,0 +1,2 @@ +component {35ec195a-e8d0-4300-83af-c8a2cc84b4a3} mozIntl.js +contract @mozilla.org/mozintl;1 {35ec195a-e8d0-4300-83af-c8a2cc84b4a3} diff --git a/toolkit/components/mozprotocol/components.conf b/toolkit/components/mozprotocol/components.conf deleted file mode 100644 index 6ff337e57f4a..000000000000 --- a/toolkit/components/mozprotocol/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{47a45e5f-691e-4799-8686-14f8d3fc0f8c}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=moz'], - 'jsm': 'resource://gre/modules/MozProtocolHandler.jsm', - 'constructor': 'MozProtocolHandler', - }, -] diff --git a/toolkit/components/mozprotocol/moz.build b/toolkit/components/mozprotocol/moz.build index b7d015bad71b..918ba69741cf 100644 --- a/toolkit/components/mozprotocol/moz.build +++ b/toolkit/components/mozprotocol/moz.build @@ -7,12 +7,9 @@ with Files('**'): BUG_COMPONENT = ('Toolkit', 'General') -EXTRA_JS_MODULES += [ - 'MozProtocolHandler.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'mozProtocolHandler.js', + 'mozProtocolHandler.manifest', ] BROWSER_CHROME_MANIFESTS += [ diff --git a/toolkit/components/mozprotocol/MozProtocolHandler.jsm b/toolkit/components/mozprotocol/mozProtocolHandler.js similarity index 87% rename from toolkit/components/mozprotocol/MozProtocolHandler.jsm rename to toolkit/components/mozprotocol/mozProtocolHandler.js index dfc5238f2594..92a3929d234f 100644 --- a/toolkit/components/mozprotocol/MozProtocolHandler.jsm +++ b/toolkit/components/mozprotocol/mozProtocolHandler.js @@ -7,12 +7,12 @@ const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm") const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); const {NetUtil} = ChromeUtils.import("resource://gre/modules/NetUtil.jsm"); -function MozProtocolHandler() { +function mozProtocolHandler() { XPCOMUtils.defineLazyPreferenceGetter(this, "urlToLoad", "toolkit.mozprotocol.url", "https://www.mozilla.org/protocol"); } -MozProtocolHandler.prototype = { +mozProtocolHandler.prototype = { scheme: "moz", defaultPort: -1, protocolFlags: Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD, @@ -40,7 +40,9 @@ MozProtocolHandler.prototype = { return this.newChannel2(uri, null); }, + classID: Components.ID("{47a45e5f-691e-4799-8686-14f8d3fc0f8c}"), + QueryInterface: ChromeUtils.generateQI([Ci.nsIProtocolHandler]), }; -var EXPORTED_SYMBOLS = ["MozProtocolHandler"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([mozProtocolHandler]); diff --git a/toolkit/components/mozprotocol/mozProtocolHandler.manifest b/toolkit/components/mozprotocol/mozProtocolHandler.manifest new file mode 100644 index 000000000000..bbfdf780af78 --- /dev/null +++ b/toolkit/components/mozprotocol/mozProtocolHandler.manifest @@ -0,0 +1,2 @@ +component {47a45e5f-691e-4799-8686-14f8d3fc0f8c} mozProtocolHandler.js +contract @mozilla.org/network/protocol;1?name=moz {47a45e5f-691e-4799-8686-14f8d3fc0f8c} diff --git a/toolkit/components/normandy/components.conf b/toolkit/components/normandy/components.conf deleted file mode 100644 index 9833df394f89..000000000000 --- a/toolkit/components/normandy/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{6ab96943-a163-482c-9622-4faedc0e827f}', - 'contract_ids': ['@mozilla.org/network/protocol/about;1?what=studies'], - 'jsm': 'resource://gre/modules/ShieldContentProcess.jsm', - 'constructor': 'AboutStudies', - }, -] diff --git a/toolkit/components/normandy/moz.build b/toolkit/components/normandy/moz.build index c0ed76d96ca3..a0420e4c55a3 100644 --- a/toolkit/components/normandy/moz.build +++ b/toolkit/components/normandy/moz.build @@ -9,12 +9,9 @@ with Files('**'): JAR_MANIFESTS += ['jar.mn'] -EXTRA_JS_MODULES += [ - 'ShieldContentProcess.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'shield-content-process.js', + 'shield.manifest', ] SPHINX_TREES['normandy'] = 'docs' diff --git a/toolkit/components/normandy/ShieldContentProcess.jsm b/toolkit/components/normandy/shield-content-process.js similarity index 53% rename from toolkit/components/normandy/ShieldContentProcess.jsm rename to toolkit/components/normandy/shield-content-process.js index 44f14fcb032b..01c0e3e8e051 100644 --- a/toolkit/components/normandy/ShieldContentProcess.jsm +++ b/toolkit/components/normandy/shield-content-process.js @@ -11,10 +11,16 @@ * process, including the parent one. */ +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {AboutPages} = ChromeUtils.import("resource://normandy-content/AboutPages.jsm"); +// generateNSGetFactory only knows how to register factory classes, with +// classID properties on their prototype, and a constructor that returns +// an instance. It can't handle singletons directly. So wrap the +// aboutStudies singleton in a trivial constructor function. function AboutStudies() { - return AboutPages.aboutStudies; + return AboutStudies.prototype; } +AboutStudies.prototype = AboutPages.aboutStudies; -var EXPORTED_SYMBOLS = ["AboutStudies"]; +var NSGetFactory = XPCOMUtils.generateNSGetFactory([AboutStudies]); diff --git a/toolkit/components/normandy/shield.manifest b/toolkit/components/normandy/shield.manifest new file mode 100644 index 000000000000..0ce61c9a98dc --- /dev/null +++ b/toolkit/components/normandy/shield.manifest @@ -0,0 +1,3 @@ + +component {6ab96943-a163-482c-9622-4faedc0e827f} shield-content-process.js +contract @mozilla.org/network/protocol/about;1?what=studies {6ab96943-a163-482c-9622-4faedc0e827f} diff --git a/toolkit/components/DefaultCLH.jsm b/toolkit/components/nsDefaultCLH.js similarity index 91% rename from toolkit/components/DefaultCLH.jsm rename to toolkit/components/nsDefaultCLH.js index 59bda57dab54..82f27dc7cc93 100644 --- a/toolkit/components/DefaultCLH.jsm +++ b/toolkit/components/nsDefaultCLH.js @@ -2,10 +2,15 @@ * 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/. */ +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); +const nsISupports = Ci.nsISupports; + +const nsICommandLine = Ci.nsICommandLine; const nsICommandLineHandler = Ci.nsICommandLineHandler; const nsIPrefBranch = Ci.nsIPrefBranch; +const nsISupportsString = Ci.nsISupportsString; const nsIWindowWatcher = Ci.nsIWindowWatcher; const nsIProperties = Ci.nsIProperties; const nsIFile = Ci.nsIFile; @@ -104,4 +109,4 @@ nsDefaultCLH.prototype = { helpInfo: "", }; -var EXPORTED_SYMBOLS = ["nsDefaultCLH"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsDefaultCLH]); diff --git a/toolkit/components/nsDefaultCLH.manifest b/toolkit/components/nsDefaultCLH.manifest new file mode 100644 index 000000000000..075c8c416bc3 --- /dev/null +++ b/toolkit/components/nsDefaultCLH.manifest @@ -0,0 +1,3 @@ +component {6ebc941a-f2ff-4d56-b3b6-f7d0b9d73344} nsDefaultCLH.js +contract @mozilla.org/toolkit/default-clh;1 {6ebc941a-f2ff-4d56-b3b6-f7d0b9d73344} +category command-line-handler y-default @mozilla.org/toolkit/default-clh;1 diff --git a/toolkit/components/passwordmgr/LoginManagerParent.jsm b/toolkit/components/passwordmgr/LoginManagerParent.jsm index 111457f29e84..2e9da8775200 100644 --- a/toolkit/components/passwordmgr/LoginManagerParent.jsm +++ b/toolkit/components/passwordmgr/LoginManagerParent.jsm @@ -67,7 +67,7 @@ var LoginManagerParent = { return LoginHelper.dedupeLogins(logins, ["username"], resolveBy, formOrigin); }, - // Listeners are added in BrowserGlue.jsm on desktop + // Listeners are added in nsBrowserGlue.js on desktop // and in BrowserCLH.js on mobile. receiveMessage(msg) { let data = msg.data; diff --git a/toolkit/components/passwordmgr/components.conf b/toolkit/components/passwordmgr/components.conf deleted file mode 100644 index f6c0ddd9a1e9..000000000000 --- a/toolkit/components/passwordmgr/components.conf +++ /dev/null @@ -1,63 +0,0 @@ -# -*- 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': '{cb9e0de8-3598-4ed7-857b-827f011ad5d8}', - 'contract_ids': ['@mozilla.org/login-manager;1'], - 'jsm': 'resource://gre/modules/LoginManager.jsm', - 'constructor': 'LoginManager', - }, - { - 'cid': '{749e62f4-60ae-4569-a8a2-de78b649660e}', - 'contract_ids': ['@mozilla.org/passwordmanager/authpromptfactory;1'], - 'jsm': 'resource://gre/modules/LoginManagerPrompter.jsm', - 'constructor': 'LoginManagerPromptFactory', - }, - { - 'cid': '{8aa66d77-1bbb-45a6-991e-b8f47751c291}', - 'contract_ids': ['@mozilla.org/login-manager/prompter;1'], - 'jsm': 'resource://gre/modules/LoginManagerPrompter.jsm', - 'constructor': 'LoginManagerPrompter', - }, - { - 'cid': '{0f2f347c-1e4f-40cc-8efd-792dea70a85e}', - 'contract_ids': ['@mozilla.org/login-manager/loginInfo;1'], - 'jsm': 'resource://gre/modules/LoginInfo.jsm', - 'constructor': 'nsLoginInfo', - }, - { - 'cid': '{dc6c2976-0f73-4f1f-b9ff-3d72b4e28309}', - 'contract_ids': ['@mozilla.org/login-manager/crypto/SDR;1'], - 'jsm': 'resource://gre/modules/crypto-SDR.js', - 'constructor': 'LoginManagerCrypto_SDR', - }, -] - -if buildconfig.substs['OS_TARGET'] == 'Android': - Classes += [ - { - 'cid': '{8c2023b9-175c-477e-9761-44ae7b549756}', - 'contract_ids': [ - '@mozilla.org/login-manager/storage/mozStorage;1', - '@mozilla.org/login-manager/storage/default;1', - ], - 'jsm': 'resource://gre/modules/storage-mozStorage.js', - 'constructor': 'LoginManagerStorage_mozStorage', - }, - ] -else: - Classes += [ - { - 'cid': '{c00c432d-a0c9-46d7-bef6-9c45b4d07341}', - 'contract_ids': [ - '@mozilla.org/login-manager/storage/json;1', - '@mozilla.org/login-manager/storage/default;1', - ], - 'jsm': 'resource://gre/modules/storage-json.js', - 'constructor': 'LoginManagerStorage_json', - }, - ] diff --git a/toolkit/components/passwordmgr/crypto-SDR.js b/toolkit/components/passwordmgr/crypto-SDR.js index 4b0896b5f4a7..da44d333cbcc 100644 --- a/toolkit/components/passwordmgr/crypto-SDR.js +++ b/toolkit/components/passwordmgr/crypto-SDR.js @@ -235,4 +235,5 @@ XPCOMUtils.defineLazyGetter(this.LoginManagerCrypto_SDR.prototype, "log", () => return logger.log.bind(logger); }); -var EXPORTED_SYMBOLS = ["LoginManagerCrypto_SDR"]; +var component = [LoginManagerCrypto_SDR]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component); diff --git a/toolkit/components/passwordmgr/moz.build b/toolkit/components/passwordmgr/moz.build index 2a16b5e08fcc..732160f54135 100644 --- a/toolkit/components/passwordmgr/moz.build +++ b/toolkit/components/passwordmgr/moz.build @@ -28,28 +28,37 @@ XPIDL_SOURCES += [ XPIDL_MODULE = 'loginmgr' -EXTRA_JS_MODULES += [ +EXTRA_COMPONENTS += [ 'crypto-SDR.js', + 'nsLoginInfo.js', + 'nsLoginManager.js', + 'nsLoginManagerPrompter.js', +] + +EXTRA_PP_COMPONENTS += [ + 'passwordmgr.manifest', +] + +EXTRA_JS_MODULES += [ 'InsecurePasswordUtils.jsm', 'LoginHelper.jsm', - 'LoginInfo.jsm', - 'LoginManager.jsm', 'LoginManagerContent.jsm', 'LoginManagerParent.jsm', - 'LoginManagerPrompter.jsm', 'LoginRecipes.jsm', 'OSCrypto.jsm', ] if CONFIG['OS_TARGET'] == 'Android': - EXTRA_JS_MODULES += [ + EXTRA_COMPONENTS += [ 'storage-mozStorage.js', ] else: + EXTRA_COMPONENTS += [ + 'storage-json.js', + ] EXTRA_JS_MODULES += [ 'LoginImport.jsm', 'LoginStore.jsm', - 'storage-json.js', ] if CONFIG['OS_TARGET'] == 'WINNT': @@ -62,10 +71,6 @@ if CONFIG['MOZ_BUILD_APP'] == 'browser': 'LoginManagerContextMenu.jsm', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - JAR_MANIFESTS += ['jar.mn'] with Files('**'): diff --git a/toolkit/components/passwordmgr/LoginInfo.jsm b/toolkit/components/passwordmgr/nsLoginInfo.js similarity index 97% rename from toolkit/components/passwordmgr/LoginInfo.jsm rename to toolkit/components/passwordmgr/nsLoginInfo.js index 392ec8eb3699..60882ebf1e76 100644 --- a/toolkit/components/passwordmgr/LoginInfo.jsm +++ b/toolkit/components/passwordmgr/nsLoginInfo.js @@ -89,4 +89,4 @@ nsLoginInfo.prototype = { }; // end of nsLoginInfo implementation -var EXPORTED_SYMBOLS = ["nsLoginInfo"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsLoginInfo]); diff --git a/toolkit/components/passwordmgr/LoginManager.jsm b/toolkit/components/passwordmgr/nsLoginManager.js similarity index 99% rename from toolkit/components/passwordmgr/LoginManager.jsm rename to toolkit/components/passwordmgr/nsLoginManager.js index 5438ea432b78..30eb4d1c6f50 100644 --- a/toolkit/components/passwordmgr/LoginManager.jsm +++ b/toolkit/components/passwordmgr/nsLoginManager.js @@ -585,4 +585,4 @@ LoginManager.prototype = { }, }; // end of LoginManager implementation -var EXPORTED_SYMBOLS = ["LoginManager"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([LoginManager]); diff --git a/toolkit/components/passwordmgr/LoginManagerPrompter.jsm b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js similarity index 99% rename from toolkit/components/passwordmgr/LoginManagerPrompter.jsm rename to toolkit/components/passwordmgr/nsLoginManagerPrompter.js index 20faa1e5f3cf..63429f9a4c81 100644 --- a/toolkit/components/passwordmgr/LoginManagerPrompter.jsm +++ b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js @@ -1561,4 +1561,5 @@ XPCOMUtils.defineLazyGetter(this.LoginManagerPrompter.prototype, "log", () => { return logger.log.bind(logger); }); -var EXPORTED_SYMBOLS = ["LoginManagerPromptFactory", "LoginManagerPrompter"]; +var component = [LoginManagerPromptFactory, LoginManagerPrompter]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component); diff --git a/toolkit/components/passwordmgr/passwordmgr.manifest b/toolkit/components/passwordmgr/passwordmgr.manifest new file mode 100644 index 000000000000..e53977e2fb70 --- /dev/null +++ b/toolkit/components/passwordmgr/passwordmgr.manifest @@ -0,0 +1,19 @@ +component {cb9e0de8-3598-4ed7-857b-827f011ad5d8} nsLoginManager.js +contract @mozilla.org/login-manager;1 {cb9e0de8-3598-4ed7-857b-827f011ad5d8} +component {749e62f4-60ae-4569-a8a2-de78b649660e} nsLoginManagerPrompter.js +contract @mozilla.org/passwordmanager/authpromptfactory;1 {749e62f4-60ae-4569-a8a2-de78b649660e} +component {8aa66d77-1bbb-45a6-991e-b8f47751c291} nsLoginManagerPrompter.js +contract @mozilla.org/login-manager/prompter;1 {8aa66d77-1bbb-45a6-991e-b8f47751c291} +component {0f2f347c-1e4f-40cc-8efd-792dea70a85e} nsLoginInfo.js +contract @mozilla.org/login-manager/loginInfo;1 {0f2f347c-1e4f-40cc-8efd-792dea70a85e} +#ifdef ANDROID +component {8c2023b9-175c-477e-9761-44ae7b549756} storage-mozStorage.js +contract @mozilla.org/login-manager/storage/mozStorage;1 {8c2023b9-175c-477e-9761-44ae7b549756} +contract @mozilla.org/login-manager/storage/default;1 {8c2023b9-175c-477e-9761-44ae7b549756} +#else +component {c00c432d-a0c9-46d7-bef6-9c45b4d07341} storage-json.js +contract @mozilla.org/login-manager/storage/json;1 {c00c432d-a0c9-46d7-bef6-9c45b4d07341} +contract @mozilla.org/login-manager/storage/default;1 {c00c432d-a0c9-46d7-bef6-9c45b4d07341} +#endif +component {dc6c2976-0f73-4f1f-b9ff-3d72b4e28309} crypto-SDR.js +contract @mozilla.org/login-manager/crypto/SDR;1 {dc6c2976-0f73-4f1f-b9ff-3d72b4e28309} diff --git a/toolkit/components/passwordmgr/storage-json.js b/toolkit/components/passwordmgr/storage-json.js index 91fe20577d92..fcc0c56ff21d 100644 --- a/toolkit/components/passwordmgr/storage-json.js +++ b/toolkit/components/passwordmgr/storage-json.js @@ -542,4 +542,4 @@ XPCOMUtils.defineLazyGetter(this.LoginManagerStorage_json.prototype, "log", () = return logger.log.bind(logger); }); -var EXPORTED_SYMBOLS = ["LoginManagerStorage_json"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([LoginManagerStorage_json]); diff --git a/toolkit/components/passwordmgr/storage-mozStorage.js b/toolkit/components/passwordmgr/storage-mozStorage.js index 319179f9ccd2..9ed12090e124 100644 --- a/toolkit/components/passwordmgr/storage-mozStorage.js +++ b/toolkit/components/passwordmgr/storage-mozStorage.js @@ -1279,4 +1279,5 @@ XPCOMUtils.defineLazyGetter(this.LoginManagerStorage_mozStorage.prototype, "log" return logger.log.bind(logger); }); -var EXPORTED_SYMBOLS = ["LoginManagerStorage_mozStorage"]; +var component = [LoginManagerStorage_mozStorage]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component); diff --git a/toolkit/components/perf/PerfMeasurement.cpp b/toolkit/components/perf/PerfMeasurement.cpp index 31a1b1ef3ccd..dc9fafa37eaf 100644 --- a/toolkit/components/perf/PerfMeasurement.cpp +++ b/toolkit/components/perf/PerfMeasurement.cpp @@ -5,15 +5,27 @@ #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; @@ -72,3 +84,17 @@ 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 deleted file mode 100644 index 8f2685b6b010..000000000000 --- a/toolkit/components/perf/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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 49e99b248c46..39c601a27b35 100644 --- a/toolkit/components/perf/moz.build +++ b/toolkit/components/perf/moz.build @@ -15,10 +15,6 @@ EXTRA_JS_MODULES += [ 'PerfMeasurement.jsm', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - FINAL_LIBRARY = 'xul' LOCAL_INCLUDES += [ diff --git a/toolkit/components/places/ColorAnalyzer.jsm b/toolkit/components/places/ColorAnalyzer.js similarity index 95% rename from toolkit/components/places/ColorAnalyzer.jsm rename to toolkit/components/places/ColorAnalyzer.js index 3147e6184a7a..d9c124abefbc 100644 --- a/toolkit/components/places/ColorAnalyzer.jsm +++ b/toolkit/components/places/ColorAnalyzer.js @@ -4,6 +4,7 @@ "use strict"; +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); const XHTML_NS = "http://www.w3.org/1999/xhtml"; @@ -81,4 +82,4 @@ ColorAnalyzer.prototype = { QueryInterface: ChromeUtils.generateQI([Ci.mozIColorAnalyzer]), }; -var EXPORTED_SYMBOLS = ["ColorAnalyzer"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ColorAnalyzer]); diff --git a/toolkit/components/places/FaviconHelpers.cpp b/toolkit/components/places/FaviconHelpers.cpp index e7d0493232a0..12baf284e56d 100644 --- a/toolkit/components/places/FaviconHelpers.cpp +++ b/toolkit/components/places/FaviconHelpers.cpp @@ -1241,7 +1241,7 @@ nsresult FetchAndConvertUnsupportedPayloads::ConvertPayload( // For non-square images, pick the largest side. int32_t originalSize = std::max(width, height); int32_t size = originalSize; - for (uint16_t supportedSize : gFaviconSizes) { + for (uint16_t supportedSize : sFaviconSizes) { if (supportedSize <= originalSize) { size = supportedSize; break; diff --git a/toolkit/components/places/PageIconProtocolHandler.jsm b/toolkit/components/places/PageIconProtocolHandler.js similarity index 96% rename from toolkit/components/places/PageIconProtocolHandler.jsm rename to toolkit/components/places/PageIconProtocolHandler.js index 47770d96c323..459e6695da74 100644 --- a/toolkit/components/places/PageIconProtocolHandler.jsm +++ b/toolkit/components/places/PageIconProtocolHandler.js @@ -4,6 +4,7 @@ "use strict"; +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); ChromeUtils.defineModuleGetter(this, "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm"); @@ -129,4 +130,4 @@ PageIconProtocolHandler.prototype = { ]), }; -var EXPORTED_SYMBOLS = ["PageIconProtocolHandler"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PageIconProtocolHandler]); diff --git a/toolkit/components/places/PlacesCategoriesStarter.jsm b/toolkit/components/places/PlacesCategoriesStarter.js similarity index 89% rename from toolkit/components/places/PlacesCategoriesStarter.jsm rename to toolkit/components/places/PlacesCategoriesStarter.js index b2453b8b3087..6c9c85920d10 100644 --- a/toolkit/components/places/PlacesCategoriesStarter.jsm +++ b/toolkit/components/places/PlacesCategoriesStarter.js @@ -10,6 +10,7 @@ const TOPIC_GATHER_TELEMETRY = "gather-telemetry"; // Seconds between maintenance runs. const MAINTENANCE_INTERVAL_SECONDS = 7 * 86400; +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); ChromeUtils.defineModuleGetter(this, "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm"); @@ -53,9 +54,11 @@ PlacesCategoriesStarter.prototype = { }, classID: Components.ID("803938d5-e26d-4453-bf46-ad4b26e41114"), + _xpcom_factory: XPCOMUtils.generateSingletonFactory(PlacesCategoriesStarter), QueryInterface: ChromeUtils.generateQI([ Ci.nsIObserver, ]), }; -var EXPORTED_SYMBOLS = ["PlacesCategoriesStarter"]; +var components = [PlacesCategoriesStarter]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components); diff --git a/toolkit/components/places/UnifiedComplete.jsm b/toolkit/components/places/UnifiedComplete.js similarity index 99% rename from toolkit/components/places/UnifiedComplete.jsm rename to toolkit/components/places/UnifiedComplete.js index a29a9873cd3e..0a7987ed270e 100644 --- a/toolkit/components/places/UnifiedComplete.jsm +++ b/toolkit/components/places/UnifiedComplete.js @@ -61,8 +61,8 @@ const QUERYINDEX_TITLE = 2; const QUERYINDEX_BOOKMARKED = 3; const QUERYINDEX_BOOKMARKTITLE = 4; const QUERYINDEX_TAGS = 5; -// QUERYINDEX_VISITCOUNT = 6; -// QUERYINDEX_TYPED = 7; +const QUERYINDEX_VISITCOUNT = 6; +const QUERYINDEX_TYPED = 7; const QUERYINDEX_PLACEID = 8; const QUERYINDEX_SWITCHTAB = 9; const QUERYINDEX_FRECENCY = 10; @@ -320,6 +320,7 @@ XPCOMUtils.defineLazyModuleGetters(this, { BrowserUtils: "resource://gre/modules/BrowserUtils.jsm", ExtensionSearchHandler: "resource://gre/modules/ExtensionSearchHandler.jsm", ObjectUtils: "resource://gre/modules/ObjectUtils.jsm", + OS: "resource://gre/modules/osfile.jsm", PlacesRemoteTabsAutocompleteProvider: "resource://gre/modules/PlacesRemoteTabsAutocompleteProvider.jsm", PlacesSearchAutocompleteProvider: "resource://gre/modules/PlacesSearchAutocompleteProvider.jsm", PlacesUtils: "resource://gre/modules/PlacesUtils.jsm", @@ -2725,6 +2726,8 @@ UnifiedComplete.prototype = { classID: Components.ID("f964a319-397a-4d21-8be6-5cdd1ee3e3ae"), + _xpcom_factory: XPCOMUtils.generateSingletonFactory(UnifiedComplete), + QueryInterface: ChromeUtils.generateQI([ Ci.nsIAutoCompleteSearch, Ci.nsIAutoCompleteSearchDescriptor, @@ -2734,4 +2737,4 @@ UnifiedComplete.prototype = { ]), }; -var EXPORTED_SYMBOLS = ["UnifiedComplete"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([UnifiedComplete]); diff --git a/toolkit/components/places/components.conf b/toolkit/components/places/components.conf deleted file mode 100644 index 2c94be39839f..000000000000 --- a/toolkit/components/places/components.conf +++ /dev/null @@ -1,105 +0,0 @@ -# -*- 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': '{0937a705-91a6-417a-8292-b22eb10da86c}', - 'contract_ids': ['@mozilla.org/browser/history;1'], - 'singleton': True, - 'type': 'mozilla::places::History', - 'headers': ['mozilla/places/History.h'], - 'constructor': 'mozilla::places::History::GetSingleton', - }, - { - 'cid': '{e8b8bdb7-c96c-4d82-9c6f-2b3c585ec7ea}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=moz-anno'], - 'type': 'nsAnnoProtocolHandler', - 'headers': ['/toolkit/components/places/nsAnnoProtocolHandler.h'], - }, - { - 'cid': '{5e8d4751-1852-434b-a992-2c6d2a25fa46}', - 'contract_ids': ['@mozilla.org/browser/annotation-service;1'], - 'singleton': True, - 'type': 'nsAnnotationService', - 'headers': ['/toolkit/components/places/nsAnnotationService.h'], - 'constructor': 'nsAnnotationService::GetSingleton', - }, - { - 'cid': '{984e3259-9266-49cf-b605-60b022a00756}', - 'contract_ids': ['@mozilla.org/browser/favicon-service;1'], - 'singleton': True, - 'type': 'nsFaviconService', - 'headers': ['/toolkit/components/places/nsFaviconService.h'], - 'constructor': 'nsFaviconService::GetSingleton', - }, - { - 'cid': '{9de95a0c-39a4-4d64-9a53-17940dd7cabb}', - 'contract_ids': ['@mozilla.org/browser/nav-bookmarks-service;1'], - 'singleton': True, - 'type': 'nsNavBookmarks', - 'headers': ['/toolkit/components/places/nsNavBookmarks.h'], - 'constructor': 'nsNavBookmarks::GetSingleton', - }, - { - 'cid': '{88cecbb7-6c63-4b3b-8cd4-84f3b8228c69}', - 'contract_ids': ['@mozilla.org/browser/nav-history-service;1'], - 'singleton': True, - 'type': 'nsNavHistory', - 'headers': ['/toolkit/components/places/nsNavHistory.h'], - 'constructor': 'nsNavHistory::GetSingleton', - 'categories': {'vacuum-participant': 'Places'}, - }, - - { - 'cid': '{bbc23860-2553-479d-8b78-94d9038334f7}', - 'contract_ids': ['@mozilla.org/browser/tagging-service;1'], - 'jsm': 'resource://gre/modules/TaggingService.jsm', - 'constructor': 'TaggingService', - }, - { - 'cid': '{1dcc23b0-d4cb-11dc-9ad6-479d56d89593}', - 'contract_ids': ['@mozilla.org/autocomplete/search;1?name=places-tag-autocomplete'], - 'jsm': 'resource://gre/modules/TaggingService.jsm', - 'constructor': 'TagAutoCompleteSearch', - }, - - { - 'cid': '{705a423f-2f69-42f3-b9fe-1517e0dee56f}', - 'contract_ids': ['@mozilla.org/places/expiration;1'], - 'jsm': 'resource://gre/modules/PlacesExpiration.jsm', - 'constructor': 'nsPlacesExpiration', - 'categories': {'places-init-complete': 'nsPlacesExpiration'}, - }, - - { - 'cid': '{803938d5-e26d-4453-bf46-ad4b26e41114}', - 'contract_ids': ['@mozilla.org/places/categoriesStarter;1'], - 'jsm': 'resource://gre/modules/PlacesCategoriesStarter.jsm', - 'constructor': 'PlacesCategoriesStarter', - 'categories': {'idle-daily': 'PlacesCategoriesStarter'}, - }, - - { - 'cid': '{d056186c-28a0-494e-aacc-9e433772b143}', - 'contract_ids': ['@mozilla.org/places/colorAnalyzer;1'], - 'jsm': 'resource://gre/modules/ColorAnalyzer.jsm', - 'constructor': 'ColorAnalyzer', - }, - - { - 'cid': '{f964a319-397a-4d21-8be6-5cdd1ee3e3ae}', - 'contract_ids': ['@mozilla.org/autocomplete/search;1?name=unifiedcomplete'], - 'jsm': 'resource://gre/modules/UnifiedComplete.jsm', - 'constructor': 'UnifiedComplete', - }, - - { - 'cid': '{60a1f7c6-4ff9-4a42-84d3-5a185faa6f32}', - 'contract_ids': ['@mozilla.org/network/protocol;1?name=page-icon'], - 'jsm': 'resource://gre/modules/PageIconProtocolHandler.jsm', - 'constructor': 'PageIconProtocolHandler', - }, -] diff --git a/toolkit/components/places/moz.build b/toolkit/components/places/moz.build index 05db20f0f564..7579bdd5f47e 100644 --- a/toolkit/components/places/moz.build +++ b/toolkit/components/places/moz.build @@ -44,6 +44,7 @@ if CONFIG['MOZ_PLACES']: 'nsNavHistory.cpp', 'nsNavHistoryQuery.cpp', 'nsNavHistoryResult.cpp', + 'nsPlacesModule.cpp', 'PlaceInfo.cpp', 'Shutdown.cpp', 'SQLFunctions.cpp', @@ -59,28 +60,28 @@ if CONFIG['MOZ_PLACES']: 'BookmarkJSONUtils.jsm', 'Bookmarks.jsm', 'ClusterLib.js', - 'ColorAnalyzer.jsm', 'ColorAnalyzer_worker.js', 'ColorConversion.js', 'ExtensionSearchHandler.jsm', 'History.jsm', - 'PageIconProtocolHandler.jsm', 'PlacesBackups.jsm', - 'PlacesCategoriesStarter.jsm', 'PlacesDBUtils.jsm', - 'PlacesExpiration.jsm', 'PlacesRemoteTabsAutocompleteProvider.jsm', 'PlacesSearchAutocompleteProvider.jsm', 'PlacesSyncUtils.jsm', 'PlacesTransactions.jsm', 'PlacesUtils.jsm', 'SyncedBookmarksMirror.jsm', - 'TaggingService.jsm', - 'UnifiedComplete.jsm', ] - XPCOM_MANIFESTS += [ - 'components.conf', + EXTRA_COMPONENTS += [ + 'ColorAnalyzer.js', + 'nsPlacesExpiration.js', + 'nsTaggingService.js', + 'PageIconProtocolHandler.js', + 'PlacesCategoriesStarter.js', + 'toolkitplaces.manifest', + 'UnifiedComplete.js', ] FINAL_LIBRARY = 'xul' diff --git a/toolkit/components/places/nsAnnotationService.h b/toolkit/components/places/nsAnnotationService.h index f0e954dffc91..516520c97193 100644 --- a/toolkit/components/places/nsAnnotationService.h +++ b/toolkit/components/places/nsAnnotationService.h @@ -16,18 +16,8 @@ #include "nsString.h" #include "mozilla/Attributes.h" -namespace mozilla { -namespace places { - -struct BookmarkData; - -} // namespace places -} // namespace mozilla - class nsAnnotationService final : public nsIAnnotationService, public nsSupportsWeakReference { - using BookmarkData = mozilla::places::BookmarkData; - public: NS_DECL_ISUPPORTS NS_DECL_NSIANNOTATIONSERVICE diff --git a/toolkit/components/places/nsFaviconService.cpp b/toolkit/components/places/nsFaviconService.cpp index e82cc79540be..4e7ed943095f 100644 --- a/toolkit/components/places/nsFaviconService.cpp +++ b/toolkit/components/places/nsFaviconService.cpp @@ -43,8 +43,6 @@ using namespace mozilla; using namespace mozilla::places; -const uint16_t gFaviconSizes[7] = {192, 144, 96, 64, 48, 32, 16}; - /** * Used to notify a topic to system observers on async execute completion. * Will throw on error. @@ -79,9 +77,9 @@ nsresult GetFramesInfoForContainer(imgIContainer* aContainer, continue; } // Check if it's one of the sizes we care about. - auto end = std::end(gFaviconSizes); - const uint16_t* matchingSize = - std::find(std::begin(gFaviconSizes), end, nativeSize.width); + auto end = std::end(sFaviconSizes); + uint16_t* matchingSize = + std::find(std::begin(sFaviconSizes), end, nativeSize.width); if (matchingSize != end) { // We must avoid duped sizes, an image could contain multiple frames // of the same size, but we can only store one. We could use an @@ -729,7 +727,7 @@ nsresult nsFaviconService::OptimizeIconSizes(IconData& aIcon) { IconPayload newPayload; newPayload.mimeType = NS_LITERAL_CSTRING(PNG_MIME_TYPE); newPayload.width = frameInfo.width; - for (uint16_t size : gFaviconSizes) { + for (uint16_t size : sFaviconSizes) { // The icon could be smaller than 16, that is our minimum. // Icons smaller than 16px are kept as-is. if (frameInfo.width >= 16) { diff --git a/toolkit/components/places/nsFaviconService.h b/toolkit/components/places/nsFaviconService.h index f55184b47424..3749be161b89 100644 --- a/toolkit/components/places/nsFaviconService.h +++ b/toolkit/components/places/nsFaviconService.h @@ -27,7 +27,7 @@ // The target dimension in pixels for favicons we store, in reverse order. // When adding/removing sizes from here, make sure to update the vector size. -extern const uint16_t gFaviconSizes[7]; +static uint16_t sFaviconSizes[7] = {192, 144, 96, 64, 48, 32, 16}; // forward class definitions class mozIStorageStatementCallback; diff --git a/toolkit/components/places/PlacesExpiration.jsm b/toolkit/components/places/nsPlacesExpiration.js similarity index 99% rename from toolkit/components/places/PlacesExpiration.jsm rename to toolkit/components/places/nsPlacesExpiration.js index e1ad56e2766b..687c6ed66c60 100644 --- a/toolkit/components/places/PlacesExpiration.jsm +++ b/toolkit/components/places/nsPlacesExpiration.js @@ -935,6 +935,8 @@ nsPlacesExpiration.prototype = { classID: Components.ID("705a423f-2f69-42f3-b9fe-1517e0dee56f"), + _xpcom_factory: XPCOMUtils.generateSingletonFactory(nsPlacesExpiration), + QueryInterface: ChromeUtils.generateQI([ Ci.nsIObserver, Ci.nsINavHistoryObserver, @@ -946,4 +948,5 @@ nsPlacesExpiration.prototype = { // Module Registration -var EXPORTED_SYMBOLS = ["nsPlacesExpiration"]; +var components = [nsPlacesExpiration]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components); diff --git a/toolkit/components/places/nsPlacesModule.cpp b/toolkit/components/places/nsPlacesModule.cpp new file mode 100644 index 000000000000..87238e426e75 --- /dev/null +++ b/toolkit/components/places/nsPlacesModule.cpp @@ -0,0 +1,64 @@ +/* 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 "nsIClassInfoImpl.h" + +#include "nsAnnoProtocolHandler.h" +#include "nsAnnotationService.h" +#include "nsNavHistory.h" +#include "nsNavBookmarks.h" +#include "nsFaviconService.h" +#include "History.h" +#include "nsDocShellCID.h" + +using namespace mozilla::places; + +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsNavHistory, + nsNavHistory::GetSingleton) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsAnnotationService, + nsAnnotationService::GetSingleton) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsNavBookmarks, + nsNavBookmarks::GetSingleton) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsFaviconService, + nsFaviconService::GetSingleton) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(History, History::GetSingleton) + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsAnnoProtocolHandler) +NS_DEFINE_NAMED_CID(NS_NAVHISTORYSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_ANNOTATIONSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_ANNOPROTOCOLHANDLER_CID); +NS_DEFINE_NAMED_CID(NS_NAVBOOKMARKSSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_FAVICONSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_HISTORYSERVICE_CID); + +const mozilla::Module::CIDEntry kPlacesCIDs[] = { + {&kNS_NAVHISTORYSERVICE_CID, false, nullptr, nsNavHistoryConstructor}, + {&kNS_ANNOTATIONSERVICE_CID, false, nullptr, + nsAnnotationServiceConstructor}, + {&kNS_ANNOPROTOCOLHANDLER_CID, false, nullptr, + nsAnnoProtocolHandlerConstructor}, + {&kNS_NAVBOOKMARKSSERVICE_CID, false, nullptr, nsNavBookmarksConstructor}, + {&kNS_FAVICONSERVICE_CID, false, nullptr, nsFaviconServiceConstructor}, + {&kNS_HISTORYSERVICE_CID, false, nullptr, HistoryConstructor}, + {nullptr}}; + +const mozilla::Module::ContractIDEntry kPlacesContracts[] = { + {NS_NAVHISTORYSERVICE_CONTRACTID, &kNS_NAVHISTORYSERVICE_CID}, + {NS_ANNOTATIONSERVICE_CONTRACTID, &kNS_ANNOTATIONSERVICE_CID}, + {NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "moz-anno", + &kNS_ANNOPROTOCOLHANDLER_CID}, + {NS_NAVBOOKMARKSSERVICE_CONTRACTID, &kNS_NAVBOOKMARKSSERVICE_CID}, + {NS_FAVICONSERVICE_CONTRACTID, &kNS_FAVICONSERVICE_CID}, + {NS_IHISTORY_CONTRACTID, &kNS_HISTORYSERVICE_CID}, + {nullptr}}; + +const mozilla::Module::CategoryEntry kPlacesCategories[] = { + {"vacuum-participant", "Places", NS_NAVHISTORYSERVICE_CONTRACTID}, + {nullptr}}; + +const mozilla::Module kPlacesModule = {mozilla::Module::kVersion, kPlacesCIDs, + kPlacesContracts, kPlacesCategories}; + +NSMODULE_DEFN(nsPlacesModule) = &kPlacesModule; diff --git a/toolkit/components/places/TaggingService.jsm b/toolkit/components/places/nsTaggingService.js similarity index 98% rename from toolkit/components/places/TaggingService.jsm rename to toolkit/components/places/nsTaggingService.js index 5e7a0b56fac7..a854f767c8ec 100644 --- a/toolkit/components/places/TaggingService.jsm +++ b/toolkit/components/places/nsTaggingService.js @@ -501,9 +501,11 @@ TagAutoCompleteSearch.prototype = { }, classID: Components.ID("{1dcc23b0-d4cb-11dc-9ad6-479d56d89593}"), + _xpcom_factory: XPCOMUtils.generateSingletonFactory(TagAutoCompleteSearch), QueryInterface: ChromeUtils.generateQI([ Ci.nsIAutoCompleteSearch, ]), }; -var EXPORTED_SYMBOLS = ["TaggingService", "TagAutoCompleteSearch"]; +var component = [TaggingService, TagAutoCompleteSearch]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component); diff --git a/toolkit/components/places/tests/gtest/places_test_harness_tail.h b/toolkit/components/places/tests/gtest/places_test_harness_tail.h index 9dd1cbf27b12..080bb1061071 100644 --- a/toolkit/components/places/tests/gtest/places_test_harness_tail.h +++ b/toolkit/components/places/tests/gtest/places_test_harness_tail.h @@ -7,7 +7,6 @@ #include "nsWidgetsCID.h" #include "nsIComponentRegistrar.h" #include "nsICrashReporter.h" -#include "nsIIdleService.h" #ifndef TEST_NAME # error "Must #define TEST_NAME before including places_test_harness_tail.h" @@ -54,9 +53,15 @@ void do_test_finished() { void disable_idle_service() { (void)fprintf(stderr, TEST_INFO_STR "Disabling Idle Service.\n"); - - nsCOMPtr idle = do_GetService("@mozilla.org/widget/idleservice;1"); - idle->SetDisabled(true); + static NS_DEFINE_IID(kIdleCID, NS_IDLE_SERVICE_CID); + nsresult rv; + nsCOMPtr idleFactory = do_GetClassObject(kIdleCID, &rv); + do_check_success(rv); + nsCOMPtr registrar; + rv = NS_GetComponentRegistrar(getter_AddRefs(registrar)); + do_check_success(rv); + rv = registrar->UnregisterFactory(kIdleCID, idleFactory); + do_check_success(rv); } TEST(IHistory, Test) { diff --git a/toolkit/components/places/toolkitplaces.manifest b/toolkit/components/places/toolkitplaces.manifest new file mode 100644 index 000000000000..9b9360d1115f --- /dev/null +++ b/toolkit/components/places/toolkitplaces.manifest @@ -0,0 +1,27 @@ +# nsTaggingService.js +component {bbc23860-2553-479d-8b78-94d9038334f7} nsTaggingService.js +contract @mozilla.org/browser/tagging-service;1 {bbc23860-2553-479d-8b78-94d9038334f7} +component {1dcc23b0-d4cb-11dc-9ad6-479d56d89593} nsTaggingService.js +contract @mozilla.org/autocomplete/search;1?name=places-tag-autocomplete {1dcc23b0-d4cb-11dc-9ad6-479d56d89593} + +# nsPlacesExpiration.js +component {705a423f-2f69-42f3-b9fe-1517e0dee56f} nsPlacesExpiration.js +contract @mozilla.org/places/expiration;1 {705a423f-2f69-42f3-b9fe-1517e0dee56f} +category places-init-complete nsPlacesExpiration @mozilla.org/places/expiration;1 + +# PlacesCategoriesStarter.js +component {803938d5-e26d-4453-bf46-ad4b26e41114} PlacesCategoriesStarter.js +contract @mozilla.org/places/categoriesStarter;1 {803938d5-e26d-4453-bf46-ad4b26e41114} +category idle-daily PlacesCategoriesStarter @mozilla.org/places/categoriesStarter;1 + +# ColorAnalyzer.js +component {d056186c-28a0-494e-aacc-9e433772b143} ColorAnalyzer.js +contract @mozilla.org/places/colorAnalyzer;1 {d056186c-28a0-494e-aacc-9e433772b143} + +# UnifiedComplete.js +component {f964a319-397a-4d21-8be6-5cdd1ee3e3ae} UnifiedComplete.js +contract @mozilla.org/autocomplete/search;1?name=unifiedcomplete {f964a319-397a-4d21-8be6-5cdd1ee3e3ae} + +# PageIconProtocolHandler.js +component {60a1f7c6-4ff9-4a42-84d3-5a185faa6f32} PageIconProtocolHandler.js +contract @mozilla.org/network/protocol;1?name=page-icon {60a1f7c6-4ff9-4a42-84d3-5a185faa6f32} diff --git a/toolkit/components/processsingleton/ContentProcessSingleton.jsm b/toolkit/components/processsingleton/ContentProcessSingleton.js similarity index 94% rename from toolkit/components/processsingleton/ContentProcessSingleton.jsm rename to toolkit/components/processsingleton/ContentProcessSingleton.js index e27b58a11c71..9d56b1d621b5 100644 --- a/toolkit/components/processsingleton/ContentProcessSingleton.jsm +++ b/toolkit/components/processsingleton/ContentProcessSingleton.js @@ -39,4 +39,4 @@ ContentProcessSingleton.prototype = { }, }; -var EXPORTED_SYMBOLS = ["ContentProcessSingleton"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentProcessSingleton]); diff --git a/toolkit/components/processsingleton/MainProcessSingleton.jsm b/toolkit/components/processsingleton/MainProcessSingleton.js similarity index 95% rename from toolkit/components/processsingleton/MainProcessSingleton.jsm rename to toolkit/components/processsingleton/MainProcessSingleton.js index e9eaa5d8c935..142491b9f46d 100644 --- a/toolkit/components/processsingleton/MainProcessSingleton.jsm +++ b/toolkit/components/processsingleton/MainProcessSingleton.js @@ -5,6 +5,7 @@ "use strict"; const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); ChromeUtils.defineModuleGetter(this, "NetUtil", "resource://gre/modules/NetUtil.jsm"); @@ -74,4 +75,4 @@ MainProcessSingleton.prototype = { }, }; -var EXPORTED_SYMBOLS = ["MainProcessSingleton"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([MainProcessSingleton]); diff --git a/toolkit/components/processsingleton/ProcessSingleton.manifest b/toolkit/components/processsingleton/ProcessSingleton.manifest index bf33cfd5c2cd..7a882ed7b6fb 100644 --- a/toolkit/components/processsingleton/ProcessSingleton.manifest +++ b/toolkit/components/processsingleton/ProcessSingleton.manifest @@ -1,2 +1,7 @@ +component {0636a680-45cb-11e4-916c-0800200c9a66} MainProcessSingleton.js process=main +contract @mozilla.org/main-process-singleton;1 {0636a680-45cb-11e4-916c-0800200c9a66} process=main category app-startup MainProcessSingleton service,@mozilla.org/main-process-singleton;1 process=main + +component {ca2a8470-45c7-11e4-916c-0800200c9a66} ContentProcessSingleton.js process=content +contract @mozilla.org/content-process-singleton;1 {ca2a8470-45c7-11e4-916c-0800200c9a66} process=content category app-startup ContentProcessSingleton service,@mozilla.org/content-process-singleton;1 process=content diff --git a/toolkit/components/processsingleton/components.conf b/toolkit/components/processsingleton/components.conf deleted file mode 100644 index 2a3c02a8395e..000000000000 --- a/toolkit/components/processsingleton/components.conf +++ /dev/null @@ -1,22 +0,0 @@ -# -*- 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': '{0636a680-45cb-11e4-916c-0800200c9a66}', - 'contract_ids': ['@mozilla.org/main-process-singleton;1'], - 'jsm': 'resource://gre/modules/MainProcessSingleton.jsm', - 'constructor': 'MainProcessSingleton', - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - { - 'cid': '{ca2a8470-45c7-11e4-916c-0800200c9a66}', - 'contract_ids': ['@mozilla.org/content-process-singleton;1'], - 'jsm': 'resource://gre/modules/ContentProcessSingleton.jsm', - 'constructor': 'ContentProcessSingleton', - 'processes': ProcessSelector.CONTENT_PROCESS_ONLY, - }, -] diff --git a/toolkit/components/processsingleton/moz.build b/toolkit/components/processsingleton/moz.build index ee72302e6b6a..fbb32d3f96fe 100644 --- a/toolkit/components/processsingleton/moz.build +++ b/toolkit/components/processsingleton/moz.build @@ -8,15 +8,11 @@ with Files('**'): BUG_COMPONENT = ('Toolkit', 'General') EXTRA_COMPONENTS += [ + 'ContentProcessSingleton.js', + 'MainProcessSingleton.js', 'ProcessSingleton.manifest', ] EXTRA_JS_MODULES += [ - 'ContentProcessSingleton.jsm', 'CustomElementsListener.jsm', - 'MainProcessSingleton.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', ] diff --git a/toolkit/components/prompts/src/components.conf b/toolkit/components/prompts/src/components.conf deleted file mode 100644 index d6861586c802..000000000000 --- a/toolkit/components/prompts/src/components.conf +++ /dev/null @@ -1,26 +0,0 @@ -# -*- 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': '{1c978d25-b37f-43a8-a2d6-0c7a239ead87}', - 'contract_ids': ['@mozilla.org/prompter;1'], - 'jsm': 'resource://gre/modules/Prompter.jsm', - 'constructor': 'Prompter', - }, - { - 'cid': '{6e134924-6c3a-4d86-81ac-69432dd971dc}', - 'contract_ids': ['@mozilla.org/network/authprompt-adapter-factory;1'], - 'jsm': 'resource://gre/modules/Prompter.jsm', - 'constructor': 'AuthPromptAdapterFactory', - }, - { - 'cid': '{7ad1b327-6dfa-46ec-9234-f2a620ea7e00}', - 'contract_ids': ['@mozilla.org/embedcomp/prompt-service;1'], - 'jsm': 'resource://gre/modules/Prompter.jsm', - 'constructor': 'EmbedPrompter', - }, -] diff --git a/toolkit/components/prompts/src/moz.build b/toolkit/components/prompts/src/moz.build index 9b991c2e9189..b13e47b42683 100644 --- a/toolkit/components/prompts/src/moz.build +++ b/toolkit/components/prompts/src/moz.build @@ -4,12 +4,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/. +EXTRA_COMPONENTS += [ + 'nsPrompter.js', + 'nsPrompter.manifest', +] + EXTRA_JS_MODULES += [ 'CommonDialog.jsm', - 'Prompter.jsm', 'SharedPromptUtils.jsm', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] diff --git a/toolkit/components/prompts/src/Prompter.jsm b/toolkit/components/prompts/src/nsPrompter.js similarity index 99% rename from toolkit/components/prompts/src/Prompter.jsm rename to toolkit/components/prompts/src/nsPrompter.js index ff9ba4ec373d..f2e29c1931b4 100644 --- a/toolkit/components/prompts/src/Prompter.jsm +++ b/toolkit/components/prompts/src/nsPrompter.js @@ -940,4 +940,5 @@ function EmbedPrompter() { EmbedPrompter.prototype = new Prompter(); EmbedPrompter.prototype.classID = Components.ID("{7ad1b327-6dfa-46ec-9234-f2a620ea7e00}"); -var EXPORTED_SYMBOLS = ["Prompter", "EmbedPrompter", "AuthPromptAdapterFactory"]; +var component = [Prompter, EmbedPrompter, AuthPromptAdapterFactory]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component); diff --git a/toolkit/components/prompts/src/nsPrompter.manifest b/toolkit/components/prompts/src/nsPrompter.manifest new file mode 100644 index 000000000000..582f6bf59729 --- /dev/null +++ b/toolkit/components/prompts/src/nsPrompter.manifest @@ -0,0 +1,6 @@ +component {1c978d25-b37f-43a8-a2d6-0c7a239ead87} nsPrompter.js +contract @mozilla.org/prompter;1 {1c978d25-b37f-43a8-a2d6-0c7a239ead87} +component {6e134924-6c3a-4d86-81ac-69432dd971dc} nsPrompter.js +contract @mozilla.org/network/authprompt-adapter-factory;1 {6e134924-6c3a-4d86-81ac-69432dd971dc} +component {7ad1b327-6dfa-46ec-9234-f2a620ea7e00} nsPrompter.js +contract @mozilla.org/embedcomp/prompt-service;1 {7ad1b327-6dfa-46ec-9234-f2a620ea7e00} diff --git a/toolkit/components/reflect/components.conf b/toolkit/components/reflect/components.conf deleted file mode 100644 index 227be0291947..000000000000 --- a/toolkit/components/reflect/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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 7b11f992791a..1ca8414cbc7c 100644 --- a/toolkit/components/reflect/moz.build +++ b/toolkit/components/reflect/moz.build @@ -15,8 +15,4 @@ 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 3688e7b75acd..6eceef6e4ee8 100644 --- a/toolkit/components/reflect/reflect.cpp +++ b/toolkit/components/reflect/reflect.cpp @@ -5,14 +5,26 @@ #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; @@ -37,3 +49,17 @@ 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 deleted file mode 100644 index df6bc46ea0bf..000000000000 --- a/toolkit/components/remote/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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 3c3cd773ecf0..e71c3e73a9a8 100644 --- a/toolkit/components/remote/moz.build +++ b/toolkit/components/remote/moz.build @@ -28,10 +28,6 @@ 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 3f3169e3fa51..98747ae6e663 100644 --- a/toolkit/components/remote/nsRemoteService.cpp +++ b/toolkit/components/remote/nsRemoteService.cpp @@ -19,6 +19,7 @@ #include "nsIAppShellService.h" #include "nsAppShellCID.h" #include "nsInterfaceHashtable.h" +#include "mozilla/ModuleUtils.h" #include "nsGTKToolkit.h" #include "nsICommandLineRunner.h" #include "nsCommandLine.h" @@ -181,3 +182,27 @@ 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/remotebrowserutils/RemoteWebNavigation.jsm b/toolkit/components/remotebrowserutils/RemoteWebNavigation.js similarity index 95% rename from toolkit/components/remotebrowserutils/RemoteWebNavigation.jsm rename to toolkit/components/remotebrowserutils/RemoteWebNavigation.js index 3574b5584053..2adad26cfe2b 100644 --- a/toolkit/components/remotebrowserutils/RemoteWebNavigation.jsm +++ b/toolkit/components/remotebrowserutils/RemoteWebNavigation.js @@ -3,8 +3,12 @@ // 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/. +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); + ChromeUtils.defineModuleGetter(this, "Services", "resource://gre/modules/Services.jsm"); +ChromeUtils.defineModuleGetter(this, "NetUtil", + "resource://gre/modules/NetUtil.jsm"); ChromeUtils.defineModuleGetter(this, "Utils", "resource://gre/modules/sessionstore/Utils.jsm"); ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils", @@ -153,4 +157,4 @@ RemoteWebNavigation.prototype = { }, }; -var EXPORTED_SYMBOLS = ["RemoteWebNavigation"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RemoteWebNavigation]); diff --git a/toolkit/components/remotebrowserutils/components.conf b/toolkit/components/remotebrowserutils/components.conf deleted file mode 100644 index 82e17f153de4..000000000000 --- a/toolkit/components/remotebrowserutils/components.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -*- 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': '{4b56964e-cdf3-4bb8-830c-0e2dad3f4ebd}', - 'contract_ids': ['@mozilla.org/remote-web-navigation;1'], - 'jsm': 'resource://gre/modules/RemoteWebNavigation.jsm', - 'constructor': 'RemoteWebNavigation', - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, -] diff --git a/toolkit/components/remotebrowserutils/moz.build b/toolkit/components/remotebrowserutils/moz.build index 09638620b79a..cecd90e14613 100644 --- a/toolkit/components/remotebrowserutils/moz.build +++ b/toolkit/components/remotebrowserutils/moz.build @@ -7,12 +7,9 @@ with Files('**'): BUG_COMPONENT = ('Core', 'Document Navigation') -EXTRA_JS_MODULES += [ - 'RemoteWebNavigation.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'remotebrowserutils.manifest', + 'RemoteWebNavigation.js', ] BROWSER_CHROME_MANIFESTS += ['tests/browser/browser.ini'] diff --git a/toolkit/components/remotebrowserutils/remotebrowserutils.manifest b/toolkit/components/remotebrowserutils/remotebrowserutils.manifest new file mode 100644 index 000000000000..d762d65a0c75 --- /dev/null +++ b/toolkit/components/remotebrowserutils/remotebrowserutils.manifest @@ -0,0 +1,2 @@ +component {4b56964e-cdf3-4bb8-830c-0e2dad3f4ebd} RemoteWebNavigation.js process=main +contract @mozilla.org/remote-web-navigation;1 {4b56964e-cdf3-4bb8-830c-0e2dad3f4ebd} process=main \ No newline at end of file diff --git a/toolkit/components/satchel/FormHistoryStartup.jsm b/toolkit/components/satchel/FormHistoryStartup.js similarity index 96% rename from toolkit/components/satchel/FormHistoryStartup.jsm rename to toolkit/components/satchel/FormHistoryStartup.js index f1453b7219ec..a13dbbccfea8 100644 --- a/toolkit/components/satchel/FormHistoryStartup.jsm +++ b/toolkit/components/satchel/FormHistoryStartup.js @@ -2,6 +2,7 @@ * 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/. */ +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); ChromeUtils.defineModuleGetter(this, "FormHistory", @@ -133,4 +134,4 @@ FormHistoryStartup.prototype = { }, }; -var EXPORTED_SYMBOLS = ["FormHistoryStartup"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FormHistoryStartup]); diff --git a/toolkit/components/satchel/components.conf b/toolkit/components/satchel/components.conf deleted file mode 100644 index 2702230abec4..000000000000 --- a/toolkit/components/satchel/components.conf +++ /dev/null @@ -1,37 +0,0 @@ -# -*- 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'], - }, - - { - 'cid': '{c11c21b2-71c9-4f87-a0f8-5e13f50495fd}', - 'contract_ids': ['@mozilla.org/satchel/form-autocomplete;1'], - 'jsm': 'resource://gre/modules/FormAutoComplete.jsm', - 'constructor': 'FormAutoComplete', - }, - { - 'cid': '{bf1e01d0-953e-11df-981c-0800200c9a66}', - 'contract_ids': ['@mozilla.org/satchel/inputlist-autocomplete;1'], - 'jsm': 'resource://gre/modules/InputListAutoComplete.jsm', - 'constructor': 'InputListAutoComplete', - }, - { - 'cid': '{3a0012eb-007f-4bb8-aa81-a07385f77a25}', - 'contract_ids': ['@mozilla.org/satchel/form-history-startup;1'], - 'jsm': 'resource://gre/modules/FormHistoryStartup.jsm', - 'constructor': 'FormHistoryStartup', - 'categories': {'profile-after-change': 'formHistoryStartup'}, - }, -] diff --git a/toolkit/components/satchel/moz.build b/toolkit/components/satchel/moz.build index ecdf1be5922a..d34df1cf75a6 100644 --- a/toolkit/components/satchel/moz.build +++ b/toolkit/components/satchel/moz.build @@ -27,17 +27,17 @@ LOCAL_INCLUDES += [ '../build', ] -EXTRA_JS_MODULES += [ - 'AutoCompletePopup.jsm', - 'FormAutoComplete.jsm', - 'FormHistory.jsm', - 'FormHistoryStartup.jsm', - 'InputListAutoComplete.jsm', - 'nsFormAutoCompleteResult.jsm', +EXTRA_COMPONENTS += [ + 'FormHistoryStartup.js', + 'nsFormAutoComplete.js', + 'nsInputListAutoComplete.js', + 'satchel.manifest', ] -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_JS_MODULES += [ + 'AutoCompletePopup.jsm', + 'FormHistory.jsm', + 'nsFormAutoCompleteResult.jsm', ] FINAL_LIBRARY = 'xul' diff --git a/toolkit/components/satchel/FormAutoComplete.jsm b/toolkit/components/satchel/nsFormAutoComplete.js similarity index 99% rename from toolkit/components/satchel/FormAutoComplete.jsm rename to toolkit/components/satchel/nsFormAutoComplete.js index 993584fe4ec5..db674bde4807 100644 --- a/toolkit/components/satchel/FormAutoComplete.jsm +++ b/toolkit/components/satchel/nsFormAutoComplete.js @@ -5,6 +5,7 @@ "use strict"; +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); function isAutocompleteDisabled(aField) { @@ -621,4 +622,4 @@ FormAutoCompleteResult.prototype = { }, }; -var EXPORTED_SYMBOLS = ["FormAutoComplete"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FormAutoComplete]); diff --git a/toolkit/components/satchel/nsFormFillController.cpp b/toolkit/components/satchel/nsFormFillController.cpp index 1cb2b9a21781..1c0a4ea4a884 100644 --- a/toolkit/components/satchel/nsFormFillController.cpp +++ b/toolkit/components/satchel/nsFormFillController.cpp @@ -34,6 +34,7 @@ #include "nsIPresShell.h" #include "nsRect.h" #include "nsILoginManager.h" +#include "mozilla/ModuleUtils.h" #include "nsToolkitCompsCID.h" #include "nsEmbedCID.h" #include "nsContentUtils.h" @@ -1347,3 +1348,23 @@ 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/satchel/InputListAutoComplete.jsm b/toolkit/components/satchel/nsInputListAutoComplete.js similarity index 91% rename from toolkit/components/satchel/InputListAutoComplete.jsm rename to toolkit/components/satchel/nsInputListAutoComplete.js index 780d68feb310..120dea45bc17 100644 --- a/toolkit/components/satchel/InputListAutoComplete.jsm +++ b/toolkit/components/satchel/nsInputListAutoComplete.js @@ -2,6 +2,7 @@ * 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/. */ +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {FormAutoCompleteResult} = ChromeUtils.import("resource://gre/modules/nsFormAutoCompleteResult.jsm"); @@ -61,4 +62,5 @@ InputListAutoComplete.prototype = { }, }; -var EXPORTED_SYMBOLS = ["InputListAutoComplete"]; +var component = [InputListAutoComplete]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component); diff --git a/toolkit/components/satchel/satchel.manifest b/toolkit/components/satchel/satchel.manifest new file mode 100644 index 000000000000..a435f780b4ab --- /dev/null +++ b/toolkit/components/satchel/satchel.manifest @@ -0,0 +1,7 @@ +component {c11c21b2-71c9-4f87-a0f8-5e13f50495fd} nsFormAutoComplete.js +contract @mozilla.org/satchel/form-autocomplete;1 {c11c21b2-71c9-4f87-a0f8-5e13f50495fd} +component {bf1e01d0-953e-11df-981c-0800200c9a66} nsInputListAutoComplete.js +contract @mozilla.org/satchel/inputlist-autocomplete;1 {bf1e01d0-953e-11df-981c-0800200c9a66} +component {3a0012eb-007f-4bb8-aa81-a07385f77a25} FormHistoryStartup.js +contract @mozilla.org/satchel/form-history-startup;1 {3a0012eb-007f-4bb8-aa81-a07385f77a25} +category profile-after-change formHistoryStartup @mozilla.org/satchel/form-history-startup;1 diff --git a/toolkit/components/search/components.conf b/toolkit/components/search/components.conf deleted file mode 100644 index 8182d3661d23..000000000000 --- a/toolkit/components/search/components.conf +++ /dev/null @@ -1,33 +0,0 @@ -# -*- 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/. - -HAVE_SIDEBAR = buildconfig.substs['MOZ_BUILD_APP'] in ('browser', 'mobile/android', 'xulrunner') - -Classes = [ - { - 'cid': '{7319788a-fe93-4db3-9f39-818cf08f4256}', - 'contract_ids': ['@mozilla.org/browser/search-service;1'], - 'jsm': 'resource://gre/modules/SearchService.jsm', - 'constructor': 'SearchService', - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - { - 'cid': '{aa892eb4-ffbf-477d-9f9a-06c995ae9f27}', - 'contract_ids': ['@mozilla.org/autocomplete/search;1?name=search-autocomplete'], - 'jsm': 'resource://gre/modules/SearchSuggestions.jsm', - 'constructor': 'SearchSuggestAutoComplete', - }, -] - -if HAVE_SIDEBAR: - Classes += [ - { - 'cid': '{22117140-9c6e-11d3-aaf1-00805f8a4905}', - 'contract_ids': ['@mozilla.org/sidebar;1'], - 'jsm': 'resource://gre/modules/Sidebar.jsm', - 'constructor': 'nsSidebar', - }, - ] diff --git a/toolkit/components/search/moz.build b/toolkit/components/search/moz.build index 651cd75ef8e8..8864aafe6358 100644 --- a/toolkit/components/search/moz.build +++ b/toolkit/components/search/moz.build @@ -14,26 +14,26 @@ if CONFIG['MOZ_TOOLKIT_SEARCH']: XPIDL_MODULE = 'toolkit_search' EXTRA_COMPONENTS += [ + 'nsSearchService.js', + 'nsSearchSuggestions.js', ] if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']: - EXTRA_JS_MODULES += [ - 'Sidebar.jsm', + DEFINES['HAVE_SIDEBAR'] = True + EXTRA_COMPONENTS += [ + 'nsSidebar.js', ] EXTRA_JS_MODULES += [ - 'SearchService.jsm', - 'SearchStaticData.jsm', 'SearchSuggestionController.jsm', - 'SearchSuggestions.jsm', ] -EXTRA_COMPONENTS += [ +EXTRA_PP_COMPONENTS += [ 'toolkitsearch.manifest', ] -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_JS_MODULES += [ + 'SearchStaticData.jsm', ] with Files('**'): diff --git a/toolkit/components/search/SearchService.jsm b/toolkit/components/search/nsSearchService.js similarity index 99% rename from toolkit/components/search/SearchService.jsm rename to toolkit/components/search/nsSearchService.js index cf1ba32cd0a3..bb19d89a7256 100644 --- a/toolkit/components/search/SearchService.jsm +++ b/toolkit/components/search/nsSearchService.js @@ -8,11 +8,15 @@ const {PromiseUtils} = ChromeUtils.import("resource://gre/modules/PromiseUtils.j const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); XPCOMUtils.defineLazyModuleGetters(this, { + AsyncShutdown: "resource://gre/modules/AsyncShutdown.jsm", DeferredTask: "resource://gre/modules/DeferredTask.jsm", OS: "resource://gre/modules/osfile.jsm", + Deprecated: "resource://gre/modules/Deprecated.jsm", SearchStaticData: "resource://gre/modules/SearchStaticData.jsm", setTimeout: "resource://gre/modules/Timer.jsm", clearTimeout: "resource://gre/modules/Timer.jsm", + Lz4: "resource://gre/modules/lz4.js", + NetUtil: "resource://gre/modules/NetUtil.jsm", ExtensionParent: "resource://gre/modules/ExtensionParent.jsm", }); @@ -47,12 +51,21 @@ XPCOMUtils.defineLazyGetter(this, "gEncoder", }); +const MODE_RDONLY = 0x01; +const MODE_WRONLY = 0x02; +const MODE_CREATE = 0x08; +const MODE_APPEND = 0x10; +const MODE_TRUNCATE = 0x20; +const PERMS_FILE = 0o644; + // Directory service keys const NS_APP_DISTRIBUTION_SEARCH_DIR_LIST = "SrchPluginsDistDL"; +const NS_APP_USER_PROFILE_50_DIR = "ProfD"; // We load plugins from APP_SEARCH_PREFIX, where a list.json // file needs to exist to list available engines. const APP_SEARCH_PREFIX = "resource://search-plugins/"; +const EXT_SEARCH_PREFIX = "resource://search-extensions/"; // See documentation in nsISearchService.idl. const SEARCH_ENGINE_TOPIC = "browser-search-engine-modified"; @@ -79,6 +92,9 @@ const SEARCH_SERVICE_TOPIC = "browser-search-service"; */ const SEARCH_SERVICE_CACHE_WRITTEN = "write-cache-to-disk-complete"; +// Delay for lazy serialization (ms) +const LAZY_SERIALIZE_DELAY = 100; + // Delay for batching invalidation of the JSON cache (ms) const CACHE_INVALIDATION_DELAY = 1000; @@ -88,6 +104,8 @@ const CACHE_VERSION = 1; const CACHE_FILENAME = "search.json.mozlz4"; +const NEW_LINES = /(\r\n|\r|\n)/; + // Set an arbitrary cap on the maximum icon size. Without this, large icons can // cause big delays when loading them at startup. const MAX_ICON_SIZE = 20000; @@ -130,6 +148,7 @@ const MOZ_PARAM_OFFICIAL = "moz:official"; // Supported OpenSearch parameters // See http://opensearch.a9.com/spec/1.1/querysyntax/#core +const OS_PARAM_USER_DEFINED = "searchTerms"; const OS_PARAM_INPUT_ENCODING = "inputEncoding"; const OS_PARAM_LANGUAGE = "language"; const OS_PARAM_OUTPUT_ENCODING = "outputEncoding"; @@ -170,6 +189,7 @@ const SEARCH_DEFAULT_UPDATE_INTERVAL = 7; // from the server doesn't specify an interval. const SEARCH_GEO_DEFAULT_UPDATE_INTERVAL = 2592000; // 30 days. +const SEARCH_COUNTS_HISTOGRAM_KEY = "SEARCH_COUNTS"; /** * Prefixed to all search debug output. */ @@ -712,6 +732,21 @@ function getVerificationHash(aName) { return hasher.finish(true); } +/** + * Safely close a nsISafeOutputStream. + * @param aFOS + * The file output stream to close. + */ +function closeSafeOutputStream(aFOS) { + if (aFOS instanceof Ci.nsISafeOutputStream) { + try { + aFOS.finish(); + return; + } catch (e) { } + } + aFOS.close(); +} + /** * Wrapper function for nsIIOService::newURI. * @param aURLSpec @@ -833,6 +868,11 @@ function notifyAction(aEngine, aVerb) { } } +function parseJsonFromStream(aInputStream) { + let bytes = NetUtil.readInputStream(aInputStream, aInputStream.available()); + return JSON.parse(new TextDecoder().decode(bytes)); +} + /** * Simple object representing a name/value pair. */ @@ -4492,4 +4532,4 @@ var engineUpdateService = { }, }; -var EXPORTED_SYMBOLS = ["SearchService"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SearchService]); diff --git a/toolkit/components/search/SearchSuggestions.jsm b/toolkit/components/search/nsSearchSuggestions.js similarity index 97% rename from toolkit/components/search/SearchSuggestions.jsm rename to toolkit/components/search/nsSearchSuggestions.js index 40d8f8d5981e..cc793e684e1d 100644 --- a/toolkit/components/search/SearchSuggestions.jsm +++ b/toolkit/components/search/nsSearchSuggestions.js @@ -2,6 +2,7 @@ * 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/. */ +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {FormAutoCompleteResult} = ChromeUtils.import("resource://gre/modules/nsFormAutoCompleteResult.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); ChromeUtils.defineModuleGetter(this, "SearchSuggestionController", @@ -178,4 +179,5 @@ SearchSuggestAutoComplete.prototype = { serviceURL: "", }; -var EXPORTED_SYMBOLS = ["SearchSuggestAutoComplete"]; +var component = [SearchSuggestAutoComplete]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(component); diff --git a/toolkit/components/search/Sidebar.jsm b/toolkit/components/search/nsSidebar.js similarity index 90% rename from toolkit/components/search/Sidebar.jsm rename to toolkit/components/search/nsSidebar.js index 381fb938f2b4..9672e4a1964f 100644 --- a/toolkit/components/search/Sidebar.jsm +++ b/toolkit/components/search/nsSidebar.js @@ -3,6 +3,7 @@ * 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/. */ +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); function nsSidebar() { @@ -42,4 +43,4 @@ nsSidebar.prototype = { QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer]), }; -var EXPORTED_SYMBOLS = ["nsSidebar"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsSidebar]); diff --git a/toolkit/components/search/toolkitsearch.manifest b/toolkit/components/search/toolkitsearch.manifest index c69934e2d3a9..b7c55da0e966 100644 --- a/toolkit/components/search/toolkitsearch.manifest +++ b/toolkit/components/search/toolkitsearch.manifest @@ -1,2 +1,10 @@ +component {7319788a-fe93-4db3-9f39-818cf08f4256} nsSearchService.js process=main +contract @mozilla.org/browser/search-service;1 {7319788a-fe93-4db3-9f39-818cf08f4256} process=main # 21600 == 6 hours category update-timer nsSearchService @mozilla.org/browser/search-service;1,getService,search-engine-update-timer,browser.search.update.interval,21600 +component {aa892eb4-ffbf-477d-9f9a-06c995ae9f27} nsSearchSuggestions.js +contract @mozilla.org/autocomplete/search;1?name=search-autocomplete {aa892eb4-ffbf-477d-9f9a-06c995ae9f27} +#ifdef HAVE_SIDEBAR +component {22117140-9c6e-11d3-aaf1-00805f8a4905} nsSidebar.js +contract @mozilla.org/sidebar;1 {22117140-9c6e-11d3-aaf1-00805f8a4905} +#endif diff --git a/toolkit/components/telemetry/TelemetryStartup.jsm b/toolkit/components/telemetry/TelemetryStartup.js similarity index 87% rename from toolkit/components/telemetry/TelemetryStartup.jsm rename to toolkit/components/telemetry/TelemetryStartup.js index d2481dc14ec4..3a51ccb0f502 100644 --- a/toolkit/components/telemetry/TelemetryStartup.jsm +++ b/toolkit/components/telemetry/TelemetryStartup.js @@ -5,6 +5,8 @@ "use strict"; +ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm", this); + ChromeUtils.defineModuleGetter(this, "TelemetryController", "resource://gre/modules/TelemetryController.jsm"); ChromeUtils.defineModuleGetter(this, "TelemetryEnvironment", @@ -17,6 +19,7 @@ ChromeUtils.defineModuleGetter(this, "TelemetryEnvironment", function TelemetryStartup() { } +TelemetryStartup.prototype.classID = Components.ID("{117b219f-92fe-4bd2-a21b-95a342a9d474}"); TelemetryStartup.prototype.QueryInterface = ChromeUtils.generateQI([Ci.nsIObserver]); TelemetryStartup.prototype.observe = function(aSubject, aTopic, aData) { if (aTopic == "profile-after-change") { @@ -42,4 +45,4 @@ function annotateEnvironment() { } } -var EXPORTED_SYMBOLS = ["TelemetryStartup"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TelemetryStartup]); diff --git a/toolkit/components/telemetry/TelemetryStartup.manifest b/toolkit/components/telemetry/TelemetryStartup.manifest new file mode 100644 index 000000000000..7adb4a17090c --- /dev/null +++ b/toolkit/components/telemetry/TelemetryStartup.manifest @@ -0,0 +1,3 @@ +component {117b219f-92fe-4bd2-a21b-95a342a9d474} TelemetryStartup.js +contract @mozilla.org/base/telemetry-startup;1 {117b219f-92fe-4bd2-a21b-95a342a9d474} +category profile-after-change TelemetryStartup @mozilla.org/base/telemetry-startup;1 process=main diff --git a/toolkit/components/telemetry/components.conf b/toolkit/components/telemetry/components.conf deleted file mode 100644 index cff6a9faf438..000000000000 --- a/toolkit/components/telemetry/components.conf +++ /dev/null @@ -1,16 +0,0 @@ -# -*- 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': '{117b219f-92fe-4bd2-a21b-95a342a9d474}', - 'contract_ids': ['@mozilla.org/base/telemetry-startup;1'], - 'jsm': 'resource://gre/modules/TelemetryStartup.jsm', - 'constructor': 'TelemetryStartup', - 'categories': {'profile-after-change': 'TelemetryStartup'}, - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, -] diff --git a/toolkit/components/telemetry/core/Telemetry.cpp b/toolkit/components/telemetry/core/Telemetry.cpp index 85a3eff02946..48faab31930f 100644 --- a/toolkit/components/telemetry/core/Telemetry.cpp +++ b/toolkit/components/telemetry/core/Telemetry.cpp @@ -27,7 +27,6 @@ #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" @@ -1546,6 +1545,35 @@ 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) { @@ -1805,6 +1833,8 @@ 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. @@ -2113,13 +2143,5 @@ 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 286040278b36..a7f56194d198 100644 --- a/toolkit/components/telemetry/core/Telemetry.h +++ b/toolkit/components/telemetry/core/Telemetry.h @@ -43,11 +43,6 @@ 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 deleted file mode 100644 index edbf2f408700..000000000000 --- a/toolkit/components/telemetry/core/components.conf +++ /dev/null @@ -1,19 +0,0 @@ -# -*- 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/hybrid-content/HybridContentTelemetry.jsm b/toolkit/components/telemetry/hybrid-content/HybridContentTelemetry.jsm index bb386ab8254c..ad12b0a2f573 100644 --- a/toolkit/components/telemetry/hybrid-content/HybridContentTelemetry.jsm +++ b/toolkit/components/telemetry/hybrid-content/HybridContentTelemetry.jsm @@ -45,8 +45,7 @@ let HybridContentTelemetry = { /** * This is the handler for the async "HybridContentTelemetry:onTelemetryMessage" - * message. This function is getting called by the listener in - * BrowserGlue.jsm. + * message. This function is getting called by the listener in nsBrowserGlue.js. */ onTelemetryMessage(aMessage, aData) { if (!this._hybridContentEnabled) { diff --git a/toolkit/components/telemetry/hybrid-content/content-HybridContentTelemetry.js b/toolkit/components/telemetry/hybrid-content/content-HybridContentTelemetry.js index 954b8483766b..0e2b64c4d5b7 100644 --- a/toolkit/components/telemetry/hybrid-content/content-HybridContentTelemetry.js +++ b/toolkit/components/telemetry/hybrid-content/content-HybridContentTelemetry.js @@ -124,7 +124,7 @@ var HybridContentTelemetryListener = { } // Note that the name of the async message must match the name of - // the message in the related listener in BrowserGlue.jsm. + // the message in the related listener in nsBrowserGlue.js. sendAsyncMessage("HybridContentTelemetry:onTelemetryMessage", { name: event.detail.name, data: event.detail.data, diff --git a/toolkit/components/telemetry/moz.build b/toolkit/components/telemetry/moz.build index 15f0c9e62a47..70c5b78be941 100644 --- a/toolkit/components/telemetry/moz.build +++ b/toolkit/components/telemetry/moz.build @@ -93,9 +93,9 @@ if CONFIG['MOZ_GECKO_PROFILER']: 'other/KeyedStackCapturer.cpp' ] -XPCOM_MANIFESTS += [ - 'components.conf', - 'core/components.conf', +EXTRA_COMPONENTS += [ + 'TelemetryStartup.js', + 'TelemetryStartup.manifest' ] EXTRA_JS_MODULES += [ @@ -116,7 +116,6 @@ EXTRA_JS_MODULES += [ 'pings/TelemetrySession.jsm', 'pings/UntrustedModulesPing.jsm', 'pings/UpdatePing.jsm', - 'TelemetryStartup.jsm', ] TESTING_JS_MODULES += [ diff --git a/toolkit/components/terminator/components.conf b/toolkit/components/terminator/components.conf deleted file mode 100644 index 8c11a2dccfa9..000000000000 --- a/toolkit/components/terminator/components.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -*- 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': '{3f78ada1-cba2-442a-82dd-d5fb300ddea7}', - 'contract_ids': ['@mozilla.org/toolkit/shutdown-terminator-telemetry;1'], - 'jsm': 'resource://gre/modules/TerminatorTelemetry.jsm', - 'constructor': 'nsTerminatorTelemetry', - 'categories': {'profile-after-change': 'nsTerminatorTelemetry'}, - }, -] diff --git a/toolkit/components/terminator/moz.build b/toolkit/components/terminator/moz.build index bae014fe27f3..19379a9313aa 100644 --- a/toolkit/components/terminator/moz.build +++ b/toolkit/components/terminator/moz.build @@ -18,15 +18,8 @@ EXPORTS += [ ] EXTRA_COMPONENTS += [ + 'nsTerminatorTelemetry.js', 'terminator.manifest', ] -EXTRA_JS_MODULES += [ - 'TerminatorTelemetry.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', -] - FINAL_LIBRARY = 'xul' diff --git a/toolkit/components/terminator/TerminatorTelemetry.jsm b/toolkit/components/terminator/nsTerminatorTelemetry.js similarity index 97% rename from toolkit/components/terminator/TerminatorTelemetry.jsm rename to toolkit/components/terminator/nsTerminatorTelemetry.js index 9d10f75959a9..14a3dd1bc5cf 100644 --- a/toolkit/components/terminator/TerminatorTelemetry.jsm +++ b/toolkit/components/terminator/nsTerminatorTelemetry.js @@ -91,4 +91,4 @@ nsTerminatorTelemetry.prototype = { // Module -var EXPORTED_SYMBOLS = ["nsTerminatorTelemetry"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsTerminatorTelemetry]); diff --git a/toolkit/components/terminator/terminator.manifest b/toolkit/components/terminator/terminator.manifest index 33cb143de9f1..c1757ba86ab3 100644 --- a/toolkit/components/terminator/terminator.manifest +++ b/toolkit/components/terminator/terminator.manifest @@ -1 +1,5 @@ category profile-after-change nsTerminator @mozilla.org/toolkit/shutdown-terminator;1 + +component {3f78ada1-cba2-442a-82dd-d5fb300ddea7} nsTerminatorTelemetry.js +contract @mozilla.org/toolkit/shutdown-terminator-telemetry;1 {3f78ada1-cba2-442a-82dd-d5fb300ddea7} +category profile-after-change nsTerminatorTelemetry @mozilla.org/toolkit/shutdown-terminator-telemetry;1 diff --git a/toolkit/components/thumbnails/PageThumbsComponents.manifest b/toolkit/components/thumbnails/PageThumbsComponents.manifest new file mode 100644 index 000000000000..1e815404c098 --- /dev/null +++ b/toolkit/components/thumbnails/PageThumbsComponents.manifest @@ -0,0 +1,2 @@ +component {97943eec-0e48-49ef-b7b7-cf4aa0109bb6} PageThumbsStorageService.js +contract @mozilla.org/thumbnails/pagethumbs-service;1 {97943eec-0e48-49ef-b7b7-cf4aa0109bb6} diff --git a/toolkit/components/thumbnails/PageThumbsStorageService.jsm b/toolkit/components/thumbnails/PageThumbsStorageService.js similarity index 95% rename from toolkit/components/thumbnails/PageThumbsStorageService.jsm rename to toolkit/components/thumbnails/PageThumbsStorageService.js index bb50195e5763..01089a0bab90 100644 --- a/toolkit/components/thumbnails/PageThumbsStorageService.jsm +++ b/toolkit/components/thumbnails/PageThumbsStorageService.js @@ -57,4 +57,4 @@ PageThumbsStorageService.prototype = { }; -var EXPORTED_SYMBOLS = ["PageThumbsStorageService"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PageThumbsStorageService]); diff --git a/toolkit/components/thumbnails/components.conf b/toolkit/components/thumbnails/components.conf deleted file mode 100644 index 615216adbf47..000000000000 --- a/toolkit/components/thumbnails/components.conf +++ /dev/null @@ -1,21 +0,0 @@ -# -*- 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'], - }, - - { - 'cid': '{97943eec-0e48-49ef-b7b7-cf4aa0109bb6}', - 'contract_ids': ['@mozilla.org/thumbnails/pagethumbs-service;1'], - 'jsm': 'resource://gre/modules/PageThumbsStorageService.jsm', - 'constructor': 'PageThumbsStorageService', - }, -] diff --git a/toolkit/components/thumbnails/moz.build b/toolkit/components/thumbnails/moz.build index 8275dbd7e87f..052a27fd994e 100644 --- a/toolkit/components/thumbnails/moz.build +++ b/toolkit/components/thumbnails/moz.build @@ -10,15 +10,20 @@ with Files('**'): BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell.ini'] +EXTRA_COMPONENTS += [ + 'PageThumbsComponents.manifest', + 'PageThumbsStorageService.js', +] + EXTRA_JS_MODULES += [ 'BackgroundPageThumbs.jsm', 'PageThumbs.jsm', - 'PageThumbsStorageService.jsm', 'PageThumbsWorker.js', 'PageThumbUtils.jsm', ] UNIFIED_SOURCES += [ + 'nsPageThumbsModule.cpp', 'PageThumbsProtocol.cpp' ] @@ -30,10 +35,6 @@ 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 new file mode 100644 index 000000000000..effd333ac9d4 --- /dev/null +++ b/toolkit/components/thumbnails/nsPageThumbsModule.cpp @@ -0,0 +1,21 @@ +#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/components/timermanager/components.conf b/toolkit/components/timermanager/components.conf deleted file mode 100644 index e91bfa681163..000000000000 --- a/toolkit/components/timermanager/components.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -*- 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': '{B322A5C0-A419-484E-96BA-D7182163899F}', - 'contract_ids': ['@mozilla.org/updates/timer-manager;1'], - 'jsm': 'resource://gre/modules/UpdateTimerManager.jsm', - 'constructor': 'TimerManager', - 'categories': {'profile-after-change': 'nsUpdateTimerManager'}, - }, -] diff --git a/toolkit/components/timermanager/moz.build b/toolkit/components/timermanager/moz.build index e923c8a42ce1..9977df6b5c39 100644 --- a/toolkit/components/timermanager/moz.build +++ b/toolkit/components/timermanager/moz.build @@ -12,12 +12,9 @@ XPIDL_SOURCES += [ 'nsIUpdateTimerManager.idl', ] -EXTRA_JS_MODULES += [ - 'UpdateTimerManager.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'nsUpdateTimerManager.js', + 'nsUpdateTimerManager.manifest', ] with Files('**'): diff --git a/toolkit/components/timermanager/UpdateTimerManager.jsm b/toolkit/components/timermanager/nsUpdateTimerManager.js similarity index 99% rename from toolkit/components/timermanager/UpdateTimerManager.jsm rename to toolkit/components/timermanager/nsUpdateTimerManager.js index ee3e3213069d..4c5dbdfc2300 100644 --- a/toolkit/components/timermanager/UpdateTimerManager.jsm +++ b/toolkit/components/timermanager/nsUpdateTimerManager.js @@ -330,4 +330,4 @@ TimerManager.prototype = { Ci.nsIObserver]), }; -var EXPORTED_SYMBOLS = ["TimerManager"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TimerManager]); diff --git a/toolkit/components/timermanager/nsUpdateTimerManager.manifest b/toolkit/components/timermanager/nsUpdateTimerManager.manifest new file mode 100644 index 000000000000..73cb11e352f0 --- /dev/null +++ b/toolkit/components/timermanager/nsUpdateTimerManager.manifest @@ -0,0 +1,3 @@ +component {B322A5C0-A419-484E-96BA-D7182163899F} nsUpdateTimerManager.js +contract @mozilla.org/updates/timer-manager;1 {B322A5C0-A419-484E-96BA-D7182163899F} +category profile-after-change nsUpdateTimerManager @mozilla.org/updates/timer-manager;1 diff --git a/toolkit/components/tooltiptext/TooltipTextProvider.jsm b/toolkit/components/tooltiptext/TooltipTextProvider.js similarity index 97% rename from toolkit/components/tooltiptext/TooltipTextProvider.jsm rename to toolkit/components/tooltiptext/TooltipTextProvider.js index a9c3a9d0f966..4d3fdccd5bb1 100644 --- a/toolkit/components/tooltiptext/TooltipTextProvider.jsm +++ b/toolkit/components/tooltiptext/TooltipTextProvider.js @@ -2,6 +2,7 @@ * 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/. */ +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); function TooltipTextProvider() {} @@ -145,4 +146,5 @@ TooltipTextProvider.prototype = { QueryInterface: ChromeUtils.generateQI([Ci.nsITooltipTextProvider]), }; -var EXPORTED_SYMBOLS = ["TooltipTextProvider"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TooltipTextProvider]); + diff --git a/toolkit/components/tooltiptext/TooltipTextProvider.manifest b/toolkit/components/tooltiptext/TooltipTextProvider.manifest new file mode 100644 index 000000000000..a7dac6cd9c34 --- /dev/null +++ b/toolkit/components/tooltiptext/TooltipTextProvider.manifest @@ -0,0 +1,2 @@ +component {f376627f-0bbc-47b8-887e-fc92574cc91f} TooltipTextProvider.js +contract @mozilla.org/embedcomp/default-tooltiptextprovider;1 {f376627f-0bbc-47b8-887e-fc92574cc91f} diff --git a/toolkit/components/tooltiptext/components.conf b/toolkit/components/tooltiptext/components.conf deleted file mode 100644 index 7a097675969a..000000000000 --- a/toolkit/components/tooltiptext/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{f376627f-0bbc-47b8-887e-fc92574cc91f}', - 'contract_ids': ['@mozilla.org/embedcomp/default-tooltiptextprovider;1'], - 'jsm': 'resource://gre/modules/TooltipTextProvider.jsm', - 'constructor': 'TooltipTextProvider', - }, -] diff --git a/toolkit/components/tooltiptext/moz.build b/toolkit/components/tooltiptext/moz.build index 28c2aff23aa6..c75e6b7a465e 100644 --- a/toolkit/components/tooltiptext/moz.build +++ b/toolkit/components/tooltiptext/moz.build @@ -6,12 +6,9 @@ BROWSER_CHROME_MANIFESTS += ['tests/browser.ini'] -EXTRA_JS_MODULES += [ - 'TooltipTextProvider.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'TooltipTextProvider.js', + 'TooltipTextProvider.manifest', ] with Files('**'): diff --git a/toolkit/components/url-classifier/components.conf b/toolkit/components/url-classifier/components.conf deleted file mode 100644 index 420d096302b9..000000000000 --- a/toolkit/components/url-classifier/components.conf +++ /dev/null @@ -1,26 +0,0 @@ -# -*- 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': '{26a4a019-2827-4a89-a85c-5931a678823a}', - 'contract_ids': ['@mozilla.org/url-classifier/jslib;1'], - 'jsm': 'resource://gre/modules/UrlClassifierLib.jsm', - 'constructor': 'UrlClassifierLib', - }, - { - 'cid': '{ca168834-cc00-48f9-b83c-fd018e58cae3}', - 'contract_ids': ['@mozilla.org/url-classifier/listmanager;1'], - 'jsm': 'resource://gre/modules/UrlClassifierListManager.jsm', - 'constructor': 'RegistrationData', - }, - { - 'cid': '{9111de73-9322-4bfc-8b65-2b727f3e6ec8}', - 'contract_ids': ['@mozilla.org/url-classifier/hashcompleter;1'], - 'jsm': 'resource://gre/modules/UrlClassifierHashCompleter.jsm', - 'constructor': 'HashCompleter', - }, -] diff --git a/toolkit/components/url-classifier/moz.build b/toolkit/components/url-classifier/moz.build index 9c06c8402dab..ecb61bbbb395 100644 --- a/toolkit/components/url-classifier/moz.build +++ b/toolkit/components/url-classifier/moz.build @@ -53,15 +53,15 @@ SOURCES += [ 'HashStore.cpp', ] -EXTRA_JS_MODULES += [ - 'SafeBrowsing.jsm', - 'UrlClassifierHashCompleter.jsm', - 'UrlClassifierLib.jsm', - 'UrlClassifierListManager.jsm', +EXTRA_COMPONENTS += [ + 'nsURLClassifier.manifest', + 'nsUrlClassifierHashCompleter.js', + 'nsUrlClassifierLib.js', + 'nsUrlClassifierListManager.js', ] -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_JS_MODULES += [ + 'SafeBrowsing.jsm', ] EXPORTS += [ diff --git a/toolkit/components/url-classifier/nsURLClassifier.manifest b/toolkit/components/url-classifier/nsURLClassifier.manifest new file mode 100644 index 000000000000..f035dea80953 --- /dev/null +++ b/toolkit/components/url-classifier/nsURLClassifier.manifest @@ -0,0 +1,6 @@ +component {26a4a019-2827-4a89-a85c-5931a678823a} nsUrlClassifierLib.js +contract @mozilla.org/url-classifier/jslib;1 {26a4a019-2827-4a89-a85c-5931a678823a} +component {ca168834-cc00-48f9-b83c-fd018e58cae3} nsUrlClassifierListManager.js +contract @mozilla.org/url-classifier/listmanager;1 {ca168834-cc00-48f9-b83c-fd018e58cae3} +component {9111de73-9322-4bfc-8b65-2b727f3e6ec8} nsUrlClassifierHashCompleter.js +contract @mozilla.org/url-classifier/hashcompleter;1 {9111de73-9322-4bfc-8b65-2b727f3e6ec8} diff --git a/toolkit/components/url-classifier/UrlClassifierHashCompleter.jsm b/toolkit/components/url-classifier/nsUrlClassifierHashCompleter.js similarity index 98% rename from toolkit/components/url-classifier/UrlClassifierHashCompleter.jsm rename to toolkit/components/url-classifier/nsUrlClassifierHashCompleter.js index c29157fa63db..cb5a6ee98f8f 100644 --- a/toolkit/components/url-classifier/UrlClassifierHashCompleter.jsm +++ b/toolkit/components/url-classifier/nsUrlClassifierHashCompleter.js @@ -845,10 +845,18 @@ HashCompleterRequest.prototype = { }, }; +// Converts a URL safe base64 string to a normal base64 string. Will not change +// normal base64 strings. This is modelled after the same function in +// nsUrlClassifierUtils.h. +function unUrlsafeBase64(aStr) { + return !aStr ? "" : aStr.replace(/-/g, "+") + .replace(/_/g, "/"); +} + function errorWithStack() { let err = new Error(); err.value = Cr.NS_ERROR_FAILURE; return err; } -var EXPORTED_SYMBOLS = ["HashCompleter"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([HashCompleter]); diff --git a/toolkit/components/url-classifier/UrlClassifierLib.jsm b/toolkit/components/url-classifier/nsUrlClassifierLib.js similarity index 96% rename from toolkit/components/url-classifier/UrlClassifierLib.jsm rename to toolkit/components/url-classifier/nsUrlClassifierLib.js index e57fa25fb3b6..bbb439980187 100644 --- a/toolkit/components/url-classifier/UrlClassifierLib.jsm +++ b/toolkit/components/url-classifier/nsUrlClassifierLib.js @@ -6,6 +6,9 @@ // the common JS files used by safebrowsing and url-classifier into a // single component. +const G_GDEBUG = false; + +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); const PREF_DISABLE_TEST_BACKOFF = "browser.safebrowsing.provider.test.disableBackoff"; @@ -183,7 +186,6 @@ RequestBackoff.prototype.isErrorStatus = function(status) { // since both listmanager and hashcompleter would use it. // Note that |maxRequests| and |requestPeriod| is still configurable // to throttle pending requests. -/* exported RequestBackoffV4 */ function RequestBackoffV4(maxRequests, requestPeriod, provider = null) { let rand = Math.random(); @@ -206,6 +208,7 @@ var lib = this; function UrlClassifierLib() { this.wrappedJSObject = lib; } +UrlClassifierLib.prototype.classID = Components.ID("{26a4a019-2827-4a89-a85c-5931a678823a}"); UrlClassifierLib.prototype.QueryInterface = ChromeUtils.generateQI([]); -var EXPORTED_SYMBOLS = ["UrlClassifierLib"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([UrlClassifierLib]); diff --git a/toolkit/components/url-classifier/UrlClassifierListManager.jsm b/toolkit/components/url-classifier/nsUrlClassifierListManager.js similarity index 97% rename from toolkit/components/url-classifier/UrlClassifierListManager.jsm rename to toolkit/components/url-classifier/nsUrlClassifierListManager.js index 8caa4e4332db..12834572ac96 100644 --- a/toolkit/components/url-classifier/UrlClassifierListManager.jsm +++ b/toolkit/components/url-classifier/nsUrlClassifierListManager.js @@ -2,6 +2,7 @@ * 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/. */ +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); // This is the only implementation of nsIUrlListManager. @@ -696,8 +697,17 @@ function Init() { } function RegistrationData() { - Init(); - return new PROT_ListManager(); } +RegistrationData.prototype = { + classID: Components.ID("{ca168834-cc00-48f9-b83c-fd018e58cae3}"), + _xpcom_factory: { + createInstance(outer, iid) { + if (outer != null) + throw Cr.NS_ERROR_NO_AGGREGATION; + Init(); + return (new PROT_ListManager()).QueryInterface(iid); + }, + }, +}; -var EXPORTED_SYMBOLS = ["RegistrationData"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RegistrationData]); diff --git a/toolkit/components/urlformatter/components.conf b/toolkit/components/urlformatter/components.conf deleted file mode 100644 index f41c89b3fc52..000000000000 --- a/toolkit/components/urlformatter/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{e6156350-2be8-11db-a98b-0800200c9a66}', - 'contract_ids': ['@mozilla.org/toolkit/URLFormatterService;1'], - 'jsm': 'resource://gre/modules/URLFormatter.jsm', - 'constructor': 'nsURLFormatterService', - }, -] diff --git a/toolkit/components/urlformatter/moz.build b/toolkit/components/urlformatter/moz.build index 7007d6ade2ec..6a13571494cc 100644 --- a/toolkit/components/urlformatter/moz.build +++ b/toolkit/components/urlformatter/moz.build @@ -15,12 +15,9 @@ XPIDL_SOURCES += [ XPIDL_MODULE = 'urlformatter' -EXTRA_JS_MODULES += [ - 'URLFormatter.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'nsURLFormatter.js', + 'nsURLFormatter.manifest', ] DEFINES['OBJDIR'] = OBJDIR diff --git a/toolkit/components/urlformatter/URLFormatter.jsm b/toolkit/components/urlformatter/nsURLFormatter.js similarity index 98% rename from toolkit/components/urlformatter/URLFormatter.jsm rename to toolkit/components/urlformatter/nsURLFormatter.js index 5a9c3a73540c..7e5a547b9620 100644 --- a/toolkit/components/urlformatter/URLFormatter.jsm +++ b/toolkit/components/urlformatter/nsURLFormatter.js @@ -133,4 +133,4 @@ nsURLFormatterService.prototype = { }, }; -var EXPORTED_SYMBOLS = ["nsURLFormatterService"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsURLFormatterService]); diff --git a/toolkit/components/urlformatter/nsURLFormatter.manifest b/toolkit/components/urlformatter/nsURLFormatter.manifest new file mode 100644 index 000000000000..3f9123d7357a --- /dev/null +++ b/toolkit/components/urlformatter/nsURLFormatter.manifest @@ -0,0 +1,2 @@ +component {e6156350-2be8-11db-a98b-0800200c9a66} nsURLFormatter.js +contract @mozilla.org/toolkit/URLFormatterService;1 {e6156350-2be8-11db-a98b-0800200c9a66} diff --git a/toolkit/components/utils/components.conf b/toolkit/components/utils/components.conf deleted file mode 100644 index 595381b8e09f..000000000000 --- a/toolkit/components/utils/components.conf +++ /dev/null @@ -1,21 +0,0 @@ -# -*- 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': '{ded150e3-c92e-4077-a396-0dba9953e39f}', - 'contract_ids': ['@mozilla.org/streamconv;1?from=application/vnd.mozilla.webext.unlocalized&to=text/css'], - 'jsm': 'resource://gre/modules/SimpleServices.jsm', - 'constructor': 'AddonLocalizationConverter', - }, - { - 'cid': '{742ad274-34c5-43d1-a8b7-293eaf8962d6}', - 'contract_ids': ['@mozilla.org/content-viewers/http-index-format'], - 'jsm': 'resource://gre/modules/SimpleServices.jsm', - 'constructor': 'HttpIndexViewer', - 'categories': {'Gecko-Content-Viewers': 'application/http-index-format'}, - }, -] diff --git a/toolkit/components/utils/moz.build b/toolkit/components/utils/moz.build index 02dee89be450..35ed1bc62193 100644 --- a/toolkit/components/utils/moz.build +++ b/toolkit/components/utils/moz.build @@ -7,8 +7,9 @@ with Files('**'): BUG_COMPONENT = ('Toolkit', 'General') -EXTRA_JS_MODULES += [ - 'SimpleServices.jsm', +EXTRA_COMPONENTS += [ + 'simpleServices.js', + 'utils.manifest', ] EXTRA_JS_MODULES['components-utils'] = [ @@ -20,9 +21,5 @@ EXTRA_JS_MODULES['components-utils'] = [ 'Sampling.jsm', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini'] XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini'] diff --git a/toolkit/components/utils/SimpleServices.jsm b/toolkit/components/utils/simpleServices.js similarity index 94% rename from toolkit/components/utils/SimpleServices.jsm rename to toolkit/components/utils/simpleServices.js index 2665308df525..d14ae59bf577 100644 --- a/toolkit/components/utils/SimpleServices.jsm +++ b/toolkit/components/utils/simpleServices.js @@ -38,6 +38,7 @@ function AddonLocalizationConverter() { } AddonLocalizationConverter.prototype = { + classID: Components.ID("{ded150e3-c92e-4077-a396-0dba9953e39f}"), QueryInterface: ChromeUtils.generateQI([Ci.nsIStreamConverter]), FROM_TYPE: "application/vnd.mozilla.webext.unlocalized", @@ -120,6 +121,7 @@ function HttpIndexViewer() { } HttpIndexViewer.prototype = { + classID: Components.ID("{742ad274-34c5-43d1-a8b7-293eaf8962d6}"), QueryInterface: ChromeUtils.generateQI([Ci.nsIDocumentLoaderFactory]), createInstance(aCommand, aChannel, aLoadGroup, aContentType, aContainer, @@ -142,4 +144,5 @@ HttpIndexViewer.prototype = { }, }; -var EXPORTED_SYMBOLS = ["AddonLocalizationConverter", "HttpIndexViewer"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AddonLocalizationConverter, + HttpIndexViewer]); diff --git a/toolkit/components/utils/utils.manifest b/toolkit/components/utils/utils.manifest new file mode 100644 index 000000000000..cb9dfb1514bd --- /dev/null +++ b/toolkit/components/utils/utils.manifest @@ -0,0 +1,6 @@ +component {ded150e3-c92e-4077-a396-0dba9953e39f} simpleServices.js +contract @mozilla.org/streamconv;1?from=application/vnd.mozilla.webext.unlocalized&to=text/css {ded150e3-c92e-4077-a396-0dba9953e39f} + +component {742ad274-34c5-43d1-a8b7-293eaf8962d6} simpleServices.js +contract @mozilla.org/content-viewsers/http-index-format {742ad274-34c5-43d1-a8b7-293eaf8962d6} +category Gecko-Content-Viewers application/http-index-format @mozilla.org/content-viewsers/http-index-format diff --git a/toolkit/components/xulstore/XULStore.jsm b/toolkit/components/xulstore/XULStore.js similarity index 99% rename from toolkit/components/xulstore/XULStore.jsm rename to toolkit/components/xulstore/XULStore.js index e04530bffe92..f9fb6c4054ac 100644 --- a/toolkit/components/xulstore/XULStore.jsm +++ b/toolkit/components/xulstore/XULStore.js @@ -305,4 +305,4 @@ nsStringEnumerator.prototype = { }, }; -var EXPORTED_SYMBOLS = ["XULStore"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([XULStore]); diff --git a/toolkit/components/xulstore/XULStore.manifest b/toolkit/components/xulstore/XULStore.manifest new file mode 100644 index 000000000000..249f0c447d42 --- /dev/null +++ b/toolkit/components/xulstore/XULStore.manifest @@ -0,0 +1,2 @@ +component {6f46b6f4-c8b1-4bd4-a4fa-9ebbed0753ea} XULStore.js +contract @mozilla.org/xul/xulstore;1 {6f46b6f4-c8b1-4bd4-a4fa-9ebbed0753ea} diff --git a/toolkit/components/xulstore/components.conf b/toolkit/components/xulstore/components.conf deleted file mode 100644 index 192a909c950a..000000000000 --- a/toolkit/components/xulstore/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{6f46b6f4-c8b1-4bd4-a4fa-9ebbed0753ea}', - 'contract_ids': ['@mozilla.org/xul/xulstore;1'], - 'jsm': 'resource://gre/modules/XULStore.jsm', - 'constructor': 'XULStore', - }, -] diff --git a/toolkit/components/xulstore/moz.build b/toolkit/components/xulstore/moz.build index 97aaa17d342e..a34eb98523ea 100644 --- a/toolkit/components/xulstore/moz.build +++ b/toolkit/components/xulstore/moz.build @@ -16,10 +16,7 @@ XPIDL_SOURCES += [ XPIDL_MODULE = 'toolkit_xulstore' -EXTRA_JS_MODULES += [ - 'XULStore.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', +EXTRA_COMPONENTS += [ + 'XULStore.js', + 'XULStore.manifest', ] diff --git a/toolkit/moz.build b/toolkit/moz.build index 4522d53ba0c3..fba361a364f9 100644 --- a/toolkit/moz.build +++ b/toolkit/moz.build @@ -14,6 +14,7 @@ DIRS += [ 'modules', 'mozapps/downloads', 'mozapps/extensions', + 'mozapps/handling', 'mozapps/preferences', 'pluginproblem', 'profile', @@ -36,8 +37,6 @@ if CONFIG['MOZ_MAINTENANCE_SERVICE']: DIRS += ['xre'] -if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android': - DIRS += ['mozapps/handling'] if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3': DIRS += ['system/unixproxy'] elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': diff --git a/toolkit/mozapps/downloads/components.conf b/toolkit/mozapps/downloads/components.conf deleted file mode 100644 index 2f0519901af9..000000000000 --- a/toolkit/mozapps/downloads/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{F68578EB-6EC2-4169-AE19-8C6243F0ABE1}', - 'contract_ids': ['@mozilla.org/helperapplauncherdialog;1'], - 'jsm': 'resource://gre/modules/HelperAppDlg.jsm', - 'constructor': 'nsUnknownContentTypeDialog', - }, -] diff --git a/toolkit/mozapps/downloads/moz.build b/toolkit/mozapps/downloads/moz.build index 69cb3fffe756..cbcab3954a87 100644 --- a/toolkit/mozapps/downloads/moz.build +++ b/toolkit/mozapps/downloads/moz.build @@ -9,14 +9,14 @@ with Files('**'): TEST_DIRS += ['tests'] +EXTRA_COMPONENTS += [ + 'nsHelperAppDlg.js', + 'nsHelperAppDlg.manifest', +] + EXTRA_JS_MODULES += [ 'DownloadLastDir.jsm', 'DownloadUtils.jsm', - 'HelperAppDlg.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', ] JAR_MANIFESTS += ['jar.mn'] diff --git a/toolkit/mozapps/downloads/HelperAppDlg.jsm b/toolkit/mozapps/downloads/nsHelperAppDlg.js similarity index 99% rename from toolkit/mozapps/downloads/HelperAppDlg.jsm rename to toolkit/mozapps/downloads/nsHelperAppDlg.js index 2181881f76dc..4d32b4c44fd2 100644 --- a/toolkit/mozapps/downloads/HelperAppDlg.jsm +++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js @@ -4,6 +4,7 @@ const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); ChromeUtils.defineModuleGetter(this, "EnableDelayHelper", "resource://gre/modules/SharedPromptUtils.jsm"); @@ -1087,4 +1088,4 @@ nsUnknownContentTypeDialog.prototype = { }, }; -var EXPORTED_SYMBOLS = ["nsUnknownContentTypeDialog"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsUnknownContentTypeDialog]); diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.manifest b/toolkit/mozapps/downloads/nsHelperAppDlg.manifest new file mode 100644 index 000000000000..8824b45a261f --- /dev/null +++ b/toolkit/mozapps/downloads/nsHelperAppDlg.manifest @@ -0,0 +1,2 @@ +component {F68578EB-6EC2-4169-AE19-8C6243F0ABE1} nsHelperAppDlg.js +contract @mozilla.org/helperapplauncherdialog;1 {F68578EB-6EC2-4169-AE19-8C6243F0ABE1} diff --git a/toolkit/mozapps/extensions/addonManager.js b/toolkit/mozapps/extensions/addonManager.js index d36666f8d1fd..0298961b2f28 100644 --- a/toolkit/mozapps/extensions/addonManager.js +++ b/toolkit/mozapps/extensions/addonManager.js @@ -34,6 +34,7 @@ const MSG_ADDON_EVENT = "WebAPIAddonEvent"; const CHILD_SCRIPT = "resource://gre/modules/addons/Content.js"; +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); var gSingleton = null; @@ -331,5 +332,4 @@ BlocklistService.prototype = { Ci.nsITimerCallback]), }; -// eslint-disable-next-line no-unused-vars -var EXPORTED_SYMBOLS = ["amManager", "BlocklistService"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([amManager, BlocklistService]); diff --git a/toolkit/mozapps/extensions/amContentHandler.jsm b/toolkit/mozapps/extensions/amContentHandler.js similarity index 95% rename from toolkit/mozapps/extensions/amContentHandler.jsm rename to toolkit/mozapps/extensions/amContentHandler.js index 8f125b79b93a..f8f0fd04af0d 100644 --- a/toolkit/mozapps/extensions/amContentHandler.jsm +++ b/toolkit/mozapps/extensions/amContentHandler.js @@ -7,6 +7,7 @@ const XPI_CONTENT_TYPE = "application/x-xpinstall"; const MSG_INSTALL_ADDON = "WebInstallerInstallAddonFromWebpage"; +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); function amContentHandler() { @@ -100,4 +101,4 @@ amContentHandler.prototype = { }, }; -var EXPORTED_SYMBOLS = ["amContentHandler"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([amContentHandler]); diff --git a/toolkit/mozapps/extensions/amInstallTrigger.jsm b/toolkit/mozapps/extensions/amInstallTrigger.js similarity index 97% rename from toolkit/mozapps/extensions/amInstallTrigger.jsm rename to toolkit/mozapps/extensions/amInstallTrigger.js index cbe1f2da12e7..b3ce8276bd80 100644 --- a/toolkit/mozapps/extensions/amInstallTrigger.jsm +++ b/toolkit/mozapps/extensions/amInstallTrigger.js @@ -4,6 +4,7 @@ "use strict"; +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); const {Preferences} = ChromeUtils.import("resource://gre/modules/Preferences.jsm"); const {Log} = ChromeUtils.import("resource://gre/modules/Log.jsm"); @@ -149,7 +150,7 @@ InstallTrigger.prototype = { item = { URL: item }; } if (!item.URL) { - throw new this._window.Error("Missing URL property for '" + keys[0] + "'"); + throw new this._window.Error("Missing URL property for '" + name + "'"); } let url = this._resolveURL(item.URL); @@ -220,4 +221,6 @@ InstallTrigger.prototype = { QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer]), }; -var EXPORTED_SYMBOLS = ["InstallTrigger"]; + + +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([InstallTrigger]); diff --git a/toolkit/mozapps/extensions/amWebAPI.jsm b/toolkit/mozapps/extensions/amWebAPI.js similarity index 99% rename from toolkit/mozapps/extensions/amWebAPI.jsm rename to toolkit/mozapps/extensions/amWebAPI.js index 8f1173886790..466b7c25a644 100644 --- a/toolkit/mozapps/extensions/amWebAPI.jsm +++ b/toolkit/mozapps/extensions/amWebAPI.js @@ -270,4 +270,4 @@ class WebAPI extends APIObject { } WebAPI.prototype.QueryInterface = ChromeUtils.generateQI(["nsIDOMGlobalPropertyInitializer"]); WebAPI.prototype.classID = Components.ID("{8866d8e3-4ea5-48b7-a891-13ba0ac15235}"); -var EXPORTED_SYMBOLS = ["WebAPI"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([WebAPI]); diff --git a/toolkit/mozapps/extensions/components.conf b/toolkit/mozapps/extensions/components.conf deleted file mode 100644 index 0820f4208f9d..000000000000 --- a/toolkit/mozapps/extensions/components.conf +++ /dev/null @@ -1,42 +0,0 @@ -# -*- 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': '{66354bc9-7ed1-4692-ae1d-8da97d6b205e}', - 'contract_ids': ['@mozilla.org/extensions/blocklist;1'], - 'jsm': 'resource://gre/modules/addonManager.js', - 'constructor': 'BlocklistService', - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - 'categories': ({'profile-after-change': 'nsBlocklistService'} - if buildconfig.substs['MOZ_BUILD_APP'] == 'browser' - else {}), - }, - { - 'cid': '{4399533d-08d1-458c-a87a-235f74451cfa}', - 'contract_ids': ['@mozilla.org/addons/integration;1'], - 'jsm': 'resource://gre/modules/addonManager.js', - 'constructor': 'amManager', - }, - { - 'cid': '{7beb3ba8-6ec3-41b4-b67c-da89b8518922}', - 'contract_ids': ['@mozilla.org/uriloader/content-handler;1?type=application/x-xpinstall'], - 'jsm': 'resource://gre/modules/amContentHandler.jsm', - 'constructor': 'amContentHandler', - }, - { - 'cid': '{9df8ef2b-94da-45c9-ab9f-132eb55fddf1}', - 'contract_ids': ['@mozilla.org/addons/installtrigger;1'], - 'jsm': 'resource://gre/modules/amInstallTrigger.jsm', - 'constructor': 'InstallTrigger', - }, - { - 'cid': '{8866d8e3-4ea5-48b7-a891-13ba0ac15235}', - 'contract_ids': ['@mozilla.org/addon-web-api/manager;1'], - 'jsm': 'resource://gre/modules/amWebAPI.jsm', - 'constructor': 'WebAPI', - }, -] diff --git a/toolkit/mozapps/extensions/extensions.manifest b/toolkit/mozapps/extensions/extensions.manifest index 9536460c816a..0488790a90b4 100644 --- a/toolkit/mozapps/extensions/extensions.manifest +++ b/toolkit/mozapps/extensions/extensions.manifest @@ -1,8 +1,22 @@ +component {66354bc9-7ed1-4692-ae1d-8da97d6b205e} addonManager.js process=main +contract @mozilla.org/extensions/blocklist;1 {66354bc9-7ed1-4692-ae1d-8da97d6b205e} process=main +#ifndef MOZ_BUILD_APP_IS_BROWSER +category profile-after-change nsBlocklistService @mozilla.org/extensions/blocklist;1 process=main +#endif + category update-timer nsBlocklistService @mozilla.org/extensions/blocklist;1,getService,blocklist-background-update-timer,extensions.blocklist.interval,86400 +component {4399533d-08d1-458c-a87a-235f74451cfa} addonManager.js +contract @mozilla.org/addons/integration;1 {4399533d-08d1-458c-a87a-235f74451cfa} #ifndef MOZ_WIDGET_ANDROID category update-timer addonManager @mozilla.org/addons/integration;1,getService,addon-background-update-timer,extensions.update.interval,86400 #endif +component {7beb3ba8-6ec3-41b4-b67c-da89b8518922} amContentHandler.js +contract @mozilla.org/uriloader/content-handler;1?type=application/x-xpinstall {7beb3ba8-6ec3-41b4-b67c-da89b8518922} +component {9df8ef2b-94da-45c9-ab9f-132eb55fddf1} amInstallTrigger.js +contract @mozilla.org/addons/installtrigger;1 {9df8ef2b-94da-45c9-ab9f-132eb55fddf1} #ifndef MOZ_WIDGET_ANDROID category addon-provider-module PluginProvider resource://gre/modules/addons/PluginProvider.jsm #endif category addon-provider-module GMPProvider resource://gre/modules/addons/GMPProvider.jsm +component {8866d8e3-4ea5-48b7-a891-13ba0ac15235} amWebAPI.js +contract @mozilla.org/addon-web-api/manager;1 {8866d8e3-4ea5-48b7-a891-13ba0ac15235} diff --git a/toolkit/mozapps/extensions/moz.build b/toolkit/mozapps/extensions/moz.build index ea4e3bde0047..bf35eb781ae4 100644 --- a/toolkit/mozapps/extensions/moz.build +++ b/toolkit/mozapps/extensions/moz.build @@ -43,16 +43,19 @@ elif CONFIG['MOZ_BUILD_APP'] == 'mobile/android': '!%s' % built_in_addons, ] +EXTRA_COMPONENTS += [ + 'addonManager.js', + 'amContentHandler.js', + 'amInstallTrigger.js', + 'amWebAPI.js', +] + EXTRA_PP_COMPONENTS += [ 'extensions.manifest', ] EXTRA_JS_MODULES += [ - 'addonManager.js', 'AddonManager.jsm', - 'amContentHandler.jsm', - 'amInstallTrigger.jsm', - 'amWebAPI.jsm', 'Blocklist.jsm', 'LightweightThemeManager.jsm', ] @@ -71,10 +74,6 @@ UNIFIED_SOURCES += [ 'AddonManagerWebAPI.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - LOCAL_INCLUDES += [ '/chrome', '/dom/base', diff --git a/toolkit/mozapps/handling/components.conf b/toolkit/mozapps/handling/components.conf deleted file mode 100644 index 087c4cf7d268..000000000000 --- a/toolkit/mozapps/handling/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{e35d5067-95bc-4029-8432-e8f1e431148d}', - 'contract_ids': ['@mozilla.org/content-dispatch-chooser;1'], - 'jsm': 'resource://gre/modules/ContentDispatchChooser.jsm', - 'constructor': 'nsContentDispatchChooser', - }, -] diff --git a/toolkit/mozapps/handling/moz.build b/toolkit/mozapps/handling/moz.build index abde4a94f7c4..87188be818dd 100644 --- a/toolkit/mozapps/handling/moz.build +++ b/toolkit/mozapps/handling/moz.build @@ -7,12 +7,9 @@ with Files('**'): BUG_COMPONENT = ('Firefox', 'File Handling') -EXTRA_JS_MODULES += [ - 'ContentDispatchChooser.jsm', +EXTRA_COMPONENTS += [ + 'nsContentDispatchChooser.js', + 'nsContentDispatchChooser.manifest', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - -JAR_MANIFESTS += ['jar.mn'] +JAR_MANIFESTS += ['jar.mn'] \ No newline at end of file diff --git a/toolkit/mozapps/handling/ContentDispatchChooser.jsm b/toolkit/mozapps/handling/nsContentDispatchChooser.js similarity index 92% rename from toolkit/mozapps/handling/ContentDispatchChooser.jsm rename to toolkit/mozapps/handling/nsContentDispatchChooser.js index c03ee8122228..c103ed79d191 100644 --- a/toolkit/mozapps/handling/ContentDispatchChooser.jsm +++ b/toolkit/mozapps/handling/nsContentDispatchChooser.js @@ -4,6 +4,7 @@ // Constants +const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); const CONTENT_HANDLING_URL = "chrome://mozapps/content/handling/dialog.xul"; @@ -66,4 +67,8 @@ nsContentDispatchChooser.prototype = QueryInterface: ChromeUtils.generateQI([Ci.nsIContentDispatchChooser]), }; -var EXPORTED_SYMBOLS = ["nsContentDispatchChooser"]; +// Module + +var components = [nsContentDispatchChooser]; + +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components); diff --git a/toolkit/mozapps/handling/nsContentDispatchChooser.manifest b/toolkit/mozapps/handling/nsContentDispatchChooser.manifest new file mode 100644 index 000000000000..fcc76a410757 --- /dev/null +++ b/toolkit/mozapps/handling/nsContentDispatchChooser.manifest @@ -0,0 +1,2 @@ +component {e35d5067-95bc-4029-8432-e8f1e431148d} nsContentDispatchChooser.js +contract @mozilla.org/content-dispatch-chooser;1 {e35d5067-95bc-4029-8432-e8f1e431148d} diff --git a/toolkit/mozapps/update/components.conf b/toolkit/mozapps/update/components.conf deleted file mode 100644 index 55edfc04dd7f..000000000000 --- a/toolkit/mozapps/update/components.conf +++ /dev/null @@ -1,40 +0,0 @@ -# -*- 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': '{B3C290A6-3943-4B89-8BBE-C01EB7B3B311}', - 'contract_ids': ['@mozilla.org/updates/update-service;1'], - 'jsm': 'resource://gre/modules/UpdateService.jsm', - 'constructor': 'UpdateService', - }, - { - 'cid': '{093C2356-4843-4C65-8709-D7DBCBBE7DFB}', - 'contract_ids': ['@mozilla.org/updates/update-manager;1'], - 'jsm': 'resource://gre/modules/UpdateService.jsm', - 'constructor': 'UpdateManager', - }, - { - 'cid': '{898CDC9B-E43F-422F-9CC4-2F6291B415A3}', - 'contract_ids': ['@mozilla.org/updates/update-checker;1'], - 'jsm': 'resource://gre/modules/UpdateService.jsm', - 'constructor': 'Checker', - }, - { - 'cid': '{27ABA825-35B5-4018-9FDD-F99250A0E722}', - 'contract_ids': ['@mozilla.org/updates/update-prompt;1'], - 'jsm': 'resource://gre/modules/UpdateService.jsm', - 'constructor': 'UpdatePrompt', - }, - - { - 'cid': '{e43b0010-04ba-4da6-b523-1f92580bc150}', - 'contract_ids': ['@mozilla.org/updates/update-service-stub;1'], - 'jsm': 'resource://gre/modules/UpdateServiceStub.jsm', - 'constructor': 'UpdateServiceStub', - 'categories': {'profile-after-change': 'nsUpdateServiceStub'}, - }, -] diff --git a/toolkit/mozapps/update/moz.build b/toolkit/mozapps/update/moz.build index ddfda4571c31..c286c34216ea 100644 --- a/toolkit/mozapps/update/moz.build +++ b/toolkit/mozapps/update/moz.build @@ -17,20 +17,16 @@ XPIDL_SOURCES += [ TEST_DIRS += ['tests'] EXTRA_COMPONENTS += [ + 'nsUpdateService.js', 'nsUpdateService.manifest', + 'nsUpdateServiceStub.js', ] EXTRA_JS_MODULES += [ 'UpdateListener.jsm', - 'UpdateService.jsm', - 'UpdateServiceStub.jsm', 'UpdateTelemetry.jsm', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - JAR_MANIFESTS += ['jar.mn'] with Files('**'): diff --git a/toolkit/mozapps/update/UpdateService.jsm b/toolkit/mozapps/update/nsUpdateService.js similarity index 99% rename from toolkit/mozapps/update/UpdateService.jsm rename to toolkit/mozapps/update/nsUpdateService.js index 5106d99c7874..50c8a8bffde8 100644 --- a/toolkit/mozapps/update/UpdateService.jsm +++ b/toolkit/mozapps/update/nsUpdateService.js @@ -4367,4 +4367,5 @@ UpdatePrompt.prototype = { QueryInterface: ChromeUtils.generateQI([Ci.nsIUpdatePrompt]), }; -var EXPORTED_SYMBOLS = ["UpdateService", "Checker", "UpdatePrompt", "UpdateManager"]; +var components = [UpdateService, Checker, UpdatePrompt, UpdateManager]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components); diff --git a/toolkit/mozapps/update/nsUpdateService.manifest b/toolkit/mozapps/update/nsUpdateService.manifest index a8d2534b1e81..59dbf0b5a8b8 100644 --- a/toolkit/mozapps/update/nsUpdateService.manifest +++ b/toolkit/mozapps/update/nsUpdateService.manifest @@ -1 +1,12 @@ +component {B3C290A6-3943-4B89-8BBE-C01EB7B3B311} nsUpdateService.js +contract @mozilla.org/updates/update-service;1 {B3C290A6-3943-4B89-8BBE-C01EB7B3B311} category update-timer nsUpdateService @mozilla.org/updates/update-service;1,getService,background-update-timer,app.update.interval,43200,86400 +component {093C2356-4843-4C65-8709-D7DBCBBE7DFB} nsUpdateService.js +contract @mozilla.org/updates/update-manager;1 {093C2356-4843-4C65-8709-D7DBCBBE7DFB} +component {898CDC9B-E43F-422F-9CC4-2F6291B415A3} nsUpdateService.js +contract @mozilla.org/updates/update-checker;1 {898CDC9B-E43F-422F-9CC4-2F6291B415A3} +component {27ABA825-35B5-4018-9FDD-F99250A0E722} nsUpdateService.js +contract @mozilla.org/updates/update-prompt;1 {27ABA825-35B5-4018-9FDD-F99250A0E722} +component {e43b0010-04ba-4da6-b523-1f92580bc150} nsUpdateServiceStub.js +contract @mozilla.org/updates/update-service-stub;1 {e43b0010-04ba-4da6-b523-1f92580bc150} +category profile-after-change nsUpdateServiceStub @mozilla.org/updates/update-service-stub;1 diff --git a/toolkit/mozapps/update/UpdateServiceStub.jsm b/toolkit/mozapps/update/nsUpdateServiceStub.js similarity index 98% rename from toolkit/mozapps/update/UpdateServiceStub.jsm rename to toolkit/mozapps/update/nsUpdateServiceStub.js index 5c75a43b2d08..49df7361acba 100644 --- a/toolkit/mozapps/update/UpdateServiceStub.jsm +++ b/toolkit/mozapps/update/nsUpdateServiceStub.js @@ -61,7 +61,7 @@ UpdateServiceStub.prototype = { QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]), }; -var EXPORTED_SYMBOLS = ["UpdateServiceStub"]; +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([UpdateServiceStub]); /** * This function should be called when there are files in the old update diff --git a/toolkit/system/gnome/components.conf b/toolkit/system/gnome/components.conf deleted file mode 100644 index 33386b0bd3ca..000000000000 --- a/toolkit/system/gnome/components.conf +++ /dev/null @@ -1,45 +0,0 @@ -# -*- 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 55e58b6fbb53..7f7f18a18a09 100644 --- a/toolkit/system/gnome/moz.build +++ b/toolkit/system/gnome/moz.build @@ -23,10 +23,6 @@ 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 a2895898c120..4ec16eacd08b 100644 --- a/toolkit/system/gnome/nsGConfService.h +++ b/toolkit/system/gnome/nsGConfService.h @@ -7,12 +7,15 @@ #define nsGConfService_h_ #include "nsIGConfService.h" +#include "gconf/gconf-client.h" #include "mozilla/Attributes.h" -extern "C" { - struct _GConfClient; - typedef struct _GConfClient GConfClient; -} +#define NS_GCONFSERVICE_CID \ + { \ + 0xd96d5985, 0xa13a, 0x4bdc, { \ + 0x93, 0x86, 0xef, 0x34, 0x8d, 0x7a, 0x97, 0xa1 \ + } \ + } class nsGConfService final : public nsIGConfService { public: diff --git a/toolkit/system/gnome/nsGnomeModule.cpp b/toolkit/system/gnome/nsGnomeModule.cpp index f073bc0d1b68..5ef3f0ec6cc8 100644 --- a/toolkit/system/gnome/nsGnomeModule.cpp +++ b/toolkit/system/gnome/nsGnomeModule.cpp @@ -3,13 +3,58 @@ * 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 "nsGnomeModule.h" +#include "nsToolkitCompsCID.h" +#include "mozilla/ModuleUtils.h" #include -namespace mozilla { -nsresult InitGType() { +#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() { g_type_init(); return NS_OK; } -} // namespace mozilla + +static const mozilla::Module kGnomeModule = {mozilla::Module::kVersion, + kGnomeCIDs, + kGnomeContracts, + nullptr, + nullptr, + InitGType}; + +NSMODULE_DEFN(mozgnome) = &kGnomeModule; diff --git a/toolkit/system/gnome/nsGnomeModule.h b/toolkit/system/gnome/nsGnomeModule.h deleted file mode 100644 index 2cbe69a35da2..000000000000 --- a/toolkit/system/gnome/nsGnomeModule.h +++ /dev/null @@ -1,10 +0,0 @@ -/* -*- 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 deleted file mode 100644 index 4f8f11c82aa3..000000000000 --- a/toolkit/system/unixproxy/components.conf +++ /dev/null @@ -1,13 +0,0 @@ -# -*- 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 f395ebf8576e..7689a26c2bd6 100644 --- a/toolkit/system/unixproxy/moz.build +++ b/toolkit/system/unixproxy/moz.build @@ -17,8 +17,4 @@ 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 33c60edac162..86e8e1ba4431 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/Components.h" +#include "mozilla/ModuleUtils.h" #include "nsIServiceManager.h" #include "nsIURI.h" #include "nsString.h" @@ -22,6 +22,7 @@ class nsUnixSystemProxySettings : public nsISystemProxySettings { NS_DECL_NSISYSTEMPROXYSETTINGS nsUnixSystemProxySettings() { mProxyFactory = nullptr; } + nsresult Init(); private: ~nsUnixSystemProxySettings() { @@ -39,6 +40,8 @@ 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(); @@ -101,6 +104,27 @@ nsresult nsUnixSystemProxySettings::GetProxyForURI(const nsACString &aSpec, return NS_OK; } -NS_IMPL_COMPONENT_FACTORY(nsUnixSystemProxySettings) { - return do_AddRef(new nsUnixSystemProxySettings()).downcast(); -} +/* 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; diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp index b124d4cdda8d..3e5c15098229 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/Components.h" +#include "mozilla/ModuleUtils.h" #include "nsIServiceManager.h" #include "nsIGConfService.h" #include "nsIURI.h" @@ -21,15 +21,13 @@ #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) {} - void Init(); + nsresult Init(); private: ~nsUnixSystemProxySettings() = default; @@ -61,7 +59,7 @@ nsUnixSystemProxySettings::GetMainThreadOnly(bool* aMainThreadOnly) { return NS_OK; } -void nsUnixSystemProxySettings::Init() { +nsresult nsUnixSystemProxySettings::Init() { mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID); if (mGSettings) { mGSettings->GetCollectionForSchema( @@ -71,6 +69,8 @@ void nsUnixSystemProxySettings::Init() { if (!mProxySettings) { mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID); } + + return NS_OK; } bool nsUnixSystemProxySettings::IsProxyMode(const char* aMode) { @@ -499,8 +499,27 @@ nsresult nsUnixSystemProxySettings::GetProxyForURI(const nsACString& aSpec, return GetProxyFromEnvironment(aScheme, aHost, aPort, aResult); } -NS_IMPL_COMPONENT_FACTORY(nsUnixSystemProxySettings) { - auto result = MakeRefPtr(); - result->Init(); - return result.forget().downcast(); -} +/* 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; diff --git a/toolkit/xre/components.conf b/toolkit/xre/components.conf deleted file mode 100644 index b875181b39a1..000000000000 --- a/toolkit/xre/components.conf +++ /dev/null @@ -1,54 +0,0 @@ -# -*- 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': '{95d89e3e-a169-41a3-8e56-719978e15b12}', - 'contract_ids': [ - '@mozilla.org/xre/app-info;1', - '@mozilla.org/xre/runtime;1', - ], - 'legacy_constructor': 'mozilla::AppInfoConstructor', - 'headers': ['nsAppRunner.h'], - }, - { - 'cid': '{471f4944-1dd2-11b2-87ac-90be0a51d609}', - 'contract_ids': ['@mozilla.org/embedcomp/rangefind;1'], - 'type': 'nsFind', - 'headers': ['/toolkit/components/find/nsFind.h'], - }, - { - 'cid': '{7e677795-c582-4cd1-9e8d-8271b3474d2a}', - 'contract_ids': ['@mozilla.org/embedding/browser/nsWebBrowserPersist;1'], - 'type': 'nsWebBrowserPersist', - 'headers': ['/dom/webbrowserpersist/nsWebBrowserPersist.h'], - }, - { - 'cid': '{a21bfa01-f349-4394-a84c-8de5cf0737d0}', - 'contract_ids': ['@mozilla.org/embedcomp/window-watcher;1'], - 'type': 'nsWindowWatcher', - 'headers': ['nsWindowWatcher.h'], - 'init_method': 'Init', - }, - { - 'cid': '{5573967d-f6cf-4c63-8e0e-9ac06e04d62b}', - 'contract_ids': ['@mozilla.org/xre/directory-provider;1'], - 'singleton': True, - 'type': 'nsXREDirProvider', - 'constructor': 'nsXREDirProvider::GetSingleton', - 'headers': ['/toolkit/xre/nsXREDirProvider.h'], - }, -] - -if defined('MOZ_XUL'): - Classes += [ - { - 'cid': '{4e4aae11-8901-46cc-8217-dad7c5415873}', - 'contract_ids': ['@mozilla.org/embedcomp/dialogparam;1'], - 'type': 'nsDialogParamBlock', - 'headers': ['/toolkit/components/windowwatcher/nsDialogParamBlock.h'], - }, - ] diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build index 87ca08b9c8b8..60da07c55061 100644 --- a/toolkit/xre/moz.build +++ b/toolkit/xre/moz.build @@ -158,10 +158,6 @@ if CONFIG['MOZ_PDF_PRINTING']: '../components/printingui', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 4730b71ef324..fc91477d20cb 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -1248,14 +1248,12 @@ nsXULAppInfo::Callback(nsISupports* aData) { } static const nsXULAppInfo kAppInfo; -namespace mozilla { -nsresult AppInfoConstructor(nsISupports* aOuter, REFNSIID aIID, - void** aResult) { +static nsresult AppInfoConstructor(nsISupports* aOuter, REFNSIID aIID, + void** aResult) { NS_ENSURE_NO_AGGREGATION(aOuter); return const_cast(&kAppInfo)->QueryInterface(aIID, aResult); } -} // namespace mozilla bool gLogConsoleErrors = false; diff --git a/toolkit/xre/nsAppRunner.h b/toolkit/xre/nsAppRunner.h index 916580f7cf24..0621aa519cae 100644 --- a/toolkit/xre/nsAppRunner.h +++ b/toolkit/xre/nsAppRunner.h @@ -51,11 +51,6 @@ extern nsString gAbsoluteArgv0Path; extern bool gIsGtest; -namespace mozilla { -nsresult AppInfoConstructor(nsISupports* aOuter, const nsID& aIID, - void** aResult); -} // namespace mozilla - /** * Create the nativeappsupport implementation. * diff --git a/toolkit/xre/nsEmbeddingModule.cpp b/toolkit/xre/nsEmbeddingModule.cpp index 07615c6ac9a2..ac754fef1c7b 100644 --- a/toolkit/xre/nsEmbeddingModule.cpp +++ b/toolkit/xre/nsEmbeddingModule.cpp @@ -4,39 +4,82 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "mozilla/ModuleUtils.h" +#include "nsDialogParamBlock.h" +#include "nsWindowWatcher.h" +#include "nsFind.h" +#include "nsWebBrowserPersist.h" +#include "nsNetCID.h" +#include "nsEmbedCID.h" +#include "nsXREDirProvider.h" -#if defined(MOZ_XUL) && defined(NS_PRINTING) +#ifdef NS_PRINTING # include "nsPrintingPromptService.h" # include "nsPrintingProxy.h" - -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsPrintingPromptService, - nsPrintingPromptService::GetSingleton) -# ifdef PROXY_PRINTING -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsPrintingProxy, - nsPrintingProxy::GetInstance) -# endif - -NS_DEFINE_NAMED_CID(NS_PRINTINGPROMPTSERVICE_CID); #endif +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowWatcher, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsFind) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebBrowserPersist) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsXREDirProvider, + nsXREDirProvider::GetSingleton) + +#ifdef MOZ_XUL +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDialogParamBlock) +# ifdef NS_PRINTING +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsPrintingPromptService, + nsPrintingPromptService::GetSingleton) +# ifdef PROXY_PRINTING +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsPrintingProxy, + nsPrintingProxy::GetInstance) +# endif +# endif +#endif + +#ifdef MOZ_XUL +NS_DEFINE_NAMED_CID(NS_DIALOGPARAMBLOCK_CID); +# ifdef NS_PRINTING +NS_DEFINE_NAMED_CID(NS_PRINTINGPROMPTSERVICE_CID); +# endif +#endif +NS_DEFINE_NAMED_CID(NS_WINDOWWATCHER_CID); +NS_DEFINE_NAMED_CID(NS_FIND_CID); +NS_DEFINE_NAMED_CID(NS_WEBBROWSERPERSIST_CID); +NS_DEFINE_NAMED_CID(NS_XREDIRPROVIDER_CID); + static const mozilla::Module::CIDEntry kEmbeddingCIDs[] = { -#if defined(MOZ_XUL) && defined(NS_PRINTING) -# ifdef PROXY_PRINTING +#ifdef MOZ_XUL + {&kNS_DIALOGPARAMBLOCK_CID, false, nullptr, nsDialogParamBlockConstructor}, +# ifdef NS_PRINTING + +# ifdef PROXY_PRINTING {&kNS_PRINTINGPROMPTSERVICE_CID, false, nullptr, nsPrintingPromptServiceConstructor, mozilla::Module::MAIN_PROCESS_ONLY}, {&kNS_PRINTINGPROMPTSERVICE_CID, false, nullptr, nsPrintingProxyConstructor, mozilla::Module::CONTENT_PROCESS_ONLY}, -# else +# else {&kNS_PRINTINGPROMPTSERVICE_CID, false, nullptr, nsPrintingPromptServiceConstructor}, +# endif # endif #endif + {&kNS_WINDOWWATCHER_CID, false, nullptr, nsWindowWatcherConstructor}, + {&kNS_FIND_CID, false, nullptr, nsFindConstructor}, + {&kNS_WEBBROWSERPERSIST_CID, false, nullptr, + nsWebBrowserPersistConstructor}, + {&kNS_XREDIRPROVIDER_CID, false, nullptr, nsXREDirProviderConstructor}, {nullptr}}; static const mozilla::Module::ContractIDEntry kEmbeddingContracts[] = { -#if defined(MOZ_XUL) && defined(NS_PRINTING) +#ifdef MOZ_XUL + {NS_DIALOGPARAMBLOCK_CONTRACTID, &kNS_DIALOGPARAMBLOCK_CID}, +# ifdef NS_PRINTING {NS_PRINTINGPROMPTSERVICE_CONTRACTID, &kNS_PRINTINGPROMPTSERVICE_CID}, +# endif #endif + {NS_WINDOWWATCHER_CONTRACTID, &kNS_WINDOWWATCHER_CID}, + {NS_FIND_CONTRACTID, &kNS_FIND_CID}, + {NS_WEBBROWSERPERSIST_CONTRACTID, &kNS_WEBBROWSERPERSIST_CID}, + {NS_XREDIRPROVIDER_CONTRACTID, &kNS_XREDIRPROVIDER_CID}, {nullptr}}; static const mozilla::Module kEmbeddingModule = { diff --git a/tools/profiler/gecko/components.conf b/tools/profiler/gecko/components.conf deleted file mode 100644 index 1584afc25465..000000000000 --- a/tools/profiler/gecko/components.conf +++ /dev/null @@ -1,15 +0,0 @@ -# -*- 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': '{25db9b8e-8123-4de1-b66d-8bbbedf2cdf4}', - 'contract_ids': ['@mozilla.org/tools/profiler;1'], - 'type': 'nsProfiler', - 'headers': ['/tools/profiler/gecko/nsProfiler.h'], - 'init_method': 'Init', - }, -] diff --git a/tools/profiler/gecko/nsProfilerFactory.cpp b/tools/profiler/gecko/nsProfilerFactory.cpp new file mode 100644 index 000000000000..2835555490a4 --- /dev/null +++ b/tools/profiler/gecko/nsProfilerFactory.cpp @@ -0,0 +1,25 @@ +/* -*- Mode: C++; tab-width: 20; 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 "nsProfiler.h" +#include "nsProfilerCIID.h" + +#include "mozilla/ModuleUtils.h" +#include "nsCOMPtr.h" + +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsProfiler, Init) + +NS_DEFINE_NAMED_CID(NS_PROFILER_CID); + +static const mozilla::Module::CIDEntry kProfilerCIDs[] = { + {&kNS_PROFILER_CID, false, nullptr, nsProfilerConstructor}, {nullptr}}; + +static const mozilla::Module::ContractIDEntry kProfilerContracts[] = { + {"@mozilla.org/tools/profiler;1", &kNS_PROFILER_CID}, {nullptr}}; + +static const mozilla::Module kProfilerModule = { + mozilla::Module::kVersion, kProfilerCIDs, kProfilerContracts}; + +NSMODULE_DEFN(nsProfilerModule) = &kProfilerModule; diff --git a/tools/profiler/moz.build b/tools/profiler/moz.build index f6a6617b060d..c417de5219db 100644 --- a/tools/profiler/moz.build +++ b/tools/profiler/moz.build @@ -30,6 +30,7 @@ if CONFIG['MOZ_GECKO_PROFILER']: 'core/ProfilerMarkerPayload.cpp', 'core/RegisteredThread.cpp', 'gecko/ChildProfilerController.cpp', + 'gecko/nsProfilerFactory.cpp', 'gecko/nsProfilerStartParams.cpp', 'gecko/ProfilerChild.cpp', 'gecko/ProfilerIOInterposeObserver.cpp', @@ -41,10 +42,6 @@ if CONFIG['MOZ_GECKO_PROFILER']: 'core/memory_hooks.cpp', # conflicts with platform.h class Thread ] - XPCOM_MANIFESTS += [ - 'gecko/components.conf', - ] - if CONFIG['OS_TARGET'] == 'Darwin': # This file cannot be built in unified mode because it includes # "nsLocalFile.h", which pulls in a system header which uses a type diff --git a/uriloader/exthandler/components.conf b/uriloader/exthandler/components.conf deleted file mode 100644 index 1379c13ffdbd..000000000000 --- a/uriloader/exthandler/components.conf +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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': '{8b1ae382-51a9-4972-b930-56977a57919d}', - 'contract_ids': ['@mozilla.org/uriloader/web-handler-app;1'], - 'jsm': 'resource://gre/modules/WebHandlerApp.jsm', - 'constructor': 'nsWebHandlerApp', - }, -] diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build index d8fd3aa236f5..059777ffa400 100644 --- a/uriloader/exthandler/moz.build +++ b/uriloader/exthandler/moz.build @@ -110,14 +110,8 @@ if CONFIG['MOZ_ENABLE_DBUS']: EXTRA_COMPONENTS += [ 'HandlerService.js', 'HandlerService.manifest', -] - -EXTRA_JS_MODULES += [ - 'WebHandlerApp.jsm', -] - -XPCOM_MANIFESTS += [ - 'components.conf', + 'nsWebHandlerApp.js', + 'nsWebHandlerApp.manifest', ] IPDL_SOURCES += [ diff --git a/uriloader/exthandler/WebHandlerApp.jsm b/uriloader/exthandler/nsWebHandlerApp.js similarity index 97% rename from uriloader/exthandler/WebHandlerApp.jsm rename to uriloader/exthandler/nsWebHandlerApp.js index 64d35eaf9d60..bb88a051bdac 100644 --- a/uriloader/exthandler/WebHandlerApp.jsm +++ b/uriloader/exthandler/nsWebHandlerApp.js @@ -162,4 +162,8 @@ nsWebHandlerApp.prototype = { QueryInterface: ChromeUtils.generateQI([Ci.nsIWebHandlerApp, Ci.nsIHandlerApp]) }; -var EXPORTED_SYMBOLS = ["nsWebHandlerApp"]; +//////////////////////////////////////////////////////////////////////////////// +//// Module + +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsWebHandlerApp]); + diff --git a/uriloader/exthandler/nsWebHandlerApp.manifest b/uriloader/exthandler/nsWebHandlerApp.manifest new file mode 100644 index 000000000000..02b1d02af3a6 --- /dev/null +++ b/uriloader/exthandler/nsWebHandlerApp.manifest @@ -0,0 +1,2 @@ +component {8b1ae382-51a9-4972-b930-56977a57919d} nsWebHandlerApp.js +contract @mozilla.org/uriloader/web-handler-app;1 {8b1ae382-51a9-4972-b930-56977a57919d} diff --git a/widget/gtk/components.conf b/widget/gtk/components.conf deleted file mode 100644 index 6c044e7e6174..000000000000 --- a/widget/gtk/components.conf +++ /dev/null @@ -1,166 +0,0 @@ -# -*- 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 = [ - '/widget/gtk/nsWidgetFactory.h', -] - -InitFunc = 'nsWidgetGtk2ModuleCtor' -UnloadFunc = 'nsWidgetGtk2ModuleDtor' - -Classes = [ - { - 'cid': '{2d96b3df-c051-11d1-a827-0040959a28c9}', - 'contract_ids': ['@mozilla.org/widget/appshell/gtk;1'], - 'legacy_constructor': 'nsAppShellConstructor', - 'headers': ['/widget/gtk/nsWidgetFactory.h'], - 'processes': ProcessSelector.ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS, - }, - { - 'cid': '{c401eb80-f9ea-11d3-bb6f-e732b73ebe7c}', - 'contract_ids': ['@mozilla.org/gfx/screenmanager;1'], - 'singleton': True, - 'type': 'mozilla::widget::ScreenManager', - 'headers': ['mozilla/StaticPtr.h', 'mozilla/widget/ScreenManager.h'], - 'constructor': 'mozilla::widget::ScreenManager::GetAddRefedSingleton', - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - { - 'cid': '{a9339876-0027-430f-b953-84c9c11c2da3}', - 'contract_ids': ['@mozilla.org/widget/taskbarprogress/gtk;1'], - 'type': 'TaskbarProgress', - 'headers': ['/widget/gtk/TaskbarProgress.h'], - }, - { - 'cid': '{0f872c8c-3ee6-46bd-92a2-69652c6b474e}', - 'contract_ids': ['@mozilla.org/colorpicker;1'], - 'type': 'nsColorPicker', - 'headers': ['/widget/gtk/nsColorPicker.h'], - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - { - 'cid': '{bd57cee8-1dd1-11b2-9fe7-95cf4709aea3}', - 'contract_ids': ['@mozilla.org/filepicker;1'], - 'type': 'nsFilePicker', - 'headers': ['/widget/gtk/nsFilePicker.h'], - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - { - 'cid': '{948a0023-e3a7-11d2-96cf-0060b0fb9956}', - 'contract_ids': ['@mozilla.org/widget/htmlformatconverter;1'], - 'type': 'nsHTMLFormatConverter', - 'headers': ['/widget/nsHTMLFormatConverter.h'], - }, - { - 'cid': '{b148eed2-236d-11d3-b35c-00a0cc3c1cde}', - 'contract_ids': ['@mozilla.org/sound;1'], - 'singleton': True, - 'type': 'nsISound', - 'constructor': 'nsSound::GetInstance', - 'headers': ['/widget/gtk/nsSound.h'], - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - { - 'cid': '{fc2389b8-c650-4093-9e42-b05e5f0685b7}', - 'contract_ids': ['@mozilla.org/widget/image-to-gdk-pixbuf;1'], - 'type': 'nsImageToPixbuf', - 'headers': ['/widget/gtk/nsImageToPixbuf.h'], - }, - { - 'cid': '{8b5314bc-db01-11d2-96ce-0060b0fb9956}', - 'contract_ids': ['@mozilla.org/widget/transferable;1'], - 'type': 'nsTransferable', - 'headers': ['/widget/nsTransferable.h'], - }, -] - -if defined('MOZ_X11'): - Classes += [ - { - 'cid': '{8b5314ba-db01-11d2-96ce-0060b0fb9956}', - 'contract_ids': ['@mozilla.org/widget/clipboard;1'], - 'type': 'nsIClipboard', - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - { - 'cid': '{77221d5a-1dd2-11b2-8c69-c710f15d2ed5}', - 'contract_ids': ['@mozilla.org/widget/clipboardhelper;1'], - 'type': 'nsClipboardHelper', - 'headers': ['/widget/nsClipboardHelper.h'], - }, - { - 'cid': '{8b5314bb-db01-11d2-96ce-0060b0fb9956}', - 'contract_ids': ['@mozilla.org/widget/dragservice;1'], - 'singleton': True, - 'type': 'nsDragService', - 'headers': ['/widget/gtk/nsDragService.h'], - 'constructor': 'nsDragService::GetInstance', - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - { - 'cid': '{d755a760-9f27-11df-0800-200c9a664242}', - 'contract_ids': ['@mozilla.org/gfx/info;1'], - 'type': 'mozilla::widget::GfxInfo', - 'headers': ['/widget/GfxInfoX11.h'], - 'init_method': 'Init', - }, - { - 'cid': '{6987230e-0098-4e78-bc5f-1493ee7519fa}', - 'contract_ids': ['@mozilla.org/widget/idleservice;1'], - 'singleton': True, - 'type': 'nsIdleService', - 'headers': ['/widget/gtk/nsIdleServiceGTK.h'], - 'constructor': 'nsIdleServiceGTK::GetInstance', - }, - ] - -if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] == 'gtk': - Classes += [ - { - 'cid': '{e221df9b-3d66-4045-9a66-5720949f8d10}', - 'contract_ids': ['@mozilla.org/applicationchooser;1'], - 'type': 'nsApplicationChooser', - 'headers': ['/widget/gtk/nsApplicationChooser.h'], - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - ] - -if defined('NS_PRINTING'): - Classes += [ - { - 'cid': '{d3f69889-e13a-4321-980c-a39332e21f34}', - 'contract_ids': ['@mozilla.org/gfx/devicecontextspec;1'], - 'type': 'nsDeviceContextSpecGTK', - 'headers': ['/widget/gtk/nsDeviceContextSpecG.h'], - }, - { - 'cid': '{06beec76-a183-4d9f-85dd-085f26da565a}', - 'contract_ids': ['@mozilla.org/widget/printdialog-service;1'], - 'type': 'nsPrintDialogServiceGTK', - 'headers': ['/widget/gtk/nsPrintDialogGTK.h'], - 'init_method': 'Init', - }, - { - 'cid': '{2f977d53-5485-11d4-87e2-0010a4e75ef2}', - 'contract_ids': ['@mozilla.org/gfx/printsession;1'], - 'type': 'nsPrintSession', - 'headers': ['/widget/nsPrintSession.h'], - 'init_method': 'Init', - }, - { - 'cid': '{841387c8-72e6-484b-9296-bf6eea80d58a}', - 'contract_ids': ['@mozilla.org/gfx/printsettings-service;1'], - 'type': 'nsPrintSettingsServiceGTK', - 'headers': ['/widget/gtk/nsPrintSettingsServiceGTK.h'], - 'init_method': 'Init', - }, - { - 'cid': '{a6cf9129-15b3-11d2-932e-00805f8add32}', - 'contract_ids': ['@mozilla.org/gfx/printerenumerator;1'], - 'type': 'nsPrinterEnumeratorGTK', - 'headers': ['/widget/gtk/nsDeviceContextSpecG.h'], - }, - ] diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build index c137d2b406bb..0ac594f3767e 100644 --- a/widget/gtk/moz.build +++ b/widget/gtk/moz.build @@ -112,10 +112,6 @@ UNIFIED_SOURCES += [ 'WidgetStyleCache.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' diff --git a/widget/gtk/nsWidgetFactory.cpp b/widget/gtk/nsWidgetFactory.cpp index f81974e8a6b3..f58c8d038401 100644 --- a/widget/gtk/nsWidgetFactory.cpp +++ b/widget/gtk/nsWidgetFactory.cpp @@ -5,9 +5,7 @@ * 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 "nsWidgetFactory.h" - -#include "mozilla/Components.h" +#include "mozilla/ModuleUtils.h" #include "mozilla/WidgetUtils.h" #include "NativeKeyBindings.h" #include "nsWidgetsCID.h" @@ -17,18 +15,41 @@ #include "nsGtkKeyUtils.h" #include "nsLookAndFeel.h" #include "nsWindow.h" +#include "nsTransferable.h" #include "nsHTMLFormatConverter.h" #include "HeadlessClipboard.h" #include "IMContextWrapper.h" #ifdef MOZ_X11 +# include "nsClipboardHelper.h" # include "nsClipboard.h" +# include "nsDragService.h" +#endif +#ifdef MOZ_WIDGET_GTK +# include "nsApplicationChooser.h" #endif #include "TaskbarProgress.h" +#include "nsColorPicker.h" #include "nsFilePicker.h" #include "nsSound.h" #include "nsGTKToolkit.h" #include "WakeLockListener.h" +#ifdef NS_PRINTING +# include "nsPrintSettingsServiceGTK.h" +# include "nsPrintSession.h" +# include "nsDeviceContextSpecG.h" +#endif + +#include "nsImageToPixbuf.h" +#include "nsPrintDialogGTK.h" + +#if defined(MOZ_X11) +# include "nsIdleServiceGTK.h" +# include "GfxInfoX11.h" +#endif + +#include "nsIComponentRegistrar.h" +#include "nsComponentManagerUtils.h" #include "mozilla/gfx/2D.h" #include "mozilla/widget/ScreenManager.h" #include @@ -36,26 +57,215 @@ using namespace mozilla; using namespace mozilla::widget; +NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter) #ifdef MOZ_X11 -NS_IMPL_COMPONENT_FACTORY(nsIClipboard) { +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIdleServiceGTK, + nsIdleServiceGTK::GetInstance) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsDragService, + nsDragService::GetInstance) +#endif +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsISound, nsSound::GetInstance) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ScreenManager, + ScreenManager::GetAddRefedSingleton) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsImageToPixbuf) +NS_GENERIC_FACTORY_CONSTRUCTOR(TaskbarProgress) + +#if defined(MOZ_X11) +namespace mozilla { +namespace widget { +// This constructor should really be shared with all platforms. +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init) +} // namespace widget +} // namespace mozilla +#endif + +#ifdef NS_PRINTING +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecGTK) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSettingsServiceGTK, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorGTK) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintDialogServiceGTK, Init) +#endif + +static nsresult nsFilePickerConstructor(nsISupports *aOuter, REFNSIID aIID, + void **aResult) { + *aResult = nullptr; + if (aOuter != nullptr) { + return NS_ERROR_NO_AGGREGATION; + } + + nsCOMPtr picker = new nsFilePicker; + + return picker->QueryInterface(aIID, aResult); +} + +#ifdef MOZ_WIDGET_GTK +static nsresult nsApplicationChooserConstructor(nsISupports *aOuter, + REFNSIID aIID, void **aResult) { + *aResult = nullptr; + if (aOuter != nullptr) { + return NS_ERROR_NO_AGGREGATION; + } + nsCOMPtr chooser = new nsApplicationChooser; + + if (!chooser) { + return NS_ERROR_OUT_OF_MEMORY; + } + + return chooser->QueryInterface(aIID, aResult); +} +#endif + +static nsresult nsColorPickerConstructor(nsISupports *aOuter, REFNSIID aIID, + void **aResult) { + *aResult = nullptr; + if (aOuter != nullptr) { + return NS_ERROR_NO_AGGREGATION; + } + + nsCOMPtr picker = new nsColorPicker; + + if (!picker) { + return NS_ERROR_OUT_OF_MEMORY; + } + + return picker->QueryInterface(aIID, aResult); +} + +static nsresult nsClipboardConstructor(nsISupports *aOuter, REFNSIID aIID, + void **aResult) { + *aResult = nullptr; + if (aOuter != nullptr) { + return NS_ERROR_NO_AGGREGATION; + } + nsCOMPtr inst; if (gfxPlatform::IsHeadless()) { inst = new HeadlessClipboard(); } else { - auto clipboard = MakeRefPtr(); - if (NS_FAILED(clipboard->Init())) { - return nullptr; - } - inst = clipboard.forget(); + RefPtr clipboard = new nsClipboard(); + nsresult rv = clipboard->Init(); + NS_ENSURE_SUCCESS(rv, rv); + inst = clipboard; } - return inst.forget().downcast(); + return inst->QueryInterface(aIID, aResult); } + +NS_DEFINE_NAMED_CID(NS_APPSHELL_CID); +NS_DEFINE_NAMED_CID(NS_COLORPICKER_CID); +NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID); +#ifdef MOZ_WIDGET_GTK +NS_DEFINE_NAMED_CID(NS_APPLICATIONCHOOSER_CID); +#endif +NS_DEFINE_NAMED_CID(NS_GTK_TASKBARPROGRESS_CID); +NS_DEFINE_NAMED_CID(NS_SOUND_CID); +NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID); +#ifdef MOZ_X11 +NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID); +NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID); +NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID); +#endif +NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID); +NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID); +#ifdef NS_PRINTING +NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_PRINTER_ENUMERATOR_CID); +NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID); +NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID); +NS_DEFINE_NAMED_CID(NS_PRINTDIALOGSERVICE_CID); +#endif +NS_DEFINE_NAMED_CID(NS_IMAGE_TO_PIXBUF_CID); +#if defined(MOZ_X11) +NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID); +NS_DEFINE_NAMED_CID(NS_GFXINFO_CID); #endif -nsresult nsWidgetGtk2ModuleCtor() { return nsAppShellInit(); } +static const mozilla::Module::CIDEntry kWidgetCIDs[] = { + {&kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor, + Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS}, + {&kNS_COLORPICKER_CID, false, nullptr, nsColorPickerConstructor, + Module::MAIN_PROCESS_ONLY}, + {&kNS_FILEPICKER_CID, false, nullptr, nsFilePickerConstructor, + Module::MAIN_PROCESS_ONLY}, +#ifdef MOZ_WIDGET_GTK + {&kNS_APPLICATIONCHOOSER_CID, false, nullptr, + nsApplicationChooserConstructor, Module::MAIN_PROCESS_ONLY}, +#endif + {&kNS_GTK_TASKBARPROGRESS_CID, false, nullptr, TaskbarProgressConstructor}, + {&kNS_SOUND_CID, false, nullptr, nsISoundConstructor, + Module::MAIN_PROCESS_ONLY}, + {&kNS_TRANSFERABLE_CID, false, nullptr, nsTransferableConstructor}, +#ifdef MOZ_X11 + {&kNS_CLIPBOARD_CID, false, nullptr, nsClipboardConstructor, + Module::MAIN_PROCESS_ONLY}, + {&kNS_CLIPBOARDHELPER_CID, false, nullptr, nsClipboardHelperConstructor}, + {&kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceConstructor, + Module::MAIN_PROCESS_ONLY}, +#endif + {&kNS_HTMLFORMATCONVERTER_CID, false, nullptr, + nsHTMLFormatConverterConstructor}, + {&kNS_SCREENMANAGER_CID, false, nullptr, ScreenManagerConstructor, + Module::MAIN_PROCESS_ONLY}, +#ifdef NS_PRINTING + {&kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, + nsPrintSettingsServiceGTKConstructor}, + {&kNS_PRINTER_ENUMERATOR_CID, false, nullptr, + nsPrinterEnumeratorGTKConstructor}, + {&kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor}, + {&kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, + nsDeviceContextSpecGTKConstructor}, + {&kNS_PRINTDIALOGSERVICE_CID, false, nullptr, + nsPrintDialogServiceGTKConstructor}, +#endif + {&kNS_IMAGE_TO_PIXBUF_CID, false, nullptr, nsImageToPixbufConstructor}, +#if defined(MOZ_X11) + {&kNS_IDLE_SERVICE_CID, false, nullptr, nsIdleServiceGTKConstructor}, + {&kNS_GFXINFO_CID, false, nullptr, mozilla::widget::GfxInfoConstructor}, +#endif + {nullptr}}; -void nsWidgetGtk2ModuleDtor() { +static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { + {"@mozilla.org/widget/appshell/gtk;1", &kNS_APPSHELL_CID, + Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS}, + {"@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID, + Module::MAIN_PROCESS_ONLY}, + {"@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID, + Module::MAIN_PROCESS_ONLY}, +#ifdef MOZ_WIDGET_GTK + {"@mozilla.org/applicationchooser;1", &kNS_APPLICATIONCHOOSER_CID, + Module::MAIN_PROCESS_ONLY}, +#endif + {"@mozilla.org/widget/taskbarprogress/gtk;1", &kNS_GTK_TASKBARPROGRESS_CID}, + {"@mozilla.org/sound;1", &kNS_SOUND_CID, Module::MAIN_PROCESS_ONLY}, + {"@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID}, +#ifdef MOZ_X11 + {"@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID, + Module::MAIN_PROCESS_ONLY}, + {"@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID}, + {"@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, + Module::MAIN_PROCESS_ONLY}, +#endif + {"@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID}, + {"@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID, + Module::MAIN_PROCESS_ONLY}, +#ifdef NS_PRINTING + {"@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID}, + {"@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID}, + {"@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID}, + {"@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID}, + {NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID}, +#endif + {"@mozilla.org/widget/image-to-gdk-pixbuf;1", &kNS_IMAGE_TO_PIXBUF_CID}, +#if defined(MOZ_X11) + {"@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID}, + {"@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID}, +#endif + {nullptr}}; + +static void nsWidgetGtk2ModuleDtor() { // Shutdown all XP level widget classes. WidgetUtils::Shutdown(); @@ -72,3 +282,15 @@ void nsWidgetGtk2ModuleDtor() { WakeLockListener::Shutdown(); #endif } + +static const mozilla::Module kWidgetModule = { + mozilla::Module::kVersion, + kWidgetCIDs, + kWidgetContracts, + nullptr, + nullptr, + nsAppShellInit, + nsWidgetGtk2ModuleDtor, + Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS}; + +NSMODULE_DEFN(nsWidgetGtk2Module) = &kWidgetModule; diff --git a/widget/gtk/nsWidgetFactory.h b/widget/gtk/nsWidgetFactory.h deleted file mode 100644 index 5538ad3a188a..000000000000 --- a/widget/gtk/nsWidgetFactory.h +++ /dev/null @@ -1,22 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:expandtab:shiftwidth=4:tabstop=4: - */ -/* 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/. */ - -#ifndef widget_gtk_nsWidgetFactory_h -#define widget_gtk_nsWidgetFactory_h - -#include "nscore.h" -#include "nsID.h" - -class nsISupports; - -nsresult nsAppShellConstructor(nsISupports *outer, const nsIID &iid, - void **result); - -nsresult nsWidgetGtk2ModuleCtor(); -void nsWidgetGtk2ModuleDtor(); - -#endif // defined widget_gtk_nsWidgetFactory_h diff --git a/widget/moz.build b/widget/moz.build index f3cbc6c9f15b..e1a4b1259331 100644 --- a/widget/moz.build +++ b/widget/moz.build @@ -127,13 +127,9 @@ EXPORTS += [ 'GfxInfoBase.h', 'GfxInfoCollector.h', 'InputData.h', - 'nsBaseAppShell.h', - 'nsBaseDragService.h', - 'nsBaseFilePicker.h', 'nsBaseScreen.h', 'nsBaseWidget.h', 'nsIDeviceContextSpec.h', - 'nsIdleService.h', 'nsIKeyEventInPluginCallback.h', 'nsIPluginWidget.h', 'nsIPrintDialogService.h', diff --git a/widget/nsAppShellSingleton.h b/widget/nsAppShellSingleton.h index 71b3a23e7241..c48be7d1547c 100644 --- a/widget/nsAppShellSingleton.h +++ b/widget/nsAppShellSingleton.h @@ -50,8 +50,8 @@ static nsresult nsAppShellInit() { static void nsAppShellShutdown() { NS_RELEASE(sAppShell); } -nsresult nsAppShellConstructor(nsISupports *outer, const nsIID &iid, - void **result) { +static nsresult nsAppShellConstructor(nsISupports *outer, const nsIID &iid, + void **result) { NS_ENSURE_TRUE(!outer, NS_ERROR_NO_AGGREGATION); NS_ENSURE_TRUE(sAppShell, NS_ERROR_NOT_INITIALIZED); diff --git a/widget/nsIIdleService.idl b/widget/nsIIdleService.idl index 21420035538d..d2db6ad14a9c 100644 --- a/widget/nsIIdleService.idl +++ b/widget/nsIIdleService.idl @@ -64,14 +64,6 @@ interface nsIIdleService : nsISupports * just as many times. */ void removeIdleObserver(in nsIObserver observer, in unsigned long time); - - /** - * If true, the idle service is temporarily disabled, and all idle events - * will be ignored. - * - * This should only be used in automation. - */ - attribute boolean disabled; }; %{C++ diff --git a/widget/nsIdleService.cpp b/widget/nsIdleService.cpp index ef3f7f274c9a..4e35f3f93cb4 100644 --- a/widget/nsIdleService.cpp +++ b/widget/nsIdleService.cpp @@ -624,16 +624,6 @@ bool nsIdleService::UsePollMode() { return PollIdleTime(&dummy); } -nsresult nsIdleService::GetDisabled(bool* aResult) { - *aResult = mDisabled; - return NS_OK; -} - -nsresult nsIdleService::SetDisabled(bool aDisabled) { - mDisabled = aDisabled; - return NS_OK; -} - void nsIdleService::StaticIdleTimerCallback(nsITimer* aTimer, void* aClosure) { static_cast(aClosure)->IdleTimerCallback(); } @@ -688,14 +678,6 @@ void nsIdleService::IdleTimerCallback(void) { return; } - if (mDisabled) { - MOZ_LOG(sLog, LogLevel::Info, - ("idleService: Skipping idle callback while disabled")); - - ReconfigureTimer(); - return; - } - // Tell expired listeners they are expired,and find the next timeout Telemetry::AutoTimer timer; diff --git a/widget/nsIdleService.h b/widget/nsIdleService.h index b3725ce64c74..0936517aaf14 100644 --- a/widget/nsIdleService.h +++ b/widget/nsIdleService.h @@ -194,12 +194,6 @@ class nsIdleService : public nsIIdleServiceInternal { */ uint32_t mDeltaToNextIdleSwitchInS; - /** - * If true, the idle service is temporarily disabled, and all idle events - * will be ignored. - */ - bool mDisabled = false; - /** * Absolute value for when the last user interaction took place. */ diff --git a/widget/windows/components.conf b/widget/windows/components.conf deleted file mode 100644 index 8db66ea3a64a..000000000000 --- a/widget/windows/components.conf +++ /dev/null @@ -1,199 +0,0 @@ -# -*- 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 = [ - '/widget/windows/nsWidgetFactory.h', -] - -InitFunc = 'nsWidgetWindowsModuleCtor' -UnloadFunc = 'nsWidgetWindowsModuleDtor' - -Classes = [ - { - 'cid': '{c401eb80-f9ea-11d3-bb6f-e732b73ebe7c}', - 'contract_ids': ['@mozilla.org/gfx/screenmanager;1'], - 'singleton': True, - 'type': 'mozilla::widget::ScreenManager', - 'constructor': 'mozilla::widget::ScreenManager::GetAddRefedSingleton', - 'headers': ['/widget/ScreenManager.h'], - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - { - 'cid': '{2d96b3df-c051-11d1-a827-0040959a28c9}', - 'contract_ids': ['@mozilla.org/widget/appshell/win;1'], - 'headers': ['/widget/windows/nsWidgetFactory.h'], - 'legacy_constructor': 'nsAppShellConstructor', - 'processes': ProcessSelector.ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS, - }, - { - 'cid': '{6987230e-0098-4e78-bc5f-1493ee7519fa}', - 'contract_ids': ['@mozilla.org/widget/idleservice;1'], - 'singleton': True, - 'type': 'nsIdleServiceWin', - 'constructor': 'nsIdleServiceWin::GetInstance', - 'headers': ['/widget/windows/nsIdleServiceWin.h', 'nsIdleService.h'], - }, - { - 'cid': '{b148eed2-236d-11d3-b35c-00a0cc3c1cde}', - 'contract_ids': ['@mozilla.org/sound;1'], - 'singleton': True, - 'type': 'nsISound', - 'constructor': 'nsSound::GetInstance', - 'headers': ['/widget/windows/nsSound.h'], - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - { - 'cid': '{77221d5a-1dd2-11b2-8c69-c710f15d2ed5}', - 'contract_ids': ['@mozilla.org/widget/clipboardhelper;1'], - 'type': 'nsClipboardHelper', - 'headers': ['/widget/nsClipboardHelper.h'], - }, - { - 'cid': '{b8e5bc54-a22f-4eb2-b061-24cb6d19c15f}', - 'contract_ids': ['@mozilla.org/windows-taskbar;1'], - 'type': 'mozilla::widget::WinTaskbar', - 'headers': ['/widget/windows/WinTaskbar.h'], - }, - { - 'cid': '{73a5946f-608d-454f-9d33-0b8f8c7294b6}', - 'contract_ids': ['@mozilla.org/windows-jumplistbuilder;1'], - 'type': 'mozilla::widget::JumpListBuilder', - 'headers': ['/widget/windows/JumpListBuilder.h'], - }, - { - 'cid': '{2b9a1f2c-27ce-45b6-8d4e-755d0e34f8db}', - 'contract_ids': ['@mozilla.org/windows-jumplistitem;1'], - 'type': 'mozilla::widget::JumpListItem', - 'headers': ['/widget/windows/JumpListItem.h'], - }, - { - 'cid': '{21f1f13b-f75a-42ad-867a-d91ad694447e}', - 'contract_ids': ['@mozilla.org/windows-jumplistseparator;1'], - 'type': 'mozilla::widget::JumpListSeparator', - 'headers': ['/widget/windows/JumpListItem.h'], - }, - { - 'cid': '{f72c5dc4-5a12-47be-be28-ab105f33b08f}', - 'contract_ids': ['@mozilla.org/windows-jumplistlink;1'], - 'type': 'mozilla::widget::JumpListLink', - 'headers': ['/widget/windows/JumpListItem.h'], - }, - { - 'cid': '{b16656b2-5187-498f-abf4-56346126bfdb}', - 'contract_ids': ['@mozilla.org/windows-jumplistshortcut;1'], - 'type': 'mozilla::widget::JumpListShortcut', - 'headers': ['/widget/windows/JumpListItem.h'], - }, - { - 'cid': '{e04a55e8-fee3-4ea2-a98b-41d2621adc3c}', - 'contract_ids': ['@mozilla.org/windows-ui-utils;1'], - 'type': 'WindowsUIUtils', - 'headers': ['/widget/windows/WindowsUIUtils.h'], - }, - { - 'cid': '{8b5314bc-db01-11d2-96ce-0060b0fb9956}', - 'contract_ids': ['@mozilla.org/widget/transferable;1'], - 'type': 'nsTransferable', - 'headers': ['/widget/nsTransferable.h'], - }, - { - 'cid': '{948a0023-e3a7-11d2-96cf-0060b0fb9956}', - 'contract_ids': ['@mozilla.org/widget/htmlformatconverter;1'], - 'type': 'nsHTMLFormatConverter', - 'headers': ['/widget/nsHTMLFormatConverter.h'], - }, - { - 'cid': '{8b5314bb-db01-11d2-96ce-0060b0fb9956}', - 'contract_ids': ['@mozilla.org/widget/dragservice;1'], - 'type': 'nsDragService', - 'headers': ['/widget/windows/nsDragService.h'], - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - { - 'cid': '{9a0cb62b-d638-4faf-9588-ae96f5e29093}', - 'contract_ids': ['@mozilla.org/widget/taskbar-preview-callback;1'], - 'type': 'mozilla::widget::TaskbarPreviewCallback', - 'headers': ['/widget/windows/TaskbarPreview.h'], - }, - { - 'cid': '{d755a760-9f27-11df-0800-200c9a664242}', - 'contract_ids': ['@mozilla.org/gfx/info;1'], - 'type': 'mozilla::widget::GfxInfo', - 'headers': ['/widget/windows/GfxInfo.h'], - 'init_method': 'Init', - 'processes': ProcessSelector.ALLOW_IN_GPU_AND_SOCKET_PROCESS, - }, - { - 'cid': '{bd57cee8-1dd1-11b2-9fe7-95cf4709aea3}', - 'contract_ids': ['@mozilla.org/filepicker;1'], - 'type': 'nsFilePicker', - 'headers': ['/widget/windows/nsFilePicker.h'], - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - { - 'cid': '{0f872c8c-3ee6-46bd-92a2-69652c6b474e}', - 'contract_ids': ['@mozilla.org/colorpicker;1'], - 'type': 'nsColorPicker', - 'headers': ['/widget/windows/nsColorPicker.h'], - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - { - 'cid': '{8b5314ba-db01-11d2-96ce-0060b0fb9956}', - 'contract_ids': ['@mozilla.org/widget/clipboard;1'], - 'type': 'nsIClipboard', - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, -] - -if buildconfig.substs['CC_TYPE'] in ('msvc', 'clang-cl'): - Classes += [ - { - 'cid': '{84e11f80-ca55-11dd-ad8b-0800200c9a66}', - 'contract_ids': ['@mozilla.org/system-alerts-service;1'], - 'type': 'mozilla::widget::ToastNotification', - 'headers': ['/widget/windows/ToastNotification.h'], - 'init_method': 'Init', - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - ] - -if defined('NS_PRINTING'): - Classes += [ - { - 'cid': '{d3f69889-e13a-4321-980c-a39332e21f34}', - 'contract_ids': ['@mozilla.org/gfx/devicecontextspec;1'], - 'type': 'nsDeviceContextSpecWin', - 'headers': ['/widget/windows/nsDeviceContextSpecWin.h'], - }, - { - 'cid': '{06beec76-a183-4d9f-85dd-085f26da565a}', - 'contract_ids': ['@mozilla.org/widget/printdialog-service;1'], - 'type': 'nsPrintDialogServiceWin', - 'headers': ['/widget/windows/nsPrintDialogWin.h'], - 'init_method': 'Init', - 'processes': ProcessSelector.MAIN_PROCESS_ONLY, - }, - { - 'cid': '{841387c8-72e6-484b-9296-bf6eea80d58a}', - 'contract_ids': ['@mozilla.org/gfx/printsettings-service;1'], - 'type': 'nsPrintSettingsServiceWin', - 'headers': ['/widget/windows/nsPrintSettingsServiceWin.h'], - 'init_method': 'Init', - }, - { - 'cid': '{a6cf9129-15b3-11d2-932e-00805f8add32}', - 'contract_ids': ['@mozilla.org/gfx/printerenumerator;1'], - 'type': 'nsPrinterEnumeratorWin', - 'headers': ['/widget/windows/nsDeviceContextSpecWin.h'], - }, - { - 'cid': '{2f977d53-5485-11d4-87e2-0010a4e75ef2}', - 'contract_ids': ['@mozilla.org/gfx/printsession;1'], - 'type': 'nsPrintSession', - 'headers': ['/widget/nsPrintSession.h'], - 'init_method': 'Init', - }, - ] diff --git a/widget/windows/moz.build b/widget/windows/moz.build index f40d14d45dda..46b041626d01 100644 --- a/widget/windows/moz.build +++ b/widget/windows/moz.build @@ -116,10 +116,6 @@ if CONFIG['NS_ENABLE_TSF']: 'TSFTextStore.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' diff --git a/widget/windows/nsWidgetFactory.cpp b/widget/windows/nsWidgetFactory.cpp index c89b4dca9aec..db0f27675cc6 100644 --- a/widget/windows/nsWidgetFactory.cpp +++ b/widget/windows/nsWidgetFactory.cpp @@ -3,21 +3,22 @@ * 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 "nsWidgetFactory.h" - -#include "mozilla/Components.h" #include "nsIFactory.h" #include "nsISupports.h" #include "nsdefs.h" #include "nsWidgetsCID.h" #include "nsAppShell.h" #include "nsAppShellSingleton.h" +#include "mozilla/ModuleUtils.h" #include "mozilla/WidgetUtils.h" #include "mozilla/widget/ScreenManager.h" #include "nsIServiceManager.h" +#include "nsIdleServiceWin.h" #include "nsLookAndFeel.h" +#include "nsSound.h" #include "WinMouseScrollHandler.h" #include "KeyboardLayout.h" +#include "GfxInfo.h" #include "nsToolkit.h" // Modules that switch out based on the environment @@ -28,31 +29,231 @@ // Content processes #include "nsFilePickerProxy.h" -// Clipboard +// Drag & Drop, Clipboard #include "nsClipboardHelper.h" #include "nsClipboard.h" #include "HeadlessClipboard.h" +#include "nsDragService.h" +#include "nsTransferable.h" +#include "nsHTMLFormatConverter.h" + +#include "WinTaskbar.h" +#include "JumpListBuilder.h" +#include "JumpListItem.h" +#include "TaskbarPreview.h" +// Toast notification support +#ifndef __MINGW32__ +# include "ToastNotification.h" +# include "nsToolkitCompsCID.h" +#endif #include "WindowsUIUtils.h" +#ifdef NS_PRINTING +# include "nsDeviceContextSpecWin.h" +# include "nsPrintDialogWin.h" +# include "nsPrintSettingsServiceWin.h" +# include "nsPrintSession.h" +#endif + using namespace mozilla; using namespace mozilla::widget; -NS_IMPL_COMPONENT_FACTORY(nsIClipboard) { +static nsresult FilePickerConstructor(nsISupports *aOuter, REFNSIID aIID, + void **aResult) { + *aResult = nullptr; + if (aOuter != nullptr) { + return NS_ERROR_NO_AGGREGATION; + } + nsCOMPtr picker = new nsFilePicker; + return picker->QueryInterface(aIID, aResult); +} + +static nsresult ColorPickerConstructor(nsISupports *aOuter, REFNSIID aIID, + void **aResult) { + *aResult = nullptr; + if (aOuter != nullptr) { + return NS_ERROR_NO_AGGREGATION; + } + nsCOMPtr picker = new nsColorPicker; + return picker->QueryInterface(aIID, aResult); +} + +static nsresult nsClipboardConstructor(nsISupports *aOuter, REFNSIID aIID, + void **aResult) { + *aResult = nullptr; + if (aOuter != nullptr) { + return NS_ERROR_NO_AGGREGATION; + } nsCOMPtr inst; if (gfxPlatform::IsHeadless()) { inst = new HeadlessClipboard(); } else { inst = new nsClipboard(); } - return inst.forget().downcast(); + return inst->QueryInterface(aIID, aResult); } -nsresult nsWidgetWindowsModuleCtor() { - return nsAppShellInit(); -} +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ScreenManager, + ScreenManager::GetAddRefedSingleton) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIdleServiceWin, + nsIdleServiceWin::GetInstance) +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsISound, nsSound::GetInstance) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper) +NS_GENERIC_FACTORY_CONSTRUCTOR(WinTaskbar) +NS_GENERIC_FACTORY_CONSTRUCTOR(JumpListBuilder) +NS_GENERIC_FACTORY_CONSTRUCTOR(JumpListItem) +NS_GENERIC_FACTORY_CONSTRUCTOR(JumpListSeparator) +NS_GENERIC_FACTORY_CONSTRUCTOR(JumpListLink) +NS_GENERIC_FACTORY_CONSTRUCTOR(JumpListShortcut) +NS_GENERIC_FACTORY_CONSTRUCTOR(WindowsUIUtils) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService) +#ifndef __MINGW32__ +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ToastNotification, Init) +#endif +NS_GENERIC_FACTORY_CONSTRUCTOR(TaskbarPreviewCallback) +#ifdef NS_PRINTING +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintDialogServiceWin, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSettingsServiceWin, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorWin) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecWin) +#endif -void nsWidgetWindowsModuleDtor() { +namespace mozilla { +namespace widget { +// This constructor should really be shared with all platforms. +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init) +} // namespace widget +} // namespace mozilla + +NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID); +NS_DEFINE_NAMED_CID(NS_COLORPICKER_CID); +NS_DEFINE_NAMED_CID(NS_APPSHELL_CID); +NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID); +NS_DEFINE_NAMED_CID(NS_GFXINFO_CID); +NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID); +NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID); +NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID); +NS_DEFINE_NAMED_CID(NS_SOUND_CID); +NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID); +NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID); +NS_DEFINE_NAMED_CID(NS_WIN_TASKBAR_CID); +NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTBUILDER_CID); +NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTITEM_CID); +NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTSEPARATOR_CID); +NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTLINK_CID); +NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTSHORTCUT_CID); +NS_DEFINE_NAMED_CID(NS_WINDOWS_UIUTILS_CID); +NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID); +#ifndef __MINGW32__ +NS_DEFINE_NAMED_CID(NS_SYSTEMALERTSSERVICE_CID); +#endif +NS_DEFINE_NAMED_CID(NS_TASKBARPREVIEWCALLBACK_CID); +#ifdef NS_PRINTING +NS_DEFINE_NAMED_CID(NS_PRINTDIALOGSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_PRINTER_ENUMERATOR_CID); +NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID); +NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID); +#endif + +static const mozilla::Module::CIDEntry kWidgetCIDs[] = { + {&kNS_FILEPICKER_CID, false, nullptr, FilePickerConstructor, + Module::MAIN_PROCESS_ONLY}, + {&kNS_COLORPICKER_CID, false, nullptr, ColorPickerConstructor, + Module::MAIN_PROCESS_ONLY}, + {&kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor, + Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS}, + {&kNS_SCREENMANAGER_CID, false, nullptr, ScreenManagerConstructor, + Module::MAIN_PROCESS_ONLY}, + {&kNS_GFXINFO_CID, false, nullptr, GfxInfoConstructor, + Module::ALLOW_IN_GPU_AND_SOCKET_PROCESS}, + {&kNS_IDLE_SERVICE_CID, false, nullptr, nsIdleServiceWinConstructor}, + {&kNS_CLIPBOARD_CID, false, nullptr, nsClipboardConstructor, + Module::MAIN_PROCESS_ONLY}, + {&kNS_CLIPBOARDHELPER_CID, false, nullptr, nsClipboardHelperConstructor}, + {&kNS_SOUND_CID, false, nullptr, nsISoundConstructor, + Module::MAIN_PROCESS_ONLY}, + {&kNS_TRANSFERABLE_CID, false, nullptr, nsTransferableConstructor}, + {&kNS_HTMLFORMATCONVERTER_CID, false, nullptr, + nsHTMLFormatConverterConstructor}, + {&kNS_WIN_TASKBAR_CID, false, nullptr, WinTaskbarConstructor}, + {&kNS_WIN_JUMPLISTBUILDER_CID, false, nullptr, JumpListBuilderConstructor}, + {&kNS_WIN_JUMPLISTITEM_CID, false, nullptr, JumpListItemConstructor}, + {&kNS_WIN_JUMPLISTSEPARATOR_CID, false, nullptr, + JumpListSeparatorConstructor}, + {&kNS_WIN_JUMPLISTLINK_CID, false, nullptr, JumpListLinkConstructor}, + {&kNS_WIN_JUMPLISTSHORTCUT_CID, false, nullptr, + JumpListShortcutConstructor}, + {&kNS_WINDOWS_UIUTILS_CID, false, nullptr, WindowsUIUtilsConstructor}, + {&kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceConstructor, + Module::MAIN_PROCESS_ONLY}, +#ifndef __MINGW32__ + {&kNS_SYSTEMALERTSSERVICE_CID, false, nullptr, ToastNotificationConstructor, + Module::MAIN_PROCESS_ONLY}, +#endif + {&kNS_TASKBARPREVIEWCALLBACK_CID, false, nullptr, + TaskbarPreviewCallbackConstructor}, +#ifdef NS_PRINTING + {&kNS_PRINTDIALOGSERVICE_CID, false, nullptr, + nsPrintDialogServiceWinConstructor, Module::MAIN_PROCESS_ONLY}, + {&kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, + nsPrintSettingsServiceWinConstructor}, + {&kNS_PRINTER_ENUMERATOR_CID, false, nullptr, + nsPrinterEnumeratorWinConstructor}, + {&kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor}, + {&kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, + nsDeviceContextSpecWinConstructor}, +#endif + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kWidgetContracts[] = { + {"@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID, + Module::MAIN_PROCESS_ONLY}, + {"@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID, + Module::MAIN_PROCESS_ONLY}, + {"@mozilla.org/widget/appshell/win;1", &kNS_APPSHELL_CID, + Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS}, + {"@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID, + Module::MAIN_PROCESS_ONLY}, + {"@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID, + Module::ALLOW_IN_GPU_AND_SOCKET_PROCESS}, + {"@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID}, + {"@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID, + Module::MAIN_PROCESS_ONLY}, + {"@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID}, + {"@mozilla.org/sound;1", &kNS_SOUND_CID, Module::MAIN_PROCESS_ONLY}, + {"@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID}, + {"@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID}, + {"@mozilla.org/windows-taskbar;1", &kNS_WIN_TASKBAR_CID}, + {"@mozilla.org/windows-jumplistbuilder;1", &kNS_WIN_JUMPLISTBUILDER_CID}, + {"@mozilla.org/windows-jumplistitem;1", &kNS_WIN_JUMPLISTITEM_CID}, + {"@mozilla.org/windows-jumplistseparator;1", + &kNS_WIN_JUMPLISTSEPARATOR_CID}, + {"@mozilla.org/windows-jumplistlink;1", &kNS_WIN_JUMPLISTLINK_CID}, + {"@mozilla.org/windows-jumplistshortcut;1", &kNS_WIN_JUMPLISTSHORTCUT_CID}, + {"@mozilla.org/windows-ui-utils;1", &kNS_WINDOWS_UIUTILS_CID}, + {"@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, + Module::MAIN_PROCESS_ONLY}, +#ifndef __MINGW32__ + {NS_SYSTEMALERTSERVICE_CONTRACTID, &kNS_SYSTEMALERTSSERVICE_CID, + Module::MAIN_PROCESS_ONLY}, +#endif + {"@mozilla.org/widget/taskbar-preview-callback;1", + &kNS_TASKBARPREVIEWCALLBACK_CID}, +#ifdef NS_PRINTING + {NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID}, + {"@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID}, + {"@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID}, + {"@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID}, + {"@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID}, +#endif + {nullptr}}; + +static void nsWidgetWindowsModuleDtor() { // Shutdown all XP level widget classes. WidgetUtils::Shutdown(); @@ -62,3 +263,15 @@ void nsWidgetWindowsModuleDtor() { nsToolkit::Shutdown(); nsAppShellShutdown(); } + +static const mozilla::Module kWidgetModule = { + mozilla::Module::kVersion, + kWidgetCIDs, + kWidgetContracts, + nullptr, + nullptr, + nsAppShellInit, + nsWidgetWindowsModuleDtor, + Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS}; + +NSMODULE_DEFN(nsWidgetModule) = &kWidgetModule; diff --git a/widget/windows/nsWidgetFactory.h b/widget/windows/nsWidgetFactory.h deleted file mode 100644 index cc9b30a77676..000000000000 --- a/widget/windows/nsWidgetFactory.h +++ /dev/null @@ -1,22 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:expandtab:shiftwidth=4:tabstop=4: - */ -/* 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/. */ - -#ifndef widget_windows_nsWidgetFactory_h -#define widget_windows_nsWidgetFactory_h - -#include "nscore.h" -#include "nsID.h" - -class nsISupports; - -nsresult nsAppShellConstructor(nsISupports *outer, const nsIID &iid, - void **result); - -nsresult nsWidgetWindowsModuleCtor(); -void nsWidgetWindowsModuleDtor(); - -#endif // defined widget_windows_nsWidgetFactory_h diff --git a/xpcom/components/StaticComponents.cpp.in b/xpcom/components/StaticComponents.cpp.in index da1753a0d3de..8f718a2564cd 100644 --- a/xpcom/components/StaticComponents.cpp.in +++ b/xpcom/components/StaticComponents.cpp.in @@ -9,16 +9,11 @@ #include "mozilla/PerfectHash.h" #include "mozilla/ResultExtensions.h" #include "mozilla/StaticPtr.h" -#include "mozilla/UniquePtr.h" -#include "mozilla/dom/ScriptSettings.h" -#include "mozJSComponentLoader.h" #include "nsCOMPtr.h" #include "nsComponentManager.h" -#include "nsContentUtils.h" #include "nsIFactory.h" #include "nsISupports.h" #include "nsString.h" -#include "nsStringEnumerator.h" // Cleanup pollution from zipstruct.h #undef UNSUPPORTED @@ -32,9 +27,6 @@ //# @decls@ namespace mozilla { - -using dom::AutoJSAPI; - namespace xpcom { static constexpr uint32_t kNoContractID = 0xffffffff; @@ -70,10 +62,6 @@ const StaticCategoryEntry gStaticCategoryEntries[] = { //# @category_entries@ }; -const StringOffset gComponentJSMs[] = { -//# @component_jsms@ -}; - /** * Returns a nsCString corresponding to the given entry in the `gStrings` string * table. The resulting nsCString points directly to static storage, and does @@ -95,37 +83,6 @@ bool ContractEntry::Matches(const nsACString& aContractID) const { } -static nsresult ConstructJSMComponent(const nsACString& aURI, - const char* aConstructor, - nsISupports** aResult) { - if (!nsComponentManagerImpl::JSLoaderReady()) { - return NS_ERROR_NOT_AVAILABLE; - } - - AutoJSAPI jsapi; - MOZ_ALWAYS_TRUE(jsapi.Init(xpc::PrivilegedJunkScope())); - JSContext* cx = jsapi.cx(); - - JS::RootedObject global(cx); - JS::RootedObject exports(cx); - MOZ_TRY(mozJSComponentLoader::Get()->Import(cx, aURI, &global, &exports)); - - JS::RootedValue ctor(cx); - if (!JS_GetProperty(cx, exports, aConstructor, &ctor) || - !ctor.isObject()) { - return NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED; - } - - JS::RootedObject inst(cx); - if (!JS::Construct(cx, ctor, JS::HandleValueArray::empty(), &inst)) { - return NS_ERROR_FAILURE; - } - - return nsContentUtils::XPConnect()->WrapJS(cx, inst, NS_GET_IID(nsISupports), - (void**)aResult); -} - - //# @module_cid_table@ //# @module_contract_id_table@ @@ -274,20 +231,6 @@ nsCString StaticCategory::Name() const { return false; } -/* static */ already_AddRefed -StaticComponents::GetComponentJSMs() { - auto jsms = MakeUnique>(MOZ_ARRAY_LENGTH(gComponentJSMs)); - - for (const auto& entry : gComponentJSMs) { - jsms->AppendElement(GetString(entry)); - } - - nsCOMPtr result; - MOZ_ALWAYS_SUCCEEDS(NS_NewAdoptingUTF8StringEnumerator(getter_AddRefs(result), - jsms.release())); - return result.forget(); -} - /* static */ void StaticComponents::Shutdown() { CallUnloadFuncs(); } diff --git a/xpcom/components/StaticComponents.h b/xpcom/components/StaticComponents.h index 618d15dd0f17..c4fd339b11b3 100644 --- a/xpcom/components/StaticComponents.h +++ b/xpcom/components/StaticComponents.h @@ -17,7 +17,6 @@ #include "StaticComponentData.h" class nsIFactory; -class nsIUTF8StringEnumerator; class nsISupports; namespace mozilla { @@ -209,8 +208,6 @@ class StaticComponents final { static bool InvalidateContractID(const nsACString& aContractID, bool aInvalid = true); - static already_AddRefed GetComponentJSMs(); - /** * Calls any module unload from manifests whose components have been loaded. */ diff --git a/xpcom/components/gen_static_components.py b/xpcom/components/gen_static_components.py index c14296178b0d..04f09b26825a 100644 --- a/xpcom/components/gen_static_components.py +++ b/xpcom/components/gen_static_components.py @@ -218,8 +218,6 @@ class ModuleEntry(object): self.legacy_constructor = data.get('legacy_constructor', None) self.init_method = data.get('init_method', []) - self.jsm = data.get('jsm', None) - self.external = data.get('external', not (self.headers or self.legacy_constructor)) self.singleton = data.get('singleton', False) @@ -238,15 +236,7 @@ class ModuleEntry(object): str(self.cid), ', '.join(map(repr, self.contract_ids)), str_)) - if self.jsm: - if not self.constructor: - error("JavaScript components must specify a constructor") - - for prop in ('init_method', 'legacy_constructor', 'headers'): - if getattr(self, prop): - error("JavaScript components may not specify a '%s' " - "property" % prop) - elif self.external: + if self.external: if self.constructor or self.legacy_constructor: error("Externally-constructed components may not specify " "'constructor' or 'legacy_constructor' properties") @@ -309,14 +299,7 @@ class ModuleEntry(object): % self.legacy_constructor) return res - if self.jsm: - res += ( - ' nsCOMPtr inst;\n' - ' MOZ_TRY(ConstructJSMComponent(NS_LITERAL_CSTRING(%s),\n' - ' %s,\n' - ' getter_AddRefs(inst)));' - '\n' % (json.dumps(self.jsm), json.dumps(self.constructor))) - elif self.external: + if self.external: res += (' nsCOMPtr inst = ' 'mozCreateComponent<%s>();\n' % self.type) else: @@ -567,8 +550,6 @@ def gen_substs(manifests): contract_map = {} categories = defaultdict(list) - jsms = set() - types = set() for mod in modules: @@ -590,9 +571,6 @@ def gen_substs(manifests): if mod.type and not mod.headers: types.add(mod.type) - if mod.jsm: - jsms.add(mod.jsm) - cid_phf = PerfectHash(modules, PHF_SIZE, key=lambda module: module.cid.bytes) @@ -613,9 +591,6 @@ def gen_substs(manifests): gen_includes(substs, headers) - substs['component_jsms'] = '\n'.join(' %s,' % strings.entry_to_cxx(jsm) - for jsm in sorted(jsms)) + '\n' - substs['decls'] = gen_decls(types) substs['constructors'] = gen_constructors(cid_phf.entries) diff --git a/xpcom/components/nsComponentManager.cpp b/xpcom/components/nsComponentManager.cpp index 7dc22e9248af..89b4a78a9eff 100644 --- a/xpcom/components/nsComponentManager.cpp +++ b/xpcom/components/nsComponentManager.cpp @@ -338,7 +338,7 @@ nsresult nsComponentManagerImpl::Create(nsISupports* aOuter, REFNSIID aIID, return gComponentManager->QueryInterface(aIID, aResult); } -static const int CONTRACTID_HASHTABLE_INITIAL_LENGTH = 32; +static const int CONTRACTID_HASHTABLE_INITIAL_LENGTH = 256; nsComponentManagerImpl::nsComponentManagerImpl() : mFactories(CONTRACTID_HASHTABLE_INITIAL_LENGTH), @@ -531,8 +531,6 @@ nsresult nsComponentManagerImpl::Init() { // used, and before any calls are made into the JS engine. nsLayoutModuleInitialize(); - mJSLoaderReady = true; - // The overall order in which chrome.manifests are expected to be treated // is the following: // - greDir @@ -754,9 +752,7 @@ void nsComponentManagerImpl::RegisterContractIDLocked( return; } - auto contract = AsLiteralCString(aEntry->contractid); - StaticComponents::InvalidateContractID(contract); - mContractIDs.Put(contract, f); + mContractIDs.Put(AsLiteralCString(aEntry->contractid), f); } static void CutExtension(nsCString& aPath) { @@ -1598,13 +1594,10 @@ nsComponentManagerImpl::RegisterFactory(const nsCID& aClass, const char* aName, return NS_ERROR_INVALID_ARG; } - nsDependentCString contractID(aContractID); - SafeMutexAutoLock lock(mLock); nsFactoryEntry* oldf = mFactories.Get(&aClass); if (oldf) { - StaticComponents::InvalidateContractID(contractID); - mContractIDs.Put(contractID, oldf); + mContractIDs.Put(nsDependentCString(aContractID), oldf); return NS_OK; } @@ -1612,6 +1605,7 @@ nsComponentManagerImpl::RegisterFactory(const nsCID& aClass, const char* aName, // If this is the CID of a static module, just reset the invalid bit of // the static entry for this contract ID, and assume it points to the // correct class. + nsDependentCString contractID(aContractID); if (StaticComponents::InvalidateContractID(contractID, false)) { mContractIDs.Remove(contractID); return NS_OK; @@ -2016,14 +2010,6 @@ nsComponentManagerImpl::RemoveBootstrappedManifestLocation(nsIFile* aLocation) { return rv; } - -NS_IMETHODIMP -nsComponentManagerImpl::GetComponentJSMs(nsIUTF8StringEnumerator** aJSMs) { - nsCOMPtr result = StaticComponents::GetComponentJSMs(); - result.forget(aJSMs); - return NS_OK; -} - NS_IMETHODIMP nsComponentManagerImpl::GetManifestLocations(nsIArray** aLocations) { NS_ENSURE_ARG_POINTER(aLocations); diff --git a/xpcom/components/nsComponentManager.h b/xpcom/components/nsComponentManager.h index 547475b58c2b..a1f988ca694a 100644 --- a/xpcom/components/nsComponentManager.h +++ b/xpcom/components/nsComponentManager.h @@ -166,8 +166,6 @@ class nsComponentManagerImpl final : public nsIComponentManager, nsresult GetService(mozilla::xpcom::ModuleID, const nsIID& aIID, void** aResult); - static bool JSLoaderReady() { return gComponentManager->mJSLoaderReady; } - static void InitializeStaticModules(); static void InitializeModuleLocations(); @@ -269,7 +267,7 @@ class nsComponentManagerImpl final : public nsIComponentManager, SHUTDOWN_COMPLETE } mStatus; - mozilla::ArenaAllocator<1024 * 1, 8> mArena; + mozilla::ArenaAllocator<1024 * 8, 8> mArena; struct PendingServiceInfo { const nsCID* cid; @@ -283,8 +281,6 @@ class nsComponentManagerImpl final : public nsIComponentManager, nsTArray mPendingServices; - bool mJSLoaderReady = false; - size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const; private: diff --git a/xpcom/components/nsIComponentManager.idl b/xpcom/components/nsIComponentManager.idl index d5e0e39c37ca..1e5693a285a9 100644 --- a/xpcom/components/nsIComponentManager.idl +++ b/xpcom/components/nsIComponentManager.idl @@ -12,7 +12,6 @@ interface nsIFile; interface nsIFactory; interface nsIArray; -interface nsIUTF8StringEnumerator; [scriptable, uuid(d604ffc3-1ba3-4f6c-b65f-1ed4199364c3)] interface nsIComponentManager : nsISupports @@ -97,12 +96,6 @@ interface nsIComponentManager : nsISupports * Get an array of nsIURIs of all registered and builtin manifest locations. */ nsIArray getManifestLocations(); - - /** - * Returns a list of JSM URLs which are used to create components. This - * should only be used in automation. - */ - nsIUTF8StringEnumerator getComponentJSMs(); }; diff --git a/xpfe/appshell/components.conf b/xpfe/appshell/components.conf deleted file mode 100644 index 547f5e502874..000000000000 --- a/xpfe/appshell/components.conf +++ /dev/null @@ -1,21 +0,0 @@ -# -*- 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': '{0099907d-123c-4853-a46a-43098b5fb68c}', - 'contract_ids': ['@mozilla.org/appshell/appShellService;1'], - 'type': 'nsAppShellService', - 'headers': ['/xpfe/appshell/nsAppShellService.h'], - }, - { - 'cid': '{79a2b7cc-f05b-4605-bfa0-fac54f27eec8}', - 'contract_ids': ['@mozilla.org/appshell/window-mediator;1'], - 'type': 'nsWindowMediator', - 'headers': ['/xpfe/appshell/nsWindowMediator.h'], - 'init_method': 'Init', - }, -] diff --git a/xpfe/appshell/moz.build b/xpfe/appshell/moz.build index ca09649e4fd9..a46feae97122 100644 --- a/xpfe/appshell/moz.build +++ b/xpfe/appshell/moz.build @@ -26,6 +26,7 @@ EXPORTS += [ ] UNIFIED_SOURCES += [ + 'nsAppShellFactory.cpp', 'nsAppShellService.cpp', 'nsAppShellWindowEnumerator.cpp', 'nsChromeTreeOwner.cpp', @@ -35,10 +36,6 @@ UNIFIED_SOURCES += [ 'nsXULWindow.cpp', ] -XPCOM_MANIFESTS += [ - 'components.conf', -] - LOCAL_INCLUDES += [ '/dom/base', '/dom/xul', diff --git a/xpfe/appshell/nsAppShellFactory.cpp b/xpfe/appshell/nsAppShellFactory.cpp new file mode 100644 index 000000000000..0684a2c558d7 --- /dev/null +++ b/xpfe/appshell/nsAppShellFactory.cpp @@ -0,0 +1,38 @@ +/* -*- 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 "mozilla/ModuleUtils.h" +#include "nscore.h" +#include "nsIWindowMediator.h" + +#include "nsIAppShellService.h" +#include "nsAppShellService.h" +#include "nsWindowMediator.h" +#include "nsChromeTreeOwner.h" +#include "nsAppShellCID.h" + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppShellService) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowMediator, Init) + +NS_DEFINE_NAMED_CID(NS_APPSHELLSERVICE_CID); +NS_DEFINE_NAMED_CID(NS_WINDOWMEDIATOR_CID); + +static const mozilla::Module::CIDEntry kAppShellCIDs[] = { + {&kNS_APPSHELLSERVICE_CID, false, nullptr, nsAppShellServiceConstructor}, + {&kNS_WINDOWMEDIATOR_CID, false, nullptr, nsWindowMediatorConstructor}, + {nullptr}}; + +static const mozilla::Module::ContractIDEntry kAppShellContracts[] = { + {NS_APPSHELLSERVICE_CONTRACTID, &kNS_APPSHELLSERVICE_CID}, + {NS_WINDOWMEDIATOR_CONTRACTID, &kNS_WINDOWMEDIATOR_CID}, + {nullptr}}; + +static const mozilla::Module kAppShellModule = { + mozilla::Module::kVersion, + kAppShellCIDs, + kAppShellContracts, +}; + +NSMODULE_DEFN(appshell) = &kAppShellModule;