Bug 644431 - Fix for Adobe PDF Files Larger than 5 MB Won't Load in browser. r=bz, a2.0=dveditz
authorJim Mathies <jmathies@mozilla.com>
Wed, 13 Apr 2011 13:34:14 -0500
changeset 63427 ff4efbda1b47b4f4e34ebd81ea00afd5dfc184f7
parent 63426 ceab2e4a52b5d67a189a648568e9c57eef1d8a93
child 63428 baa7f07fab91effb177209a4f6e7c11522300df5
push id69
push userjmathies@mozilla.com
push dateWed, 13 Apr 2011 18:34:31 +0000
reviewersbz
bugs644431
milestone2.0.1pre
Bug 644431 - Fix for Adobe PDF Files Larger than 5 MB Won't Load in browser. r=bz, a2.0=dveditz
netwerk/cache/nsCacheService.cpp
netwerk/cache/nsDiskCacheDevice.cpp
--- 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;
     }