зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1504557 - Remove the XPCOM registration for nsErrorService r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D10848 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3f93a1ac85
Коммит
e95c3cca7d
|
@ -26,7 +26,7 @@
|
|||
#include "nsThreadUtils.h"
|
||||
#include "jsapi.h"
|
||||
#include "txExprParser.h"
|
||||
#include "nsIErrorService.h"
|
||||
#include "nsErrorService.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsIXPConnect.h"
|
||||
|
@ -1286,12 +1286,9 @@ txMozillaXSLTProcessor::Startup()
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIErrorService> errorService =
|
||||
do_GetService(NS_ERRORSERVICE_CONTRACTID);
|
||||
if (errorService) {
|
||||
errorService->RegisterErrorStringBundle(NS_ERROR_MODULE_XSLT,
|
||||
XSLT_MSGS_URL);
|
||||
}
|
||||
nsCOMPtr<nsIErrorService> errorService = nsErrorService::GetOrCreate();
|
||||
errorService->RegisterErrorStringBundle(NS_ERROR_MODULE_XSLT,
|
||||
XSLT_MSGS_URL);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1302,11 +1299,8 @@ txMozillaXSLTProcessor::Shutdown()
|
|||
{
|
||||
txXSLTProcessor::shutdown();
|
||||
|
||||
nsCOMPtr<nsIErrorService> errorService =
|
||||
do_GetService(NS_ERRORSERVICE_CONTRACTID);
|
||||
if (errorService) {
|
||||
errorService->UnregisterErrorStringBundle(NS_ERROR_MODULE_XSLT);
|
||||
}
|
||||
nsCOMPtr<nsIErrorService> errorService = nsErrorService::GetOrCreate();
|
||||
errorService->UnregisterErrorStringBundle(NS_ERROR_MODULE_XSLT);
|
||||
}
|
||||
|
||||
/* static*/
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "nsIObserverService.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsTextFormatter.h"
|
||||
#include "nsIErrorService.h"
|
||||
#include "nsErrorService.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsPersistentProperties.h"
|
||||
|
@ -49,8 +49,6 @@ using mozilla::dom::ipc::SharedStringMap;
|
|||
using mozilla::dom::ipc::SharedStringMapBuilder;
|
||||
using mozilla::ipc::FileDescriptor;
|
||||
|
||||
static NS_DEFINE_CID(kErrorServiceCID, NS_ERRORSERVICE_CID);
|
||||
|
||||
/**
|
||||
* A set of string bundle URLs which are loaded by content processes, and
|
||||
* should be allocated in a shared memory region, and then sent to content
|
||||
|
@ -763,8 +761,8 @@ struct bundleCacheEntry_t final : public LinkedListElement<bundleCacheEntry_t> {
|
|||
nsStringBundleService::nsStringBundleService() :
|
||||
mBundleMap(MAX_CACHED_BUNDLES)
|
||||
{
|
||||
mErrorService = do_GetService(kErrorServiceCID);
|
||||
NS_ASSERTION(mErrorService, "Couldn't get error service");
|
||||
mErrorService = nsErrorService::GetOrCreate();
|
||||
MOZ_ALWAYS_TRUE(mErrorService);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsStringBundleService,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "nscore.h"
|
||||
#include "nsIURI.h"
|
||||
#include "prprf.h"
|
||||
#include "nsIErrorService.h"
|
||||
#include "nsErrorService.h"
|
||||
#include "netCore.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIPrefService.h"
|
||||
|
@ -216,12 +216,9 @@ nsresult
|
|||
nsIOService::Init()
|
||||
{
|
||||
// XXX hack until xpidl supports error info directly (bug 13423)
|
||||
nsCOMPtr<nsIErrorService> errorService = do_GetService(NS_ERRORSERVICE_CONTRACTID);
|
||||
if (errorService) {
|
||||
errorService->RegisterErrorStringBundle(NS_ERROR_MODULE_NETWORK, NECKO_MSGS_URL);
|
||||
}
|
||||
else
|
||||
NS_WARNING("failed to get error service");
|
||||
nsCOMPtr<nsIErrorService> errorService = nsErrorService::GetOrCreate();
|
||||
MOZ_ALWAYS_TRUE(errorService);
|
||||
errorService->RegisterErrorStringBundle(NS_ERROR_MODULE_NETWORK, NECKO_MSGS_URL);
|
||||
|
||||
InitializeCaptivePortalService();
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ EXPORTS += [
|
|||
'nsDebugImpl.h',
|
||||
'nsDumpUtils.h',
|
||||
'nsError.h',
|
||||
'nsErrorService.h',
|
||||
'nsGZFileWriter.h',
|
||||
'nsIClassInfoImpl.h',
|
||||
'nsID.h',
|
||||
|
|
|
@ -7,18 +7,31 @@
|
|||
#include "nsErrorService.h"
|
||||
#include "nsCRTGlue.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
|
||||
namespace {
|
||||
|
||||
mozilla::StaticRefPtr<nsErrorService> gSingleton;
|
||||
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsErrorService, nsIErrorService)
|
||||
|
||||
nsresult
|
||||
nsErrorService::Create(nsISupports* aOuter, const nsIID& aIID,
|
||||
void** aInstancePtr)
|
||||
// static
|
||||
already_AddRefed<nsIErrorService>
|
||||
nsErrorService::GetOrCreate()
|
||||
{
|
||||
if (NS_WARN_IF(aOuter)) {
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
RefPtr<nsErrorService> svc;
|
||||
if (gSingleton) {
|
||||
svc = gSingleton;
|
||||
} else {
|
||||
gSingleton = new nsErrorService();
|
||||
mozilla::ClearOnShutdown(&gSingleton);
|
||||
svc = gSingleton;
|
||||
}
|
||||
RefPtr<nsErrorService> serv = new nsErrorService();
|
||||
return serv->QueryInterface(aIID, aInstancePtr);
|
||||
|
||||
return svc.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -19,17 +19,11 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIERRORSERVICE
|
||||
|
||||
nsErrorService()
|
||||
{
|
||||
}
|
||||
|
||||
static nsresult
|
||||
Create(nsISupports* aOuter, const nsIID& aIID, void** aInstancePtr);
|
||||
static already_AddRefed<nsIErrorService> GetOrCreate();
|
||||
|
||||
private:
|
||||
~nsErrorService()
|
||||
{
|
||||
}
|
||||
nsErrorService() = default;
|
||||
~nsErrorService() = default;
|
||||
|
||||
nsClassHashtable<nsUint32HashKey, nsCString> mErrorStringBundleURLMap;
|
||||
};
|
||||
|
|
|
@ -32,18 +32,3 @@ interface nsIErrorService : nsISupports
|
|||
*/
|
||||
string getErrorStringBundle(in short errorModule);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
// The global nsIErrorService:
|
||||
#define NS_ERRORSERVICE_NAME "Error Service"
|
||||
#define NS_ERRORSERVICE_CONTRACTID "@mozilla.org/xpcom/error-service;1"
|
||||
#define NS_ERRORSERVICE_CID \
|
||||
{ /* 744afd5e-5f8c-11d4-9877-00c04fa0cf4a */ \
|
||||
0x744afd5e, \
|
||||
0x5f8c, \
|
||||
0x11d4, \
|
||||
{0x98, 0x77, 0x00, 0xc0, 0x4f, 0xa0, 0xcf, 0x4a} \
|
||||
}
|
||||
|
||||
%}
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include "nsMemoryImpl.h"
|
||||
#include "nsDebugImpl.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "nsErrorService.h"
|
||||
|
||||
#include "nsArray.h"
|
||||
#include "nsINIParserImpl.h"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
COMPONENT_M(MEMORY, nsMemoryImpl::Create, Module::ALLOW_IN_GPU_PROCESS)
|
||||
COMPONENT_M(DEBUG, nsDebugImpl::Create, Module::ALLOW_IN_GPU_PROCESS)
|
||||
COMPONENT(ERRORSERVICE, nsErrorService::Create)
|
||||
|
||||
COMPONENT_M(CATEGORYMANAGER, nsCategoryManager::Create, Module::ALLOW_IN_GPU_PROCESS)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче