Bug 40996 - Progress event should not be fired during synchronous XMLHttpRequest
Summary: Progress event should not be fired during synchronous XMLHttpRequest
Alias: None
Product: WebKit
Classification: Unclassified
Component: XML (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alexey Proskuryakov
: 17502 (view as bug list)
Depends on:
Reported: 2010-06-22 10:50 PDT by Stuart Ng
Modified: 2010-08-03 06:09 PDT (History)
3 users (show)

See Also:

proposed fix (18.69 KB, patch)
2010-07-19 11:27 PDT, Alexey Proskuryakov
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Ng 2010-06-22 10:50:19 PDT
OnProgress Event was fired once during a synchronous XHR request

Event.Total is some garbage value, while Event.lengthComputable and Event.loaded is correct.

OnProgress should never be fired according to w3C spec.
Comment 1 Alexey Proskuryakov 2010-06-23 09:59:27 PDT
This also means that having progress event handlers installed probably shouldn't force preflight for sync requests, since they will be ignored anyway.
Comment 2 Alexey Proskuryakov 2010-07-19 11:27:24 PDT
Created attachment 61970 [details]
proposed fix
Comment 3 Alexey Proskuryakov 2010-07-19 11:47:13 PDT
*** Bug 17502 has been marked as a duplicate of this bug. ***
Comment 4 Alexey Proskuryakov 2010-07-19 11:48:07 PDT
Committed <http://trac.webkit.org/changeset/63680>.

Anne, any comments you may have about this change would be highly appreciated.
Comment 5 Anne van Kesteren 2010-07-26 01:23:35 PDT
What you are saying in comment 2 is addressed by step 5 of the send() algorithm.

The way the specification is meant to be written (and I think it is) is that for synchronous requests no tasks are added to the task queue as defined by HTML5. So nothing can happen during a synchronous request, no events, no timeouts, etc.
Comment 6 Alexey Proskuryakov 2010-08-01 23:42:22 PDT
I think that we'll have/want to continue sending events that aren't async in nature, such as readystatechange for states UNSENT, OPENED and DONE. There doesn't seem to be any harm in that.

These aren't added to task queue, they are dispatched right away.
Comment 7 Anne van Kesteren 2010-08-03 06:09:12 PDT
Yes. But they are not dispatched during a request. But you are right. Those will be always dispatched (and their definition also does not depend on the asynchronous flag like the events under discussion here).