Bug 644431 - Adobe PDF Files Larger than 5 MB Won't Load in Browser. r=bz
authorJim Mathies <jmathies@mozilla.com>
Fri, 08 Apr 2011 12:53:55 -0700
changeset 67725 ab290352e31698ddee5f352031157e6edb86edba
parent 67724 473ec8c05215f2ed6c1dd8e4c1084cb680cc7a68
child 67726 2982dbd4d61bf93f9aeba589516ea441a12fd435
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs644431
milestone2.2a1pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 644431 - Adobe PDF Files Larger than 5 MB Won't Load in Browser. r=bz
netwerk/cache/nsCacheService.cpp
netwerk/cache/nsDiskCacheDevice.cpp
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -1822,16 +1822,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
@@ -780,18 +780,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;
     }