Bug 567360: Don't call UpdateExpirationTime if mRequestTime isn't set r=bzbarsky

--HG--
extra : rebase_source : e41a600f48ea9fb602f99b31d6110b42c4ee2513
This commit is contained in:
Byron Milligan 2010-08-02 13:24:18 -07:00
Родитель 21282ea00f
Коммит 23110d4462
2 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -107,6 +107,7 @@ nsHttpChannel::nsHttpChannel()
, mFallingBack(PR_FALSE)
, mWaitingForRedirectCallback(PR_FALSE)
, mRemoteChannel(PR_FALSE)
, mRequestTimeInitialized(PR_FALSE)
{
LOG(("Creating nsHttpChannel [this=%p]\n", this));
}
@ -520,6 +521,7 @@ nsHttpChannel::SetupTransaction()
// set the request time for cache expiration calculations
mRequestTime = NowInSeconds();
mRequestTimeInitialized = PR_TRUE;
// if doing a reload, force end-to-end
if (mLoadFlags & LOAD_BYPASS_CACHE) {
@ -3708,8 +3710,10 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult st
mStatus = status;
// perform any final cache operations before we close the cache entry.
if (mCacheEntry && (mCacheAccess & nsICache::ACCESS_WRITE))
if (mCacheEntry && (mCacheAccess & nsICache::ACCESS_WRITE) &&
mRequestTimeInitialized){
FinalizeCacheEntry();
}
if (mListener) {
LOG((" calling OnStopRequest\n"));

Просмотреть файл

@ -326,6 +326,9 @@ private:
PRUint32 mWaitingForRedirectCallback : 1;
// True iff this channel is servicing a remote HttpChannelChild
PRUint32 mRemoteChannel : 1;
// True if mRequestTime has been set. In such a case it is safe to update
// the cache entry's expiration time. Otherwise, it is not(see bug 567360).
PRUint32 mRequestTimeInitialized : 1;
class nsContentEncodings : public nsIUTF8StringEnumerator
{