Skip to content

Commit

Permalink
Require the argument to WebSocket#send() (fixes #7858).
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Berlage committed Oct 8, 2015
1 parent 94816bb commit 0ffd2f6
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 47 deletions.
2 changes: 1 addition & 1 deletion components/script/dom/webidls/WebSocket.webidl
Expand Up @@ -28,7 +28,7 @@ interface WebSocket : EventTarget {
//messaging
attribute EventHandler onmessage;
attribute BinaryType binaryType;
[Throws] void send(optional USVString data);
[Throws] void send(USVString data);
//void send(Blob data);
//void send(ArrayBuffer data);
//void send(ArrayBufferView data);
Expand Down
4 changes: 2 additions & 2 deletions components/script/dom/websocket.rs
Expand Up @@ -256,7 +256,7 @@ impl WebSocketMethods for WebSocket {
}

// 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() {
WebSocketRequestState::Connecting => {
return Err(Error::InvalidState);
Expand All @@ -278,7 +278,7 @@ impl WebSocketMethods for WebSocket {
*/
let mut other_sender = self.sender.borrow_mut();
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(())
}

Expand Down
12 changes: 0 additions & 12 deletions tests/wpt/metadata/html/dom/interfaces.html.ini
Expand Up @@ -8739,18 +8739,6 @@
[Location interface: window.location must have own property "reload"]
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()]
expected: FAIL
Expand Down
24 changes: 0 additions & 24 deletions tests/wpt/metadata/websockets/interfaces.html.ini
Expand Up @@ -15,18 +15,6 @@
[WebSocket interface: attribute protocol]
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

Expand All @@ -39,18 +27,6 @@
[WebSocket interface: new WebSocket("ws://foo") must inherit property "protocol" with the proper type (11)]
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

Expand Down

This file was deleted.

4 changes: 1 addition & 3 deletions tests/wpt/mozilla/meta/mozilla/navigator.html.ini
@@ -1,12 +1,10 @@
[navigator.html]
type: testharness

[navigator.platform linux]
expected:
if os != "linux": FAIL
PASS

[navigator.platform mac]
expected:
if os != "mac": FAIL
PASS

0 comments on commit 0ffd2f6

Please sign in to comment.