diff --git a/mozilla/xpfe/components/download-manager/src/nsDownloadManager.cpp b/mozilla/xpfe/components/download-manager/src/nsDownloadManager.cpp index a97d1c2fd49..c29b544bdbe 100644 --- a/mozilla/xpfe/components/download-manager/src/nsDownloadManager.cpp +++ b/mozilla/xpfe/components/download-manager/src/nsDownloadManager.cpp @@ -623,6 +623,49 @@ nsDownloadManager::RemoveDownload(const char* aPath) nsCOMPtr res; gRDFService->GetResource(aPath, getter_AddRefs(res)); + // remove all the arcs for this resource, and then remove it from the Seq + nsCOMPtr 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 supports; + rv = arcs->GetNext(getter_AddRefs(supports)); + if (NS_FAILED(rv)) return rv; + + nsCOMPtr arc(do_QueryInterface(supports, &rv)); + if (NS_FAILED(rv)) return rv; + + nsCOMPtr 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 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)