Bug 1207864 - Fix nsWebBrowserPersist's onStateChange callback in error cases. r=billm

This commit is contained in:
Jed Davis 2015-10-07 12:49:53 -07:00
parent 2f682a1b2b
commit 7938778ece

View File

@ -2299,6 +2299,12 @@ nsWebBrowserPersist::FinishDownload()
void
nsWebBrowserPersist::EndDownload(nsresult aResult)
{
// Store the error code in the result if it is an error
if (NS_SUCCEEDED(mPersistResult) && NS_FAILED(aResult))
{
mPersistResult = aResult;
}
// State stop notification
if (mProgressListener) {
mProgressListener->OnStateChange(nullptr, nullptr,
@ -2306,12 +2312,6 @@ nsWebBrowserPersist::EndDownload(nsresult aResult)
| nsIWebProgressListener::STATE_IS_NETWORK, mPersistResult);
}
// Store the error code in the result if it is an error
if (NS_SUCCEEDED(mPersistResult) && NS_FAILED(aResult))
{
mPersistResult = aResult;
}
// Do file cleanup if required
if (NS_FAILED(aResult) && (mPersistFlags & PERSIST_FLAGS_CLEANUP_ON_FAILURE))
{