Skip to content

Editorial: remove nested Queue a task around message dispatch in Client.postMessage - #1844

Open
monica-ch wants to merge 1 commit into
w3c:mainfrom
monica-ch:postmessage-remove-nested-task-queue
Open

Editorial: remove nested Queue a task around message dispatch in Client.postMessage#1844
monica-ch wants to merge 1 commit into
w3c:mainfrom
monica-ch:postmessage-remove-nested-task-queue

Conversation

@monica-ch

@monica-ch monica-ch commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #1836. Addresses @asutherland's comment.

Client.postMessage's fire messageerror and Dispatch message steps already run inside Add a task ... to |destination|'s client message queue, which runs on |targetClient|'s event loop. #1836 added an inner Queue a task on |targetClient|'s responsible event loop, using the DOM manipulation task source around each step, which:

  • Requeues to the same event loop the outer task already put us on — no crossing to do.
  • Changes the task source from the client message queue's source to DOM manipulation, losing the ordering guarantees postMessage needs.
  • Splits one delivery into two tasks, letting other event-loop work interleave between deserialization and dispatch.

This PR removes the two inner wrappers. Clients.get and Clients.claim from #1836 are unchanged.


Preview | Diff

…nt.postMessage

The fire messageerror and Dispatch message steps already run inside a task on |destination|'s client message queue, so wrapping them in an additional Queue a task on |targetClient|'s responsible event loop is redundant (both queues target the destination client's event loop) and potentially incorrect (the outer client message queue task source is superseded by the inner DOM manipulation task source).

This reverts the Client.postMessage changes from w3c#1836, per @asutherland's post-merge feedback on that PR. The Clients.get and Clients.claim changes from w3c#1836 are unaffected.
@monica-ch
monica-ch marked this pull request as ready for review August 5, 2026 22:25
@monica-ch

Copy link
Copy Markdown
Collaborator Author

@asutherland @yoshisatoyanagisawa Will you take look, this reverts the recent change to Client.postMessage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant