From 43963449c6ce80b6a427a82b0ef4e46c81dd5114 Mon Sep 17 00:00:00 2001 From: "davidm%netscape.com" Date: Sun, 7 May 2000 05:38:02 +0000 Subject: [PATCH] 37071 Crash while downloading anything 37353 browser segfaults on page loading --- netwerk/cache/filecache/nsNetDiskCache.cpp | 15 +++------------ netwerk/cache/mgr/nsCachedNetData.cpp | 5 +++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/netwerk/cache/filecache/nsNetDiskCache.cpp b/netwerk/cache/filecache/nsNetDiskCache.cpp index 36e1cd1cc06..a8380a2e3ae 100644 --- a/netwerk/cache/filecache/nsNetDiskCache.cpp +++ b/netwerk/cache/filecache/nsNetDiskCache.cpp @@ -472,7 +472,7 @@ nsNetDiskCache::GetCachedNetDataByID(PRInt32 RecordID, nsINetDataCacheRecord **_ return rv; } - NS_ERROR("Error: RecordID not in DB\n"); + NS_WARNING("Error: RecordID not in DB\n"); DBRecovery(); return rv; } @@ -751,18 +751,9 @@ nsNetDiskCache::DBRecovery(void) // False since we want to delete a file rather than recursively delete a directory - mDBFile->Delete(PR_FALSE) ; - - // make sure it's not there any more - // DJM shouldn't we just check the return value? + rv = mDBFile->Delete(PR_FALSE) ; + if (NS_FAILED ( rv ) ) return rv; - PRBool exists =PR_FALSE; - mDBFile->Exists( &exists ); - - if(exists) { - NS_ERROR("can't remove old db.") ; - return NS_ERROR_FAILURE ; - } // reinitilize DB return InitDB() ; diff --git a/netwerk/cache/mgr/nsCachedNetData.cpp b/netwerk/cache/mgr/nsCachedNetData.cpp index 49c6599e70b..73a94bfea68 100644 --- a/netwerk/cache/mgr/nsCachedNetData.cpp +++ b/netwerk/cache/mgr/nsCachedNetData.cpp @@ -1029,8 +1029,9 @@ nsresult nsCachedNetData::Evict(PRUint32 aTruncatedContentLength) { nsCOMPtr record; - GetRecord(getter_AddRefs(record)); - + nsresult rv = GetRecord(getter_AddRefs(record)); + if ( NS_FAILED( rv ) ) return rv; + if ( record.get() == NULL ) return NS_ERROR_FAILURE; // Tell observers about the eviction, so that they can release their // references to this cache object. Notify(nsIStreamAsFileObserver::REQUEST_DELETION, NS_OK);