Bug 137831 - WebSocket readyState should not throw an exception ever.
Summary: WebSocket readyState should not throw an exception ever.
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-17 12:48 PDT by Brandon Andrews
Modified: 2014-10-21 19:23 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brandon Andrews 2014-10-17 12:48:31 PDT
Webkit currently throws an exception if a handshake fails and the user attempts to access the readyState member. The following exception can be seen with Webkit's implementation when a handshake is interrupted:

WebSocket connection to 'wss://example.com' failed: Connection closed before receiving a handshake response 

This should simply close the connection and set the readyState to CLOSED and call the onerror event. Having readyState throw an exception for this is unintuitive. (I don't think any other browser does this).
Comment 1 Alexey Proskuryakov 2014-10-18 23:33:24 PDT
Could you please provide a test case? Looking at the readState attribute implementation, there is no way it could possibly raise an exception on getting. It doesn't even have a way to return an exception code:

WebSocket::State WebSocket::readyState() const
{
    return m_state;
}
Comment 2 Alexey Proskuryakov 2014-10-21 19:23:06 PDT
Please feel free to re-open with a test case.