Last Comment Bug 676025 - Websockets - failure to connect should generate onerror
: Websockets - failure to connect should generate onerror
Status: RESOLVED FIXED
: dev-doc-complete
Product: Core
Classification: Components
Component: Networking: WebSockets (show other bugs)
: Trunk
: x86_64 Linux
: -- normal (vote)
: mozilla8
Assigned To: Patrick McManus [:mcmanus]
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-02 11:14 PDT by Patrick McManus [:mcmanus]
Modified: 2011-10-17 13:44 PDT (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch 1 (4.19 KB, patch)
2011-08-02 11:19 PDT, Patrick McManus [:mcmanus]
jonas: review+
Details | Diff | Splinter Review

Description Patrick McManus [:mcmanus] 2011-08-02 11:14:44 PDT
When there is a websocket connection error we currently issue a close event, but not an error event.

The current API requires the error event:

"If the establish a WebSocket connection algorithm fails, it triggers the fail the WebSocket connection algorithm, which then invokes the close the WebSocket connection algorithm, which then establishes that the WebSocket connection is closed, which fires the close event as described below."
[..]
"When the WebSocket connection is closed, possibly cleanly, the user agent must queue a task to run the following substeps:

    Change the readyState attribute's value to CLOSED (3).

    If the user agent was required to fail the websocket connection, fire a simple event named error at the WebSocket object. [WSP]

    Create an event that uses the CloseEvent interface, with the event name close, which does not bubble, is not cancelable, has no default action, whose wasClean attribute is set to true if the connection closed cleanly and false otherwise, whose code attribute is set to the WebSocket connection close code, and whose reason attribute is set to the WebSocket connection close reason decoded as UTF-8, with error handling, and dispatch the event at the WebSocket object. [WSP]"
Comment 1 Patrick McManus [:mcmanus] 2011-08-02 11:19:34 PDT
Created attachment 550133 [details] [diff] [review]
patch 1
Comment 2 Jonas Sicking (:sicking) No longer reading bugmail consistently 2011-08-02 20:10:27 PDT
Comment on attachment 550133 [details] [diff] [review]
patch 1

Review of attachment 550133 [details] [diff] [review]:
-----------------------------------------------------------------

r=me
Comment 3 Marco Bonardo [::mak] 2011-08-04 02:54:28 PDT
http://hg.mozilla.org/mozilla-central/rev/36b1761da39d
Comment 4 Eric Shepherd [:sheppy] 2011-10-17 13:44:51 PDT
Docs updated:

https://developer.mozilla.org/en/WebSockets/Writing_WebSocket_client_applications#Connection_errors

And mentioned on Firefox 8 for developers.

Note You need to log in before you can comment on or make changes to this bug.