зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 11 changesets (bug 1773770) because shouldn't have been landed during a soft freeze CLOSED TREE
Backed out changeset ede55d570d1e (bug 1773770) Backed out changeset d5374ef362c2 (bug 1773770) Backed out changeset 26e47956508b (bug 1773770) Backed out changeset c78f0c4c8f3f (bug 1773770) Backed out changeset 9089a97bcb26 (bug 1773770) Backed out changeset 17894f5b3b41 (bug 1773770) Backed out changeset 986a64a9e6b4 (bug 1773770) Backed out changeset 7a63d8676bf0 (bug 1773770) Backed out changeset 38e7b99ffbed (bug 1773770) Backed out changeset e9ad07c96ab2 (bug 1773770) Backed out changeset 2a8f65417b66 (bug 1773770)
This commit is contained in:
Родитель
64865cfb7a
Коммит
ff26b8a5d0
|
@ -136,3 +136,35 @@ PowerManagerService::NewWakeLock(const nsAString& aTopic,
|
|||
}
|
||||
|
||||
} // namespace mozilla::dom::power
|
||||
|
||||
NS_DEFINE_NAMED_CID(NS_POWERMANAGERSERVICE_CID);
|
||||
|
||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(
|
||||
nsIPowerManagerService,
|
||||
mozilla::dom::power::PowerManagerService::GetInstance)
|
||||
|
||||
static const mozilla::Module::CIDEntry kPowerManagerCIDs[] = {
|
||||
// clang-format off
|
||||
{ &kNS_POWERMANAGERSERVICE_CID, false, nullptr, nsIPowerManagerServiceConstructor, mozilla::Module::ALLOW_IN_GPU_RDD_AND_SOCKET_PROCESS },
|
||||
{ nullptr }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kPowerManagerContracts[] = {
|
||||
// clang-format off
|
||||
{ POWERMANAGERSERVICE_CONTRACTID, &kNS_POWERMANAGERSERVICE_CID, mozilla::Module::ALLOW_IN_GPU_RDD_AND_SOCKET_PROCESS },
|
||||
{ nullptr }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
// We mark the power module as being available in the GPU process because the
|
||||
// appshell depends on the power manager service.
|
||||
extern const mozilla::Module kPowerManagerModule = {
|
||||
mozilla::Module::kVersion,
|
||||
kPowerManagerCIDs,
|
||||
kPowerManagerContracts,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
mozilla::Module::ALLOW_IN_GPU_RDD_AND_SOCKET_PROCESS};
|
||||
|
|
|
@ -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': '{18c2e238-3a0a-4153-89fc-166b3b1465a1}',
|
||||
'contract_ids': ['@mozilla.org/power/powermanagerservice;1'],
|
||||
'type': 'mozilla::dom::power::PowerManagerService',
|
||||
'constructor': 'mozilla::dom::power::PowerManagerService::GetInstance',
|
||||
'headers': ['mozilla/dom/power/PowerManagerService.h'],
|
||||
'singleton': True,
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_AND_SOCKET_PROCESS,
|
||||
},
|
||||
]
|
|
@ -15,10 +15,6 @@ XPIDL_SOURCES += [
|
|||
|
||||
XPIDL_MODULE = "dom_power"
|
||||
|
||||
XPCOM_MANIFESTS += [
|
||||
"components.conf",
|
||||
]
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
"WakeLock.h",
|
||||
]
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "nsISupports.idl"
|
||||
|
||||
%{C++
|
||||
#define NS_POWERMANAGERSERVICE_CID { 0x18c2e238, 0x3a0a, 0x4153, {0x89, 0xfc, 0x16, 0x6b, 0x3b, 0x14, 0x65, 0xa1 } }
|
||||
#define POWERMANAGERSERVICE_CONTRACTID "@mozilla.org/power/powermanagerservice;1"
|
||||
%}
|
||||
|
||||
|
|
|
@ -645,7 +645,7 @@ static bool RegisterXPCTestComponents(JSContext* cx, unsigned argc, Value* vp) {
|
|||
JS_ReportErrorASCII(cx, "Wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
nsresult rv = xpcTestRegisterComponents();
|
||||
nsresult rv = XRE_AddStaticComponent(&kXPCTestModule);
|
||||
if (NS_FAILED(rv)) {
|
||||
XPCThrower::Throw(rv, cx);
|
||||
return false;
|
||||
|
|
|
@ -16,8 +16,4 @@ UNIFIED_SOURCES += [
|
|||
"xpctest_returncode.cpp",
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
"/xpcom/components",
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = "xul"
|
||||
|
|
|
@ -6,38 +6,75 @@
|
|||
|
||||
/* module registration and factory code. */
|
||||
|
||||
#include "mozilla/GenericFactory.h"
|
||||
#include "mozilla/ResultExtensions.h"
|
||||
#include "nsComponentManager.h"
|
||||
#include "xpctest_private.h"
|
||||
|
||||
template <typename T>
|
||||
nsresult RegisterFactory(const char* aContractID) {
|
||||
auto constructor = [](REFNSIID aIID, void** aResult) {
|
||||
RefPtr inst = new T();
|
||||
return inst->QueryInterface(aIID, aResult);
|
||||
};
|
||||
#define NS_XPCTESTOBJECTREADONLY_CID \
|
||||
{ \
|
||||
0x492609a7, 0x2582, 0x436b, { \
|
||||
0xb0, 0xef, 0x92, 0xe2, 0x9b, 0xb9, 0xe1, 0x43 \
|
||||
} \
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFactory> factory = new mozilla::GenericFactory(constructor);
|
||||
#define NS_XPCTESTOBJECTREADWRITE_CID \
|
||||
{ \
|
||||
0x8f37f760, 0x3686, 0x4dbb, { \
|
||||
0xb1, 0x21, 0x96, 0x93, 0xba, 0x81, 0x3f, 0x8f \
|
||||
} \
|
||||
}
|
||||
|
||||
nsID cid;
|
||||
MOZ_TRY(nsID::GenerateUUIDInPlace(cid));
|
||||
#define NS_XPCTESTPARAMS_CID \
|
||||
{ \
|
||||
0x1f11076a, 0x0fa2, 0x4f07, { \
|
||||
0xb4, 0x7a, 0xa1, 0x54, 0x31, 0xf2, 0xce, 0xf7 \
|
||||
} \
|
||||
}
|
||||
|
||||
return nsComponentManagerImpl::gComponentManager->RegisterFactory(
|
||||
cid, aContractID, aContractID, factory);
|
||||
}
|
||||
#define NS_XPCTESTRETURNCODEPARENT_CID \
|
||||
{ \
|
||||
0x3818f744, 0x5445, 0x4e9c, { \
|
||||
0x9b, 0xb8, 0x64, 0x62, 0xfe, 0x81, 0xb6, 0x19 \
|
||||
} \
|
||||
}
|
||||
|
||||
nsresult xpcTestRegisterComponents() {
|
||||
MOZ_TRY(RegisterFactory<xpcTestObjectReadOnly>(
|
||||
"@mozilla.org/js/xpc/test/native/ObjectReadOnly;1"));
|
||||
MOZ_TRY(RegisterFactory<xpcTestObjectReadWrite>(
|
||||
"@mozilla.org/js/xpc/test/native/ObjectReadWrite;1"));
|
||||
MOZ_TRY(RegisterFactory<nsXPCTestParams>(
|
||||
"@mozilla.org/js/xpc/test/native/Params;1"));
|
||||
MOZ_TRY(RegisterFactory<nsXPCTestReturnCodeParent>(
|
||||
"@mozilla.org/js/xpc/test/native/ReturnCodeParent;1"));
|
||||
MOZ_TRY(RegisterFactory<xpcTestCEnums>(
|
||||
"@mozilla.org/js/xpc/test/native/CEnums;1"));
|
||||
#define NS_XPCTESTCENUMS_CID \
|
||||
{ \
|
||||
0x89ba673a, 0xa987, 0xb89c, { \
|
||||
0x92, 0x02, 0xb9, 0xc6, 0x23, 0x38, 0x64, 0x55 \
|
||||
} \
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(xpcTestCEnums)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(xpcTestObjectReadOnly)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(xpcTestObjectReadWrite)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsXPCTestParams)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsXPCTestReturnCodeParent)
|
||||
NS_DEFINE_NAMED_CID(NS_XPCTESTOBJECTREADONLY_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_XPCTESTOBJECTREADWRITE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_XPCTESTPARAMS_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_XPCTESTRETURNCODEPARENT_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_XPCTESTCENUMS_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kXPCTestCIDs[] = {
|
||||
{&kNS_XPCTESTOBJECTREADONLY_CID, false, nullptr,
|
||||
xpcTestObjectReadOnlyConstructor},
|
||||
{&kNS_XPCTESTOBJECTREADWRITE_CID, false, nullptr,
|
||||
xpcTestObjectReadWriteConstructor},
|
||||
{&kNS_XPCTESTPARAMS_CID, false, nullptr, nsXPCTestParamsConstructor},
|
||||
{&kNS_XPCTESTRETURNCODEPARENT_CID, false, nullptr,
|
||||
nsXPCTestReturnCodeParentConstructor},
|
||||
{&kNS_XPCTESTCENUMS_CID, false, nullptr, xpcTestCEnumsConstructor},
|
||||
{nullptr}};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kXPCTestContracts[] = {
|
||||
{"@mozilla.org/js/xpc/test/native/CEnums;1", &kNS_XPCTESTCENUMS_CID},
|
||||
{"@mozilla.org/js/xpc/test/native/ObjectReadOnly;1",
|
||||
&kNS_XPCTESTOBJECTREADONLY_CID},
|
||||
{"@mozilla.org/js/xpc/test/native/ObjectReadWrite;1",
|
||||
&kNS_XPCTESTOBJECTREADWRITE_CID},
|
||||
{"@mozilla.org/js/xpc/test/native/Params;1", &kNS_XPCTESTPARAMS_CID},
|
||||
{"@mozilla.org/js/xpc/test/native/ReturnCodeParent;1",
|
||||
&kNS_XPCTESTRETURNCODEPARENT_CID},
|
||||
{nullptr}};
|
||||
|
||||
const mozilla::Module kXPCTestModule = {mozilla::Module::kVersion, kXPCTestCIDs,
|
||||
kXPCTestContracts};
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ModuleUtils.h"
|
||||
|
||||
nsresult xpcTestRegisterComponents();
|
||||
extern const mozilla::Module kXPCTestModule;
|
||||
|
||||
class xpcTestObjectReadOnly final : public nsIXPCTestObjectReadOnly {
|
||||
public:
|
||||
|
|
|
@ -227,6 +227,12 @@ nsresult SessionStorageManagerConstructor(REFNSIID aIID, void** aResult) {
|
|||
return manager->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
static const mozilla::Module::CategoryEntry kLayoutCategories[] = {
|
||||
// clang-format off
|
||||
{nullptr}
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
void nsLayoutModuleDtor() {
|
||||
if (XRE_GetProcessType() == GeckoProcessType_GPU ||
|
||||
XRE_GetProcessType() == GeckoProcessType_VR ||
|
||||
|
@ -246,3 +252,11 @@ void nsLayoutModuleDtor() {
|
|||
nsScriptSecurityManager::Shutdown();
|
||||
xpcModuleDtor();
|
||||
}
|
||||
|
||||
extern const mozilla::Module kLayoutModule = {mozilla::Module::kVersion,
|
||||
nullptr,
|
||||
nullptr,
|
||||
kLayoutCategories,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr};
|
||||
|
|
|
@ -40,6 +40,9 @@ class ColorPickerDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
ColorPickerDelegate.prototype.classID = Components.ID(
|
||||
"{aa0dd6fc-73dd-4621-8385-c0b377e02cee}"
|
||||
);
|
||||
ColorPickerDelegate.prototype.QueryInterface = ChromeUtils.generateQI([
|
||||
"nsIColorPicker",
|
||||
]);
|
||||
|
|
|
@ -41,15 +41,15 @@ Classes = [
|
|||
'constructor': 'PushService',
|
||||
},
|
||||
{
|
||||
'cid': '{fc4bec74-ddd0-4ea8-9a66-9a5081258e32}',
|
||||
'contract_ids': ['@mozilla.org/parent/colorpicker;1'],
|
||||
'cid': '{aa0dd6fc-73dd-4621-8385-c0b377e02cee}',
|
||||
'contract_ids': ['@mozilla.org/colorpicker;1'],
|
||||
'jsm': 'resource://gre/modules/ColorPickerDelegate.jsm',
|
||||
'constructor': 'ColorPickerDelegate',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{25fdbae6-f684-4bf0-b773-ff2b7a6273c8}',
|
||||
'contract_ids': ['@mozilla.org/parent/filepicker;1'],
|
||||
'cid': '{e4565e36-f101-4bf5-950b-4be0887785a9}',
|
||||
'contract_ids': ['@mozilla.org/filepicker;1'],
|
||||
'jsm': 'resource://gre/modules/FilePickerDelegate.jsm',
|
||||
'constructor': 'FilePickerDelegate',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
|
|
|
@ -11,22 +11,6 @@ Headers = [
|
|||
InitFunc = 'nsNetStartup'
|
||||
UnloadFunc = 'nsNetShutdown'
|
||||
|
||||
Categories = {
|
||||
'@mozilla.org/streamconv;1': {
|
||||
'?from=application/http-index-format&to=text/html': ('', ProcessSelector.ALLOW_IN_SOCKET_PROCESS),
|
||||
'?from=multipart/x-mixed-replace&to=*/*': ('', ProcessSelector.ALLOW_IN_SOCKET_PROCESS),
|
||||
'?from=multipart/mixed&to=*/*': ('', ProcessSelector.ALLOW_IN_SOCKET_PROCESS),
|
||||
'?from=multipart/byteranges&to=*/*': ('', ProcessSelector.ALLOW_IN_SOCKET_PROCESS),
|
||||
'?from=application/x-unknown-content-type&to=*/*': ('', ProcessSelector.ALLOW_IN_SOCKET_PROCESS),
|
||||
'?from=gzip&to=uncompressed': ('', ProcessSelector.ALLOW_IN_SOCKET_PROCESS),
|
||||
'?from=x-gzip&to=uncompressed': ('', ProcessSelector.ALLOW_IN_SOCKET_PROCESS),
|
||||
'?from=br&to=uncompressed': ('', ProcessSelector.ALLOW_IN_SOCKET_PROCESS),
|
||||
'?from=compress&to=uncompressed': ('', ProcessSelector.ALLOW_IN_SOCKET_PROCESS),
|
||||
'?from=x-compress&to=uncompressed': ('', ProcessSelector.ALLOW_IN_SOCKET_PROCESS),
|
||||
'?from=deflate&to=uncompressed': ('', ProcessSelector.ALLOW_IN_SOCKET_PROCESS),
|
||||
},
|
||||
}
|
||||
|
||||
Classes = [
|
||||
{
|
||||
'cid': '{3014dde6-aa1c-41db-87d0-48764a3710f6}',
|
||||
|
@ -85,7 +69,6 @@ Classes = [
|
|||
'cid': '{a2027ec6-ba0d-4c72-805d-148233f5f33c}',
|
||||
'contract_ids': ['@mozilla.org/network/binary-detector;1'],
|
||||
'legacy_constructor': 'CreateNewBinaryDetectorFactory',
|
||||
'categories': {'net-content-sniffers': 'Binary Detector'}
|
||||
},
|
||||
{
|
||||
'cid': '{9226888e-da08-11d3-8cda-0060b0fc14a3}',
|
||||
|
|
|
@ -119,6 +119,33 @@ nsresult MOZ_NewTXTToHTMLConv(mozTXTToHTMLConv** result);
|
|||
nsresult NS_NewHTTPCompressConv(mozilla::net::nsHTTPCompressConv** result);
|
||||
nsresult NS_NewStreamConv(nsStreamConverterService** aStreamConv);
|
||||
|
||||
#define INDEX_TO_HTML "?from=application/http-index-format&to=text/html"
|
||||
#define MULTI_MIXED_X "?from=multipart/x-mixed-replace&to=*/*"
|
||||
#define MULTI_MIXED "?from=multipart/mixed&to=*/*"
|
||||
#define MULTI_BYTERANGES "?from=multipart/byteranges&to=*/*"
|
||||
#define UNKNOWN_CONTENT "?from=" UNKNOWN_CONTENT_TYPE "&to=*/*"
|
||||
#define GZIP_TO_UNCOMPRESSED "?from=gzip&to=uncompressed"
|
||||
#define XGZIP_TO_UNCOMPRESSED "?from=x-gzip&to=uncompressed"
|
||||
#define BROTLI_TO_UNCOMPRESSED "?from=br&to=uncompressed"
|
||||
#define COMPRESS_TO_UNCOMPRESSED "?from=compress&to=uncompressed"
|
||||
#define XCOMPRESS_TO_UNCOMPRESSED "?from=x-compress&to=uncompressed"
|
||||
#define DEFLATE_TO_UNCOMPRESSED "?from=deflate&to=uncompressed"
|
||||
|
||||
static const mozilla::Module::CategoryEntry kNeckoCategories[] = {
|
||||
{NS_ISTREAMCONVERTER_KEY, INDEX_TO_HTML, ""},
|
||||
{NS_ISTREAMCONVERTER_KEY, MULTI_MIXED_X, ""},
|
||||
{NS_ISTREAMCONVERTER_KEY, MULTI_MIXED, ""},
|
||||
{NS_ISTREAMCONVERTER_KEY, MULTI_BYTERANGES, ""},
|
||||
{NS_ISTREAMCONVERTER_KEY, UNKNOWN_CONTENT, ""},
|
||||
{NS_ISTREAMCONVERTER_KEY, GZIP_TO_UNCOMPRESSED, ""},
|
||||
{NS_ISTREAMCONVERTER_KEY, XGZIP_TO_UNCOMPRESSED, ""},
|
||||
{NS_ISTREAMCONVERTER_KEY, BROTLI_TO_UNCOMPRESSED, ""},
|
||||
{NS_ISTREAMCONVERTER_KEY, COMPRESS_TO_UNCOMPRESSED, ""},
|
||||
{NS_ISTREAMCONVERTER_KEY, XCOMPRESS_TO_UNCOMPRESSED, ""},
|
||||
{NS_ISTREAMCONVERTER_KEY, DEFLATE_TO_UNCOMPRESSED, ""},
|
||||
NS_BINARYDETECTOR_CATEGORYENTRY,
|
||||
{nullptr}};
|
||||
|
||||
nsresult CreateNewStreamConvServiceFactory(REFNSIID aIID, void** aResult) {
|
||||
if (!aResult) {
|
||||
return NS_ERROR_INVALID_POINTER;
|
||||
|
@ -252,3 +279,13 @@ void nsNetShutdown() {
|
|||
delete gNetAndORBSniffers;
|
||||
gNetAndORBSniffers = nullptr;
|
||||
}
|
||||
|
||||
extern const mozilla::Module kNeckoModule = {
|
||||
mozilla::Module::kVersion,
|
||||
nullptr,
|
||||
nullptr,
|
||||
kNeckoCategories,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
mozilla::Module::ALLOW_IN_SOCKET_PROCESS};
|
||||
|
|
|
@ -149,4 +149,10 @@ class nsBinaryDetector : public nsUnknownDecoder {
|
|||
virtual void DetermineContentType(nsIRequest* aRequest) override;
|
||||
};
|
||||
|
||||
#define NS_BINARYDETECTOR_CATEGORYENTRY \
|
||||
{ \
|
||||
NS_CONTENT_SNIFFER_CATEGORY, "Binary Detector", \
|
||||
NS_BINARYDETECTOR_CONTRACTID \
|
||||
}
|
||||
|
||||
#endif /* nsUnknownDecoder_h__ */
|
||||
|
|
|
@ -112,10 +112,6 @@ const backgroundtaskPhases = {
|
|||
name: "@mozilla.org/gfx/screenmanager;1",
|
||||
condition: WIN,
|
||||
},
|
||||
{
|
||||
name: "@mozilla.org/gfx/parent/screenmanager;1",
|
||||
condition: WIN,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
|
||||
#define NS_FAVICONSERVICE_CONTRACTID "@mozilla.org/browser/favicon-service;1"
|
||||
|
||||
#define NS_KEY_VALUE_SERVICE_CONTRACTID "@mozilla.org/key-value-service;1"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// {84E11F80-CA55-11DD-AD8B-0800200C9A66}
|
||||
|
@ -99,3 +101,11 @@
|
|||
0xb6, 0x05, 0x60, 0xb0, 0x22, 0xa0, 0x07, 0x56 \
|
||||
} \
|
||||
}
|
||||
|
||||
// 6cc1a0a8-af97-4d41-9b4a-58dcec46ebce
|
||||
#define NS_KEY_VALUE_SERVICE_CID \
|
||||
{ \
|
||||
0x6cc1a0a8, 0xaf97, 0x4d41, { \
|
||||
0x9b, 0x4a, 0x58, 0xdc, 0xec, 0x46, 0xeb, 0xce \
|
||||
} \
|
||||
}
|
||||
|
|
|
@ -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': '{6cc1a0a8-af97-4d41-9b4a-58dcec46ebce}',
|
||||
'contract_ids': ['@mozilla.org/key-value-service;1'],
|
||||
'headers': ['/toolkit/components/kvstore/nsKeyValueModule.h'],
|
||||
'legacy_constructor': 'nsKeyValueServiceConstructor',
|
||||
},
|
||||
]
|
|
@ -17,10 +17,10 @@ XPIDL_SOURCES += [
|
|||
"nsIKeyValue.idl",
|
||||
]
|
||||
|
||||
XPCOM_MANIFESTS += [
|
||||
"components.conf",
|
||||
]
|
||||
|
||||
XPIDL_MODULE = "kvstore"
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
"nsKeyValueModule.cpp",
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = "xul"
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/* 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 "nsToolkitCompsCID.h"
|
||||
|
||||
extern "C" {
|
||||
// Implemented in Rust.
|
||||
nsresult nsKeyValueServiceConstructor(REFNSIID aIID, void** aResult);
|
||||
} // extern "C"
|
||||
|
||||
NS_DEFINE_NAMED_CID(NS_KEY_VALUE_SERVICE_CID);
|
||||
|
||||
const mozilla::Module::CIDEntry kKeyValueCIDs[] = {
|
||||
{&kNS_KEY_VALUE_SERVICE_CID, false, nullptr, nsKeyValueServiceConstructor},
|
||||
{nullptr}};
|
||||
|
||||
const mozilla::Module::ContractIDEntry kKeyValueContracts[] = {
|
||||
{NS_KEY_VALUE_SERVICE_CONTRACTID, &kNS_KEY_VALUE_SERVICE_CID}, {nullptr}};
|
||||
|
||||
extern const mozilla::Module kKeyValueModule = {
|
||||
mozilla::Module::kVersion, kKeyValueCIDs, kKeyValueContracts, nullptr};
|
|
@ -1,15 +0,0 @@
|
|||
/* 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 nsKeyValueModule_h
|
||||
#define nsKeyValueModule_h
|
||||
|
||||
#include "nsID.h"
|
||||
|
||||
extern "C" {
|
||||
// Implemented in Rust.
|
||||
nsresult nsKeyValueServiceConstructor(REFNSIID aIID, void** aResult);
|
||||
} // extern "C"
|
||||
|
||||
#endif // defined nsKeyValueModule_h
|
|
@ -2071,6 +2071,26 @@ nsToolkitProfileService::Flush() {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsToolkitProfileFactory, nsIFactory)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsToolkitProfileFactory::CreateInstance(const nsID& aIID, void** aResult) {
|
||||
RefPtr<nsToolkitProfileService> profileService =
|
||||
nsToolkitProfileService::gService;
|
||||
if (!profileService) {
|
||||
nsresult rv = NS_NewToolkitProfileService(getter_AddRefs(profileService));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
return profileService->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
nsresult NS_NewToolkitProfileFactory(nsIFactory** aResult) {
|
||||
*aResult = new nsToolkitProfileFactory();
|
||||
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult NS_NewToolkitProfileService(nsToolkitProfileService** aResult) {
|
||||
nsToolkitProfileService* profileService = new nsToolkitProfileService();
|
||||
nsresult rv = profileService->Init();
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#ifndef nsToolkitProfileService_h
|
||||
#define nsToolkitProfileService_h
|
||||
|
||||
#include "mozilla/Components.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "nsIToolkitProfileService.h"
|
||||
#include "nsIToolkitProfile.h"
|
||||
|
@ -65,6 +64,14 @@ class nsToolkitProfileLock final : public nsIProfileLock {
|
|||
nsProfileLock mLock;
|
||||
};
|
||||
|
||||
class nsToolkitProfileFactory final : public nsIFactory {
|
||||
~nsToolkitProfileFactory() = default;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIFACTORY
|
||||
};
|
||||
|
||||
class nsToolkitProfileService final : public nsIToolkitProfileService {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -80,9 +87,8 @@ class nsToolkitProfileService final : public nsIToolkitProfileService {
|
|||
|
||||
private:
|
||||
friend class nsToolkitProfile;
|
||||
friend class nsToolkitProfileFactory;
|
||||
friend nsresult NS_NewToolkitProfileService(nsToolkitProfileService**);
|
||||
friend nsresult mozilla::xpcom::CreateInstanceImpl(
|
||||
mozilla::xpcom::ModuleID aID, const nsIID& aIID, void** aResult);
|
||||
|
||||
nsToolkitProfileService();
|
||||
~nsToolkitProfileService();
|
||||
|
|
|
@ -59,11 +59,4 @@ Classes = [
|
|||
'type': 'nsDialogParamBlock',
|
||||
'headers': ['/toolkit/components/windowwatcher/nsDialogParamBlock.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{5f5e59ce-27bc-47eb-9d1f-b09ca9049836}',
|
||||
'contract_ids': ['@mozilla.org/toolkit/profile-service;1'],
|
||||
'type': 'nsToolkitProfileService',
|
||||
'init_method': 'Init',
|
||||
'headers': ['/toolkit/profile/nsToolkitProfileService.h'],
|
||||
},
|
||||
]
|
||||
|
|
|
@ -2063,6 +2063,30 @@ ScopedXPCOMStartup::~ScopedXPCOMStartup() {
|
|||
}
|
||||
}
|
||||
|
||||
// {5F5E59CE-27BC-47eb-9D1F-B09CA9049836}
|
||||
static const nsCID kProfileServiceCID = {
|
||||
0x5f5e59ce,
|
||||
0x27bc,
|
||||
0x47eb,
|
||||
{0x9d, 0x1f, 0xb0, 0x9c, 0xa9, 0x4, 0x98, 0x36}};
|
||||
|
||||
static already_AddRefed<nsIFactory> ProfileServiceFactoryConstructor(
|
||||
const mozilla::Module& module, const mozilla::Module::CIDEntry& entry) {
|
||||
nsCOMPtr<nsIFactory> factory;
|
||||
NS_NewToolkitProfileFactory(getter_AddRefs(factory));
|
||||
return factory.forget();
|
||||
}
|
||||
|
||||
static const mozilla::Module::CIDEntry kXRECIDs[] = {
|
||||
{&kProfileServiceCID, false, ProfileServiceFactoryConstructor, nullptr},
|
||||
{nullptr}};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kXREContracts[] = {
|
||||
{NS_PROFILESERVICE_CONTRACTID, &kProfileServiceCID}, {nullptr}};
|
||||
|
||||
extern const mozilla::Module kXREModule = {mozilla::Module::kVersion, kXRECIDs,
|
||||
kXREContracts};
|
||||
|
||||
nsresult ScopedXPCOMStartup::Initialize(bool aInitJSContext) {
|
||||
NS_ASSERTION(gDirServiceProvider, "Should not get here!");
|
||||
|
||||
|
|
|
@ -80,6 +80,8 @@ already_AddRefed<nsINativeAppSupport> NS_GetNativeAppSupport();
|
|||
|
||||
nsresult NS_NewToolkitProfileService(nsIToolkitProfileService** aResult);
|
||||
|
||||
nsresult NS_NewToolkitProfileFactory(nsIFactory** aResult);
|
||||
|
||||
/**
|
||||
* Try to acquire exclusive access to the specified profile directory.
|
||||
*
|
||||
|
|
|
@ -20,8 +20,8 @@ Classes = [
|
|||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{d594094c-28b6-466b-97d7-66c039c3dea9}',
|
||||
'contract_ids': ['@mozilla.org/gfx/parent/screenmanager;1'],
|
||||
'cid': '{c401eb80-f9ea-11d3-bb6f-e732b73ebe7c}',
|
||||
'contract_ids': ['@mozilla.org/gfx/screenmanager;1'],
|
||||
'singleton': True,
|
||||
'type': 'mozilla::widget::ScreenManager',
|
||||
'headers': ['mozilla/widget/ScreenManager.h'],
|
||||
|
@ -43,12 +43,14 @@ Classes = [
|
|||
'headers': ['/widget/nsTransferable.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{9d5adbb9-1da4-4162-acba-b373fe3ae837}',
|
||||
'contract_ids': ['@mozilla.org/widget/parent/clipboard;1'],
|
||||
'js_name': 'clipboard',
|
||||
'cid': '{8b5314ba-db01-11d2-96ce-0060b0fb9956}',
|
||||
'contract_ids': ['@mozilla.org/widget/clipboard;1'],
|
||||
'interfaces': ['nsIClipboard'],
|
||||
'type': 'nsClipboard',
|
||||
'headers': ['/widget/android/nsClipboard.h'],
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
'overridable': True,
|
||||
},
|
||||
{
|
||||
'cid': '{77221d5a-1dd2-11b2-8c69-c710f15d2ed5}',
|
||||
|
|
|
@ -4,18 +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/.
|
||||
|
||||
Headers = '/widget/cocoa/nsWidgetFactory.h',
|
||||
|
||||
InitFunc = 'nsWidgetCocoaModuleCtor'
|
||||
UnloadFunc = 'nsWidgetCocoaModuleDtor'
|
||||
|
||||
Classes = [
|
||||
{
|
||||
'cid': '{49f428e8-baf9-4ba3-b1b0-7d2fd3abbcea}',
|
||||
'contract_ids': ['@mozilla.org/widget/parent/clipboard;1'],
|
||||
'js_name': 'clipboard',
|
||||
'cid': '{8b5314ba-db01-11d2-96ce-0060b0fb9956}',
|
||||
'contract_ids': ['@mozilla.org/widget/clipboard;1'],
|
||||
'interfaces': ['nsIClipboard'],
|
||||
'type': 'nsIClipboard',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
'overridable': True,
|
||||
},
|
||||
{
|
||||
'name': 'GfxInfo',
|
||||
|
@ -25,144 +22,4 @@ Classes = [
|
|||
'headers': ['/widget/cocoa/GfxInfo.h'],
|
||||
'init_method': 'Init',
|
||||
},
|
||||
{
|
||||
'cid': '{e5170091-c16b-492d-bf00-f45d72470553}',
|
||||
'contract_ids': ['@mozilla.org/parent/filepicker;1'],
|
||||
'type': 'nsFilePicker',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{b90f5fdd-c23e-4ad6-a10e-1da8ffe07799}',
|
||||
'contract_ids': ['@mozilla.org/parent/colorpicker;1'],
|
||||
'type': 'nsColorPicker',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{2d96b3df-c051-11d1-a827-0040959a28c9}',
|
||||
'contract_ids': ['@mozilla.org/widget/appshell/mac;1'],
|
||||
'legacy_constructor': 'nsAppShellConstructor',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{15cc80a9-5329-4fcb-9a0b-c6cf1440ae51}',
|
||||
'contract_ids': ['@mozilla.org/parent/sound;1'],
|
||||
'type': 'nsSound',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{8b5314bc-db01-11d2-96ce-0060b0fb9956}',
|
||||
'contract_ids': ['@mozilla.org/widget/transferable;1'],
|
||||
'type': 'nsTransferable',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{948a0023-e3a7-11d2-96cf-0060b0fb9956}',
|
||||
'contract_ids': ['@mozilla.org/widget/htmlformatconverter;1'],
|
||||
'type': 'nsHTMLFormatConverter',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{77221d5a-1dd2-11b2-8c69-c710f15d2ed5}',
|
||||
'contract_ids': ['@mozilla.org/widget/clipboardhelper;1'],
|
||||
'type': 'nsClipboardHelper',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{9a155bb2-2b67-45de-83e3-13a9dacf8336}',
|
||||
'contract_ids': ['@mozilla.org/widget/parent/dragservice;1'],
|
||||
'type': 'nsDragService',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{f0ddedd7-e8d5-4f95-a5b4-0f48f1741b36}',
|
||||
'contract_ids': ['@mozilla.org/gfx/parent/screenmanager;1'],
|
||||
'type': 'mozilla::widget::ScreenManager',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
'singleton': True,
|
||||
},
|
||||
{
|
||||
'cid': '{d3f69889-e13a-4321-980c-a39332e21f34}',
|
||||
'contract_ids': ['@mozilla.org/gfx/devicecontextspec;1'],
|
||||
'type': 'nsDeviceContextSpecX',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{a6cf9129-15b3-11d2-932e-00805f8add32}',
|
||||
'contract_ids': ['@mozilla.org/gfx/printerlist;1'],
|
||||
'type': 'nsPrinterListCUPS',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{841387c8-72e6-484b-9296-bf6eea80d58a}',
|
||||
'contract_ids': ['@mozilla.org/gfx/printsettings-service;1'],
|
||||
'type': 'nsPrintSettingsServiceX',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{06beec76-a183-4d9f-85dd-085f26da565a}',
|
||||
'contract_ids': ['@mozilla.org/widget/printdialog-service;1'],
|
||||
'type': 'nsPrintDialogServiceX',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{6987230e-0089-4e78-bc5f-1493ee7519fa}',
|
||||
'contract_ids': ['@mozilla.org/widget/useridleservice;1'],
|
||||
'type': 'nsUserIdleServiceX',
|
||||
'singleton': True,
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{84e11f80-ca55-11dd-ad8b-0800200c9a66}',
|
||||
'contract_ids': ['@mozilla.org/system-alerts-service;1'],
|
||||
'type': 'mozilla::OSXNotificationCenter',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{2451baed-8dc3-46d9-9e30-96e1baa03666}',
|
||||
'contract_ids': ['@mozilla.org/widget/macdocksupport;1'],
|
||||
'type': 'nsMacDockSupport',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{74ea4101-a5bb-49bc-9984-66da8b225a37}',
|
||||
'contract_ids': ['@mozilla.org/widget/macfinderprogress;1'],
|
||||
'type': 'nsMacFinderProgress',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{de59fe1a-46c8-490f-b04d-34545acb06c9}',
|
||||
'contract_ids': ['@mozilla.org/widget/macsharingservice;1'],
|
||||
'type': 'nsMacSharingService',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{29046c8f-cba6-4ffa-9141-1685e96c4ea0}',
|
||||
'contract_ids': ['@mozilla.org/widget/macuseractivityupdater;1'],
|
||||
'type': 'nsMacUserActivityUpdater',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{e9096367-ddd9-45e4-b762-49c0c18b7119}',
|
||||
'contract_ids': ['@mozilla.org/widget/mac-web-app-utils;1'],
|
||||
'type': 'nsMacWebAppUtils',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{1f39ae50-b6a0-4b37-90f4-60af614193d8}',
|
||||
'contract_ids': ['@mozilla.org/widget/standalonenativemenu;1'],
|
||||
'type': 'nsStandaloneNativeMenu',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{b6e1a890-b2b8-4883-a65f-9476f6185313}',
|
||||
'contract_ids': ['@mozilla.org/widget/systemstatusbar;1'],
|
||||
'type': 'nsSystemStatusBarCocoa',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{38f396e2-93c9-4a77-aaf7-2d50b9962186}',
|
||||
'contract_ids': ['@mozilla.org/widget/touchbarupdater;1'],
|
||||
'type': 'nsTouchBarUpdater',
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
]
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// This file contains forward declarations for classes defined in static
|
||||
// components. The appropriate headers for those types cannot be included in
|
||||
// the generated static component code directly.
|
||||
|
||||
#include "nsID.h"
|
||||
|
||||
namespace mozilla {
|
||||
class OSXNotificationCenter;
|
||||
} // namespace mozilla
|
||||
|
||||
namespace mozilla::widget {
|
||||
class ScreenManager;
|
||||
}
|
||||
|
||||
class nsClipboardHelper;
|
||||
class nsColorPicker;
|
||||
class nsDeviceContextSpecX;
|
||||
class nsDragService;
|
||||
class nsFilePicker;
|
||||
class nsHTMLFormatConverter;
|
||||
class nsMacDockSupport;
|
||||
class nsMacFinderProgress;
|
||||
class nsMacSharingService;
|
||||
class nsMacUserActivityUpdater;
|
||||
class nsMacWebAppUtils;
|
||||
class nsPrintDialogServiceX;
|
||||
class nsPrintSettingsServiceX;
|
||||
class nsPrinterListCUPS;
|
||||
class nsSound;
|
||||
class nsStandaloneNativeMenu;
|
||||
class nsSystemStatusBarCocoa;
|
||||
class nsTouchBarUpdater;
|
||||
class nsTransferable;
|
||||
class nsUserIdleServiceX;
|
||||
|
||||
nsresult nsAppShellConstructor(const nsIID&, void**);
|
||||
|
||||
void nsWidgetCocoaModuleCtor();
|
||||
void nsWidgetCocoaModuleDtor();
|
|
@ -54,66 +54,133 @@ NS_IMPL_COMPONENT_FACTORY(nsIClipboard) {
|
|||
return inst.forget();
|
||||
}
|
||||
|
||||
#define MAKE_GENERIC_CTOR(class_, iface_) \
|
||||
NS_IMPL_COMPONENT_FACTORY(class_) { \
|
||||
RefPtr inst = new class_(); \
|
||||
return inst.forget().downcast<iface_>(); \
|
||||
}
|
||||
|
||||
#define MAKE_GENERIC_CTOR_INIT(class_, iface_, init_) \
|
||||
NS_IMPL_COMPONENT_FACTORY(class_) { \
|
||||
RefPtr inst = new class_(); \
|
||||
if (NS_SUCCEEDED(inst->init_())) { \
|
||||
return inst.forget().downcast<iface_>(); \
|
||||
} \
|
||||
return nullptr; \
|
||||
}
|
||||
|
||||
#define MAKE_GENERIC_SINGLETON_CTOR(iface_, func_) \
|
||||
NS_IMPL_COMPONENT_FACTORY(iface_) { return func_(); }
|
||||
|
||||
MAKE_GENERIC_CTOR(nsFilePicker, nsIFilePicker)
|
||||
MAKE_GENERIC_CTOR(nsColorPicker, nsIColorPicker)
|
||||
MAKE_GENERIC_CTOR(nsSound, nsISound)
|
||||
MAKE_GENERIC_CTOR(nsTransferable, nsITransferable)
|
||||
MAKE_GENERIC_CTOR(nsHTMLFormatConverter, nsIFormatConverter)
|
||||
MAKE_GENERIC_CTOR(nsClipboardHelper, nsIClipboardHelper)
|
||||
MAKE_GENERIC_CTOR(nsDragService, nsIDragService)
|
||||
MAKE_GENERIC_CTOR(nsDeviceContextSpecX, nsIDeviceContextSpec)
|
||||
MAKE_GENERIC_CTOR(nsPrinterListCUPS, nsIPrinterList)
|
||||
MAKE_GENERIC_CTOR_INIT(nsPrintSettingsServiceX, nsIPrintSettingsService, Init)
|
||||
MAKE_GENERIC_CTOR_INIT(nsPrintDialogServiceX, nsIPrintDialogService, Init)
|
||||
MAKE_GENERIC_SINGLETON_CTOR(nsUserIdleServiceX, nsUserIdleServiceX::GetInstance)
|
||||
MAKE_GENERIC_SINGLETON_CTOR(ScreenManager, ScreenManager::GetAddRefedSingleton)
|
||||
MAKE_GENERIC_CTOR_INIT(OSXNotificationCenter, nsIAlertsService, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsColorPicker)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecX)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterListCUPS)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSettingsServiceX, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintDialogServiceX, Init)
|
||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsUserIdleServiceX, nsUserIdleServiceX::GetInstance)
|
||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ScreenManager, ScreenManager::GetAddRefedSingleton)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(OSXNotificationCenter, Init)
|
||||
|
||||
#include "nsMacDockSupport.h"
|
||||
MAKE_GENERIC_CTOR(nsMacDockSupport, nsIMacDockSupport)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacDockSupport)
|
||||
|
||||
#include "nsMacFinderProgress.h"
|
||||
MAKE_GENERIC_CTOR(nsMacFinderProgress, nsIMacFinderProgress)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacFinderProgress)
|
||||
|
||||
#include "nsMacSharingService.h"
|
||||
MAKE_GENERIC_CTOR(nsMacSharingService, nsIMacSharingService)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacSharingService)
|
||||
|
||||
#include "nsMacUserActivityUpdater.h"
|
||||
MAKE_GENERIC_CTOR(nsMacUserActivityUpdater, nsIMacUserActivityUpdater)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacUserActivityUpdater)
|
||||
|
||||
#include "nsMacWebAppUtils.h"
|
||||
MAKE_GENERIC_CTOR(nsMacWebAppUtils, nsIMacWebAppUtils)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacWebAppUtils)
|
||||
|
||||
#include "nsStandaloneNativeMenu.h"
|
||||
MAKE_GENERIC_CTOR(nsStandaloneNativeMenu, nsIStandaloneNativeMenu)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsStandaloneNativeMenu)
|
||||
|
||||
#include "nsSystemStatusBarCocoa.h"
|
||||
MAKE_GENERIC_CTOR(nsSystemStatusBarCocoa, nsISystemStatusBar)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSystemStatusBarCocoa)
|
||||
|
||||
#include "nsTouchBarUpdater.h"
|
||||
MAKE_GENERIC_CTOR(nsTouchBarUpdater, nsITouchBarUpdater)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTouchBarUpdater)
|
||||
|
||||
void nsWidgetCocoaModuleCtor() { nsAppShellInit(); }
|
||||
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_SOUND_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_PRINTER_LIST_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_PRINTDIALOGSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_SYSTEMALERTSSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_MACDOCKSUPPORT_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_MACFINDERPROGRESS_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_MACSHARINGSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_MACUSERACTIVITYUPDATER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_MACWEBAPPUTILS_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_STANDALONENATIVEMENU_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_SYSTEMSTATUSBAR_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_TOUCHBARUPDATER_CID);
|
||||
|
||||
void nsWidgetCocoaModuleDtor() {
|
||||
static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
|
||||
{&kNS_FILEPICKER_CID, false, NULL, nsFilePickerConstructor, mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{&kNS_COLORPICKER_CID, false, NULL, nsColorPickerConstructor,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{&kNS_APPSHELL_CID, false, NULL, nsAppShellConstructor,
|
||||
mozilla::Module::ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS},
|
||||
{&kNS_SOUND_CID, false, NULL, nsSoundConstructor, mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{&kNS_TRANSFERABLE_CID, false, NULL, nsTransferableConstructor},
|
||||
{&kNS_HTMLFORMATCONVERTER_CID, false, NULL, nsHTMLFormatConverterConstructor},
|
||||
{&kNS_CLIPBOARDHELPER_CID, false, NULL, nsClipboardHelperConstructor},
|
||||
{&kNS_DRAGSERVICE_CID, false, NULL, nsDragServiceConstructor,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{&kNS_SCREENMANAGER_CID, false, NULL, ScreenManagerConstructor,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{&kNS_DEVICE_CONTEXT_SPEC_CID, false, NULL, nsDeviceContextSpecXConstructor,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{&kNS_PRINTER_LIST_CID, false, NULL, nsPrinterListCUPSConstructor,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{&kNS_PRINTSETTINGSSERVICE_CID, false, NULL, nsPrintSettingsServiceXConstructor},
|
||||
{&kNS_PRINTDIALOGSERVICE_CID, false, NULL, nsPrintDialogServiceXConstructor,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{&kNS_IDLE_SERVICE_CID, false, NULL, nsUserIdleServiceXConstructor},
|
||||
{&kNS_SYSTEMALERTSSERVICE_CID, false, NULL, OSXNotificationCenterConstructor},
|
||||
{&kNS_MACDOCKSUPPORT_CID, false, NULL, nsMacDockSupportConstructor},
|
||||
{&kNS_MACFINDERPROGRESS_CID, false, NULL, nsMacFinderProgressConstructor},
|
||||
{&kNS_MACSHARINGSERVICE_CID, false, NULL, nsMacSharingServiceConstructor},
|
||||
{&kNS_MACUSERACTIVITYUPDATER_CID, false, NULL, nsMacUserActivityUpdaterConstructor},
|
||||
{&kNS_MACWEBAPPUTILS_CID, false, NULL, nsMacWebAppUtilsConstructor},
|
||||
{&kNS_STANDALONENATIVEMENU_CID, false, NULL, nsStandaloneNativeMenuConstructor},
|
||||
{&kNS_SYSTEMSTATUSBAR_CID, false, NULL, nsSystemStatusBarCocoaConstructor},
|
||||
{&kNS_TOUCHBARUPDATER_CID, false, NULL, nsTouchBarUpdaterConstructor},
|
||||
{NULL}};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
|
||||
{"@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID, mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{"@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID, mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{"@mozilla.org/widget/appshell/mac;1", &kNS_APPSHELL_CID,
|
||||
mozilla::Module::ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS},
|
||||
{"@mozilla.org/sound;1", &kNS_SOUND_CID, mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{"@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID},
|
||||
{"@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID},
|
||||
{"@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID},
|
||||
{"@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{"@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{"@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{"@mozilla.org/gfx/printerlist;1", &kNS_PRINTER_LIST_CID, mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{"@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID},
|
||||
{NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{"@mozilla.org/widget/useridleservice;1", &kNS_IDLE_SERVICE_CID},
|
||||
{"@mozilla.org/system-alerts-service;1", &kNS_SYSTEMALERTSSERVICE_CID},
|
||||
{"@mozilla.org/widget/macdocksupport;1", &kNS_MACDOCKSUPPORT_CID},
|
||||
{"@mozilla.org/widget/macfinderprogress;1", &kNS_MACFINDERPROGRESS_CID},
|
||||
{"@mozilla.org/widget/macsharingservice;1", &kNS_MACSHARINGSERVICE_CID},
|
||||
{"@mozilla.org/widget/macuseractivityupdater;1", &kNS_MACUSERACTIVITYUPDATER_CID},
|
||||
{"@mozilla.org/widget/mac-web-app-utils;1", &kNS_MACWEBAPPUTILS_CID},
|
||||
{"@mozilla.org/widget/standalonenativemenu;1", &kNS_STANDALONENATIVEMENU_CID},
|
||||
{"@mozilla.org/widget/systemstatusbar;1", &kNS_SYSTEMSTATUSBAR_CID},
|
||||
{"@mozilla.org/widget/touchbarupdater;1", &kNS_TOUCHBARUPDATER_CID},
|
||||
{NULL}};
|
||||
|
||||
static void nsWidgetCocoaModuleDtor() {
|
||||
// Shutdown all XP level widget classes.
|
||||
WidgetUtils::Shutdown();
|
||||
|
||||
|
@ -122,3 +189,13 @@ void nsWidgetCocoaModuleDtor() {
|
|||
nsToolkit::Shutdown();
|
||||
nsAppShellShutdown();
|
||||
}
|
||||
|
||||
extern const mozilla::Module kWidgetModule = {
|
||||
mozilla::Module::kVersion,
|
||||
kWidgetCIDs,
|
||||
kWidgetContracts,
|
||||
NULL,
|
||||
NULL,
|
||||
nsAppShellInit,
|
||||
nsWidgetCocoaModuleDtor,
|
||||
mozilla::Module::ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS};
|
||||
|
|
|
@ -1,98 +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 = [
|
||||
{
|
||||
'js_name': 'clipboard',
|
||||
'cid': '{8b5314ba-db01-11d2-96ce-0060b0fb9956}',
|
||||
'contract_ids': ['@mozilla.org/widget/clipboard;1'],
|
||||
'constructor': 'nsClipboardSelector',
|
||||
'headers': ['/widget/nsContentProcessWidgetFactory.h'],
|
||||
'interfaces': ['nsIClipboard'],
|
||||
'overridable': True,
|
||||
},
|
||||
{
|
||||
'cid': '{c0ed2a75-96f8-4166-91d4-2fe8774448dc}',
|
||||
'type': 'nsClipboardProxy',
|
||||
'headers': ['/widget/nsClipboardProxy.h'],
|
||||
'contract_ids': ['@mozilla.org/widget/content/clipboard;1'],
|
||||
'processes': ProcessSelector.CONTENT_PROCESS_ONLY,
|
||||
},
|
||||
|
||||
{
|
||||
'cid': '{0f872c8c-3ee6-46bd-92a2-69652c6b474e}',
|
||||
'contract_ids': ['@mozilla.org/colorpicker;1'],
|
||||
'constructor': 'nsColorPickerSelector',
|
||||
'headers': ['/widget/nsContentProcessWidgetFactory.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{11a77259-9d16-4386-8ac8-94338ee22f78}',
|
||||
'type': 'nsColorPickerProxy',
|
||||
'headers': ['/widget/nsColorPickerProxy.h'],
|
||||
'contract_ids': ['@mozilla.org/content/colorpicker;1'],
|
||||
'processes': ProcessSelector.CONTENT_PROCESS_ONLY,
|
||||
},
|
||||
|
||||
{
|
||||
'cid': '{8b5314bb-db01-11d2-96ce-0060b0fb9956}',
|
||||
'contract_ids': ['@mozilla.org/widget/dragservice;1'],
|
||||
'constructor': 'nsDragServiceSelector',
|
||||
'headers': ['/widget/nsContentProcessWidgetFactory.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{28be18ae-73ee-494f-8c6d-5d14b7c998c7}',
|
||||
'type': 'nsDragServiceProxy',
|
||||
'headers': ['/widget/nsDragServiceProxy.h'],
|
||||
'contract_ids': ['@mozilla.org/widget/content/dragservice;1'],
|
||||
'processes': ProcessSelector.CONTENT_PROCESS_ONLY,
|
||||
},
|
||||
|
||||
{
|
||||
'cid': '{bd57cee8-1dd1-11b2-9fe7-95cf4709aea3}',
|
||||
'contract_ids': ['@mozilla.org/filepicker;1'],
|
||||
'constructor': 'nsFilePickerSelector',
|
||||
'headers': ['/widget/nsContentProcessWidgetFactory.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{40fd47f2-463a-4e4a-a33f-27eb148bfee4}',
|
||||
'type': 'nsFilePickerProxy',
|
||||
'headers': ['/widget/nsFilePickerProxy.h'],
|
||||
'contract_ids': ['@mozilla.org/content/filepicker;1'],
|
||||
'processes': ProcessSelector.CONTENT_PROCESS_ONLY,
|
||||
},
|
||||
|
||||
{
|
||||
'cid': '{b148eed2-236d-11d3-b35c-00a0cc3c1cde}',
|
||||
'contract_ids': ['@mozilla.org/sound;1'],
|
||||
'singleton': True,
|
||||
'constructor': 'nsSoundSelector',
|
||||
'headers': ['/widget/nsContentProcessWidgetFactory.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{b02c2470-6e5a-4865-a202-8b5ebae52632}',
|
||||
'type': 'nsSoundProxy',
|
||||
'headers': ['/widget/nsSoundProxy.h'],
|
||||
'contract_ids': ['@mozilla.org/content/sound;1'],
|
||||
'processes': ProcessSelector.CONTENT_PROCESS_ONLY,
|
||||
},
|
||||
|
||||
{
|
||||
'cid': '{c401eb80-f9ea-11d3-bb6f-e732b73ebe7c}',
|
||||
'contract_ids': ['@mozilla.org/gfx/screenmanager;1'],
|
||||
'singleton': True,
|
||||
'constructor': 'nsScreenManagerSelector',
|
||||
'headers': ['/widget/nsContentProcessWidgetFactory.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{b2cdd51c-4277-417b-a931-08306c7814c3}',
|
||||
'type': 'mozilla::widget::ScreenManager',
|
||||
'constructor': 'mozilla::widget::ScreenManager::GetAddRefedSingleton',
|
||||
'headers': ['mozilla/widget/ScreenManager.h'],
|
||||
'contract_ids': ['@mozilla.org/gfx/content/screenmanager;1'],
|
||||
'singleton': True,
|
||||
'processes': ProcessSelector.CONTENT_PROCESS_ONLY,
|
||||
},
|
||||
]
|
|
@ -20,8 +20,8 @@ Classes = [
|
|||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{e9537f8f-c07e-4435-8ab3-83f1ad6e3bbf}',
|
||||
'contract_ids': ['@mozilla.org/gfx/parent/screenmanager;1'],
|
||||
'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'],
|
||||
|
@ -35,15 +35,15 @@ Classes = [
|
|||
'headers': ['/widget/gtk/TaskbarProgress.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{4364de1a-798e-419c-a6f5-ca28866b6d5f}',
|
||||
'contract_ids': ['@mozilla.org/parent/colorpicker;1'],
|
||||
'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': '{1940fed5-7d02-4122-8acf-7abaac698983}',
|
||||
'contract_ids': ['@mozilla.org/parent/filepicker;1'],
|
||||
'cid': '{bd57cee8-1dd1-11b2-9fe7-95cf4709aea3}',
|
||||
'contract_ids': ['@mozilla.org/filepicker;1'],
|
||||
'type': 'nsFilePicker',
|
||||
'headers': ['/widget/gtk/nsFilePicker.h'],
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
|
@ -55,8 +55,8 @@ Classes = [
|
|||
'headers': ['/widget/nsHTMLFormatConverter.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{e711c28b-c1f1-4b87-8448-e1e0da0a7b7d}',
|
||||
'contract_ids': ['@mozilla.org/parent/sound;1'],
|
||||
'cid': '{b148eed2-236d-11d3-b35c-00a0cc3c1cde}',
|
||||
'contract_ids': ['@mozilla.org/sound;1'],
|
||||
'singleton': True,
|
||||
'type': 'nsISound',
|
||||
'constructor': 'nsSound::GetInstance',
|
||||
|
@ -77,11 +77,13 @@ Classes = [
|
|||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{f55f5d31-dbb7-4d0d-9f6f-a4f4cd8e8ef1}',
|
||||
'contract_ids': ['@mozilla.org/widget/parent/clipboard;1'],
|
||||
'js_name': 'clipboard',
|
||||
'cid': '{8b5314ba-db01-11d2-96ce-0060b0fb9956}',
|
||||
'contract_ids': ['@mozilla.org/widget/clipboard;1'],
|
||||
'interfaces': ['nsIClipboard'],
|
||||
'type': 'nsIClipboard',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
'overridable': True,
|
||||
},
|
||||
{
|
||||
'cid': '{77221d5a-1dd2-11b2-8c69-c710f15d2ed5}',
|
||||
|
@ -90,8 +92,8 @@ Classes = [
|
|||
'headers': ['/widget/nsClipboardHelper.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{0ba77e04-2adb-422f-af01-5a57b8013100}',
|
||||
'contract_ids': ['@mozilla.org/widget/parent/dragservice;1'],
|
||||
'cid': '{8b5314bb-db01-11d2-96ce-0060b0fb9956}',
|
||||
'contract_ids': ['@mozilla.org/widget/dragservice;1'],
|
||||
'singleton': True,
|
||||
'type': 'nsDragService',
|
||||
'headers': ['/widget/gtk/nsDragService.h'],
|
||||
|
|
|
@ -51,10 +51,6 @@ with Files("*NativeKeyBindings*"):
|
|||
|
||||
toolkit = CONFIG["MOZ_WIDGET_TOOLKIT"]
|
||||
|
||||
XPCOM_MANIFESTS += [
|
||||
"components.conf",
|
||||
]
|
||||
|
||||
if toolkit in ("android", "cocoa", "gtk", "uikit", "windows"):
|
||||
DIRS += [toolkit]
|
||||
|
||||
|
@ -225,6 +221,7 @@ UNIFIED_SOURCES += [
|
|||
"nsClipboardHelper.cpp",
|
||||
"nsClipboardProxy.cpp",
|
||||
"nsColorPickerProxy.cpp",
|
||||
"nsContentProcessWidgetFactory.cpp",
|
||||
"nsDragServiceProxy.cpp",
|
||||
"nsFilePickerProxy.cpp",
|
||||
"nsHTMLFormatConverter.cpp",
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
/* -*- 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/. */
|
||||
|
||||
#include "mozilla/ModuleUtils.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsClipboardProxy.h"
|
||||
#include "nsColorPickerProxy.h"
|
||||
#include "nsDragServiceProxy.h"
|
||||
#include "nsFilePickerProxy.h"
|
||||
#include "nsSoundProxy.h"
|
||||
#include "mozilla/widget/ScreenManager.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::widget;
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardProxy)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsColorPickerProxy)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragServiceProxy)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePickerProxy)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSoundProxy)
|
||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ScreenManager,
|
||||
ScreenManager::GetAddRefedSingleton)
|
||||
|
||||
NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_COLORPICKER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_SOUND_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
|
||||
{&kNS_CLIPBOARD_CID, false, nullptr, nsClipboardProxyConstructor,
|
||||
Module::CONTENT_PROCESS_ONLY},
|
||||
{&kNS_COLORPICKER_CID, false, nullptr, nsColorPickerProxyConstructor,
|
||||
Module::CONTENT_PROCESS_ONLY},
|
||||
{&kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceProxyConstructor,
|
||||
Module::CONTENT_PROCESS_ONLY},
|
||||
{&kNS_FILEPICKER_CID, false, nullptr, nsFilePickerProxyConstructor,
|
||||
Module::CONTENT_PROCESS_ONLY},
|
||||
{&kNS_SOUND_CID, false, nullptr, nsSoundProxyConstructor,
|
||||
Module::CONTENT_PROCESS_ONLY},
|
||||
{&kNS_SCREENMANAGER_CID, false, nullptr, ScreenManagerConstructor,
|
||||
Module::CONTENT_PROCESS_ONLY},
|
||||
{nullptr}};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
|
||||
{"@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID,
|
||||
Module::CONTENT_PROCESS_ONLY},
|
||||
{"@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID,
|
||||
Module::CONTENT_PROCESS_ONLY},
|
||||
{"@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID,
|
||||
Module::CONTENT_PROCESS_ONLY},
|
||||
{"@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID,
|
||||
Module::CONTENT_PROCESS_ONLY},
|
||||
{"@mozilla.org/sound;1", &kNS_SOUND_CID, Module::CONTENT_PROCESS_ONLY},
|
||||
{"@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID,
|
||||
Module::CONTENT_PROCESS_ONLY},
|
||||
{nullptr}};
|
||||
|
||||
extern const mozilla::Module kContentProcessWidgetModule = {
|
||||
mozilla::Module::kVersion, kWidgetCIDs, kWidgetContracts};
|
|
@ -1,59 +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 nsContentProcessWidgetFactory_h
|
||||
#define nsContentProcessWidgetFactory_h
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
#define MAKE_COMPONENT_CHOOSER(name_, parent_, content_, constructor_) \
|
||||
static already_AddRefed<nsISupports> name_() { \
|
||||
nsCOMPtr<nsISupports> inst; \
|
||||
if (XRE_IsContentProcess()) { \
|
||||
inst = constructor_(content_); \
|
||||
} else { \
|
||||
inst = constructor_(parent_); \
|
||||
} \
|
||||
return inst.forget(); \
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
// This should be `do_GetService`, but test_bug466599.xhtml erroneously uses
|
||||
// `createInstance` rather than `getService`, and passes only because doing so
|
||||
// bypasses the clipboard contents cache, which does not have the expected
|
||||
// wrapping.
|
||||
MAKE_COMPONENT_CHOOSER(nsClipboardSelector,
|
||||
"@mozilla.org/widget/parent/clipboard;1",
|
||||
"@mozilla.org/widget/content/clipboard;1",
|
||||
do_CreateInstance)
|
||||
#else
|
||||
MAKE_COMPONENT_CHOOSER(nsClipboardSelector,
|
||||
"@mozilla.org/widget/parent/clipboard;1",
|
||||
"@mozilla.org/widget/content/clipboard;1", do_GetService)
|
||||
#endif
|
||||
MAKE_COMPONENT_CHOOSER(nsColorPickerSelector,
|
||||
"@mozilla.org/parent/colorpicker;1",
|
||||
"@mozilla.org/content/colorpicker;1", do_CreateInstance)
|
||||
MAKE_COMPONENT_CHOOSER(nsFilePickerSelector, "@mozilla.org/parent/filepicker;1",
|
||||
"@mozilla.org/content/filepicker;1", do_CreateInstance)
|
||||
MAKE_COMPONENT_CHOOSER(nsScreenManagerSelector,
|
||||
"@mozilla.org/gfx/parent/screenmanager;1",
|
||||
"@mozilla.org/gfx/content/screenmanager;1",
|
||||
do_GetService)
|
||||
MAKE_COMPONENT_CHOOSER(nsSoundSelector, "@mozilla.org/parent/sound;1",
|
||||
"@mozilla.org/content/sound;1", do_GetService)
|
||||
MAKE_COMPONENT_CHOOSER(nsDragServiceSelector,
|
||||
"@mozilla.org/widget/parent/dragservice;1",
|
||||
"@mozilla.org/widget/content/dragservice;1",
|
||||
do_GetService)
|
||||
|
||||
#undef MAKE_COMPONENT_CHOOSER
|
||||
|
||||
#endif // defined nsContentProcessWidgetFactory_h
|
|
@ -13,8 +13,8 @@ UnloadFunc = 'nsWidgetWindowsModuleDtor'
|
|||
|
||||
Classes = [
|
||||
{
|
||||
'cid': '{4c9dee4a-b083-4261-8bbe-c6883d2a6bc9}',
|
||||
'contract_ids': ['@mozilla.org/gfx/parent/screenmanager;1'],
|
||||
'cid': '{c401eb80-f9ea-11d3-bb6f-e732b73ebe7c}',
|
||||
'contract_ids': ['@mozilla.org/gfx/screenmanager;1'],
|
||||
'singleton': True,
|
||||
'type': 'mozilla::widget::ScreenManager',
|
||||
'constructor': 'mozilla::widget::ScreenManager::GetAddRefedSingleton',
|
||||
|
@ -37,8 +37,8 @@ Classes = [
|
|||
'headers': ['/widget/windows/nsUserIdleServiceWin.h', 'nsUserIdleService.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{919f1217-073a-4a14-b034-67d461eccacc}',
|
||||
'contract_ids': ['@mozilla.org/parent/sound;1'],
|
||||
'cid': '{b148eed2-236d-11d3-b35c-00a0cc3c1cde}',
|
||||
'contract_ids': ['@mozilla.org/sound;1'],
|
||||
'singleton': True,
|
||||
'type': 'nsISound',
|
||||
'constructor': 'nsSound::GetInstance',
|
||||
|
@ -106,8 +106,8 @@ Classes = [
|
|||
'headers': ['/widget/nsHTMLFormatConverter.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{f92e733e-33a3-4752-90e5-25801ddeaf7b}',
|
||||
'contract_ids': ['@mozilla.org/widget/parent/dragservice;1'],
|
||||
'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,
|
||||
|
@ -128,15 +128,15 @@ Classes = [
|
|||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
{
|
||||
'cid': '{e2fc3e45-c893-4b34-8f6d-b87faf65a897}',
|
||||
'contract_ids': ['@mozilla.org/parent/filepicker;1'],
|
||||
'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': '{035d92f3-3802-4cf5-87cb-1758bfc5d4da}',
|
||||
'contract_ids': ['@mozilla.org/parent/colorpicker;1'],
|
||||
'cid': '{0f872c8c-3ee6-46bd-92a2-69652c6b474e}',
|
||||
'contract_ids': ['@mozilla.org/colorpicker;1'],
|
||||
'type': 'nsColorPicker',
|
||||
'headers': ['/widget/windows/nsColorPicker.h'],
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
|
@ -149,11 +149,13 @@ Classes = [
|
|||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{25b4efa0-7054-4787-9cd6-630efb3fe6fa}',
|
||||
'contract_ids': ['@mozilla.org/widget/parent/clipboard;1'],
|
||||
'js_name': 'clipboard',
|
||||
'cid': '{8b5314ba-db01-11d2-96ce-0060b0fb9956}',
|
||||
'contract_ids': ['@mozilla.org/widget/clipboard;1'],
|
||||
'interfaces': ['nsIClipboard'],
|
||||
'type': 'nsIClipboard',
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
'overridable': True,
|
||||
},
|
||||
{
|
||||
'cid': '{b6e1a890-b2b8-4883-a65f-9476f6185313}',
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#include "nsDebugImpl.h"
|
||||
#include "nsSystemInfo.h"
|
||||
|
||||
#include "nsINIParserImpl.h"
|
||||
|
||||
#include "nsComponentManager.h"
|
||||
#include "nsCategoryManagerUtils.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
@ -151,6 +153,30 @@ mozilla::Atomic<bool, mozilla::SequentiallyConsistent> gXPCOMThreadsShutDown(
|
|||
bool gXPCOMMainThreadEventsAreDoomed = false;
|
||||
char16_t* gGREBinPath = nullptr;
|
||||
|
||||
static NS_DEFINE_CID(kINIParserFactoryCID, NS_INIPARSERFACTORY_CID);
|
||||
|
||||
static already_AddRefed<nsIFactory> CreateINIParserFactory(
|
||||
const mozilla::Module& aModule, const mozilla::Module::CIDEntry& aEntry) {
|
||||
nsCOMPtr<nsIFactory> f = new nsINIParserFactory();
|
||||
return f.forget();
|
||||
}
|
||||
|
||||
const mozilla::Module::CIDEntry kXPCOMCIDEntries[] = {
|
||||
{&kINIParserFactoryCID, false, CreateINIParserFactory}, {nullptr}};
|
||||
|
||||
const mozilla::Module::ContractIDEntry kXPCOMContracts[] = {
|
||||
{NS_INIPARSERFACTORY_CONTRACTID, &kINIParserFactoryCID}, {nullptr}};
|
||||
|
||||
const mozilla::Module kXPCOMModule = {
|
||||
mozilla::Module::kVersion,
|
||||
kXPCOMCIDEntries,
|
||||
kXPCOMContracts,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
mozilla::Module::ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS};
|
||||
|
||||
// gDebug will be freed during shutdown.
|
||||
static nsIDebug2* gDebug = nullptr;
|
||||
|
||||
|
|
|
@ -228,13 +228,6 @@ Classes = [
|
|||
'type': 'nsVersionComparatorImpl',
|
||||
'headers': ['/xpcom/base/nsVersionComparatorImpl.h'],
|
||||
},
|
||||
{
|
||||
'cid': '{dfac10a9-dd24-43cf-a095-6ffa2e4b6a6c}',
|
||||
'contract_ids': ['@mozilla.org/xpcom/ini-parser-factory;1'],
|
||||
'type': 'nsINIParserFactory',
|
||||
'headers': ['/xpcom/ds/nsINIParserImpl.h'],
|
||||
'processes': ProcessSelector.ALLOW_IN_GPU_RDD_VR_SOCKET_AND_UTILITY_PROCESS,
|
||||
},
|
||||
]
|
||||
|
||||
if buildconfig.substs['OS_ARCH'] == 'WINNT':
|
||||
|
|
|
@ -39,6 +39,9 @@ extern bool gXPCOMMainThreadEventsAreDoomed;
|
|||
|
||||
#ifdef __cplusplus
|
||||
# include "nsStringFwd.h"
|
||||
namespace mozilla {
|
||||
struct Module;
|
||||
} // namespace mozilla
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,6 +28,7 @@ struct XREShellData;
|
|||
namespace mozilla {
|
||||
class XREAppData;
|
||||
struct BootstrapConfig;
|
||||
struct Module;
|
||||
} // namespace mozilla
|
||||
|
||||
/**
|
||||
|
@ -218,6 +219,11 @@ nsresult XRE_GetFileFromPath(const char* aPath, nsIFile** aResult);
|
|||
*/
|
||||
nsresult XRE_GetBinaryPath(nsIFile** aResult);
|
||||
|
||||
/**
|
||||
* Get the static module built in to libxul.
|
||||
*/
|
||||
const mozilla::Module* XRE_GetStaticModule();
|
||||
|
||||
/**
|
||||
* Lock a profile directory using platform-specific semantics.
|
||||
*
|
||||
|
@ -251,6 +257,13 @@ nsresult XRE_LockProfileDirectory(nsIFile* aDirectory,
|
|||
nsresult XRE_InitEmbedding2(nsIFile* aLibXULDirectory, nsIFile* aAppDirectory,
|
||||
nsIDirectoryServiceProvider* aAppDirProvider);
|
||||
|
||||
/**
|
||||
* Register static XPCOM component information.
|
||||
* This method may be called at any time before or after XRE_main or
|
||||
* XRE_InitEmbedding.
|
||||
*/
|
||||
nsresult XRE_AddStaticComponent(const mozilla::Module* aComponent);
|
||||
|
||||
/**
|
||||
* Register XPCOM components found in an array of files/directories.
|
||||
* This method may be called at any time before or after XRE_main or
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
#ifndef mozilla_GenericFactory_h
|
||||
#define mozilla_GenericFactory_h
|
||||
|
||||
#include "nsIFactory.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
#include "mozilla/Module.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -17,10 +19,10 @@ namespace mozilla {
|
|||
* module.
|
||||
*/
|
||||
class GenericFactory final : public nsIFactory {
|
||||
~GenericFactory() = default;
|
||||
~GenericFactory() {}
|
||||
|
||||
public:
|
||||
typedef nsresult (*ConstructorProcPtr)(const nsIID& aIID, void** aResult);
|
||||
typedef Module::ConstructorProcPtr ConstructorProcPtr;
|
||||
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIFACTORY
|
||||
|
|
|
@ -8,12 +8,31 @@
|
|||
#define mozilla_Module_h
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsID.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsCOMPtr.h" // for already_AddRefed
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace Module {
|
||||
/**
|
||||
* A module implements one or more XPCOM components. This structure is used
|
||||
* for binary modules.
|
||||
*/
|
||||
struct Module {
|
||||
static const unsigned int kVersion = 103;
|
||||
|
||||
struct CIDEntry;
|
||||
|
||||
typedef already_AddRefed<nsIFactory> (*GetFactoryProcPtr)(
|
||||
const Module& module, const CIDEntry& entry);
|
||||
|
||||
typedef nsresult (*ConstructorProcPtr)(const nsIID& aIID, void** aResult);
|
||||
|
||||
typedef nsresult (*LoadFuncPtr)();
|
||||
typedef void (*UnloadFuncPtr)();
|
||||
|
||||
/**
|
||||
* This selector allows components to be marked so that they're only loaded
|
||||
* This selector allows CIDEntrys to be marked so that they're only loaded
|
||||
* into certain kinds of processes. Selectors can be combined.
|
||||
*/
|
||||
// Note: This must be kept in sync with the selector matching in
|
||||
|
@ -69,6 +88,76 @@ namespace Module {
|
|||
NO_TASKS = 0x0,
|
||||
ALL_TASKS = 0xFFFF,
|
||||
};
|
||||
|
||||
/**
|
||||
* The constructor callback is an implementation detail of the default binary
|
||||
* loader and may be null.
|
||||
*/
|
||||
struct CIDEntry {
|
||||
const nsCID* cid;
|
||||
bool service;
|
||||
GetFactoryProcPtr getFactoryProc;
|
||||
ConstructorProcPtr constructorProc;
|
||||
ProcessSelector processSelector;
|
||||
};
|
||||
|
||||
struct ContractIDEntry {
|
||||
const char* contractid;
|
||||
nsID const* cid;
|
||||
ProcessSelector processSelector;
|
||||
};
|
||||
|
||||
struct CategoryEntry {
|
||||
const char* category;
|
||||
const char* entry;
|
||||
const char* value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Binary compatibility check, should be kModuleVersion.
|
||||
*/
|
||||
unsigned int mVersion;
|
||||
|
||||
/**
|
||||
* An array of CIDs (class IDs) implemented by this module. The final entry
|
||||
* should be { nullptr }.
|
||||
*/
|
||||
const CIDEntry* mCIDs;
|
||||
|
||||
/**
|
||||
* An array of mappings from contractid to CID. The final entry should
|
||||
* be { nullptr }.
|
||||
*/
|
||||
const ContractIDEntry* mContractIDs;
|
||||
|
||||
/**
|
||||
* An array of category manager entries. The final entry should be
|
||||
* { nullptr }.
|
||||
*/
|
||||
const CategoryEntry* mCategoryEntries;
|
||||
|
||||
/**
|
||||
* When the component manager tries to get the factory for a CID, it first
|
||||
* checks for this module-level getfactory callback. If this function is
|
||||
* not implemented, it checks the CIDEntry getfactory callback. If that is
|
||||
* also nullptr, a generic factory is generated using the CIDEntry
|
||||
* constructor callback which must be non-nullptr.
|
||||
*/
|
||||
GetFactoryProcPtr getFactoryProc;
|
||||
|
||||
/**
|
||||
* Optional Function which are called when this module is loaded and
|
||||
* at shutdown. These are not C++ constructor/destructors to avoid
|
||||
* calling them too early in startup or too late in shutdown.
|
||||
*/
|
||||
LoadFuncPtr loadProc;
|
||||
UnloadFuncPtr unloadProc;
|
||||
|
||||
/**
|
||||
* Optional flags which control whether the module loads on a process-type
|
||||
* basis.
|
||||
*/
|
||||
ProcessSelector selector;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include <type_traits>
|
||||
|
||||
#include "mozilla/AlreadyAddRefed.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Module.h"
|
||||
|
||||
|
|
|
@ -192,7 +192,8 @@ static void CallUnloadFuncs() {
|
|||
//# @unload_funcs@
|
||||
}
|
||||
|
||||
nsresult CreateInstanceImpl(ModuleID aID, const nsIID& aIID, void** aResult) {
|
||||
static nsresult CreateInstanceImpl(ModuleID aID, const nsIID& aIID,
|
||||
void** aResult) {
|
||||
// The full set of constructors for all static modules.
|
||||
// This switch statement will be compiled to a relative address jump table
|
||||
// with no runtime relocations and a single indirect jump.
|
||||
|
|
|
@ -997,10 +997,6 @@ enum class ModuleID : uint16_t {
|
|||
%(module_ids)s
|
||||
};
|
||||
|
||||
// May be added as a friend function to allow constructing services via
|
||||
// private constructors and init methods.
|
||||
nsresult CreateInstanceImpl(ModuleID aID, const nsIID& aIID, void** aResult);
|
||||
|
||||
class MOZ_STACK_CLASS StaticModuleHelper : public nsCOMPtr_helper {
|
||||
public:
|
||||
StaticModuleHelper(ModuleID aId, nsresult* aErrorPtr)
|
||||
|
|
|
@ -163,7 +163,7 @@ class MOZ_STACK_CLASS EntryWrapper final {
|
|||
return mEntry.match((Matcher()))
|
||||
|
||||
const nsID& CID() {
|
||||
MATCH(const nsID&, return entry->mCID, return entry->CID());
|
||||
MATCH(const nsID&, return *entry->mCIDEntry->cid, return entry->CID());
|
||||
}
|
||||
|
||||
already_AddRefed<nsIFactory> GetFactory() {
|
||||
|
@ -202,11 +202,14 @@ class MOZ_STACK_CLASS EntryWrapper final {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the description string for the module this entry belongs to.
|
||||
* Currently always returns "<unknown module>".
|
||||
* Returns the description string for the module this entry belongs to. For
|
||||
* static entries, always returns "<unknown module>".
|
||||
*/
|
||||
nsCString ModuleDescription() {
|
||||
return "<unknown module>"_ns;
|
||||
MATCH(nsCString,
|
||||
return entry->mModule ? entry->mModule->Description()
|
||||
: "<unknown module>"_ns,
|
||||
return "<unknown module>"_ns);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -260,7 +263,7 @@ nsresult nsComponentManagerImpl::Create(REFNSIID aIID, void** aResult) {
|
|||
return gComponentManager->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
static const int CONTRACTID_HASHTABLE_INITIAL_LENGTH = 8;
|
||||
static const int CONTRACTID_HASHTABLE_INITIAL_LENGTH = 16;
|
||||
|
||||
nsComponentManagerImpl::nsComponentManagerImpl()
|
||||
: mFactories(CONTRACTID_HASHTABLE_INITIAL_LENGTH),
|
||||
|
@ -268,6 +271,27 @@ nsComponentManagerImpl::nsComponentManagerImpl()
|
|||
mLock("nsComponentManagerImpl.mLock"),
|
||||
mStatus(NOT_INITIALIZED) {}
|
||||
|
||||
extern const mozilla::Module kNeckoModule;
|
||||
extern const mozilla::Module kPowerManagerModule;
|
||||
extern const mozilla::Module kContentProcessWidgetModule;
|
||||
#if defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_UIKIT)
|
||||
extern const mozilla::Module kWidgetModule;
|
||||
#endif
|
||||
extern const mozilla::Module kLayoutModule;
|
||||
extern const mozilla::Module kKeyValueModule;
|
||||
extern const mozilla::Module kXREModule;
|
||||
|
||||
static nsTArray<const mozilla::Module*>* sExtraStaticModules;
|
||||
|
||||
/* static */
|
||||
void nsComponentManagerImpl::InitializeStaticModules() {
|
||||
if (sExtraStaticModules) {
|
||||
return;
|
||||
}
|
||||
|
||||
sExtraStaticModules = new nsTArray<const mozilla::Module*>;
|
||||
}
|
||||
|
||||
nsTArray<nsComponentManagerImpl::ComponentLocation>*
|
||||
nsComponentManagerImpl::sModuleLocations;
|
||||
|
||||
|
@ -336,8 +360,25 @@ nsresult nsComponentManagerImpl::Init() {
|
|||
nsCOMPtr<nsIFile> appDir =
|
||||
GetLocationFromDirectoryService(NS_XPCOM_CURRENT_PROCESS_DIR);
|
||||
|
||||
InitializeStaticModules();
|
||||
|
||||
nsCategoryManager::GetSingleton()->SuppressNotifications(true);
|
||||
|
||||
RegisterModule(&kXPCOMModule);
|
||||
RegisterModule(&kNeckoModule);
|
||||
RegisterModule(&kPowerManagerModule);
|
||||
RegisterModule(&kContentProcessWidgetModule);
|
||||
#if defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_UIKIT)
|
||||
RegisterModule(&kWidgetModule);
|
||||
#endif
|
||||
RegisterModule(&kLayoutModule);
|
||||
RegisterModule(&kKeyValueModule);
|
||||
RegisterModule(&kXREModule);
|
||||
|
||||
for (uint32_t i = 0; i < sExtraStaticModules->Length(); ++i) {
|
||||
RegisterModule((*sExtraStaticModules)[i]);
|
||||
}
|
||||
|
||||
auto* catMan = nsCategoryManager::GetSingleton();
|
||||
for (const auto& cat : gStaticCategories) {
|
||||
for (const auto& entry : cat) {
|
||||
|
@ -441,13 +482,14 @@ nsresult nsComponentManagerImpl::Init() {
|
|||
mStatus = NORMAL;
|
||||
|
||||
MOZ_ASSERT(!XRE_IsContentProcess() ||
|
||||
CONTRACTID_HASHTABLE_INITIAL_LENGTH <= 8 ||
|
||||
mFactories.Count() > CONTRACTID_HASHTABLE_INITIAL_LENGTH / 3,
|
||||
"Initial component hashtable size is too large");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const int kModuleVersionWithSelector = 51;
|
||||
|
||||
template <typename T>
|
||||
static void AssertNotMallocAllocated(T* aPtr) {
|
||||
#if defined(DEBUG) && defined(MOZ_MEMORY)
|
||||
|
@ -488,6 +530,140 @@ static void AssertNotStackAllocated(T* aPtr) {
|
|||
#endif
|
||||
}
|
||||
|
||||
static inline nsCString AsLiteralCString(const char* aStr) {
|
||||
AssertNotMallocAllocated(aStr);
|
||||
AssertNotStackAllocated(aStr);
|
||||
|
||||
nsCString str;
|
||||
str.AssignLiteral(aStr, strlen(aStr));
|
||||
return str;
|
||||
}
|
||||
|
||||
void nsComponentManagerImpl::RegisterModule(const mozilla::Module* aModule) {
|
||||
mLock.AssertNotCurrentThreadOwns();
|
||||
|
||||
if (aModule->mVersion >= kModuleVersionWithSelector &&
|
||||
!ProcessSelectorMatches(aModule->selector)) {
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
// Scope the monitor so that we don't hold it while calling into the
|
||||
// category manager.
|
||||
MonitorAutoLock lock(mLock);
|
||||
|
||||
KnownModule* m = new KnownModule(aModule);
|
||||
mKnownStaticModules.AppendElement(m);
|
||||
|
||||
if (aModule->mCIDs) {
|
||||
const mozilla::Module::CIDEntry* entry;
|
||||
for (entry = aModule->mCIDs; entry->cid; ++entry) {
|
||||
RegisterCIDEntryLocked(entry, m);
|
||||
}
|
||||
}
|
||||
|
||||
if (aModule->mContractIDs) {
|
||||
const mozilla::Module::ContractIDEntry* entry;
|
||||
for (entry = aModule->mContractIDs; entry->contractid; ++entry) {
|
||||
RegisterContractIDLocked(entry);
|
||||
}
|
||||
MOZ_ASSERT(!entry->cid, "Incorrectly terminated contract list");
|
||||
}
|
||||
}
|
||||
|
||||
if (aModule->mCategoryEntries) {
|
||||
const mozilla::Module::CategoryEntry* entry;
|
||||
for (entry = aModule->mCategoryEntries; entry->category; ++entry)
|
||||
nsCategoryManager::GetSingleton()->AddCategoryEntry(
|
||||
AsLiteralCString(entry->category), AsLiteralCString(entry->entry),
|
||||
AsLiteralCString(entry->value));
|
||||
}
|
||||
}
|
||||
|
||||
void nsComponentManagerImpl::RegisterCIDEntryLocked(
|
||||
const mozilla::Module::CIDEntry* aEntry, KnownModule* aModule) {
|
||||
mLock.AssertCurrentThreadOwns();
|
||||
|
||||
if (!ProcessSelectorMatches(aEntry->processSelector)) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// If we're still in the static initialization phase, check that we're not
|
||||
// registering something that was already registered.
|
||||
if (mStatus != NORMAL) {
|
||||
if (StaticComponents::LookupByCID(*aEntry->cid)) {
|
||||
MOZ_CRASH_UNSAFE_PRINTF(
|
||||
"While registering XPCOM module %s, trying to re-register CID '%s' "
|
||||
"already registered by a static component.",
|
||||
aModule->Description().get(), AutoIDString(*aEntry->cid).get());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
mFactories.WithEntryHandle(aEntry->cid, [&](auto&& entry) {
|
||||
mLock.AssertCurrentThreadOwns();
|
||||
if (entry) {
|
||||
nsFactoryEntry* f = entry.Data();
|
||||
NS_WARNING("Re-registering a CID?");
|
||||
|
||||
nsCString existing;
|
||||
if (f->mModule) {
|
||||
existing = f->mModule->Description();
|
||||
} else {
|
||||
existing = "<unknown module>";
|
||||
}
|
||||
MonitorAutoUnlock unlock(mLock);
|
||||
LogMessage(
|
||||
"While registering XPCOM module %s, trying to re-register CID '%s' "
|
||||
"already registered by %s.",
|
||||
aModule->Description().get(), AutoIDString(*aEntry->cid).get(),
|
||||
existing.get());
|
||||
} else {
|
||||
entry.Insert(new nsFactoryEntry(aEntry, aModule));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void nsComponentManagerImpl::RegisterContractIDLocked(
|
||||
const mozilla::Module::ContractIDEntry* aEntry) {
|
||||
mLock.AssertCurrentThreadOwns();
|
||||
|
||||
if (!ProcessSelectorMatches(aEntry->processSelector)) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// If we're still in the static initialization phase, check that we're not
|
||||
// registering something that was already registered.
|
||||
if (mStatus != NORMAL) {
|
||||
if (const StaticModule* module = StaticComponents::LookupByContractID(
|
||||
nsAutoCString(aEntry->contractid))) {
|
||||
MOZ_CRASH_UNSAFE_PRINTF(
|
||||
"Could not map contract ID '%s' to CID %s because it is already "
|
||||
"mapped to CID %s.",
|
||||
aEntry->contractid, AutoIDString(*aEntry->cid).get(),
|
||||
AutoIDString(module->CID()).get());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
nsFactoryEntry* f = mFactories.Get(aEntry->cid);
|
||||
if (!f) {
|
||||
NS_WARNING("No CID found when attempting to map contract ID");
|
||||
|
||||
MonitorAutoUnlock unlock(mLock);
|
||||
LogMessage(
|
||||
"Could not map contract ID '%s' to CID %s because no implementation of "
|
||||
"the CID is registered.",
|
||||
aEntry->contractid, AutoIDString(*aEntry->cid).get());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
mContractIDs.InsertOrUpdate(AsLiteralCString(aEntry->contractid), f);
|
||||
}
|
||||
|
||||
static void DoRegisterManifest(NSLocationType aType, FileLocation& aFile,
|
||||
bool aChromeOnly) {
|
||||
auto result = URLPreloader::Read(aFile);
|
||||
|
@ -537,6 +713,28 @@ void nsComponentManagerImpl::RereadChromeManifests(bool aChromeOnly) {
|
|||
}
|
||||
}
|
||||
|
||||
bool nsComponentManagerImpl::KnownModule::Load() {
|
||||
if (mFailed) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(mModule);
|
||||
if (!mLoaded) {
|
||||
if (mModule->loadProc) {
|
||||
nsresult rv = mModule->loadProc();
|
||||
if (NS_FAILED(rv)) {
|
||||
mFailed = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
mLoaded = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
nsCString nsComponentManagerImpl::KnownModule::Description() const {
|
||||
return "<static module>"_ns;
|
||||
}
|
||||
|
||||
nsresult nsComponentManagerImpl::Shutdown(void) {
|
||||
MOZ_ASSERT(NORMAL == mStatus);
|
||||
|
||||
|
@ -551,9 +749,11 @@ nsresult nsComponentManagerImpl::Shutdown(void) {
|
|||
// Release all cached factories
|
||||
mContractIDs.Clear();
|
||||
mFactories.Clear(); // XXX release the objects, don't just clear
|
||||
mKnownStaticModules.Clear();
|
||||
|
||||
StaticComponents::Shutdown();
|
||||
|
||||
delete sExtraStaticModules;
|
||||
delete sModuleLocations;
|
||||
|
||||
mStatus = SHUTDOWN_COMPLETE;
|
||||
|
@ -619,7 +819,7 @@ Maybe<EntryWrapper> nsComponentManagerImpl::LookupByContractID(
|
|||
// UnregisterFactory might have left a stale nsFactoryEntry in
|
||||
// mContractIDs, so we should check to see whether this entry has
|
||||
// anything useful.
|
||||
if (entry->mFactory || entry->mServiceObject) {
|
||||
if (entry->mModule || entry->mFactory || entry->mServiceObject) {
|
||||
return Some(EntryWrapper(entry));
|
||||
}
|
||||
}
|
||||
|
@ -1202,11 +1402,11 @@ nsComponentManagerImpl::RegisterFactory(const nsCID& aClass, const char* aName,
|
|||
auto f = MakeUnique<nsFactoryEntry>(aClass, aFactory);
|
||||
|
||||
MonitorAutoLock lock(mLock);
|
||||
return mFactories.WithEntryHandle(&f->mCID, [&](auto&& entry) {
|
||||
return mFactories.WithEntryHandle(f->mCIDEntry->cid, [&](auto&& entry) {
|
||||
if (entry) {
|
||||
return NS_ERROR_FACTORY_EXISTS;
|
||||
}
|
||||
if (StaticComponents::LookupByCID(f->mCID)) {
|
||||
if (StaticComponents::LookupByCID(*f->mCIDEntry->cid)) {
|
||||
return NS_ERROR_FACTORY_EXISTS;
|
||||
}
|
||||
if (aContractID) {
|
||||
|
@ -1361,16 +1561,20 @@ size_t nsComponentManagerImpl::SizeOfIncludingThis(
|
|||
n += key.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
|
||||
}
|
||||
|
||||
n += sExtraStaticModules->ShallowSizeOfIncludingThis(aMallocSizeOf);
|
||||
if (sModuleLocations) {
|
||||
n += sModuleLocations->ShallowSizeOfIncludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
n += mKnownStaticModules.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||
|
||||
n += mPendingServices.ShallowSizeOfExcludingThis(aMallocSizeOf);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mMon
|
||||
// - sModuleLocations' entries
|
||||
// - mKnownStaticModules' entries?
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -1379,13 +1583,63 @@ size_t nsComponentManagerImpl::SizeOfIncludingThis(
|
|||
// nsFactoryEntry
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsFactoryEntry::nsFactoryEntry(const mozilla::Module::CIDEntry* aEntry,
|
||||
nsComponentManagerImpl::KnownModule* aModule)
|
||||
: mCIDEntry(aEntry), mModule(aModule) {}
|
||||
|
||||
nsFactoryEntry::nsFactoryEntry(const nsCID& aCID, nsIFactory* aFactory)
|
||||
: mCID(aCID), mFactory(aFactory) {
|
||||
: mCIDEntry(nullptr), mModule(nullptr), mFactory(aFactory) {
|
||||
auto* e = new mozilla::Module::CIDEntry();
|
||||
auto* cid = new nsCID;
|
||||
*cid = aCID;
|
||||
e->cid = cid;
|
||||
mCIDEntry = e;
|
||||
}
|
||||
|
||||
nsFactoryEntry::~nsFactoryEntry() {
|
||||
// If this was a RegisterFactory entry, we own the CIDEntry/CID
|
||||
if (!mModule) {
|
||||
delete mCIDEntry->cid;
|
||||
delete mCIDEntry;
|
||||
}
|
||||
}
|
||||
|
||||
already_AddRefed<nsIFactory> nsFactoryEntry::GetFactory() {
|
||||
nsComponentManagerImpl::gComponentManager->mLock.AssertNotCurrentThreadOwns();
|
||||
|
||||
if (!mFactory) {
|
||||
// RegisterFactory then UnregisterFactory can leave an entry in mContractIDs
|
||||
// pointing to an unusable nsFactoryEntry.
|
||||
if (!mModule) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mModule->Load()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Don't set mFactory directly, it needs to be locked
|
||||
nsCOMPtr<nsIFactory> factory;
|
||||
|
||||
if (mModule->Module()->getFactoryProc) {
|
||||
factory =
|
||||
mModule->Module()->getFactoryProc(*mModule->Module(), *mCIDEntry);
|
||||
} else if (mCIDEntry->getFactoryProc) {
|
||||
factory = mCIDEntry->getFactoryProc(*mModule->Module(), *mCIDEntry);
|
||||
} else {
|
||||
NS_ASSERTION(mCIDEntry->constructorProc, "no getfactory or constructor");
|
||||
factory = new mozilla::GenericFactory(mCIDEntry->constructorProc);
|
||||
}
|
||||
if (!factory) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MonitorAutoLock lock(nsComponentManagerImpl::gComponentManager->mLock);
|
||||
// Threads can race to set mFactory
|
||||
if (!mFactory) {
|
||||
factory.swap(mFactory);
|
||||
}
|
||||
}
|
||||
nsCOMPtr<nsIFactory> factory = mFactory;
|
||||
return factory.forget();
|
||||
}
|
||||
|
@ -1401,7 +1655,8 @@ size_t nsFactoryEntry::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) {
|
|||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
// - mCID;
|
||||
// - mCIDEntry;
|
||||
// - mModule;
|
||||
// - mFactory;
|
||||
// - mServiceObject;
|
||||
|
||||
|
@ -1439,6 +1694,20 @@ nsresult NS_GetComponentRegistrar(nsIComponentRegistrar** aResult) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
EXPORT_XPCOM_API(nsresult)
|
||||
XRE_AddStaticComponent(const mozilla::Module* aComponent) {
|
||||
nsComponentManagerImpl::InitializeStaticModules();
|
||||
sExtraStaticModules->AppendElement(aComponent);
|
||||
|
||||
if (nsComponentManagerImpl::gComponentManager &&
|
||||
nsComponentManagerImpl::NORMAL ==
|
||||
nsComponentManagerImpl::gComponentManager->mStatus) {
|
||||
nsComponentManagerImpl::gComponentManager->RegisterModule(aComponent);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::AddBootstrappedManifestLocation(nsIFile* aLocation) {
|
||||
NS_ENSURE_ARG_POINTER(aLocation);
|
||||
|
|
|
@ -51,6 +51,8 @@ struct PRThread;
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern const mozilla::Module kXPCOMModule;
|
||||
|
||||
namespace {
|
||||
class EntryWrapper;
|
||||
} // namespace
|
||||
|
@ -137,6 +139,48 @@ class nsComponentManagerImpl final : public nsIComponentManager,
|
|||
|
||||
static nsTArray<ComponentLocation>* sModuleLocations;
|
||||
|
||||
class KnownModule {
|
||||
public:
|
||||
/**
|
||||
* Static or binary module.
|
||||
*/
|
||||
explicit KnownModule(const mozilla::Module* aModule)
|
||||
: mModule(aModule), mLoaded(false), mFailed(false) {}
|
||||
|
||||
~KnownModule() {
|
||||
if (mLoaded && mModule->unloadProc) {
|
||||
mModule->unloadProc();
|
||||
}
|
||||
}
|
||||
|
||||
bool Load();
|
||||
|
||||
const mozilla::Module* Module() const { return mModule; }
|
||||
|
||||
/**
|
||||
* For error logging, get a description of this module, either the
|
||||
* file path, or <static module>.
|
||||
*/
|
||||
nsCString Description() const;
|
||||
|
||||
private:
|
||||
const mozilla::Module* mModule;
|
||||
bool mLoaded;
|
||||
bool mFailed;
|
||||
};
|
||||
|
||||
// The KnownModule is kept alive by these members, it is
|
||||
// referenced by pointer from the factory entries.
|
||||
nsTArray<mozilla::UniquePtr<KnownModule>> mKnownStaticModules;
|
||||
|
||||
// Mutex not held
|
||||
void RegisterModule(const mozilla::Module* aModule);
|
||||
|
||||
// Mutex held
|
||||
void RegisterCIDEntryLocked(const mozilla::Module::CIDEntry* aEntry,
|
||||
KnownModule* aModule);
|
||||
void RegisterContractIDLocked(const mozilla::Module::ContractIDEntry* aEntry);
|
||||
|
||||
// Mutex not held
|
||||
void RegisterManifest(NSLocationType aType, mozilla::FileLocation& aFile,
|
||||
bool aChromeOnly);
|
||||
|
@ -198,10 +242,13 @@ class nsComponentManagerImpl final : public nsIComponentManager,
|
|||
#define NS_ERROR_IS_DIR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XPCOM, 24)
|
||||
|
||||
struct nsFactoryEntry {
|
||||
nsFactoryEntry(const mozilla::Module::CIDEntry* aEntry,
|
||||
nsComponentManagerImpl::KnownModule* aModule);
|
||||
|
||||
// nsIComponentRegistrar.registerFactory support
|
||||
nsFactoryEntry(const nsCID& aClass, nsIFactory* aFactory);
|
||||
|
||||
~nsFactoryEntry() = default;
|
||||
~nsFactoryEntry();
|
||||
|
||||
already_AddRefed<nsIFactory> GetFactory();
|
||||
|
||||
|
@ -209,7 +256,8 @@ struct nsFactoryEntry {
|
|||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
|
||||
|
||||
const nsCID mCID;
|
||||
const mozilla::Module::CIDEntry* mCIDEntry;
|
||||
nsComponentManagerImpl::KnownModule* mModule;
|
||||
|
||||
nsCOMPtr<nsIFactory> mFactory;
|
||||
nsCOMPtr<nsISupports> mServiceObject;
|
||||
|
|
|
@ -26,7 +26,7 @@ class nsINIParserImpl final : public nsIINIParser, public nsIINIParserWriter {
|
|||
bool ContainsNull(const nsACString& aStr);
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsINIParserFactory, nsIINIParserFactory)
|
||||
NS_IMPL_ISUPPORTS(nsINIParserFactory, nsIINIParserFactory, nsIFactory)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsINIParserFactory::CreateINIParser(nsIFile* aINIFile, nsIINIParser** aResult) {
|
||||
|
@ -45,6 +45,12 @@ nsINIParserFactory::CreateINIParser(nsIFile* aINIFile, nsIINIParser** aResult) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsINIParserFactory::CreateInstance(REFNSIID aIID, void** aResult) {
|
||||
// We are our own singleton.
|
||||
return QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsINIParserImpl, nsIINIParser, nsIINIParserWriter)
|
||||
|
||||
bool nsINIParserImpl::ContainsNull(const nsACString& aStr) {
|
||||
|
|
|
@ -8,16 +8,25 @@
|
|||
#define nsINIParserImpl_h__
|
||||
|
||||
#include "nsIINIParser.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
#define NS_INIPARSERFACTORY_CID \
|
||||
{ \
|
||||
0xdfac10a9, 0xdd24, 0x43cf, { \
|
||||
0xa0, 0x95, 0x6f, 0xfa, 0x2e, 0x4b, 0x6a, 0x6c \
|
||||
} \
|
||||
}
|
||||
|
||||
#define NS_INIPARSERFACTORY_CONTRACTID "@mozilla.org/xpcom/ini-parser-factory;1"
|
||||
|
||||
class nsINIParserFactory final : public nsIINIParserFactory {
|
||||
class nsINIParserFactory final : public nsIINIParserFactory, public nsIFactory {
|
||||
~nsINIParserFactory() = default;
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIINIPARSERFACTORY
|
||||
NS_DECL_NSIFACTORY
|
||||
};
|
||||
|
||||
#endif // nsINIParserImpl_h__
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsIFactory.h"
|
||||
#include "mozilla/Module.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsIThread.h"
|
||||
|
||||
#include "nsComponentManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsXPCOMCIDInternal.h"
|
||||
|
@ -195,17 +195,31 @@ TestRunnable::Run() {
|
|||
|
||||
static Factory* gFactory;
|
||||
|
||||
static already_AddRefed<nsIFactory> CreateFactory(
|
||||
const mozilla::Module& module, const mozilla::Module::CIDEntry& entry) {
|
||||
if (!gFactory) {
|
||||
gFactory = new Factory();
|
||||
NS_ADDREF(gFactory);
|
||||
}
|
||||
nsCOMPtr<nsIFactory> ret = gFactory;
|
||||
return ret.forget();
|
||||
}
|
||||
|
||||
static const mozilla::Module::CIDEntry kLocalCIDs[] = {
|
||||
{&kFactoryCID1, false, CreateFactory, nullptr},
|
||||
{&kFactoryCID2, false, CreateFactory, nullptr},
|
||||
{nullptr}};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kLocalContracts[] = {
|
||||
{FACTORY_CONTRACTID, &kFactoryCID2}, {nullptr}};
|
||||
|
||||
static const mozilla::Module kLocalModule = {mozilla::Module::kVersion,
|
||||
kLocalCIDs, kLocalContracts};
|
||||
|
||||
TEST(RacingServiceManager, Test)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
gFactory = new Factory();
|
||||
NS_ADDREF(gFactory);
|
||||
|
||||
nsComponentManagerImpl::gComponentManager->RegisterFactory(
|
||||
kFactoryCID2, "factory1", FACTORY_CONTRACTID, gFactory);
|
||||
nsComponentManagerImpl::gComponentManager->RegisterFactory(
|
||||
kFactoryCID1, "factory2", nullptr, gFactory);
|
||||
XRE_AddStaticComponent(&kLocalModule);
|
||||
|
||||
AutoCreateAndDestroyReentrantMonitor mon1(&gReentrantMonitor);
|
||||
|
||||
|
|
|
@ -152,7 +152,6 @@ SOURCES += [
|
|||
LOCAL_INCLUDES += [
|
||||
"../../base",
|
||||
"/toolkit/components/telemetry/tests/gtest",
|
||||
"/xpcom/components",
|
||||
]
|
||||
|
||||
GeneratedFile(
|
||||
|
|
Загрузка…
Ссылка в новой задаче