aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webidls
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-05-05 12:57:48 -0500
committerbors-servo <metajack+bors@gmail.com>2015-05-05 12:57:48 -0500
commit6d2f70a4fd275510ca90c5da27bb841dd25d39bd (patch)
treefcf4bba4bc72f4391bd1f649fe663ff83667da8b /components/script/dom/webidls
parentab589da1f464ed00b0105bc4531690da0118ea5b (diff)
parent5afec62f0709bff8f77a14cc8e9ccbbc6f294fca (diff)
downloadservo-6d2f70a4fd275510ca90c5da27bb841dd25d39bd.tar.gz
servo-6d2f70a4fd275510ca90c5da27bb841dd25d39bd.zip
Auto merge of #5939 - jdm:websocket, r=jdm
...ets using rust-websocket. Authors: Shivaji Vidhale <savidhal@ncsu.edu> William Galliher <wpgallih@ncsu.edu> Allen Chen <achen4@ncsu.edu> Rucha Jogaikar <rsjogaik@ncsu.edu> <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5939) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/webidls')
-rw-r--r--components/script/dom/webidls/CloseEvent.webidl17
-rw-r--r--components/script/dom/webidls/WebSocket.webidl24
2 files changed, 33 insertions, 8 deletions
diff --git a/components/script/dom/webidls/CloseEvent.webidl b/components/script/dom/webidls/CloseEvent.webidl
new file mode 100644
index 00000000000..edc2a43de19
--- /dev/null
+++ b/components/script/dom/webidls/CloseEvent.webidl
@@ -0,0 +1,17 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+//https://html.spec.whatwg.org/multipage/#the-closeevent-interfaces
+[Constructor(DOMString type, optional CloseEventInit eventInitDict)/*, Exposed=(Window,Worker)*/]
+interface CloseEvent : Event {
+ readonly attribute boolean wasClean;
+ readonly attribute unsigned short code;
+ readonly attribute DOMString reason;
+};
+
+dictionary CloseEventInit : EventInit {
+ boolean wasClean;
+ unsigned short code;
+ DOMString reason;
+};
diff --git a/components/script/dom/webidls/WebSocket.webidl b/components/script/dom/webidls/WebSocket.webidl
index 3f54ec79019..6067ca30c4f 100644
--- a/components/script/dom/webidls/WebSocket.webidl
+++ b/components/script/dom/webidls/WebSocket.webidl
@@ -2,26 +2,34 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+enum BinaryType { "blob", "arraybuffer" };
+
[Constructor(DOMString url)]
interface WebSocket : EventTarget {
-readonly attribute DOMString url;
- //attribute DOMString port;
- //attribute DOMString host;
+ readonly attribute DOMString url;
//ready state
const unsigned short CONNECTING = 0;
const unsigned short OPEN = 1;
const unsigned short CLOSING = 2;
const unsigned short CLOSED = 3;
- //readonly attribute unsigned short readyState;
+ readonly attribute unsigned short readyState;
//readonly attribute unsigned long bufferedAmount;
+
//networking
- //attribute EventHandler onopen;
- //attribute EventHandler onerror;
- //attribute EventHandler onclose;
+ attribute EventHandler onopen;
+ attribute EventHandler onerror;
+ attribute EventHandler onclose;
//readonly attribute DOMString extensions;
//readonly attribute DOMString protocol;
- //void send(USVString data);
+ //[Throws] void close([Clamp] optional unsigned short code, optional DOMString reason); //Clamp doesn't work
+ [Throws] void close(optional unsigned short code, optional DOMString reason); //No clamp version - works
+
+ //messaging
+ //attribute EventHandler onmessage;
+ //attribute BinaryType binaryType;
+ [Throws] void send(optional DOMString data);
//void send(Blob data);
//void send(ArrayBuffer data);
//void send(ArrayBufferView data);
+
};