From e0f75a2f5241de10d1396fa72c5e128b1f20743b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20J=C3=A4genstedt?= Date: Wed, 27 Mar 2024 20:25:16 +0100 Subject: [PATCH] Add custom IDL for WebSocketStream (#1341) This would help update data for Chrome 124: https://github.com/mdn/browser-compat-data/pull/22681 --- custom/idl/websockets.idl | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 custom/idl/websockets.idl diff --git a/custom/idl/websockets.idl b/custom/idl/websockets.idl new file mode 100644 index 000000000..9f04740a1 --- /dev/null +++ b/custom/idl/websockets.idl @@ -0,0 +1,36 @@ +// https://github.com/whatwg/websockets/pull/48 + +dictionary WebSocketOpenInfo { + ReadableStream readable; + WritableStream writable; + DOMString extensions; + DOMString protocol; +}; + +dictionary WebSocketCloseInfo { + [EnforceRange] unsigned short closeCode; + USVString reason = ""; +}; + +dictionary WebSocketStreamOptions { + sequence protocols; + AbortSignal signal; +}; + +[Exposed=(Window,Worker)] +interface WebSocketStream { + constructor(USVString url, optional WebSocketStreamOptions options = {}); + readonly attribute USVString url; + readonly attribute Promise opened; + readonly attribute Promise closed; + undefined close(optional WebSocketCloseInfo closeInfo = {}); +}; + +[Exposed=(Window,Worker)] +interface WebSocketError : DOMException { + constructor(optional DOMString message = "", + optional WebSocketCloseInfo init = {}); + + readonly attribute unsigned short? closeCode; + readonly attribute USVString reason; +};