зеркало из https://github.com/mozilla/gecko-dev.git
142310 - topcrash quitting while downloading @ nsHashTable::Exists. r=bryner sr=ben
This commit is contained in:
Родитель
a270823871
Коммит
deac412c42
|
@ -238,33 +238,28 @@ nsDownloadManager::GetDataSource(nsIRDFDataSource** aDataSource)
|
|||
nsresult
|
||||
nsDownloadManager::AssertProgressInfo()
|
||||
{
|
||||
// get the downloads container
|
||||
nsCOMPtr<nsIRDFContainer> downloads;
|
||||
nsresult rv = GetDownloadsContainer(getter_AddRefs(downloads));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// get the container's elements (nsIRDFResource's)
|
||||
nsCOMPtr<nsISimpleEnumerator> items;
|
||||
rv = downloads->GetElements(getter_AddRefs(items));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!mCurrDownloads)
|
||||
mCurrDownloads = new nsHashtable();
|
||||
|
||||
// enumerate the resources, use their ids to retrieve the corresponding
|
||||
// nsIDownloads from the hashtable (if they don't exist, the download isn't
|
||||
// a current transfer), get the items' progress information,
|
||||
// and assert it into the graph
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
const char* uri;
|
||||
nsCOMPtr<nsIRDFInt> intLiteral;
|
||||
|
||||
PRBool moreElements;
|
||||
items->HasMoreElements(&moreElements);
|
||||
for( ; moreElements; items->HasMoreElements(&moreElements)) {
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
items->GetNext(getter_AddRefs(supports));
|
||||
nsCOMPtr<nsIRDFResource> res = do_QueryInterface(supports);
|
||||
char* id;
|
||||
res->GetValue(&id);
|
||||
rv = AssertProgressInfoFor(id);
|
||||
gRDFService->GetIntLiteral(DOWNLOADING, getter_AddRefs(intLiteral));
|
||||
nsCOMPtr<nsISimpleEnumerator> downloads;
|
||||
nsresult rv = mDataSource->GetSources(gNC_DownloadState, intLiteral, PR_TRUE, getter_AddRefs(downloads));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRBool hasMoreElements;
|
||||
downloads->HasMoreElements(&hasMoreElements);
|
||||
|
||||
while (hasMoreElements) {
|
||||
downloads->GetNext(getter_AddRefs(supports));
|
||||
res = do_QueryInterface(supports);
|
||||
res->GetValueConst(&uri);
|
||||
AssertProgressInfoFor(uri);
|
||||
downloads->HasMoreElements(&hasMoreElements);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче