This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 13295 - The "make disappear a WebSocket object" case should not fail the WebSocket connection
Summary: The "make disappear a WebSocket object" case should not fail the WebSocket co...
Status: RESOLVED WONTFIX
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: WebSocket API (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: PC All
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-19 05:20 UTC by Brian Raymor [MSFT]
Modified: 2011-08-08 21:24 UTC (History)
4 users (show)

See Also:


Attachments

Description Brian Raymor [MSFT] 2011-07-19 05:20:40 UTC
Are there valid use cases where the developer would want to capture this case as an error condition?



If a user agent is to make disappear a WebSocket object (this happens when a Document object goes away), the user agent must follow the first appropriate set of steps from the following list:
↪If the WebSocket connection is not yet established [WSP]
Fail the WebSocket connection. [WSP]
Comment 1 Ian 'Hixie' Hickson 2011-08-05 23:05:42 UTC
I don't understand the question. What would you do instead? Let the handshake complete then close it?

How would it be captured as an error condition? It's not like any events are going to be fired, the event queue is about to be torn down...
Comment 2 Brian Raymor [MSFT] 2011-08-06 00:13:38 UTC
If the connection is not established, then the preference is to treat this as a "user cancel" rather than an error and simply "close the websocket connection" and fire onClose.

The other option is to be specific about the "fail the websocket connection" behavior for this case and indicate onError is not fired.

Based on the definition of "fail the websocket connection" in the protocol draft, "report the problem to the user" is a MAY:

http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10#section-7.1.7

 Certain algorithms and specifications require an endpoint to _Fail
   the WebSocket Connection_.  To do so, the client MUST _Close the
   WebSocket Connection_, and MAY report the problem to the user (which
   would be especially useful for developers) in an appropriate manner.
Comment 3 Ian 'Hixie' Hickson 2011-08-08 21:24:49 UTC
By the time you are to "make disappear a WebSocket object", no events are going to fire ever again for that WebSocket object — the entire event queue for the Document is about to be cleared.

So the only difference here is at the protocol level, and even there, there is essentially no difference — in fact the only difference is that "fail" says that the UA "may" report a problem, as you quote. But then the UA is always allowed to do that. That's just UI.

So anyway, I don't understand what difference this would ever make. I've left the spec as is. The requirements on user agents are identical.