XMLHttpRequest.abort() doesn't actually cancel the request
Categories
(Core :: DOM: Networking, defect, P3)
Tracking
()
People
(Reporter: zurldan, Unassigned)
Details
(Whiteboard: [necko-triaged])
Attachments
(1 obsolete file)
Comment 1•7 years ago
|
||
Updated•7 years ago
|
Comment 2•7 years ago
|
||
Comment 4•7 years ago
|
||
Updated•7 years ago
|
Comment 5•7 years ago
|
||
Comment 6•7 years ago
|
||
Maybe the condition at [1] excludes calling Cancel() on the underlying channel.
No, it calls CloseRequest() (the next function in the link given), which calls mChannel->Cancel(NS_BINDING_ABORTED).
In fact, I can't reproduce this with a test-case like the following:
const x = new XMLHttpRequest();
x.responseType = "arraybuffer";
x.open("get", "large_file.tar.bz2");
x.send();
setTimeout(function() {
x.abort();
}, 50);
The devtools only shows whatever size was downloaded before the abort, and things seem to be working fine otherwise.
If anyone has a working test-case or definitive steps to reproduce this, it would help.
Comment 7•6 years ago
|
||
I noticed this behavior today and created a CodeSandbox:
https://codesandbox.io/embed/jovial-cori-h14yg
For this to work you need to enable network speed throttling to e.g. "regular 3g".
Then you'll see the request is still fetching the file and returning http 200.
I've validated this with Chrome 75, where the request gets cancelled as it should be.
Screenshot:
Comment 8•6 years ago
|
||
Comment 9•6 years ago
|
||
I'm having this same problem in Firefox Developer Edition 70.0.1. I am unable to abort file uploads. I have not yet tried aborting other types of requests.
Updated•6 years ago
|
Comment 10•6 years ago
|
||
(In reply to Krystof Beuermann from comment #7)
I noticed this behavior today and created a CodeSandbox:
https://codesandbox.io/embed/jovial-cori-h14ygFor this to work you need to enable network speed throttling to e.g. "regular 3g".
Then you'll see the request is still fetching the file and returning http 200.
I've validated this with Chrome 75, where the request gets cancelled as it should be.
Screenshot:
FWIW, I can't reproduce with this test case.
Comment 11•2 years ago
|
||
A needinfo is requested from the reporter, however, the reporter is inactive on Bugzilla. Given that the bug is still UNCONFIRMED, closing the bug as incomplete.
For more information, please visit BugBot documentation.
Description
•