Bug 644431 - Fix for Adobe PDF Files Larger than 5 MB Won't Load in browser. r=bz, a2.0=dveditz
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -1844,16 +1844,17 @@ nsCacheService::EnsureEntryHasDevice(nsC
// this is the default
if (!mDiskDevice) {
(void)CreateDiskDevice(); // ignore the error (check for mDiskDevice instead)
}
if (mDiskDevice) {
// Bypass the cache if Content-Length says the entry will be too big
if (predictedDataSize != -1 &&
+ entry->StoragePolicy() != nsICache::STORE_ON_DISK_AS_FILE &&
mDiskDevice->EntryIsTooBig(predictedDataSize)) {
nsresult rv = nsCacheService::DoomEntry(entry);
NS_ASSERTION(NS_SUCCEEDED(rv),"DoomEntry() failed.");
return nsnull;
}
entry->MarkBinding(); // enter state of binding
nsresult rv = mDiskDevice->BindEntry(entry);
--- a/netwerk/cache/nsDiskCacheDevice.cpp
+++ b/netwerk/cache/nsDiskCacheDevice.cpp
@@ -779,18 +779,20 @@ nsDiskCacheDevice::OnDataSizeChange(nsCa
if (!binding) return NS_ERROR_UNEXPECTED;
NS_ASSERTION(binding->mRecord.ValidRecord(), "bad record");
PRUint32 newSize = entry->DataSize() + deltaSize;
PRUint32 newSizeK = ((newSize + 0x3FF) >> 10);
// If the new size is larger than max. file size or larger than
- // 1/8 the cache capacity (which is in KiB's), doom the entry and abort
- if (EntryIsTooBig(newSize)) {
+ // 1/8 the cache capacity (which is in KiB's), and the entry has
+ // not been marked for file storage, doom the entry and abort.
+ if (EntryIsTooBig(newSize) &&
+ entry->StoragePolicy() != nsICache::STORE_ON_DISK_AS_FILE) {
#ifdef DEBUG
nsresult rv =
#endif
nsCacheService::DoomEntry(entry);
NS_ASSERTION(NS_SUCCEEDED(rv),"DoomEntry() failed.");
return NS_ERROR_ABORT;
}