Bug 491873 - Crash [@ nsFtpState::CanReadCacheEntry] with cursor that points to ftp and going offline

This commit is contained in:
Michal Novotny 2009-07-22 15:05:52 +02:00
Родитель c899d75f14
Коммит d7636b9a33
1 изменённых файлов: 18 добавлений и 11 удалений

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

@ -2010,13 +2010,16 @@ nsFtpState::OnCacheEntryAvailable(nsICacheEntryDescriptor *entry,
if (IsClosed())
return NS_OK;
mDoomCache = PR_TRUE;
mCacheEntry = entry;
if (CanReadCacheEntry() && ReadCacheEntry()) {
mState = FTP_READ_CACHE;
} else {
Connect();
if (NS_SUCCEEDED(status) && entry) {
mDoomCache = PR_TRUE;
mCacheEntry = entry;
if (CanReadCacheEntry() && ReadCacheEntry()) {
mState = FTP_READ_CACHE;
return NS_OK;
}
}
Connect();
return NS_OK;
}
@ -2207,15 +2210,19 @@ nsFtpState::CheckCache()
// Try to open a cache entry immediately, but if the cache entry is busy,
// then wait for it to be available.
session->OpenCacheEntry(key, accessReq, PR_FALSE,
getter_AddRefs(mCacheEntry));
if (mCacheEntry) {
nsresult rv = session->OpenCacheEntry(key, accessReq, PR_FALSE,
getter_AddRefs(mCacheEntry));
if (NS_SUCCEEDED(rv) && mCacheEntry) {
mDoomCache = PR_TRUE;
return PR_FALSE; // great, we're ready to proceed!
}
nsresult rv = session->AsyncOpenCacheEntry(key, accessReq, this);
return NS_SUCCEEDED(rv);
if (rv == NS_ERROR_CACHE_WAIT_FOR_VALIDATION) {
rv = session->AsyncOpenCacheEntry(key, accessReq, this);
return NS_SUCCEEDED(rv);
}
return PR_FALSE;
}
nsresult