aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--embed/mozilla/EphySingle.cpp14
2 files changed, 13 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index a9d46c51c..5b721f73d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2004-01-10 Christian Persch <chpe@cvs.gnome.org>
+ * embed/mozilla/EphySingle.cpp:
+
+ Use NS_ENSURE_SUCCESS/NS_ENSURE_TRUE at appropriate places instead of
+ silent "if (...) return ...;".
+
+2004-01-10 Christian Persch <chpe@cvs.gnome.org>
+
* embed/mozilla/EphyAboutRedirector.cpp:
* embed/mozilla/EphyAboutRedirector.h:
diff --git a/embed/mozilla/EphySingle.cpp b/embed/mozilla/EphySingle.cpp
index b9566a329..bfdba4251 100644
--- a/embed/mozilla/EphySingle.cpp
+++ b/embed/mozilla/EphySingle.cpp
@@ -52,9 +52,8 @@ EphySingle::Init (EphyEmbedSingle *aOwner)
mOwner = aOwner;
- nsresult rv;
- mObserverService = do_GetService ("@mozilla.org/observer-service;1", &rv);
- if (NS_FAILED (rv) || !mObserverService) return NS_ERROR_FAILURE;
+ mObserverService = do_GetService ("@mozilla.org/observer-service;1");
+ NS_ENSURE_TRUE (mObserverService, NS_ERROR_FAILURE);
mObserverService->AddObserver (this, "cookie-changed", PR_FALSE);
mObserverService->AddObserver (this, "cookie-rejected", PR_FALSE);
@@ -91,7 +90,7 @@ EphySingle::EmitCookieNotification (const char *name,
LOG ("EmitCookieNotification %s", name)
nsCOMPtr<nsICookie> cookie = do_QueryInterface (aSubject);
- if (!cookie) return NS_ERROR_FAILURE;
+ NS_ENSURE_TRUE (cookie, NS_ERROR_FAILURE);
EphyCookie *info = mozilla_cookie_to_ephy_cookie (cookie);
@@ -109,12 +108,11 @@ EphySingle::EmitPermissionNotification (const char *name,
LOG ("EmitPermissionNotification %s", name)
nsCOMPtr<nsIPermission> perm = do_QueryInterface (aSubject);
- if (!perm) return NS_ERROR_FAILURE;
+ NS_ENSURE_TRUE (perm, NS_ERROR_FAILURE);
EphyPermissionInfo *info =
mozilla_permission_to_ephy_permission (perm);
-
g_signal_emit_by_name (EPHY_PERMISSION_MANAGER (mOwner), name, info);
ephy_permission_info_free (info);
@@ -277,7 +275,7 @@ mozilla_permission_to_ephy_permission (nsIPermission *perm)
#if MOZILLA_SNAPSHOT >= 10
nsCAutoString str;
result = perm->GetType(str);
- if (NS_FAILED (result)) return NULL;
+ NS_ENSURE_SUCCESS (result, NULL);
if (str.Equals ("cookie"))
{
@@ -294,7 +292,7 @@ mozilla_permission_to_ephy_permission (nsIPermission *perm)
#else
PRUint32 num;
result = perm->GetType(&num);
- if (NS_FAILED (result)) return NULL;
+ NS_ENSURE_SUCCESS (result, NULL);
type = (EphyPermissionType) num;
#endif