LibWeb+WebWorker: Convert Workers to use MessagePorts for postMessage

This aligns Workers and Window and MessagePorts to all use the same
mechanism for transferring serialized messages across realms.

It also allows transferring more message ports into a worker.

Re-enable the Worker-echo test, as none of the MessagePort tests have
themselves been flaky, and those are now using the same underlying
implementation.
This commit is contained in:
Andrew Kaster 2023-12-20 13:47:01 -07:00 committed by Andreas Kling
commit b10fee00eb
Notes: sideshowbarker 2024-07-17 00:47:29 +09:00
21 changed files with 159 additions and 222 deletions

View file

@ -61,6 +61,8 @@ public:
virtual WebIDL::ExceptionOr<void> transfer_receiving_steps(HTML::TransferDataHolder&) override;
virtual HTML::TransferType primary_interface() const override { return HTML::TransferType::MessagePort; }
void set_worker_event_target(JS::NonnullGCPtr<DOM::EventTarget>);
private:
explicit MessagePort(JS::Realm&);
@ -91,6 +93,8 @@ private:
Error,
} m_socket_state { SocketState::Header };
size_t m_socket_incoming_message_size { 0 };
JS::GCPtr<DOM::EventTarget> m_worker_event_target;
};
}