Bug 653936: fix: StartupCache uses nsZipItemPtr without ensuring that the JAR module is loaded, causes leak r=mwu
authorTaras Glek <tglek@mozilla.com>
Thu, 30 Jun 2011 14:58:03 -0700
changeset 72165 11e4980826aa05ad32b22050ae536ba55bb3880f
parent 72164 86518f4610373786e5350943f1aa6fac56f138ba
child 72166 fce9b0ca58c3f63c481f603bae75a15af6b4503a
push id20667
push usermak77@bonardo.net
push dateSat, 02 Jul 2011 08:40:37 +0000
treeherdermozilla-central@cff486d4d6a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwu
bugs653936
milestone7.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 653936: fix: StartupCache uses nsZipItemPtr without ensuring that the JAR module is loaded, causes leak r=mwu
startupcache/StartupCache.cpp
--- a/startupcache/StartupCache.cpp
+++ b/startupcache/StartupCache.cpp
@@ -62,16 +62,17 @@
 #include "nsIZipReader.h"
 #include "nsWeakReference.h"
 #include "nsZipArchive.h"
 #include "mozilla/Omnijar.h"
 #include "prenv.h"
 #include "mozilla/FunctionTimer.h"
 #include "nsThreadUtils.h"
 #include "nsXULAppAPI.h"
+#include "nsIProtocolHandler.h"
 
 #ifdef IS_BIG_ENDIAN
 #define SC_ENDIAN "big"
 #else
 #define SC_ENDIAN "little"
 #endif
 
 #if PR_BYTES_PER_WORD == 4
@@ -137,17 +138,19 @@ StartupCache::~StartupCache()
 
 nsresult
 StartupCache::Init() 
 {
   if (XRE_GetProcessType() != GeckoProcessType_Default) {
     NS_WARNING("Startup cache is only available in the chrome process");
     return NS_ERROR_NOT_AVAILABLE;
   }
-
+  // workaround for bug 653936
+  nsCOMPtr<nsIProtocolHandler> jarInitializer(do_GetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "jar"));
+  
   nsresult rv;
   mTable.Init();
 #ifdef DEBUG
   mWriteObjectMap.Init();
 #endif
 
   // This allows to override the startup cache filename
   // which is useful from xpcshell, when there is no ProfLDS directory to keep cache in.