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

Document reasons why portal activation can fail #185

Open
jeremyroman opened this issue May 4, 2020 · 6 comments
Open

Document reasons why portal activation can fail #185

jeremyroman opened this issue May 4, 2020 · 6 comments
Labels
spec todo A nitty-gritty detail that needs spec work

Comments

@jeremyroman
Copy link
Collaborator

jeremyroman commented May 4, 2020

Currently the following cases exist in the Chromium implementation. Those marked with an asterisk (*) are already expressed in the draft:

Synchronously:

  1. no browsing context associated with the element*
  2. another HTMLPortalElement has an outstanding activation
  3. the element is itself inside a portal browsing context*
  4. activate data serialization failure*

Asynchronously:

  1. a top-level navigation was in progress when the browser tried to execute the activation
  2. no document was yet loaded in the portal, e.g. because the fetch isn't far enough along to commit, or because the UA chose to block it for some reason (incl. but not limited to CSP)
  3. an error page (interstitial) is being displayed, rather than the requested resource
@jeremyroman
Copy link
Collaborator Author

@domenic three of the seven possible reasons are currently expressed in the draft

@jakearchibald
Copy link
Collaborator

a top-level navigation was in progress when the browser tried to execute the activation

Is this consistent with other forms of navigation? I thought in-process navigations were cancelled if a new navigation happens, but I'm sure it's more complicated than that.

no document was yet loaded in the portal, e.g. because the fetch isn't far enough along to commit, or because the UA chose to block it for some reason (incl. but not limited to CSP)

Do developers have a way to detect when the fetch is far enough along?

@kjmcnee
Copy link
Collaborator

kjmcnee commented May 5, 2020

In chromium at least, renderer initiated navigations without a user gesture are not allowed to cancel a browser initiated navigation. The idea is to prevent a page from trapping a user who is trying to use the back button by navigating repeatedly.

We have the same behaviour for portals: a portal activation without a user gesture cannot cancel a browser initiated navigation.

@jeremyroman
Copy link
Collaborator Author

a top-level navigation was in progress when the browser tried to execute the activation

Is this consistent with other forms of navigation? I thought in-process navigations were cancelled if a new navigation happens, but I'm sure it's more complicated than that.

Ultimately there's a point at which the browser has decided to go ahead with the navigation. In Chromium, at least, this is triggered by the beginning of the response body. At this point we have changed, or are about to change upon receiving a rendered frame, the page that the user is looking at. Activation cannot proceed at that point.

Navigations are cancelled by new navigations, unless they have reached this point.

no document was yet loaded in the portal, e.g. because the fetch isn't far enough along to commit, or because the UA chose to block it for some reason (incl. but not limited to CSP)

Do developers have a way to detect when the fetch is far enough along?

They have a way to detect later events, like load. I don't know whether we can reasonably expose this information. This is necessary because the entire load could end up being blocked and then we have nothing to show the user. This could have already happened, or we could be sitting waiting on a request which will ultimately result in a redirect to an invalid URL, a response with a CSP that prevents loading, or something similar.

@jakearchibald
Copy link
Collaborator

@kjmcnee

In chromium at least, renderer initiated navigations without a user gesture are not allowed to cancel a browser initiated navigation. The idea is to prevent a page from trapping a user who is trying to use the back button by navigating repeatedly.

We should probably spec this if it isn't already (and I don't recall seeing it).

@jakearchibald
Copy link
Collaborator

@jeremyroman

Do developers have a way to detect when the fetch is far enough along?

They have a way to detect later events, like load. I don't know whether we can reasonably expose this information. This is necessary because the entire load could end up being blocked and then we have nothing to show the user.

I'm unsure about this, but I don't want to derail this issue. Filed #191.

@domenic domenic added the spec todo A nitty-gritty detail that needs spec work label May 8, 2020
domenic added a commit that referenced this issue Sep 3, 2020
domenic added a commit that referenced this issue Sep 17, 2020
domenic added a commit that referenced this issue Sep 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec todo A nitty-gritty detail that needs spec work
Projects
None yet
Development

No branches or pull requests

4 participants