зеркало из https://github.com/mozilla/pjs.git
fix bug 120833 "default value of nsICacheEntryInfo::expirationTime should be PRUint32(-1)". r=gagan, sr=darin.
This commit is contained in:
Родитель
02df8cc322
Коммит
7687c13e73
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -40,6 +40,8 @@ class nsCacheMetaData;
|
|||
class nsCacheRequest;
|
||||
class nsCacheEntryDescriptor;
|
||||
|
||||
#define NO_EXPIRATION_TIME 0xFFFFFFFF
|
||||
|
||||
/******************************************************************************
|
||||
* nsCacheEntry
|
||||
*******************************************************************************/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче