fixes bug 136210 "cannot view any https urls when memory cache size is set to 0"

r=beard sr=rpotts


git-svn-id: svn://10.0.0.236/trunk@122574 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
darin%netscape.com
2002-06-03 20:05:53 +00:00
parent a36ee39e7c
commit 69fdc31f3f
2 changed files with 22 additions and 14 deletions

View File

@@ -562,22 +562,26 @@ nsCacheService::IsStorageEnabledForPolicy(nsCacheStoragePolicy storagePolicy,
{
if (gService == nsnull) return NS_ERROR_NOT_AVAILABLE;
nsAutoLock lock(gService->mCacheServiceLock);
if (gService->mEnableMemoryDevice &&
*result = gService->IsStorageEnabledForPolicy_Locked(storagePolicy);
return NS_OK;
}
PRBool
nsCacheService::IsStorageEnabledForPolicy_Locked(nsCacheStoragePolicy storagePolicy)
{
if (mEnableMemoryDevice &&
(storagePolicy == nsICache::STORE_ANYWHERE ||
storagePolicy == nsICache::STORE_IN_MEMORY)) {
*result = PR_TRUE;
return PR_TRUE;
}
else if (gService->mEnableDiskDevice &&
(storagePolicy == nsICache::STORE_ANYWHERE ||
storagePolicy == nsICache::STORE_ON_DISK ||
storagePolicy == nsICache::STORE_ON_DISK_AS_FILE)) {
*result = PR_TRUE;
} else {
*result = PR_FALSE;
if (mEnableDiskDevice &&
(storagePolicy == nsICache::STORE_ANYWHERE ||
storagePolicy == nsICache::STORE_ON_DISK ||
storagePolicy == nsICache::STORE_ON_DISK_AS_FILE)) {
return PR_TRUE;
}
return NS_OK;
return PR_FALSE;
}
@@ -839,9 +843,11 @@ nsCacheService::ActivateEntry(nsCacheRequest * request,
if (result) *result = nsnull;
if ((!request) || (!result)) return NS_ERROR_NULL_POINTER;
if (!mEnableMemoryDevice && (!mEnableDiskDevice || !request->IsStreamBased() ))
// check if the request can be satisfied
if (!mEnableMemoryDevice && !request->IsStreamBased())
return NS_ERROR_FAILURE;
if (!IsStorageEnabledForPolicy_Locked(request->StoragePolicy()))
return NS_ERROR_FAILURE;
// search active entries (including those not bound to device)
nsCacheEntry *entry = mActiveEntries.GetEntry(request->mKey);

View File

@@ -164,6 +164,8 @@ private:
void ClearActiveEntries(void);
void DoomActiveEntries(void);
PRBool IsStorageEnabledForPolicy_Locked(nsCacheStoragePolicy policy);
static
PLDHashOperator PR_CALLBACK DeactivateAndClearEntry(PLDHashTable * table,
PLDHashEntryHdr * hdr,