mirror of
https://github.com/servo/servo.git
synced 2025-06-13 02:44:29 +00: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
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[Send-before-open.htm]
|
||||
type: testharness
|
||||
[W3C WebSocket API - Send data on a WebSocket before connection is opened - INVALID_STATE_ERR is returned]
|
||||
expected: FAIL
|
||||
|
|
@ -1,3 +1,71 @@
|
|||
[interfaces.html]
|
||||
type: testharness
|
||||
expected: CRASH
|
||||
[WebSocket interface: existence and properties of interface object]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: existence and properties of interface prototype object]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: attribute bufferedAmount]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: attribute extensions]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: attribute protocol]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: attribute onmessage]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: attribute binaryType]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: operation send(DOMString)]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: operation send(Blob)]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: operation send(ArrayBuffer)]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: operation send(ArrayBufferView)]
|
||||
expected: FAIL
|
||||
|
||||
[Stringification of new WebSocket("ws://foo")]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: new WebSocket("ws://foo") must inherit property "bufferedAmount" with the proper type (6)]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: new WebSocket("ws://foo") must inherit property "extensions" with the proper type (10)]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: new WebSocket("ws://foo") must inherit property "protocol" with the proper type (11)]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: new WebSocket("ws://foo") must inherit property "onmessage" with the proper type (13)]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: new WebSocket("ws://foo") must inherit property "binaryType" with the proper type (14)]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: calling send(DOMString) on new WebSocket("ws://foo") with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: calling send(Blob) on new WebSocket("ws://foo") with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: calling send(ArrayBuffer) on new WebSocket("ws://foo") with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[WebSocket interface: calling send(ArrayBufferView) on new WebSocket("ws://foo") with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[CloseEvent interface: existence and properties of interface object]
|
||||
expected: FAIL
|
||||
|
||||
[CloseEvent interface: existence and properties of interface prototype object]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
[001.html]
|
||||
type: testharness
|
||||
expected: CRASH
|
||||
[WebSockets: send() with no args]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
[003.html]
|
||||
type: testharness
|
||||
expected: CRASH
|
|
@ -1,3 +0,0 @@
|
|||
[004.html]
|
||||
type: testharness
|
||||
expected: CRASH
|
Loading…
Add table
Add a link
Reference in a new issue