2
modules/libjar/nsJAR.cpp | 12 +++++++++++-
3
modules/libjar/nsJAR.h | 5 +++++
4
2 files changed, 16 insertions(+), 1 deletion(-)
6
## 35_zip_cache.patch converted from dpatch file initially by Mike Hommey <glandium@debian.org>
8
# Invalidate cache for a zip file that got modified. It will prevent
9
# corruption of the XUL FastLoad cache when upgrade is performed
10
# while an instance of the application is running. bz#368428.
12
Index: iceape-1.1.4/modules/libjar/nsJAR.cpp
13
===================================================================
14
--- iceape-1.1.4.orig/modules/libjar/nsJAR.cpp
15
+++ iceape-1.1.4/modules/libjar/nsJAR.cpp
17
//----------------------------------------------
18
// nsIZipReader implementation
19
//----------------------------------------------
22
nsJAR::Init(nsIFile* zipFile)
25
+ zipFile->GetLastModifiedTime(&mMtime);
27
return mLock ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
31
nsJAR::GetFile(nsIFile* *result)
34
@@ -1211,25 +1212,34 @@
35
#ifdef ZIP_CACHE_HIT_RATE
40
rv = zipFile->GetNativePath(path);
41
if (NS_FAILED(rv)) return rv;
44
+ rv = zipFile->GetLastModifiedTime(&Mtime);
45
+ if (NS_FAILED(rv)) return rv;
47
nsCStringKey key(path);
48
nsJAR* zip = NS_STATIC_CAST(nsJAR*, NS_STATIC_CAST(nsIZipReader*,mZips.Get(&key))); // AddRefs
50
+ if (zip && LL_EQ(Mtime, zip->GetMtime())) {
51
#ifdef ZIP_CACHE_HIT_RATE
54
zip->ClearReleaseTime();
64
return NS_ERROR_OUT_OF_MEMORY;
66
zip->SetZipReaderCache(this);
68
rv = zip->Init(zipFile);
70
Index: iceape-1.1.4/modules/libjar/nsJAR.h
71
===================================================================
72
--- iceape-1.1.4.orig/modules/libjar/nsJAR.h
73
+++ iceape-1.1.4/modules/libjar/nsJAR.h
75
void ClearReleaseTime() {
76
mReleaseTime = PR_INTERVAL_NO_TIMEOUT;
79
void SetZipReaderCache(nsZipReaderCache* cache) {
83
+ PRInt64 GetMtime() {
87
PRFileDesc* OpenFile();
89
//-- Private data members
90
nsCOMPtr<nsIFile> mZipFile; // The zip/jar file on disk
91
nsZipArchive mZip; // The underlying zip archive
92
nsObjectHashtable mManifestData; // Stores metadata for each entry
93
PRBool mParsedManifest; // True if manifest has been parsed
94
nsCOMPtr<nsIPrincipal> mPrincipal; // The entity which signed this file
95
PRInt16 mGlobalStatus; // Global signature verification status
96
PRIntervalTime mReleaseTime; // used by nsZipReaderCache for flushing entries
97
nsZipReaderCache* mCache; // if cached, this points to the cache it's contained in
99
PRInt32 mTotalItemsInManifest;
103
//-- Private functions
104
nsresult ParseManifest(nsISignatureVerifier* verifier);
105
void ReportError(const char* aFilename, PRInt16 errorCode);
106
nsresult LoadEntry(const char* aFilename, char** aBuf,
107
PRUint32* aBufLen = nsnull);
108
PRInt32 ReadLine(const char** src);
109
nsresult ParseOneFile(nsISignatureVerifier* verifier,