Bug 32332 - WebSocket events should be dispatched synchronously
Summary: WebSocket events should be dispatched synchronously
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alexey Proskuryakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-09 11:15 PST by Alexey Proskuryakov
Modified: 2009-12-09 19:33 PST (History)
3 users (show)

See Also:


Attachments
proposed patch (5.58 KB, patch)
2009-12-09 13:51 PST, 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 Alexey Proskuryakov 2009-12-09 11:15:59 PST
As per recent WhatWG discussion, everywhere the spec says "queue a task to dispatch an event", it actually means "dispatch the event synchronously". We should update the code accordingly, and make readyState checks in websocket/tests/simple test strict again.
Comment 1 Ian 'Hixie' Hickson 2009-12-09 11:27:03 PST
(In reply to comment #0)
> As per recent WhatWG discussion, everywhere the spec says "queue a task to
> dispatch an event", it actually means "dispatch the event synchronously".

That's only true if the code that would be queueing the task is itself a task that was queued. In which case, the task in question is simply the task that was queued. (In other words, it's not the case if the code that would be dispatching the event is actually running on another thread.)

That is, where the spec says:

   On another thread, if X, queue a task on the main thread that does Y and Z.

...it is fine to implement this as:

   Queue a task on the main thread that, if X, does Y and Z.

...but it's not fine to implement it as:

   On another thread, if X, do Y and Z.


The spec has changed to make the readyState attribute change at the same time as the events are dispatched (as part of the same task).
Comment 2 Alexey Proskuryakov 2009-12-09 11:31:49 PST
In WebKit, all code that handles events from network layer is "a task that was queued". I suspect that's true of most/all other browser engines.
Comment 3 Alexey Proskuryakov 2009-12-09 13:51:42 PST
Created attachment 44560 [details]
proposed patch

Ian, do the ChangeLog comment and test changes look right?
Comment 4 WebKit Review Bot 2009-12-09 13:56:11 PST
style-queue ran check-webkit-style on attachment 44560 [details] without any errors.
Comment 5 Alexey Proskuryakov 2009-12-09 19:33:08 PST
Committed revision 51935.