-
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
Clients.get: block on reserved clients. #1315
Closed
Closed
Changes from 2 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1f77b03
Building Spec: 9a6b738771d1e3d235b539bbdc896e88803573e8
mfalken 95f857f
Clients.get: block on reserved clients.
mfalken af0da60
Rebuilding spec (#1314)
mfalken 6477cd1
Building Spec: af0da60935ffd5e80db388709de0ffa157431ed3
46d6b65
Clients.get: block on reserved clients.
mfalken 59374f0
ok
mfalken 29c9a2e
ok
mfalken e90c0d8
Merge branch 'clients-get' of https://github.com/mattto/ServiceWorker…
mfalken 0d5ba24
Change the affiliation of Jungkee Song
jungkees 3a8e09c
Building Spec: e616460b2fae8a4d589de9a099a8c6dd739d89fe
ad1b2b3
Change affiliation of Jungkee Song in Nightly
jungkees 7e994b5
Restore the reference to response's cache state
jungkees 08ad67e
rebase-compile
mfalken File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 seems a bit hand-wavey, since there isn't an explicit connection between a client & it's fetch.
Adding this connection would likely be really hard, since fetch doesn't really return an instance (this has been a problem elsewhere).
Feels like it would be easier to turn the execution ready flag into an enum, eg execution state, which could be "pending", "ready" or "failed". Then, this part of the spec would be explicit, as you'd be waiting for that enum to change to "failed" (in which case you'd reject and abort) or "ready" (in which case you'd continue).
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 agree that waiting for a state change is probably better. At least, it matches what I've anticipated implementing.
Note, I'm not sure we need a tri-state enum, though. I think we can just get by with an execution ready boolean. If the browser fails to mark a client as execution ready I believe it should simply destroy the client fairly quickly. So we can just listen for "client goes away before being marked execution ready".
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.
Ohh, if we have a standard way of describing "goes away", I agree that would fit nicely.
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.
Its probably not clearly defined for windows in the html spec. I think defining when to set this error state would be equivalent to defining discarding the client on failure, though.
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.
Note, we also already depend on client discarding in other places in the service worker spec. We activate waiting workers when the last client "goes away". If that last controlled client is a reserved client being navigated, then we have this same situation.
Not saying we shouldn't spec it better, but just highlighting that we already depend on this concept pretty heavily.
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.
Strangely, "terminating" links to "service worker termination", which doesn't really make sense... service workers are not service worker clients.
I didn't know about reserved clients going away on redirect. I thought the reserved client gets set one time in the HTML spec here https://html.spec.whatwg.org/#process-a-navigate-fetch before continuing on to the Fetch spec. The Fetch spec follows the redirects here https://fetch.spec.whatwg.org/#http-redirect-fetch. So I thought there's just one time the reserved client gets set, at the start of the navigation.
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.
Oh, it probably means to link to worker termination in the HTML spec.
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 probably here "process a navigate response" https://html.spec.whatwg.org/multipage/browsing-the-web.html#process-a-navigate-response we can add something like "discard reservedEnvironment" and have the service worker spec wait for that.
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.
To clarify, the reserved client is not discarded on all redirects. Redirecting cross-origin, though, must result in a new client being reserved with the new origin to avoid violating same-origin restrictions. So at that point the old reserved client can be discarded.
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.
@wanderview Hum, that's not what I thought. I filed #1316
FYI: created whatwg/html#3723