Skip to content

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

Merged
monica-ch merged 1 commit into
w3c:mainfrom
monica-ch:postmessage-remove-nested-task-queue
Aug 12, 2026
Merged

Editorial: remove nested Queue a task around message dispatch in Client.postMessage#1844
monica-ch merged 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

@yoshisatoyanagisawa yoshisatoyanagisawa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@monica-ch
monica-ch merged commit 92aba3b into w3c:main Aug 12, 2026
2 checks passed
github-actions Bot added a commit that referenced this pull request Aug 12, 2026
…nt.postMessage (#1844)

SHA: 92aba3b
Reason: push, by monica-ch

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions Bot added a commit to asleekgeek/ServiceWorker that referenced this pull request Aug 12, 2026
…nt.postMessage (w3c#1844)

SHA: 92aba3b
Reason: push, by pull[bot]

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

2 participants