Properly fix crash in nsDownloadManager when repeatedly pausing and resuming a download

This applies only to applications that do not use JSDownloads and is based on Bug 1224326
This commit is contained in:
Matt A. Tobin 2020-03-29 05:06:50 -04:00 committed by Roy Tam
commit 248573ed91

View file

@ -1829,6 +1829,9 @@ nsDownloadManager::RetryDownload(nsDownload* dl)
return rv;
}
rv = NotifyDownloadRemoval(dl);
NS_ENSURE_SUCCESS(rv, rv);
// reset time and download progress
dl->SetStartTime(PR_Now());
dl->SetProgressBytes(0, -1);
@ -3083,7 +3086,7 @@ nsDownload::OnStateChange(nsIWebProgress *aWebProgress,
#else
(void)SetState(nsIDownloadManager::DOWNLOAD_FINISHED);
#endif
} else {
} else if (aStatus != NS_BINDING_ABORTED) {
// We failed for some unknown reason -- fail with a generic message
(void)FailDownload(aStatus, nullptr);
}