Editorial: queue a task in Client / Clients API - #1836
Merged
Conversation
…ients API - Client.postMessage(): queue tasks to fire messageerror and dispatch message on the target client's responsible event loop. - Clients.get(id): restructure per review to queue once and run invoke+abort in substeps; also queue the fall-through resolve. - Clients.claim(): queue the final resolve with undefined on the promise's responsible event loop. Refs: w3c#1740
github-actions Bot
added a commit
to asleekgeek/ServiceWorker
that referenced
this pull request
Jul 24, 2026
This was referenced Aug 4, 2026
|
I think the postMessage changes may be incorrect; the event dispatch was already happening under the auspices of:
The clients-get and clients-claim changes seem correct though. |
Collaborator
Author
|
Thanks for catching this @asutherland! Opened #1844 to remove the two nested |
monica-ch
added a commit
that referenced
this pull request
Aug 12, 2026
…nt.postMessage (#1844) 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 #1836, per @asutherland's post-merge feedback on that PR. The Clients.get and Clients.claim changes from #1836 are unaffected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates to:
messageerrorand dispatchmessageon the target client's responsible event loop.All of these resolved/rejected promises or fired events directly from an "in parallel" block, which violates the "don't touch JS objects from parallel" rule.
This is part 4/6 of #1740. Split out from #1755 for focused review.
Preview | Diff