From 61a1601fb58af7ebd33577bbfe084319689dd63c Mon Sep 17 00:00:00 2001 From: "edward.lee%engineering.uiuc.edu" Date: Sun, 14 Oct 2007 00:57:34 +0000 Subject: [PATCH] Bug 397380 - Clear the temp file path upon successful completion of the download. r=sdwilsh, a=mconnor git-svn-id: svn://10.0.0.236/trunk@237727 18797224-902f-48f8-a5cc-f745e15eee43 --- .../downloads/src/nsDownloadManager.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp b/mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp index 97bc6ce4ce4..bb6bedc1fd5 100644 --- a/mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp +++ b/mozilla/toolkit/components/downloads/src/nsDownloadManager.cpp @@ -721,9 +721,9 @@ nsDownloadManager::Init() rv = mDBConn->CreateStatement(NS_LITERAL_CSTRING( "UPDATE moz_downloads " - "SET startTime = ?1, endTime = ?2, state = ?3, referrer = ?4, " - "entityID = ?5, currBytes = ?6, maxBytes = ?7 " - "WHERE id = ?8"), getter_AddRefs(mUpdateDownloadStatement)); + "SET tempPath = ?1, startTime = ?2, endTime = ?3, state = ?4, " + "referrer = ?5, entityID = ?6, currBytes = ?7, maxBytes = ?8 " + "WHERE id = ?9"), getter_AddRefs(mUpdateDownloadStatement)); NS_ENSURE_SUCCESS(rv, rv); // Do things *after* initializing various download manager properties such as @@ -2039,6 +2039,7 @@ nsDownload::Finalize() // Reset values that aren't needed anymore, so the DB can be updated as well mEntityID.Truncate(); + mTempFile = nsnull; // Remove ourself from the active downloads (void)mDownloadManager->mCurrentDownloads.RemoveObject(this); @@ -2299,8 +2300,14 @@ nsDownload::UpdateDB() mozIStorageStatement *stmt = mDownloadManager->mUpdateDownloadStatement; PRInt32 i = 0; + // tempPath + nsAutoString tempPath; + if (mTempFile) + (void)mTempFile->GetPath(tempPath); + nsresult rv = stmt->BindStringParameter(i++, tempPath); + // startTime - nsresult rv = stmt->BindInt64Parameter(i++, mStartTime); + rv = stmt->BindInt64Parameter(i++, mStartTime); NS_ENSURE_SUCCESS(rv, rv); // endTime