mirror of
https://github.com/servo/servo.git
synced 2025-07-08 07:53:40 +01:00
Auto merge of #6622 - Ms2ger:send-invalid-state, r=metajack
Throw an InvalidStateError from WebSocket#send when it is called too early. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6622) <!-- Reviewable:end -->
This commit is contained in:
commit
a2903091e4
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