Require the argument to WebSocket#send() (fixes #7858).

This commit is contained in:
Jim Berlage 2015-10-05 19:24:24 -05:00
parent 94816bb3b4
commit 0ffd2f636f
6 changed files with 4 additions and 47 deletions

View file

@ -28,7 +28,7 @@ interface WebSocket : EventTarget {
//messaging //messaging
attribute EventHandler onmessage; attribute EventHandler onmessage;
attribute BinaryType binaryType; attribute BinaryType binaryType;
[Throws] void send(optional USVString data); [Throws] void send(USVString data);
//void send(Blob data); //void send(Blob data);
//void send(ArrayBuffer data); //void send(ArrayBuffer data);
//void send(ArrayBufferView data); //void send(ArrayBufferView data);

View file

@ -256,7 +256,7 @@ impl WebSocketMethods for WebSocket {
} }
// https://html.spec.whatwg.org/multipage/#dom-websocket-send // https://html.spec.whatwg.org/multipage/#dom-websocket-send
fn Send(&self, data: Option<USVString>) -> Fallible<()> { fn Send(&self, data: USVString) -> Fallible<()> {
match self.ready_state.get() { match self.ready_state.get() {
WebSocketRequestState::Connecting => { WebSocketRequestState::Connecting => {
return Err(Error::InvalidState); return Err(Error::InvalidState);
@ -278,7 +278,7 @@ impl WebSocketMethods for WebSocket {
*/ */
let mut other_sender = self.sender.borrow_mut(); let mut other_sender = self.sender.borrow_mut();
let my_sender = other_sender.as_mut().unwrap(); let my_sender = other_sender.as_mut().unwrap();
let _ = my_sender.lock().unwrap().send_message(Message::Text(data.unwrap().0)); let _ = my_sender.lock().unwrap().send_message(Message::Text(data.0));
Ok(()) Ok(())
} }

View file

@ -8739,18 +8739,6 @@
[Location interface: window.location must have own property "reload"] [Location interface: window.location must have own property "reload"]
expected: FAIL 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
[HTMLOptionElement must be primary interface of new Option()] [HTMLOptionElement must be primary interface of new Option()]
expected: FAIL expected: FAIL

View file

@ -15,18 +15,6 @@
[WebSocket interface: attribute protocol] [WebSocket interface: attribute protocol]
expected: FAIL 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")] [Stringification of new WebSocket("ws://foo")]
expected: FAIL expected: FAIL
@ -39,18 +27,6 @@
[WebSocket interface: new WebSocket("ws://foo") must inherit property "protocol" with the proper type (11)] [WebSocket interface: new WebSocket("ws://foo") must inherit property "protocol" with the proper type (11)]
expected: FAIL 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] [CloseEvent interface: existence and properties of interface object]
expected: FAIL expected: FAIL

View file

@ -1,5 +0,0 @@
[001.html]
type: testharness
[WebSockets: send() with no args]
expected: FAIL

View file

@ -1,12 +1,10 @@
[navigator.html] [navigator.html]
type: testharness type: testharness
[navigator.platform linux] [navigator.platform linux]
expected: expected:
if os != "linux": FAIL if os != "linux": FAIL
PASS
[navigator.platform mac] [navigator.platform mac]
expected: expected:
if os != "mac": FAIL if os != "mac": FAIL
PASS