1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 21:37:36 +00:00

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
parent 37f2d49818
commit b10fee00eb
21 changed files with 159 additions and 222 deletions

View file

@ -10,24 +10,22 @@
#include <AK/URL.h>
#include <LibWeb/Bindings/MainThreadVM.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/StructuredSerialize.h>
namespace WebWorker {
class DedicatedWorkerHost : public RefCounted<DedicatedWorkerHost> {
public:
explicit DedicatedWorkerHost(Web::Page&, AK::URL url, String type, int outside_port);
explicit DedicatedWorkerHost(AK::URL url, String type);
~DedicatedWorkerHost();
void run();
void run(JS::NonnullGCPtr<Web::Page>, Web::HTML::TransferDataHolder message_port_data);
private:
RefPtr<Web::HTML::WorkerDebugConsoleClient> m_console;
Web::Page& m_page;
AK::URL m_url;
String m_type;
int m_outside_port { -1 };
};
}