mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Handle Send correctly if readyState is not Open.
This commit is contained in:
parent
cd741e681d
commit
072fdf695b
1 changed files with 9 additions and 2 deletions
|
@ -169,8 +169,15 @@ impl<'a> WebSocketMethods for &'a WebSocket {
|
|||
}
|
||||
|
||||
fn Send(self, data: Option<USVString>) -> Fallible<()> {
|
||||
if self.ready_state.get() == WebSocketRequestState::Connecting {
|
||||
return Err(Error::InvalidState);
|
||||
match self.ready_state.get() {
|
||||
WebSocketRequestState::Connecting => {
|
||||
return Err(Error::InvalidState);
|
||||
},
|
||||
WebSocketRequestState::Open => (),
|
||||
WebSocketRequestState::Closing | WebSocketRequestState::Closed => {
|
||||
// TODO: Update bufferedAmount.
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
/*TODO: This is not up to spec see http://html.spec.whatwg.org/multipage/comms.html search for
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue