fix bug 120833 "default value of nsICacheEntryInfo::expirationTime should be PRUint32(-1)". r=gagan, sr=darin.

This commit is contained in:
gordon%netscape.com 2002-01-24 03:06:28 +00:00
parent a37be1e44f
commit 7cf5c26933
8 changed files with 9 additions and 8 deletions

View File

@ -211,7 +211,7 @@ PRBool imgCache::Get(nsIURI *aKey, PRBool aDoomIfExpired, imgRequest **aRequest,
if (aDoomIfExpired) {
PRUint32 expirationTime;
entry->GetExpirationTime(&expirationTime);
if (expirationTime && (expirationTime <= SecondsFromPRTime(PR_Now()))) {
if (expirationTime <= SecondsFromPRTime(PR_Now())) {
entry->Doom();
return PR_FALSE;
}

View File

@ -40,7 +40,7 @@ nsCacheEntry::nsCacheEntry(nsCString * key,
: mKey(key),
mFetchCount(0),
mLastFetched(0),
mExpirationTime(0),
mExpirationTime(NO_EXPIRATION_TIME),
mFlags(0),
mDataSize(0),
mMetaSize(0),

View File

@ -40,6 +40,8 @@ class nsCacheMetaData;
class nsCacheRequest;
class nsCacheEntryDescriptor;
#define NO_EXPIRATION_TIME 0xFFFFFFFF
/******************************************************************************
* nsCacheEntry
*******************************************************************************/

View File

@ -860,8 +860,7 @@ nsCacheService::ActivateEntry(nsCacheRequest * request,
if (entry &&
((request->AccessRequested() == nsICache::ACCESS_WRITE) ||
(entry->mExpirationTime &&
entry->mExpirationTime <= SecondsFromPRTime(PR_Now()) &&
(entry->mExpirationTime <= SecondsFromPRTime(PR_Now()) &&
request->WillDoomEntriesIfExpired())))
{
// this is FORCE-WRITE request or the entry has expired

View File

@ -326,7 +326,7 @@ int
nsMemoryCacheDevice::EvictionList(nsCacheEntry * entry, PRUint32 deltaSize)
{
PRUint32 size = entry->Size() + deltaSize;
if ((size > mEvictionThreshold) || (entry->ExpirationTime() != 0))
if ((size > mEvictionThreshold) || (entry->ExpirationTime() != NO_EXPIRATION_TIME))
return mostLikelyToEvict;
return leastLikelyToEvict;

View File

@ -743,7 +743,7 @@ nsHttpChannel::UpdateExpirationTime()
{
NS_ENSURE_TRUE(mResponseHead, NS_ERROR_FAILURE);
PRUint32 expirationTime = 1; // this can't be 0 unless bug 120833 is fixed
PRUint32 expirationTime = 0;
if (!mResponseHead->MustValidate()) {
PRUint32 freshnessLifetime = 0;
nsresult rv;

View File

@ -408,7 +408,7 @@ nsSound::PutSoundInCache(nsIChannel* inChannel, PRUint32 inDataSize, nsISupports
}
}
if (expirationTime == 0)
if (expirationTime == PRUint32(-1)) // no expiration time (never expires)
{
// set it to some reasonable default, like now + 24 hours
expirationTime = SecondsFromPRTime(PR_Now()) + 60 * 60 * 24;

View File

@ -408,7 +408,7 @@ nsSound::PutSoundInCache(nsIChannel* inChannel, PRUint32 inDataSize, nsISupports
}
}
if (expirationTime == 0)
if (expirationTime == PRUint32(-1)) // no expiration time (never expires)
{
// set it to some reasonable default, like now + 24 hours
expirationTime = SecondsFromPRTime(PR_Now()) + 60 * 60 * 24;