Bug 617699 nsDOMFileReader::DispatchProgressEvent compares PRUint64 mReadTotal >= 0, r+a=sicking

This commit is contained in:
timeless@mozdev.org 2010-12-08 17:23:00 -08:00
Родитель 391ead70cb
Коммит 3fa149a5a2
1 изменённых файлов: 13 добавлений и 3 удалений

Просмотреть файл

@ -88,6 +88,7 @@
#define LOADEND_STR "loadend"
#define NS_PROGRESS_EVENT_INTERVAL 50
const PRUint64 kUnknownSize = PRUint64(-1);
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMFileReader)
@ -519,7 +520,7 @@ nsDOMFileReader::ReadFileContent(nsIDOMBlob* aFile,
}
//Obtain the total size of the file before reading
mReadTotal = -1;
mReadTotal = kUnknownSize;
mFile->GetSize(&mReadTotal);
rv = mChannel->AsyncOpen(this, nsnull);
@ -575,8 +576,17 @@ nsDOMFileReader::DispatchProgressEvent(const nsAString& aType)
if (!progress)
return;
progress->InitProgressEvent(aType, PR_FALSE, PR_FALSE, mReadTotal >= 0,
mReadTransferred, PR_MAX(mReadTotal, 0));
PRBool known;
PRUint64 size;
if (mReadTotal != kUnknownSize) {
known = PR_TRUE;
size = mReadTotal;
} else {
known = PR_FALSE;
size = 0;
}
progress->InitProgressEvent(aType, PR_FALSE, PR_FALSE, known,
mReadTransferred, size);
this->DispatchDOMEvent(nsnull, event, nsnull, nsnull);
}