Bug 451991 - nsIProgressEventSink::OnProgress reports wrong values when uploading, r+sr=biesi

This commit is contained in:
Olli Pettay 2008-09-10 13:06:06 +03:00
parent ef06fa9b7b
commit d9a98bcf71
2 changed files with 10 additions and 1 deletions

View File

@ -4601,8 +4601,10 @@ nsHttpChannel::OnTransportStatus(nsITransport *trans, nsresult status,
mProgressSink->OnStatus(this, nsnull, status,
NS_ConvertUTF8toUTF16(host).get());
if (progress > 0)
if (progress > 0) {
NS_ASSERTION(progress <= progressMax, "unexpected progress values");
mProgressSink->OnProgress(this, nsnull, progress, progressMax);
}
}
#ifdef DEBUG
else

View File

@ -366,6 +366,13 @@ nsHttpTransaction::OnTransportStatus(nsresult status, PRUint64 progress)
if (!mHasRequestBody)
return;
nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mRequestStream);
NS_ASSERTION(seekable, "Request stream isn't seekable?!?");
PRInt64 prog = 0;
seekable->Tell(&prog);
progress = prog;
// when uploading, we include the request headers in the progress
// notifications.
progressMax = mRequestSize; // XXX mRequestSize is 32-bit!