Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Client.postMessage to unloaded client not throw #1293

Merged
merged 4 commits into from
May 28, 2019

Conversation

jungkees
Copy link
Collaborator

@jungkees jungkees commented Mar 27, 2018

cf834f0
clarified the target object can be null, and it must throw in that case.

But #1291 pointed out that we
cannot implement that behavior without blocking the service worker
process in multi-process browser architectures.

This change makes the control return right away if the target client has
been unloaded.

Fixes #1291.


Preview | Diff

cf834f0
clarified the target object can be null, and it must throw in that case.

But #1291 pointed out that we
cannot implement that behavior without blocking the service worker
process in multi-process browser architectures.

This change makes the control return right away if the target client has
been unloaded.

Fixes #1291.
@jungkees
Copy link
Collaborator Author

@jungkees jungkees mentioned this pull request Sep 12, 2018
docs/index.bs Outdated
1. Let |serializeWithTransferResult| be <a abstract-op>StructuredSerializeWithTransfer</a>(|message|, |transfer|). Rethrow any exceptions.
1. Add a <a>task</a> that runs the following steps to |destination|'s [=ServiceWorkerContainer/client message queue=]:
1. Let |targetClient| be the [=context object=]'s [=Client/service worker client=], or null if it does not exist (i.e. if the [=/service worker client=] has been [=Handle Service Worker Client Unload|unloaded=]).
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what "or null if it does not exist" means. Have we defined how to check for existence? If so we should link to that. Also, is it ok to perform this existence check on the main thread?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@jakearchibald, I pushed a commit to address these points. PTAL.

Copy link
Contributor

@jakearchibald jakearchibald left a comment

Choose a reason for hiding this comment

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

LGTM!

@jungkees jungkees merged commit 86d9414 into master May 28, 2019
@jungkees jungkees deleted the client-postmessage-fix branch May 28, 2019 15:36
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.

Client.postMessage() throwing for unloaded client is problematic
2 participants