- From: <bugzilla@jessica.w3.org>
- Date: Mon, 13 Oct 2014 16:57:25 +0000
- To: public-webapps@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=27033
Bug ID: 27033
Summary: XHR request termination doesn't terminate queued tasks
Product: WebAppsWG
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P2
Component: XHR
Assignee: annevk@annevk.nl
Reporter: manishearth@gmail.com
QA Contact: public-webapps-bugzilla@w3.org
CC: mike@w3.org, public-webapps@w3.org
https://xhr.spec.whatwg.org/
When a request is terminated via `abort()` or the timeout, the fetch algorithm
is the only thing that is terminated[1]
However, there's no indication that we need to terminate existing queued up
tasks for the XHR object.
For example, the following can happen:
- Initialiaze an XHR object, call send()
- On readystatechange to 2 or 3, in the event handler, perform a long
computation
- In the meantime, the fetch algorithm continues to fetch, and pushes
fetch-related events (eg "process response body"/"process response end of
file") to the DOM task queue.
- abort() is called once the computation finishes. This aborts the fetch
algorithm, but does *not* remove already-queued events
- After calling abort(), try to initialize and send a new request with the
same XHR object
- The queued up tasks from the previous request will now be received by the
XHR object assuming they are for the new request, and we'll have some sort of
frankenresponse.
The w3 spec[2] explicitly mentions that tasks in the queue for the XHR object
should be aborted. I'm not certain if this includes the currently running task
-- if, for example, the user calls abort() followed by a new open() and send()
in the onprogress handler, should the onload/onloadend handlers be called for
the previous request? Probably not -- but this involves checking for an abort
on each step of the send(), which seems icky.
I guess the WHATWG spec needs to be updated to terminate more than just the
fetch algorithm.
[1]: https://xhr.spec.whatwg.org/#terminate-the-request
[2]: http://www.w3.org/TR/XMLHttpRequest2/#the-abort-method
--
You are receiving this mail because:
You are on the CC list for the bug.
Received on Monday, 13 October 2014 16:57:26 UTC