mirror of
https://github.com/servo/servo.git
synced 2025-06-10 09:33:13 +00:00
Throw an InvalidStateError from WebSocket#send when it is called too early.
This commit is contained in:
parent
d91a6f3834
commit
48b94ec02b
6 changed files with 77 additions and 14 deletions
|
@ -208,7 +208,11 @@ impl<'a> WebSocketMethods for &'a WebSocket {
|
|||
self.ready_state.get() as u16
|
||||
}
|
||||
|
||||
fn Send(self, data: Option<USVString>)-> Fallible<()>{
|
||||
fn Send(self, data: Option<USVString>) -> Fallible<()> {
|
||||
if self.ready_state.get() == WebSocketRequestState::Connecting {
|
||||
return Err(Error::InvalidState);
|
||||
}
|
||||
|
||||
/*TODO: This is not up to spec see http://html.spec.whatwg.org/multipage/comms.html search for
|
||||
"If argument is a string"
|
||||
TODO: Need to buffer data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue