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
parent 89ed3b80bb
commit 583ff3811c
2 changed files with 8 additions and 1 deletions

View File

@ -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"));

View File

@ -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
{