142824 - downloads.rdf keeps on growing. patch by jrgm@netscape.com. r=blake sr=ben
git-svn-id: svn://10.0.0.236/trunk@123599 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -623,6 +623,49 @@ nsDownloadManager::RemoveDownload(const char* aPath)
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
gRDFService->GetResource(aPath, getter_AddRefs(res));
|
||||
|
||||
// remove all the arcs for this resource, and then remove it from the Seq
|
||||
nsCOMPtr<nsISimpleEnumerator> arcs;
|
||||
rv = mDataSource->ArcLabelsOut(res, getter_AddRefs(arcs));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRBool moreArcs;
|
||||
rv = arcs->HasMoreElements(&moreArcs);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
while (moreArcs) {
|
||||
nsCOMPtr<nsISupports> supports;
|
||||
rv = arcs->GetNext(getter_AddRefs(supports));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFResource> arc(do_QueryInterface(supports, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> targets;
|
||||
rv = mDataSource->GetTargets(res, arc, PR_TRUE, getter_AddRefs(targets));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRBool moreTargets;
|
||||
rv = targets->HasMoreElements(&moreTargets);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
while (moreTargets) {
|
||||
rv = targets->GetNext(getter_AddRefs(supports));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFNode> target(do_QueryInterface(supports, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// and now drop this assertion from the graph
|
||||
rv = mDataSource->Unassert(res, arc, target);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = targets->HasMoreElements(&moreTargets);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
rv = arcs->HasMoreElements(&moreArcs);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
PRInt32 itemIndex;
|
||||
downloads->IndexOf(res, &itemIndex);
|
||||
if (itemIndex <= 0)
|
||||
|
||||
Reference in New Issue
Block a user