Bug 612131 - Crash [@ mozilla::scache::NS_NewObjectOutputWrappedStorageStream ] when storageStream fails to get created; r=dwitte a=blocking-fennec2.0+
authorTaras Glek <tglek@mozilla.com>
Fri, 26 Nov 2010 12:37:55 -0500
changeset 58277 bc8a510004f0f3ee615b1a54569713cd4ac1cc80
parent 58276 fa69cf56d15bfc04871444f9b7bdfc972e03c612
child 58278 7ce0cc6b8cc9f52d5d70bbb3f28e81f000eee647
push idunknown
push userunknown
push dateunknown
reviewersdwitte, blocking-fennec2.0
bugs612131
milestone2.0b8pre
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 612131 - Crash [@ mozilla::scache::NS_NewObjectOutputWrappedStorageStream ] when storageStream fails to get created; r=dwitte a=blocking-fennec2.0+
startupcache/StartupCacheUtils.cpp
--- a/startupcache/StartupCacheUtils.cpp
+++ b/startupcache/StartupCacheUtils.cpp
@@ -24,23 +24,21 @@ NS_NewObjectInputStreamFromBuffer(char* 
   objectInput.forget(stream);
   return NS_OK;
 }
 
 NS_EXPORT nsresult
 NS_NewObjectOutputWrappedStorageStream(nsIObjectOutputStream **wrapperStream,
                                        nsIStorageStream** stream)
 {
-  nsresult rv;
-  nsCOMPtr<nsIStorageStream> storageStream
-    = do_CreateInstance("@mozilla.org/storagestream;1");
-  
-  rv = storageStream->Init(256, PR_UINT32_MAX, nsnull);
+  nsCOMPtr<nsIStorageStream> storageStream;
+
+  nsresult rv = NS_NewStorageStream(256, PR_UINT32_MAX, getter_AddRefs(storageStream));
   NS_ENSURE_SUCCESS(rv, rv);
-  
+
   nsCOMPtr<nsIObjectOutputStream> objectOutput
     = do_CreateInstance("@mozilla.org/binaryoutputstream;1");
   nsCOMPtr<nsIOutputStream> outputStream
     = do_QueryInterface(storageStream);
   
   objectOutput->SetOutputStream(outputStream);
   
 #ifdef DEBUG