-
Notifications
You must be signed in to change notification settings - Fork 313
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 that manually constructed ExtendableEvent objects may not extend lifetime via waitUntil() #1040
Comments
I would also be happy to make manually constructed ExtendableEvent objects unset extensions allowed flag. |
I think we also used to have something that prevented waitUntil() outside of a dispatch, but I don't see that any more. Thats a minor issue, though, since the the script can call |
FWIW, we are going to throw InvalidStateError in this case. Its easier to open this up to not throw if we need that behavior for some reason. |
To put this in context, I do, to emulate background sync on Firefox, periodically check if
My event handler looks like:
where |
I think #980 (comment) would fix this too. |
To discuss: Should we spec #980 (comment), and is this v1? |
Even if we spec the solution in #980, I don't think it should apply to manually constructed events. |
F2F: When we spec #980, the example in the OP shouldn't allow waitUntil, as if promises have been previously passed & all settled. |
I think we may want to use |
What is mentioned in OP should already throw since the dispatch flag is not set. But yeah, it seems reasonable to also check the isTrusted attribute (internal slot at some point). Not entirely convinced that's the best way, but that should work. |
This change adds a guard to waitUntil() that disallows the extension of the event that is not dispatched by the user agent. Fixes #1040.
This moves the state check point of the script created event from the outside into the event dispatch task. Before this change, it could be possible to pass the test without checking the isTrusted state when "the pending promises count is zero and the dispatch flag is unset" condition was met. Spec issue: w3c/ServiceWorker#1040. Spec PR: w3c/ServiceWorker#1166.
…sk (#6517) * Check the state of the script created event inside of the dispatch task This moves the state check point of the script created event from the outside into the event dispatch task. Before this change, it could be possible to pass the test without checking the isTrusted state when "the pending promises count is zero and the dispatch flag is unset" condition was met. Spec issue: w3c/ServiceWorker#1040. Spec PR: w3c/ServiceWorker#1166. * Dispatch event synchronously and reuse sync_waituntil * Change for a retry after 502 server error
…sk (web-platform-tests#6517) * Check the state of the script created event inside of the dispatch task This moves the state check point of the script created event from the outside into the event dispatch task. Before this change, it could be possible to pass the test without checking the isTrusted state when "the pending promises count is zero and the dispatch flag is unset" condition was met. Spec issue: w3c/ServiceWorker#1040. Spec PR: w3c/ServiceWorker#1166. * Dispatch event synchronously and reuse sync_waituntil * Change for a retry after 502 server error
…sk (web-platform-tests#6517) * Check the state of the script created event inside of the dispatch task This moves the state check point of the script created event from the outside into the event dispatch task. Before this change, it could be possible to pass the test without checking the isTrusted state when "the pending promises count is zero and the dispatch flag is unset" condition was met. Spec issue: w3c/ServiceWorker#1040. Spec PR: w3c/ServiceWorker#1166. * Dispatch event synchronously and reuse sync_waituntil * Change for a retry after 502 server error
Currently its possible to do this in the spec:
By default the extensions allowed flag is set, so this does not throw an InvalidStateError.
We should be clear, though, that this does not actually extend the lifetime of the SW. Currently the spec is written in a way that suggests that this might imbue some keep-alive budget to the SW.
The text was updated successfully, but these errors were encountered: