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

This commit is contained in:
Fedor 2020-05-07 14:44:55 +03:00
parent 7c52cc8e7f
commit 57d94700ac
1 changed files with 4 additions and 1 deletions

View File

@ -1847,6 +1847,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);
@ -3124,7 +3127,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);
}