[w3c/ServiceWorker] Editorial: remove nested Queue a task around message dispatch in Client.postMessage (PR #1844)

Follow-up to #1836. Addresses [@asutherland's post-merge review comment](https://github.com/w3c/ServiceWorker/pull/1836#issuecomment-3252891569).

## Problem

`Client.postMessage` currently has this shape (post-#1836):

```
1. Run the following steps in parallel:
    ...
    1. Add a task that runs the following steps to |destination|'s client message queue:
        ... deserialize ...
        1. queue a task on |targetClient|'s responsible event loop, using the DOM manipulation task source, to fire an event named messageerror ...
        ...
        1. Queue a task on |targetClient|'s responsible event loop, using the DOM manipulation task source, to Dispatch an event named message ...
```

The `fire messageerror` and `Dispatch message` steps already run inside a task on `|destination|`'s [=ServiceWorkerContainer/client message queue=]. The extra inner `Queue a task on |targetClient|'s responsible event loop` wrappers added by #1836 are:

1. **Redundant**, because `|destination|` is the {{ServiceWorkerContainer}} associated with `|targetClient|`, so both the outer `client message queue` task and the inner `queue a task` target the same client's event loop.
2. **Potentially incorrect**, because the outer task's task source (the [=client message queue=]) is superseded by the inner [=DOM manipulation task source=], subtly changing the ordering/timing semantics of message delivery.

As @asutherland noted:

> I think the postMessage changes may be incorrect; the event dispatch was already happening under the auspices of:
>> Add a task that runs the following steps to destination's client message queue
>
> The clients-get and clients-claim changes seem correct though.

## Fix

Remove the two inner `queue a task` wrappers in `Client.postMessage`. The outer `Add a task ... to |destination|'s client message queue:` retains full task-queue semantics for both `fire messageerror` and `Dispatch message`.

Total change: **+2 / −2** in `index.bs`, one commit. `Clients.get` and `Clients.claim` from #1836 are untouched.

## Related

- #1836 — the PR whose `postMessage` change this addresses
- #1740 — original missing-tasks-in-parallel issue
- #1755 — parent queue-a-task refactor


<!--
    This comment and the below content is programmatically generated.
    You may add a comma-separated list of anchors you'd like a
    direct link to below (e.g. #idl-serializers, #idl-sequence):

    Don't remove this comment or modify anything below this line.
    If you don't want a preview generated for this pull request,
    just replace the whole of this comment's content by "no preview"
    and remove what's below.
-->
***
<a href="https://pr-preview.s3.amazonaws.com/monica-ch/ServiceWorker/pull/1844.html" title="Last updated on Aug 5, 2026, 9:40 PM UTC (4968a23)">Preview</a> | <a href="https://pr-preview.s3.amazonaws.com/w3c/ServiceWorker/1844/9e9fe27...monica-ch:4968a23.html" title="Last updated on Aug 5, 2026, 9:40 PM UTC (4968a23)">Diff</a>
You can view, comment on, or merge this pull request online at:

  https://github.com/w3c/ServiceWorker/pull/1844

-- Commit Summary --

  * Editorial: remove nested Queue a task around message dispatch in Client.postMessage

-- File Changes --

    M index.bs (4)

-- Patch Links --

https://github.com/w3c/ServiceWorker/pull/1844.patch
https://github.com/w3c/ServiceWorker/pull/1844.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/pull/1844
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/ServiceWorker/pull/1844@github.com>

Received on Wednesday, 5 August 2026 21:41:15 UTC