mirror of
https://github.com/RGBCube/serenity
synced 2025-05-23 18:55:08 +00:00
LibWeb: Implement MessagePort.postMessage closer to the spec
Use a LocalSocket to represent the connection between two message ports. The concept of the port message queue is still missing, however. When that concept is implemented, the "steps" in step 7 of the message port transfer steps will need to send the serialized data over the connected socketpair and run in the event loop of the process that holds onto the other side of the message port. Doing this should allow centralizing the behavior of postMessage for Window, MessagePorts and Workers.
This commit is contained in:
parent
c7f7ee2c4b
commit
f68c67bf3f
7 changed files with 142 additions and 33 deletions
|
@ -1053,7 +1053,7 @@ WebIDL::ExceptionOr<void> Window::window_post_message_steps(JS::Value message, W
|
|||
auto serialize_with_transfer_result = TRY(structured_serialize_with_transfer(target_realm.vm(), message, transfer));
|
||||
|
||||
// 8. Queue a global task on the posted message task source given targetWindow to run the following steps:
|
||||
queue_global_task(Task::Source::PostedMessage, *this, [this, serialize_with_transfer_result = move(serialize_with_transfer_result), target_origin = move(target_origin), &incumbent_settings, &target_realm]() {
|
||||
queue_global_task(Task::Source::PostedMessage, *this, [this, serialize_with_transfer_result = move(serialize_with_transfer_result), target_origin = move(target_origin), &incumbent_settings, &target_realm]() mutable {
|
||||
// 1. If the targetOrigin argument is not a single literal U+002A ASTERISK character (*) and targetWindow's
|
||||
// associated Document's origin is not same origin with targetOrigin, then return.
|
||||
// NOTE: Due to step 4 and 5 above, the only time it's not '*' is if target_origin contains an Origin.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue