-
Notifications
You must be signed in to change notification settings - Fork 315
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
WindowClient.navigate() behavior for reserved clients and in-flight navigations #1123
Comments
Over here I proposed rejecting with InvalidStateError: I think implementing anything active like this on reserved clients could be difficult and racy. One of the reasons we thought it was ok to add reserved clients was that it could be lightweight and effectively implemented by pre-allocating a UUID. If we require this kind of cancellation behavior it gets a lot harder to implement IMO. |
When |
So, in essence, a navigation that is in progress should always get to complete (regardless of the client type)? Only after a completed navigation do we allow a navigate() call without rejecting it with an InvalidStateError? |
Well, it could be stopped through other means. I just think of a "reserved" Client object as an inert placeholder. The only thing you can really do with it is queue up messages via postMessage(). I support we could be more explicit about this by creating a |
Ok so to recap, reserved clients cannot and should not have the ability to be navigated. Clients (not reserved) that are half-way through a navigation will not perform a new navigation until the in-flight navigation is complete. |
We could just use the
Right.
@aliams Ignore my comment in #1123 (comment). I think that's wrong. The reason why we don't want to navigate a reserved client would be because it can be in an invalid state to trigger a navigate: it doesn't have a global yet, not associated with a browsing context yet, etc.
|
In that case, should we be more explicit about the behavior of navigate() for non-reserved clients? Specifically, what happens to in-flight navigations? |
The synchronous part of navigate algorithm checks whether it'll abort its own steps or go ahead after aborting the active document of the browsing context. I think |
F2F: This is no longer a problem as we aren't going to expose reserved clients. If a client is navigated while it's navigating, it should behave like iframes do in the same situation – tests should assert this. I assume that the latest navigation happens and the old aborts, as long as the new client hasn't been created yet. Use case: You serve something online-first, but it gets stuck after headers & some body. You want to start again, switching to an offline-first model. Client navigation gets you this. |
Reading through the spec, it wasn't immediately clear what should happen when navigate() is called on a reserved client (which could be going through a navigation) or even a client that has an in progress navigation. Chatting with @mattto, it sounds like we should cancel the in-progress navigation and replace it with the new navigation. I would liken this to someone who is in the middle of a navigation when they change course via the address bar.
cc spec editors @jakearchibald and @jungkees
The text was updated successfully, but these errors were encountered: