From 22413ef729ffe995c5ef3a9f8fb69567ed913980 Mon Sep 17 00:00:00 2001 From: DexesTTP Date: Sat, 24 Apr 2021 13:54:24 +0200 Subject: [PATCH] LibWeb: Add WebSocket bindings The WebSocket bindings match the original specification from the WHATWG living standard, but do not match the later update of the standard that involves FETCH. The FETCH update will be handled later since the changes would also affect XMLHttpRequest. --- Base/res/html/misc/websocket.html | 42 +++ Base/res/html/misc/welcome.html | 1 + Userland/Applications/Browser/main.cpp | 4 +- .../LibWeb/Bindings/EventWrapperFactory.cpp | 6 + .../LibWeb/Bindings/WindowObjectHelper.h | 9 + Userland/Libraries/LibWeb/CMakeLists.txt | 4 + .../CodeGenerators/WrapperGenerator.cpp | 6 + Userland/Libraries/LibWeb/Forward.h | 6 + Userland/Libraries/LibWeb/HTML/CloseEvent.h | 42 +++ Userland/Libraries/LibWeb/HTML/CloseEvent.idl | 7 + Userland/Libraries/LibWeb/HTML/MessageEvent.h | 39 +++ .../Libraries/LibWeb/HTML/MessageEvent.idl | 7 + Userland/Libraries/LibWeb/HTML/WebSocket.cpp | 274 ++++++++++++++++++ Userland/Libraries/LibWeb/HTML/WebSocket.h | 114 ++++++++ Userland/Libraries/LibWeb/HTML/WebSocket.idl | 29 ++ Userland/Services/WebContent/main.cpp | 4 + 16 files changed, 593 insertions(+), 1 deletion(-) create mode 100644 Base/res/html/misc/websocket.html create mode 100644 Userland/Libraries/LibWeb/HTML/CloseEvent.h create mode 100644 Userland/Libraries/LibWeb/HTML/CloseEvent.idl create mode 100644 Userland/Libraries/LibWeb/HTML/MessageEvent.h create mode 100644 Userland/Libraries/LibWeb/HTML/MessageEvent.idl create mode 100644 Userland/Libraries/LibWeb/HTML/WebSocket.cpp create mode 100644 Userland/Libraries/LibWeb/HTML/WebSocket.h create mode 100644 Userland/Libraries/LibWeb/HTML/WebSocket.idl diff --git a/Base/res/html/misc/websocket.html b/Base/res/html/misc/websocket.html new file mode 100644 index 0000000000..f3263bedeb --- /dev/null +++ b/Base/res/html/misc/websocket.html @@ -0,0 +1,42 @@ + + + + + WebSocket Test + + +

WebSocket Test

+
+ + + diff --git a/Base/res/html/misc/welcome.html b/Base/res/html/misc/welcome.html index 65b4dbfc08..e3d3a1d939 100644 --- a/Base/res/html/misc/welcome.html +++ b/Base/res/html/misc/welcome.html @@ -38,6 +38,7 @@ span#loadtime {

This page loaded in ms

Some small test pages: