fixes bug 229984 "HTTP download of over 64MB causes disk cache to break" r=gordon sr=bzbarsky

git-svn-id: svn://10.0.0.236/trunk@153242 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
darin%meer.net
2004-02-25 23:01:08 +00:00
parent 1ab0548688
commit 8129f62db0
2 changed files with 7 additions and 5 deletions

View File

@@ -676,10 +676,11 @@ nsDiskCacheDevice::OnDataSizeChange(nsCacheEntry * entry, PRInt32 deltaSize)
NS_ASSERTION(binding->mRecord.ValidRecord(), "bad record");
PRUint32 newSize = entry->DataSize() + deltaSize;
if (newSize > mCacheCapacity) {
PRUint32 maxSize = PR_MIN(mCacheCapacity / 2, kMaxDataFileSize);
if (newSize > maxSize) {
nsresult rv = nsCacheService::DoomEntry(entry);
NS_ASSERTION(NS_SUCCEEDED(rv),"DoomEntry() failed.");
return rv;
return NS_ERROR_ABORT;
}
PRUint32 sizeK = ((entry->DataSize() + 0x03FF) >> 10); // round up to next 1k

View File

@@ -61,14 +61,15 @@ struct nsDiskCacheEntry;
* 2 = 1k block file
* 3 = 4k block file
*
* eFileSizeMask note: Files larger than 64 Mb have zero size stored in the
* eFileSizeMask note: Files larger than 64 MiB have zero size stored in the
* location. The file itself must be examined to determine
* its actual size.
* its actual size. (XXX This is broken in places -darin)
*
*****************************************************************************/
#define BLOCK_SIZE_FOR_INDEX(index) ((index) ? (256 << (2 * ((index) - 1))) : 0)
#define kSeparateFile 0
#define kSeparateFile 0
#define kMaxDataFileSize 0x4000000 // 64 MiB
class nsDiskCacheRecord {