Bug 899495 - Correct the usage patterns of TestPermissionFromPrincipal in nsPermissionManager. r=mounir
☠☠ backed out by 9ff97dd09df4 ☠ ☠
authorGenti Tola <genti.tola@live.com>
Mon, 07 Oct 2013 12:34:31 +0200
changeset 158867 b2e1c92b7e39a7c3a929d8c07a7b17aacbcf1acb
parent 158866 994c850a583a5e511612181e0ad1b0aff254b436
child 158868 36a709ae32dbc339c8d078d125cc015f3150c11f
push id4537
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 22:18:47 +0000
treeherdermozilla-aurora@60c6fd67470e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmounir
bugs899495
milestone27.0a1
Bug 899495 - Correct the usage patterns of TestPermissionFromPrincipal in nsPermissionManager. r=mounir
dom/src/storage/DOMStorage.cpp
extensions/cookie/nsCookiePermission.cpp
--- a/dom/src/storage/DOMStorage.cpp
+++ b/dom/src/storage/DOMStorage.cpp
@@ -250,18 +250,19 @@ DOMStorage::CanUseStorage(DOMStorage* aS
 
   nsCOMPtr<nsIPermissionManager> permissionManager =
     do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
   if (!permissionManager) {
     return false;
   }
 
   uint32_t perm;
-  permissionManager->TestPermissionFromPrincipal(subjectPrincipal,
-                                                 kPermissionType, &perm);
+  rv = permissionManager->TestPermissionFromPrincipal(subjectPrincipal,
+                                                      kPermissionType, &perm);
+  NS_ENSURE_SUCCESS(rv, false);
 
   if (perm == nsIPermissionManager::DENY_ACTION) {
     return false;
   }
 
   if (perm == nsICookiePermission::ACCESS_SESSION) {
     if (aStorage) {
       aStorage->mIsSessionOnly = true;
--- a/extensions/cookie/nsCookiePermission.cpp
+++ b/extensions/cookie/nsCookiePermission.cpp
@@ -190,17 +190,19 @@ nsCookiePermission::CanSetCookie(nsIURI 
 
   *aResult = kDefaultPolicy;
 
   // Lazily initialize ourselves
   if (!EnsureInitialized())
     return NS_ERROR_UNEXPECTED;
 
   uint32_t perm;
-  mPermMgr->TestPermission(aURI, kPermissionType, &perm);
+  nsresult rv = mPermMgr->TestPermission(aURI, kPermissionType, &perm);
+  NS_ENSURE_SUCCESS(rv, false);
+
   bool isThirdParty = false;
   switch (perm) {
   case nsICookiePermission::ACCESS_SESSION:
     *aIsSession = true;
 
   case nsICookiePermission::ACCESS_ALLOW:
     *aResult = true;
     break;