aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/MozRegisterComponents.cpp
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-01-10 19:19:52 +0800
committerChristian Persch <chpe@src.gnome.org>2004-01-10 19:19:52 +0800
commit137a5961bbd03f74a90927ae1a03ed5e19e5d666 (patch)
tree710be6153d725c44fa97993e3dee32aaf74ef9d6 /embed/mozilla/MozRegisterComponents.cpp
parent264834c946c5555c48b1fda985c6513c23773228 (diff)
downloadgsoc2013-epiphany-137a5961bbd03f74a90927ae1a03ed5e19e5d666.tar
gsoc2013-epiphany-137a5961bbd03f74a90927ae1a03ed5e19e5d666.tar.gz
gsoc2013-epiphany-137a5961bbd03f74a90927ae1a03ed5e19e5d666.tar.bz2
gsoc2013-epiphany-137a5961bbd03f74a90927ae1a03ed5e19e5d666.tar.lz
gsoc2013-epiphany-137a5961bbd03f74a90927ae1a03ed5e19e5d666.tar.xz
gsoc2013-epiphany-137a5961bbd03f74a90927ae1a03ed5e19e5d666.tar.zst
gsoc2013-epiphany-137a5961bbd03f74a90927ae1a03ed5e19e5d666.zip
Use NS_ENSURE_SUCCESS/NS_ENSURE_TRUE at appropriate places.
2004-01-10 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/FilePicker.cpp: * embed/mozilla/MozDownload.cpp: * embed/mozilla/MozRegisterComponents.cpp: * embed/mozilla/MozillaPrivate.cpp: Use NS_ENSURE_SUCCESS/NS_ENSURE_TRUE at appropriate places.
Diffstat (limited to 'embed/mozilla/MozRegisterComponents.cpp')
-rw-r--r--embed/mozilla/MozRegisterComponents.cpp51
1 files changed, 26 insertions, 25 deletions
diff --git a/embed/mozilla/MozRegisterComponents.cpp b/embed/mozilla/MozRegisterComponents.cpp
index 57010a22a..6168c82e5 100644
--- a/embed/mozilla/MozRegisterComponents.cpp
+++ b/embed/mozilla/MozRegisterComponents.cpp
@@ -173,12 +173,6 @@ static const nsModuleComponentInfo sAppComps[] = {
{
EPHY_ABOUT_REDIRECTOR_CLASSNAME,
EPHY_ABOUT_REDIRECTOR_CID,
- EPHY_ABOUT_REDIRECTOR_OPTIONS_CONTRACTID,
- EphyAboutRedirectorConstructor
- },
- {
- EPHY_ABOUT_REDIRECTOR_CLASSNAME,
- EPHY_ABOUT_REDIRECTOR_CID,
EPHY_ABOUT_REDIRECTOR_CONSPIRACY_CONTRACTID,
EphyAboutRedirectorConstructor
},
@@ -230,16 +224,18 @@ mozilla_register_components (void)
nsresult rv;
nsCOMPtr<nsIComponentRegistrar> cr;
- rv = NS_GetComponentRegistrar(getter_AddRefs(cr));
- NS_ENSURE_SUCCESS(rv, rv);
+ NS_GetComponentRegistrar(getter_AddRefs(cr));
+ NS_ENSURE_TRUE (cr, FALSE);
for (int i = 0; i < sNumAppComps; i++)
{
nsCOMPtr<nsIGenericFactory> componentFactory;
rv = NS_NewGenericFactory(getter_AddRefs(componentFactory),
&(sAppComps[i]));
- if (NS_FAILED(rv))
+ if (NS_FAILED(rv) || !componentFactory)
{
+ g_warning ("Failed to make a factory for %s\n", sAppComps[i].mDescription);
+
ret = FALSE;
continue; // don't abort registering other components
}
@@ -249,7 +245,11 @@ mozilla_register_components (void)
sAppComps[i].mContractID,
componentFactory);
if (NS_FAILED(rv))
+ {
+ g_warning ("Failed to register %s\n", sAppComps[i].mDescription);
+
ret = FALSE;
+ }
}
return ret;
@@ -263,34 +263,34 @@ mozilla_register_FtpProtocolHandler (void)
{
if (ftpRegistered == PR_TRUE) return TRUE;
- nsresult rv = NS_OK;
+ nsresult rv;
nsCOMPtr<nsIComponentManager> cm;
- rv = NS_GetComponentManager(getter_AddRefs(cm));
- if (NS_FAILED(rv) || !cm) return FALSE;
+ NS_GetComponentManager(getter_AddRefs(cm));
+ NS_ENSURE_TRUE (cm, FALSE);
rv = cm->GetClassObject(knsFtpProtocolHandlerCID,
NS_GET_IID(nsIFactory),
getter_AddRefs(nsFtpFactory));
- if (NS_FAILED(rv)) return FALSE;
+ if (NS_FAILED (rv)) return FALSE;
nsCOMPtr<nsIGenericFactory> ftpFactory;
- rv = NS_NewGenericFactory(getter_AddRefs(ftpFactory),
- &sFtpComps);
- if (NS_FAILED(rv) || !ftpFactory) return FALSE;
+ NS_NewGenericFactory(getter_AddRefs(ftpFactory), &sFtpComps);
+ NS_ENSURE_TRUE (ftpFactory, FALSE);
nsCOMPtr<nsIComponentRegistrar> cr;
- rv = NS_GetComponentRegistrar(getter_AddRefs(cr));
- if (NS_FAILED(rv) || !cr) return FALSE;
+ NS_GetComponentRegistrar(getter_AddRefs(cr));
+ NS_ENSURE_TRUE (cr, FALSE);
rv = cr->RegisterFactory(sFtpComps.mCID,
sFtpComps.mDescription,
sFtpComps.mContractID,
ftpFactory);
- if (NS_FAILED(rv)) return FALSE;
+ NS_ENSURE_SUCCESS (rv, FALSE);
ftpRegistered = PR_TRUE;
- return NS_SUCCEEDED (rv) ? TRUE : FALSE;
+
+ return TRUE;
}
/**
@@ -301,17 +301,18 @@ mozilla_unregister_FtpProtocolHandler (void)
{
if (ftpRegistered == PR_FALSE) return FALSE;
- nsresult rv = NS_OK;
-
+ nsresult rv;
nsCOMPtr<nsIComponentRegistrar> cr;
- rv = NS_GetComponentRegistrar(getter_AddRefs(cr));
- if (NS_FAILED(rv) || !cr) return FALSE;
+ NS_GetComponentRegistrar(getter_AddRefs(cr));
+ NS_ENSURE_TRUE (cr, FALSE);
rv = cr->RegisterFactory(knsFtpProtocolHandlerCID,
NS_FTPPROTOCOLHANDLER_CLASSNAME,
G_FTP_PROTOCOL_CONTRACTID,
nsFtpFactory);
+ NS_ENSURE_SUCCESS (rv, FALSE);
ftpRegistered = PR_FALSE;
- return NS_SUCCEEDED (rv) ? TRUE : FALSE;
+
+ return TRUE;
}