1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:17:44 +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

@ -3,6 +3,7 @@
#import <HTML/WindowOrWorkerGlobalScope.idl>
#import <HTML/WorkerLocation.idl>
#import <HTML/WorkerNavigator.idl>
#import <HTML/MessagePort.idl>
// https://html.spec.whatwg.org/multipage/workers.html#workerglobalscope
[Exposed=Worker]
@ -19,8 +20,9 @@ interface WorkerGlobalScope : EventTarget {
attribute EventHandler onrejectionhandled;
attribute EventHandler onunhandledrejection;
// FIXME: This belongs on the subclasses of WorkerGlobalScope
undefined postMessage(any message, any transfer);
// FIXME: IDL overload issue here
// FIXME: undefined postMessage(any message, sequence<object> transfer);
undefined postMessage(any message, optional StructuredSerializeOptions options = {});
attribute EventHandler onmessage;
attribute EventHandler onmessageerror;
};