-
Notifications
You must be signed in to change notification settings - Fork 312
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
Conversation
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.
There was a problem hiding this 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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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.
Added a test: web-platform-tests/wpt#10153. |
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