From 0661a81aa4285c40cf33c408026df6d44d09700f Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sat, 10 Jan 2004 10:42:10 +0000 Subject: Use NS_ENSURE_SUCCESS/NS_ENSURE_TRUE at appropriate places instead of 2004-01-10 Christian Persch * embed/mozilla/EphyAboutRedirector.cpp: * embed/mozilla/EphyAboutRedirector.h: Use NS_ENSURE_SUCCESS/NS_ENSURE_TRUE at appropriate places instead of silent "if (...) return ...;". Really kill "about:options". --- embed/mozilla/EphyAboutRedirector.cpp | 22 ++++++++++++++-------- embed/mozilla/EphyAboutRedirector.h | 1 - 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'embed/mozilla') diff --git a/embed/mozilla/EphyAboutRedirector.cpp b/embed/mozilla/EphyAboutRedirector.cpp index 7a240d92b..6d1e9d479 100644 --- a/embed/mozilla/EphyAboutRedirector.cpp +++ b/embed/mozilla/EphyAboutRedirector.cpp @@ -36,6 +36,10 @@ * * ***** END LICENSE BLOCK ***** */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include "EphyAboutRedirector.h" #include "nsNetCID.h" #include "nsIIOService.h" @@ -68,23 +72,26 @@ EphyAboutRedirector::NewChannel(nsIURI *aURI, nsIChannel **result) NS_ENSURE_ARG(aURI); nsCAutoString path; (void)aURI->GetPath(path); - nsresult rv; - nsCOMPtr ioService(do_GetService(kIOServiceCID, &rv)); - if (NS_FAILED(rv)) - return rv; + + nsCOMPtr ioService(do_GetService(kIOServiceCID)); + NS_ENSURE_TRUE (ioService, NS_ERROR_FAILURE); for (int i = 0; i< kRedirTotal; i++) { if (!PL_strcasecmp(path.get(), kRedirMap[i].id)) { nsCOMPtr tempChannel; - rv = ioService->NewChannel(nsDependentCString(kRedirMap[i].url), - nsnull, nsnull, getter_AddRefs(tempChannel)); + ioService->NewChannel(nsDependentCString(kRedirMap[i].url), + nsnull, nsnull, getter_AddRefs(tempChannel)); + NS_ENSURE_TRUE (tempChannel, NS_ERROR_FAILURE); + *result = tempChannel.get(); NS_ADDREF(*result); - return rv; + + return NS_OK; } } + NS_ASSERTION(0, "EphyAboutRedirector called for unknown case"); return NS_ERROR_ILLEGAL_VALUE; } @@ -100,4 +107,3 @@ EphyAboutRedirector::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) NS_RELEASE(about); return rv; } - diff --git a/embed/mozilla/EphyAboutRedirector.h b/embed/mozilla/EphyAboutRedirector.h index 4ac63be78..70421f089 100644 --- a/embed/mozilla/EphyAboutRedirector.h +++ b/embed/mozilla/EphyAboutRedirector.h @@ -64,7 +64,6 @@ protected: {0xbf, 0xd0, 0x52, 0xf6, 0x94, 0x45, 0xaf, 0xb7} \ } -#define EPHY_ABOUT_REDIRECTOR_OPTIONS_CONTRACTID NS_ABOUT_MODULE_CONTRACTID_PREFIX "options" #define EPHY_ABOUT_REDIRECTOR_EPIPHANY_CONTRACTID NS_ABOUT_MODULE_CONTRACTID_PREFIX "epiphany" #define EPHY_ABOUT_REDIRECTOR_CONSPIRACY_CONTRACTID NS_ABOUT_MODULE_CONTRACTID_PREFIX "conspiracy" #define EPHY_ABOUT_REDIRECTOR_MARCO_CONTRACTID NS_ABOUT_MODULE_CONTRACTID_PREFIX "marco" -- cgit v1.2.3