Skip to content

Commit 6a8f012

Browse files
committedMar 7, 2021
XHR: avoid a redundant final progress event
See whatwg/xhr#318. This fixes a broken web platform test which happens to pass in all browsers, to also happen to pass in jsdom: web-platform-tests/wpt#27917.
1 parent 021555b commit 6a8f012

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
 

‎lib/jsdom/living/xhr/XMLHttpRequest-impl.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,10 @@ function receiveResponse(xhr, response) {
884884
properties.timeoutFn = null;
885885
properties.timeoutStart = 0;
886886
properties.client = null;
887-
fireAnEvent("progress", xhr, ProgressEvent, progressObj);
887+
if (lastProgressReported !== progressObj.loaded) {
888+
// https://github.com/whatwg/xhr/issues/318
889+
fireAnEvent("progress", xhr, ProgressEvent, progressObj);
890+
}
888891
readyStateChange(xhr, READY_STATES.DONE);
889892
fireAnEvent("load", xhr, ProgressEvent, progressObj);
890893
fireAnEvent("loadend", xhr, ProgressEvent, progressObj);

‎test/web-platform-tests/to-run.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,7 @@ send-entity-body-empty.htm: [fail, hard to get Node to not send Content-Length]
11801180
send-entity-body-get-head-async.htm: [fail, hard to get Node to not send Content-Length]
11811181
send-entity-body-get-head.htm: [fail, hard to get Node to not send Content-Length]
11821182
send-entity-body-none.htm: [fail-slow, hard to get Node to not send Content-Length]
1183+
send-no-response-event-order.htm: [fail, https://github.com/whatwg/xhr/issues/318#issuecomment-792106102]
11831184
send-redirect-post-upload.htm: [fail, Unknown]
11841185
send-redirect-to-cors.htm: [fail, request module remove content-type header on redirect]
11851186
send-redirect.htm: [fail, request module remove content-type header on redirect]

0 commit comments

Comments
 (0)
Please sign in to comment.