Messages queued during port entaglement are never sent if main thread blocks
Categories
(Core :: DOM: postMessage, defect, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox150 | --- | fixed |
People
(Reporter: bholley, Assigned: bholley)
References
Details
Attachments
(1 file)
See bug 1752287 comment 33. Patch forthcoming.
| Assignee | ||
Comment 1•15 days ago
|
||
When a MessagePort is transferred to a worker, it enters eStateEntangling
while waiting for an async IPC round-trip (PMessagePortConstructor ->
RequestEntangling -> Entangled) to complete. Previously, PostMessage()
during this state queued messages in mMessagesForTheOtherPort, which were
only flushed when the Entangled() callback fired. If the worker blocked
the thread (e.g. via Atomics.wait() or sync XHR) before that callback
arrived, the queued messages were never sent.
Conceptually, it's safer to buffer pre-entanglement in the parent
PBackground thread, which never blocks. By the time we're in
eStateEntangling, the parent should be guaranteed to be set up enough to
receive the message.
On the parent side, RecvPostMessages() now buffers messages received before
Entangled() is called (in mPendingMessages), rather than returning IPC_FAIL.
These buffered messages are flushed via PostMessages() when Entangled() is
called. This handles the multi-transfer edge case where a port's parent
actor is queued in mNextParents and hasn't become active yet.
Updated•15 days ago
|
Comment 3•14 days ago
|
||
| bugherder | ||
Updated•5 hours ago
|
Description
•