From df0b2421b8762f77c751cd3ab749aa24eb993f6d Mon Sep 17 00:00:00 2001 From: "timeless@mozdev.org" Date: Sun, 1 Mar 2009 17:06:55 -0800 Subject: [PATCH] Bug 400322 "ASSERTION: nsStandardURL not thread-safe" (nsJARInputThunk marked as threadsafe uses nsJARURI in a non threadsafe manner), r+sr=biesi --- modules/libjar/nsJARChannel.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/libjar/nsJARChannel.cpp b/modules/libjar/nsJARChannel.cpp index 73914dfae09..a943bbd6f7e 100644 --- a/modules/libjar/nsJARChannel.cpp +++ b/modules/libjar/nsJARChannel.cpp @@ -90,11 +90,15 @@ public: nsIZipReaderCache *jarCache) : mJarCache(jarCache) , mJarFile(jarFile) - , mFullJarURI(fullJarURI) , mJarEntry(jarEntry) , mContentLength(-1) { NS_ASSERTION(mJarFile, "no jar file"); + + if (fullJarURI) { + nsresult rv = fullJarURI->GetAsciiSpec(mJarDirSpec); + NS_ASSERTION(NS_SUCCEEDED(rv), "this shouldn't fail"); + } } virtual ~nsJARInputThunk() @@ -120,7 +124,7 @@ private: nsCOMPtr mJarCache; nsCOMPtr mJarReader; nsCOMPtr mJarFile; - nsCOMPtr mFullJarURI; + nsCString mJarDirSpec; nsCOMPtr mJarStream; nsCString mJarEntry; PRInt32 mContentLength; @@ -150,11 +154,9 @@ nsJARInputThunk::EnsureJarStream() // A directory stream also needs the Spec of the FullJarURI // because is included in the stream data itself. - nsCAutoString jarDirSpec; - rv = mFullJarURI->GetAsciiSpec(jarDirSpec); - if (NS_FAILED(rv)) return rv; + NS_ENSURE_STATE(!mJarDirSpec.IsEmpty()); - rv = mJarReader->GetInputStreamWithSpec(jarDirSpec, + rv = mJarReader->GetInputStreamWithSpec(mJarDirSpec, mJarEntry.get(), getter_AddRefs(mJarStream)); }