[w3c/ServiceWorker] Client.postMessage() throwing for unloaded client is problematic (#1291)

Currently `Client.postMessage()` says:

```
2. Let destination be the ServiceWorkerContainer object whose
service worker client is the context object’s service worker client,
or null if no match is found.

3. If destination is null, throw an "InvalidStateError" DOMException.
```

This is problematic for a few reasons:

1. Most `postMessage()` implementations don't throw.  They just silently consume the message if the other end is no longer listening.  For example Worker.postMessage() and MessageChannel, etc.
2. The lookup of the destination is presented as synchronous in the spec, but it must be async in any cross-process browser implementation.

If we wanted we could change postMessage() to return a promise, but its probably better to just silently eat the message.

I'm filing this issue in regards to https://github.com/w3c/web-platform-tests/pull/10153

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

Received on Friday, 23 March 2018 17:16:27 UTC