aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-01-10 19:13:06 +0800
committerChristian Persch <chpe@src.gnome.org>2004-01-10 19:13:06 +0800
commit264834c946c5555c48b1fda985c6513c23773228 (patch)
tree6b238750e3e3404dd9a0933d058da40f9f28fdae /embed
parent6f51f41957dafd6cf84c9def7f03b5823c15811d (diff)
downloadgsoc2013-epiphany-264834c946c5555c48b1fda985c6513c23773228.tar
gsoc2013-epiphany-264834c946c5555c48b1fda985c6513c23773228.tar.gz
gsoc2013-epiphany-264834c946c5555c48b1fda985c6513c23773228.tar.bz2
gsoc2013-epiphany-264834c946c5555c48b1fda985c6513c23773228.tar.lz
gsoc2013-epiphany-264834c946c5555c48b1fda985c6513c23773228.tar.xz
gsoc2013-epiphany-264834c946c5555c48b1fda985c6513c23773228.tar.zst
gsoc2013-epiphany-264834c946c5555c48b1fda985c6513c23773228.zip
Use NS_ENSURE_SUCCESS/NS_ENSURE_TRUE at appropriate places.
2004-01-10 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/ExternalProtocolHandlers.cpp: Use NS_ENSURE_SUCCESS/NS_ENSURE_TRUE at appropriate places.
Diffstat (limited to 'embed')
-rw-r--r--embed/mozilla/ExternalProtocolHandlers.cpp48
-rw-r--r--embed/mozilla/ExternalProtocolService.cpp2
2 files changed, 30 insertions, 20 deletions
diff --git a/embed/mozilla/ExternalProtocolHandlers.cpp b/embed/mozilla/ExternalProtocolHandlers.cpp
index f5dfa3264..8f85f2c01 100644
--- a/embed/mozilla/ExternalProtocolHandlers.cpp
+++ b/embed/mozilla/ExternalProtocolHandlers.cpp
@@ -16,6 +16,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ExternalProtocolHandlers.h"
#include "nsCOMPtr.h"
#include "nsIComponentManager.h"
@@ -129,26 +133,30 @@ GBaseProtocolContentHandler::~GBaseProtocolContentHandler()
NS_IMETHODIMP GBaseProtocolContentHandler::NewChannel(nsIURI *aURI,
nsIChannel **_retval)
{
+ nsresult rv;
nsCOMPtr<nsIStorageStream> sStream;
- nsresult rv = NS_NewStorageStream(1, 16, getter_AddRefs(sStream));
- if (NS_FAILED(rv)) return rv;
+ rv = NS_NewStorageStream(1, 16, getter_AddRefs(sStream));
+ NS_ENSURE_SUCCESS (rv, rv);
nsCOMPtr<nsIOutputStream> oStream;
rv = sStream->GetOutputStream(0, getter_AddRefs(oStream));
+ NS_ENSURE_SUCCESS (rv, rv);
PRUint32 bytes;
- oStream->Write("Dummy stream\0", 13, &bytes);
+ rv = oStream->Write("Dummy stream\0", 13, &bytes);
+ NS_ENSURE_SUCCESS (rv, rv);
nsCOMPtr<nsIInputStream> iStream;
rv = sStream->NewInputStream(0, getter_AddRefs(iStream));
- if (NS_FAILED(rv)) return rv;
+ NS_ENSURE_SUCCESS (rv, rv);
nsCOMPtr<nsIChannel> channel;
rv = NS_NewInputStreamChannel(getter_AddRefs(channel), aURI,
iStream, mMimeType, NS_LITERAL_CSTRING(""));
- if (NS_FAILED(rv)) return rv;
+ NS_ENSURE_SUCCESS (rv, rv);
NS_IF_ADDREF (*_retval = channel);
+
return rv;
}
@@ -158,28 +166,30 @@ NS_IMETHODIMP GBaseProtocolContentHandler::HandleContent (
nsISupports * aWindowContext,
nsIRequest *aRequest)
{
+ NS_ENSURE_ARG (aRequest);
+
nsresult rv = NS_OK;
- if (!aRequest)
- return NS_ERROR_NULL_POINTER;
+
// First of all, get the content type and make sure it is a
// content type we know how to handle!
if (mMimeType.Equals(aContentType))
{
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
- if(!channel) return NS_ERROR_FAILURE;
+ NS_ENSURE_TRUE (channel, NS_ERROR_FAILURE);
nsCOMPtr<nsIURI> uri;
- rv = channel->GetURI(getter_AddRefs(uri));
- if (NS_FAILED(rv)) return rv;
-
- aRequest->Cancel(NS_BINDING_ABORTED);
- if (uri)
- {
- nsCOMPtr<nsIExternalProtocolService> ps =
- do_GetService (NS_EXTERNALPROTOCOLSERVICE_CONTRACTID, &rv);
- if (NS_FAILED(rv) || !ps) return NS_ERROR_FAILURE;
- ps->LoadUrl (uri);
- }
+ channel->GetURI(getter_AddRefs(uri));
+ NS_ENSURE_TRUE (uri, NS_ERROR_FAILURE);
+
+ rv = aRequest->Cancel(NS_BINDING_ABORTED);
+ NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
+
+ nsCOMPtr<nsIExternalProtocolService> ps =
+ do_GetService (NS_EXTERNALPROTOCOLSERVICE_CONTRACTID);
+ NS_ENSURE_TRUE (ps, NS_ERROR_FAILURE);
+
+ rv = ps->LoadUrl (uri);
}
+
return rv;
}
diff --git a/embed/mozilla/ExternalProtocolService.cpp b/embed/mozilla/ExternalProtocolService.cpp
index a8a9ce949..9c00e080a 100644
--- a/embed/mozilla/ExternalProtocolService.cpp
+++ b/embed/mozilla/ExternalProtocolService.cpp
@@ -17,7 +17,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include <config.h>
+#include "config.h"
#endif
#if MOZILLA_SNAPSHOT < 12