From 8ba48c051d84ec955949b9e85d557337c2f2c16b Mon Sep 17 00:00:00 2001 From: "bbaetz%cs.mcgill.ca" Date: Wed, 18 Jul 2001 23:37:17 +0000 Subject: [PATCH] This fixes two small problems that may cause pages being partially loaded. 82720. The first problem addresses new cache entries being created when access to the entry is readonly. The second fix was to a badly placed assertion. Patch by gordon, r=bbaetz, sr=dougt. git-svn-id: svn://10.0.0.236/trunk@99543 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/netwerk/cache/src/nsCacheService.cpp | 11 ++++++----- mozilla/netwerk/cache/src/nsMemoryCacheDevice.cpp | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mozilla/netwerk/cache/src/nsCacheService.cpp b/mozilla/netwerk/cache/src/nsCacheService.cpp index dd60fb3267a..c152d45b016 100644 --- a/mozilla/netwerk/cache/src/nsCacheService.cpp +++ b/mozilla/netwerk/cache/src/nsCacheService.cpp @@ -833,11 +833,6 @@ nsCacheService::ActivateEntry(nsCacheRequest * request, } else { ++mCacheMisses; } - if (!entry && !(request->AccessRequested() & nsICache::ACCESS_WRITE)) { - // this is a READ-ONLY request - rv = NS_ERROR_CACHE_KEY_NOT_FOUND; - goto error; - } if (entry && ((request->AccessRequested() == nsICache::ACCESS_WRITE) || @@ -854,6 +849,12 @@ nsCacheService::ActivateEntry(nsCacheRequest * request, } if (!entry) { + if (! (request->AccessRequested() & nsICache::ACCESS_WRITE)) { + // this is a READ-ONLY request + rv = NS_ERROR_CACHE_KEY_NOT_FOUND; + goto error; + } + entry = new nsCacheEntry(request->mKey, request->IsStreamBased(), request->StoragePolicy()); diff --git a/mozilla/netwerk/cache/src/nsMemoryCacheDevice.cpp b/mozilla/netwerk/cache/src/nsMemoryCacheDevice.cpp index 0c9f58f6b2f..ecd5cf9c955 100644 --- a/mozilla/netwerk/cache/src/nsMemoryCacheDevice.cpp +++ b/mozilla/netwerk/cache/src/nsMemoryCacheDevice.cpp @@ -164,10 +164,10 @@ nsMemoryCacheDevice::DeactivateEntry(nsCacheEntry * entry) nsresult nsMemoryCacheDevice::BindEntry(nsCacheEntry * entry) { - NS_ASSERTION(PR_CLIST_IS_EMPTY(entry),"entry is already on a list!"); - if (!entry->IsDoomed()) { - // append entry to the eviction list + NS_ASSERTION(PR_CLIST_IS_EMPTY(entry),"entry is already on a list!"); + + // append entry to the eviction list PR_APPEND_LINK(entry, &mEvictionList[EvictionList(entry, 0)]); // add entry to hashtable of mem cache entries