DescriptionXHR: compliant event sequencing on request errors and aborts.
Implement the event sequencing that the XHR spec now mandates for
request errors and abort()s. For request errors over async requests,
the following steps and sequence of events should now be dispatched:
- readyState transitions to state DONE, dispatching a
readystatechange event.
- The ordered event triple (progress, <event type>, loadend) is
dispatched to the upload event listeners, if any.
- The ordered event triple (progress, <event type>, loadend) is
dispatched to the regular/download event listeners.
- readyState transitions to UNSENT.
where <event type> is one of {'error', 'timeout', 'abort'}.
Same steps for abort(), for both sync and async requests.
The required dispatching of 'progress' here is a relatively new
addition to the specification, late 2012.
A behavioral implementation change is the fourth step of transitioning
to UNSENT. This was previously done as step two (after dispatching
readystatechange), an out-of-spec and incorrect quirk.
For the above sequence, to allow for the delivery of
'readystatechange' on transitioning to DONE, but delay the delivery of
the final 'progress', we carefully only flush any deferred 'progress'
event before that 'readystatechange' event, but do not issue new. That
dispatch happens after the upload progress events have been dealt
with.
To make the correspondence clearer to the underlying spec text, the
request error steps have been factored out into a separate method.
R=tyoshino,abarth
BUG=315488
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=162340
Patch Set 1 #
Total comments: 7
Patch Set 2 : Improve test code quality #Messages
Total messages: 10 (0 generated)
|