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

Clarify target object of Client.postMessage can be null #1274

Merged
merged 3 commits into from
Mar 23, 2018

Conversation

jungkees
Copy link
Collaborator

@jungkees jungkees commented Feb 2, 2018

This change addresses the issue described in the second paragraph of
#1042 (comment).
This change gets |destination| variable initialized to null if the
ServiceWorkerContainer object does not exist.

Fixes #1042.


Preview | Diff

This change addresses the issue described in the second paragraph of
#1042 (comment).
This change gets |destination| variable initialized to null if the
ServiceWorkerContainer object does not exist.

Fixes #1042.
Copy link
Member

@mfalken mfalken left a comment

Choose a reason for hiding this comment

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

This makes sense to me.

docs/index.bs Outdated
@@ -1028,7 +1028,7 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
The <dfn method for="Client"><code>postMessage(|message|, |transfer|)</code></dfn> method *must* run these steps:

1. Let |sourceSettings| be the <a>context object</a>'s <a>relevant settings object</a>.
1. Let |destination| be the {{ServiceWorkerContainer}} object whose [=ServiceWorkerContainer/service worker client=] is the <a>context object</a>'s [=Client/service worker client=].
1. Let |destination| be the {{ServiceWorkerContainer}} object whose [=ServiceWorkerContainer/service worker client=] is the <a>context object</a>'s [=Client/service worker client=], if any; otherwise let it be null.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think ", or null if no match is found" would be clearer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That sounds good. I addressed it.

jungkees added a commit to jungkees/web-platform-tests that referenced this pull request Mar 23, 2018
Client.postMessage to an unloaded Client object must throw an
"InvalidStateError" DOMException. (See https://w3c.github.io/ServiceWorker/#dom-client-postmessage.)
This adds a test for that requirement.

Related spec issue: w3c/ServiceWorker#1042.
Related spec PR: w3c/ServiceWorker#1274.
@jungkees
Copy link
Collaborator Author

Added a test: web-platform-tests/wpt#10153.

@jungkees jungkees merged commit cf834f0 into master Mar 23, 2018
@jungkees jungkees deleted the client-postmessage-fix branch March 23, 2018 06:13
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.

3 participants