LibWeb: Implement transfer for Resizable/ArrayBuffer

Implement transfer logic for ArrayBuffer and ResizableArrayBuffer.

Change TransferDataHolder data type to Vector<u32> to reuse existing
serialization infrastructure.

Fix 5 WPT tests in `window-postmessage.window.html` that relates to
transport.
Fix `LibWeb/Text/input/Worker/Worker-postMessage-transfer.html`.
The latter is currently ignored due to flakiness, no rebaseline is
needed.

During serialization with transfer, initialize memory with known index
and initialize Serializer at position that dependent on the memory.
This is mandatory to make ArrayBuffer transport to work. It also happens
to fix 4 WPT tests, that are related to curcular references during
serialization.
This commit is contained in:
Konstantin Konstantin 2024-11-24 14:20:57 +01:00 committed by Tim Ledbetter
commit 9dad8f55a4
Notes: github-actions[bot] 2024-12-03 21:32:51 +00:00
5 changed files with 98 additions and 35 deletions

View file

@ -25,7 +25,7 @@
namespace Web::HTML {
struct TransferDataHolder {
Vector<u8> data;
Vector<u32> data;
Vector<IPC::File> fds;
};
@ -46,6 +46,8 @@ struct DeserializedRecord {
enum class TransferType : u8 {
MessagePort,
ArrayBuffer,
ResizableArrayBuffer,
};
WebIDL::ExceptionOr<SerializationRecord> structured_serialize(JS::VM& vm, JS::Value);