From d241795247ce50f3f1c87490b8c3955db914ba5b Mon Sep 17 00:00:00 2001 From: "gavin%gavinsharp.com" Date: Tue, 30 Oct 2007 18:31:50 +0000 Subject: [PATCH] Bug 401430: download manager 'add to recent docs' functionality (Windows) isn't working, r=sdwilsh --- toolkit/components/downloads/src/nsDownloadManager.cpp | 4 +++- .../downloads/test/unit/head_download_manager.js | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/toolkit/components/downloads/src/nsDownloadManager.cpp b/toolkit/components/downloads/src/nsDownloadManager.cpp index 56d9d83e8c9..b76b37045b6 100644 --- a/toolkit/components/downloads/src/nsDownloadManager.cpp +++ b/toolkit/components/downloads/src/nsDownloadManager.cpp @@ -1828,7 +1828,9 @@ nsDownload::SetState(DownloadState aState) nsCOMPtr fileURL = do_QueryInterface(mTarget); nsCOMPtr file; nsAutoString path; - if (fileURL && fileURL->GetFile(getter_AddRefs(file)) && file && + if (fileURL && + NS_SUCCEEDED(fileURL->GetFile(getter_AddRefs(file))) && + file && NS_SUCCEEDED(file->GetPath(path))) { PRUnichar *filePath = ToNewUnicode(path); LPITEMIDLIST lpItemIDList = NULL; diff --git a/toolkit/components/downloads/test/unit/head_download_manager.js b/toolkit/components/downloads/test/unit/head_download_manager.js index ff40635b043..5413be9941a 100644 --- a/toolkit/components/downloads/test/unit/head_download_manager.js +++ b/toolkit/components/downloads/test/unit/head_download_manager.js @@ -106,7 +106,12 @@ function cleanup() } var gDownloadCount = 0; -function addDownload() +/** + * Adds a download to the DM, and starts it. + * @param aResultFileName (optional): the leafName of the download's target + * file. + */ +function addDownload(aResultFileName) { const nsIWBP = Ci.nsIWebBrowserPersist; var persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"] @@ -116,7 +121,7 @@ function addDownload() nsIWBP.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION; var destFile = dirSvc.get("ProfD", Ci.nsIFile); - destFile.append("download.result"); + destFile.append(aResultFileName || "download.result"); var srcFile = dirSvc.get("ProfD", Ci.nsIFile); srcFile.append("LICENSE");