Bug 869928 - Remove Off-Main-Thread XPCWrappedJS refcounting from OpenSignedJARFileTask. r=bsmith
authorJosh Matthews <josh@joshmatthews.net>
Thu, 09 May 2013 15:43:25 -0400
changeset 138198 7fa500e12a386c35928fc8f5b0ebf8b3f50ce551
parent 138197 ae045b8a759b32ad45c53ba125547b0fb90bc8a6
child 138199 1bc459138617b42345ff7d27e01aa05776582993
push id3752
push userlsblakk@mozilla.com
push dateMon, 13 May 2013 17:21:10 +0000
treeherdermozilla-aurora@1580544aef0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmith
bugs869928
milestone23.0a1
Bug 869928 - Remove Off-Main-Thread XPCWrappedJS refcounting from OpenSignedJARFileTask. r=bsmith
security/manager/ssl/src/JARSignatureVerification.cpp
--- a/security/manager/ssl/src/JARSignatureVerification.cpp
+++ b/security/manager/ssl/src/JARSignatureVerification.cpp
@@ -15,16 +15,17 @@
 #include "nsComponentManagerUtils.h"
 #include "nsCOMPtr.h"
 #include "nsHashKeys.h"
 #include "nsIFile.h"
 #include "nsIInputStream.h"
 #include "nsIStringEnumerator.h"
 #include "nsIZipReader.h"
 #include "nsNSSCertificate.h"
+#include "nsProxyRelease.h"
 #include "nsString.h"
 #include "nsTHashtable.h"
 #include "ScopedNSSTypes.h"
 
 #include "base64.h"
 #include "secmime.h"
 #include "plstr.h"
 #include "prlog.h"
@@ -722,17 +723,17 @@ OpenSignedJARFile(nsIFile * aJarFile,
 }
 
 class OpenSignedJARFileTask MOZ_FINAL : public CryptoTask
 {
 public:
   OpenSignedJARFileTask(nsIFile * aJarFile,
                         nsIOpenSignedJARFileCallback * aCallback)
     : mJarFile(aJarFile)
-    , mCallback(aCallback)
+    , mCallback(new nsMainThreadPtrHolder<nsIOpenSignedJARFileCallback>(aCallback))
   {
   }
 
 private:
   virtual nsresult CalculateResult() MOZ_OVERRIDE
   {
     return OpenSignedJARFile(mJarFile, getter_AddRefs(mZipReader),
                              getter_AddRefs(mSignerCert));
@@ -743,17 +744,17 @@ private:
   virtual void ReleaseNSSResources() { }
 
   virtual void CallCallback(nsresult rv)
   {
     (void) mCallback->OpenSignedJARFileFinished(rv, mZipReader, mSignerCert);
   }
 
   const nsCOMPtr<nsIFile> mJarFile;
-  const nsCOMPtr<nsIOpenSignedJARFileCallback> mCallback;
+  nsMainThreadPtrHandle<nsIOpenSignedJARFileCallback> mCallback;
   nsCOMPtr<nsIZipReader> mZipReader; // out
   nsCOMPtr<nsIX509Cert3> mSignerCert; // out
 };
 
 } // unnamed namespace
 
 NS_IMETHODIMP
 nsNSSCertificateDB::OpenSignedJARFileAsync(