mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 948246, don't change xhr.upload's event.total and always fire at least one progress event, r=bz
--HG-- extra : rebase_source : 7a265bcb40155a257d885538a5c07825a83b018e
This commit is contained in:
parent
334958a29b
commit
c1ef502d06
@ -1899,7 +1899,11 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
mProgressTimerIsActive = false;
|
||||
mProgressNotifier->Cancel();
|
||||
}
|
||||
MaybeDispatchProgressEvents(true);
|
||||
if (mUploadTransferred < mUploadTotal) {
|
||||
mUploadTransferred = mUploadTotal;
|
||||
mProgressSinceLastProgressEvent = true;
|
||||
MaybeDispatchProgressEvents(true);
|
||||
}
|
||||
mUploadComplete = true;
|
||||
DispatchProgressEvent(mUpload, NS_LITERAL_STRING(LOAD_STR),
|
||||
true, mUploadTotal, mUploadTotal);
|
||||
@ -3410,9 +3414,6 @@ nsXMLHttpRequest::MaybeDispatchProgressEvents(bool aFinalProgress)
|
||||
// We're uploading if our state is XML_HTTP_REQUEST_OPENED or
|
||||
// XML_HTTP_REQUEST_SENT
|
||||
if ((XML_HTTP_REQUEST_OPENED | XML_HTTP_REQUEST_SENT) & mState) {
|
||||
if (aFinalProgress) {
|
||||
mUploadTotal = mUploadTransferred;
|
||||
}
|
||||
if (mUpload && !mUploadComplete) {
|
||||
DispatchProgressEvent(mUpload, NS_LITERAL_STRING(PROGRESS_STR),
|
||||
mUploadLengthComputable, mUploadTransferred,
|
||||
|
@ -23,6 +23,7 @@ var xhr = null;
|
||||
var upload = null;
|
||||
var currentEvents = null;
|
||||
var expectedResponseText = null;
|
||||
var uploadTotal = 0;
|
||||
|
||||
function logEvent(evt) {
|
||||
var i = 0;
|
||||
@ -32,6 +33,13 @@ function logEvent(evt) {
|
||||
!(evt.target instanceof currentEvents[i].target))) {
|
||||
++i;
|
||||
}
|
||||
if (evt.target instanceof XMLHttpRequestUpload) {
|
||||
if (evt.type == "loadstart") {
|
||||
uploadTotal = evt.total
|
||||
} else {
|
||||
is(evt.total, uploadTotal, "event(" + evt.type + ").total should not change during upload.");
|
||||
}
|
||||
}
|
||||
ok(i != currentEvents.length, "Extra or wrong event?");
|
||||
is(evt.type, currentEvents[i].type, "Wrong event!")
|
||||
ok(evt.target instanceof currentEvents[i].target,
|
||||
|
Loading…
Reference in New Issue
Block a user