1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:38:10 +00:00

LibWeb+WebWorker: Implement a first cut of post_message for Workers

This implementation completely ignores MessagePorts, and manually plumbs
data through LocalSockets.
This commit is contained in:
Andrew Kaster 2023-11-22 09:57:22 -07:00 committed by Andreas Kling
parent 05ec93e276
commit 1602663b9e
15 changed files with 225 additions and 29 deletions

View file

@ -41,7 +41,7 @@ public:
WebIDL::ExceptionOr<void> terminate();
void post_message(JS::Value message, JS::Value transfer);
WebIDL::ExceptionOr<void> post_message(JS::Value message, JS::Value transfer);
virtual ~Worker() = default;
@ -66,6 +66,13 @@ private:
JS::GCPtr<DOM::Document> m_document;
JS::GCPtr<MessagePort> m_outside_port;
// FIXME: Move tihs state into the message port (and actually use it :) )
enum class PortState : u8 {
Header,
Data,
Error,
} m_outside_port_state { PortState::Header };
size_t m_outside_port_incoming_message_size { 0 };
JS::GCPtr<WorkerAgent> m_agent;