fix "Download Link Target" results in bad download for large MP3 file. b=281648 sr=pinkerton

git-svn-id: svn://10.0.0.236/trunk@170215 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
joshmoz%gmail.com
2005-03-05 18:34:12 +00:00
parent 201efabc25
commit 48fdfef822

View File

@@ -55,6 +55,8 @@
#include "nsIDOMHTMLDocument.h"
#include "nsIMIMEHeaderParam.h"
#include "nsIDownload.h"
#include "nsIExternalHelperAppService.h"
#include "nsCExternalHandlerService.h"
const char* const persistContractID = "@mozilla.org/embedding/browser/nsWebBrowserPersist;1";
@@ -107,6 +109,8 @@ nsHeaderSniffer::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aReques
httpChannel->GetResponseHeader(nsCAutoString("content-disposition"), mContentDisposition);
mPersist->CancelSave();
mPersist = nsnull;
PRBool exists;
mTmpFile->Exists(&exists);
if (exists)
@@ -374,8 +378,8 @@ nsresult nsHeaderSniffer::InitiateDownload(nsISupports* inSourceData, nsString&
webPersist->SetPersistFlags(flags);
if (sourceURI)
{ // Tell web persist we want no decoding on this data
flags |= nsIWebBrowserPersist::PERSIST_FLAGS_NO_CONVERSION;
{
flags |= nsIWebBrowserPersist::PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
webPersist->SetPersistFlags(flags);
rv = webPersist->SaveURI(sourceURI, nsnull, nsnull, mPostData, nsnull, destURI);
}