Bug 689008: Part 2 - Fix the cache issue; r=michal

This commit is contained in:
Masatoshi Kimura 2011-10-26 08:52:27 -04:00
Родитель 3c613cc455
Коммит b17a5ec2d2
1 изменённых файлов: 19 добавлений и 1 удалений

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

@ -4298,8 +4298,26 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult st
mListenerContext = 0;
}
if (mCacheEntry)
if (mCacheEntry) {
bool asFile = false;
if (mInitedCacheEntry && !mCachedContentIsPartial &&
(NS_SUCCEEDED(mStatus) || contentComplete) &&
(mCacheAccess & nsICache::ACCESS_WRITE) &&
NS_SUCCEEDED(GetCacheAsFile(&asFile)) && asFile) {
// We can allow others access to the cache entry
// because we don't write to the cache anymore.
// CloseCacheEntry may not actually close the cache
// entry immediately because someone (such as XHR2
// blob response) may hold the token to the cache
// entry. So we mark the cache valid here.
// We also need to check the entry is stored as file
// because we write to the cache asynchronously when
// it isn't stored in the file and it isn't completely
// written to the disk yet.
mCacheEntry->MarkValid();
}
CloseCacheEntry(!contentComplete);
}
if (mOfflineCacheEntry)
CloseOfflineCacheEntry();