Bug 1123854 - Remove some out of memory checks in caps/. r=jst
authorAndrew McCreight <continuation@gmail.com>
Fri, 30 Jan 2015 10:59:49 -0800
changeset 226822 1cd8f91060fd6a9e0c1a3a28a5912a60e7b70353
parent 226821 d9142d9137a777a8f67af5b3bb3a5764c0e0ba89
child 226823 530d438655f711572eb7c678f10257c1b920a667
push id54925
push useramccreight@mozilla.com
push dateFri, 30 Jan 2015 19:00:06 +0000
treeherdermozilla-inbound@1cd8f91060fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs1123854
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1123854 - Remove some out of memory checks in caps/. r=jst
caps/nsNullPrincipal.cpp
caps/nsScriptSecurityManager.cpp
--- a/caps/nsNullPrincipal.cpp
+++ b/caps/nsNullPrincipal.cpp
@@ -111,17 +111,16 @@ nsNullPrincipal::Init(uint32_t aAppId, b
   str.Append(chars);
 
   if (str.Length() != prefixLen + suffixLen) {
     NS_WARNING("Out of memory allocating null-principal URI");
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   mURI = new nsNullPrincipalURI(str);
-  NS_ENSURE_TRUE(mURI, NS_ERROR_OUT_OF_MEMORY);
 
   return NS_OK;
 }
 
 void
 nsNullPrincipal::GetScriptLocation(nsACString &aStr)
 {
   mURI->GetSpec(aStr);
--- a/caps/nsScriptSecurityManager.cpp
+++ b/caps/nsScriptSecurityManager.cpp
@@ -981,18 +981,16 @@ nsScriptSecurityManager::CreateCodebaseP
         }
 
         principal.forget(result);
 
         return NS_OK;
     }
 
     nsRefPtr<nsPrincipal> codebase = new nsPrincipal();
-    if (!codebase)
-        return NS_ERROR_OUT_OF_MEMORY;
 
     nsresult rv = codebase->Init(aURI, aAppId, aInMozBrowser);
     if (NS_FAILED(rv))
         return rv;
 
     NS_ADDREF(*result = codebase);
 
     return NS_OK;
@@ -1264,17 +1262,16 @@ nsresult nsScriptSecurityManager::Init()
     if (!bundleService)
         return NS_ERROR_FAILURE;
 
     rv = bundleService->CreateBundle("chrome://global/locale/security/caps.properties", &sStrBundle);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Create our system principal singleton
     nsRefPtr<nsSystemPrincipal> system = new nsSystemPrincipal();
-    NS_ENSURE_TRUE(system, NS_ERROR_OUT_OF_MEMORY);
 
     mSystemPrincipal = system;
 
     //-- Register security check callback in the JS engine
     //   Currently this is used to control access to function.caller
     rv = nsXPConnect::XPConnect()->GetRuntime(&sRuntime);
     NS_ENSURE_SUCCESS(rv, rv);