mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 04:38:02 +00:00
Bug 1524687: Part 2 - Convert most of the embedding module to static registration. r=mossop
Differential Revision: https://phabricator.services.mozilla.com/D18397 --HG-- extra : rebase_source : e1b5638fd2ec08f9d934a41020d2b666e30715e7
This commit is contained in:
parent
01cd56a799
commit
85ac6775b5
@ -55,7 +55,6 @@ 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});
|
||||
@ -95,7 +94,7 @@ function run_test() {
|
||||
|
||||
if (ind) {
|
||||
let old_factory = old_factories[i];
|
||||
registrar.registerFactory(old_factory.CID, factory.scheme, factory.contractID, old_factory.factory);
|
||||
registrar.registerFactory(old_factory.CID, factory.scheme, factory.contractID, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,6 @@ 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...");
|
||||
}
|
||||
@ -214,6 +213,6 @@ function run_test() {
|
||||
// Unregister XULAppInfoFactory
|
||||
registrar.unregisterFactory(XULAppInfoFactory.CID, XULAppInfoFactory);
|
||||
if (old_factory.factory != null) {
|
||||
registrar.registerFactory(old_factory.CID, "", XULAppInfoFactory.contractID, old_factory.factory);
|
||||
registrar.registerFactory(old_factory.CID, "", XULAppInfoFactory.contractID, null);
|
||||
}
|
||||
}
|
||||
|
54
toolkit/xre/components.conf
Normal file
54
toolkit/xre/components.conf
Normal file
@ -0,0 +1,54 @@
|
||||
# -*- 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'],
|
||||
},
|
||||
]
|
@ -158,6 +158,10 @@ if CONFIG['MOZ_PDF_PRINTING']:
|
||||
'../components/printingui',
|
||||
]
|
||||
|
||||
XPCOM_MANIFESTS += [
|
||||
'components.conf',
|
||||
]
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
@ -1248,12 +1248,14 @@ nsXULAppInfo::Callback(nsISupports* aData) {
|
||||
}
|
||||
|
||||
static const nsXULAppInfo kAppInfo;
|
||||
static nsresult AppInfoConstructor(nsISupports* aOuter, REFNSIID aIID,
|
||||
void** aResult) {
|
||||
namespace mozilla {
|
||||
nsresult AppInfoConstructor(nsISupports* aOuter, REFNSIID aIID,
|
||||
void** aResult) {
|
||||
NS_ENSURE_NO_AGGREGATION(aOuter);
|
||||
|
||||
return const_cast<nsXULAppInfo*>(&kAppInfo)->QueryInterface(aIID, aResult);
|
||||
}
|
||||
} // namespace mozilla
|
||||
|
||||
bool gLogConsoleErrors = false;
|
||||
|
||||
|
@ -51,6 +51,11 @@ extern nsString gAbsoluteArgv0Path;
|
||||
|
||||
extern bool gIsGtest;
|
||||
|
||||
namespace mozilla {
|
||||
nsresult AppInfoConstructor(nsISupports* aOuter, const nsID& aIID,
|
||||
void** aResult);
|
||||
} // namespace mozilla
|
||||
|
||||
/**
|
||||
* Create the nativeappsupport implementation.
|
||||
*
|
||||
|
@ -4,82 +4,39 @@
|
||||
* 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"
|
||||
|
||||
#ifdef NS_PRINTING
|
||||
#if defined(MOZ_XUL) && defined(NS_PRINTING)
|
||||
# include "nsPrintingPromptService.h"
|
||||
# include "nsPrintingProxy.h"
|
||||
#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
|
||||
# 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[] = {
|
||||
#ifdef MOZ_XUL
|
||||
{&kNS_DIALOGPARAMBLOCK_CID, false, nullptr, nsDialogParamBlockConstructor},
|
||||
# ifdef NS_PRINTING
|
||||
|
||||
# ifdef PROXY_PRINTING
|
||||
#if defined(MOZ_XUL) && defined(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[] = {
|
||||
#ifdef MOZ_XUL
|
||||
{NS_DIALOGPARAMBLOCK_CONTRACTID, &kNS_DIALOGPARAMBLOCK_CID},
|
||||
# ifdef NS_PRINTING
|
||||
#if defined(MOZ_XUL) && defined(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 = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user