diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-01-10 18:44:04 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-01-10 18:44:04 +0800 |
commit | ce9cc9bb6ac5b2efd307b214c11a1e1ba56ed92e (patch) | |
tree | 4a570fc464301328bec4b0d1b1e70f3370a8dc0b /embed/mozilla | |
parent | 0661a81aa4285c40cf33c408026df6d44d09700f (diff) | |
download | gsoc2013-epiphany-ce9cc9bb6ac5b2efd307b214c11a1e1ba56ed92e.tar gsoc2013-epiphany-ce9cc9bb6ac5b2efd307b214c11a1e1ba56ed92e.tar.gz gsoc2013-epiphany-ce9cc9bb6ac5b2efd307b214c11a1e1ba56ed92e.tar.bz2 gsoc2013-epiphany-ce9cc9bb6ac5b2efd307b214c11a1e1ba56ed92e.tar.lz gsoc2013-epiphany-ce9cc9bb6ac5b2efd307b214c11a1e1ba56ed92e.tar.xz gsoc2013-epiphany-ce9cc9bb6ac5b2efd307b214c11a1e1ba56ed92e.tar.zst gsoc2013-epiphany-ce9cc9bb6ac5b2efd307b214c11a1e1ba56ed92e.zip |
Use NS_ENSURE_SUCCESS/NS_ENSURE_TRUE at appropriate places instead of
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 ...;".
Diffstat (limited to 'embed/mozilla')
-rw-r--r-- | embed/mozilla/EphySingle.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
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 |