Skip to content

What should happen when traversing to a history entry results in nothing displayable #6483

Closed
@jakearchibald

Description

@jakearchibald

…but also not an error? Things like HTTP 204 and responses with Content-Disposition.

Top level Content-Disposition

Traversing back to a page that, different to last time, serves a file via Content-Disposition.

  1. https://iframe-session-history.glitch.me/
  2. Click "unset all" (just to clear any existing cookies)
  3. Click "Set cookie: Give all responses noStore"
  4. Reload https://iframe-session-history.glitch.me/ (you may want to do this in a new tab so you can "unset all" later)
  5. Click "Set cookie: Make top-level page response trigger download"
  6. Click "Navigate to same origin page"
  7. Click back

Chrome: Download starts. The traversal is cancelled, meaning you're stuck on the history entry. Clicking back again starts another download. If you hammer the back button fast enough you can get past the history entry.

Firefox: Download prompt. The traversal is cancelled, meaning you're stuck on the history entry. Clicking back again starts another download. Hammering the back button doesn't seem to help, but it might be a race.

Safari: As Chrome. Download starts. The traversal is cancelled, meaning you're stuck on the history entry. Clicking back again starts another download. If you hammer the back button fast enough you can get past the history entry.

Top level 204

Traversing back to a page that, different to last time, serves a 204.

  1. https://iframe-session-history.glitch.me/
  2. Click "unset all" (just to clear any existing cookies)
  3. Click "Set cookie: Give all responses noStore"
  4. Reload https://iframe-session-history.glitch.me/ (you may want to do this in a new tab so you can "unset all" later)
  5. Click "Set cookie: Make top-level page response 204"
  6. Click "Navigate to same origin page"
  7. Click back

Chrome: Similar to the download case. The traversal is cancelled, meaning you're stuck on the history entry. If you hammer the download button fast enough you can get past the history entry.

Firefox: Similar to the download case. The traversal is cancelled, meaning you're stuck on the history entry. Hammering the back button doesn't seem to help, but it might be a race.

Safari: Traversal happens, but the active document doesn't change. So, clicking back again returns to the new tab page. Clicking forward also traverses, but you stay visually on the new tab page.

Iframe Content-Disposition

Traversing back to an iframe page that, different to last time, serves a file via Content-Disposition.

  1. https://iframe-session-history.glitch.me/
  2. Click "unset all" (just to clear any existing cookies)
  3. Click "Set cookie: Give all responses noStore"
  4. Reload https://iframe-session-history.glitch.me/
  5. Click "Set cookie: Make iframe initial response trigger download"
  6. Click iframe-1 "add unload listener" (to prevent bfcache)
  7. Click iframe-1 "Navigate to 'one'"
  8. Click back

Chrome: Download starts. The traversal is cancelled, meaning you're stuck on the history entry. Clicking back again starts another download. Hammering the back button doesn't seem to help, but it might be a race.

Firefox: Download prompt. The traversal is cancelled, meaning you're stuck on the history entry. Clicking back again starts another download. Hammering the back button doesn't seem to help, but it might be a race.

Safari: Download starts. Traversal happens, but the active document doesn't change. So, clicking back again returns to the new tab page.

Iframe 204

Traversing back to an iframe page that, different to last time, serves a 204.

  1. https://iframe-session-history.glitch.me/
  2. Click "unset all" (just to clear any existing cookies)
  3. Click "Set cookie: Give all responses noStore"
  4. Reload https://iframe-session-history.glitch.me/
  5. Click "Set cookie: Make iframe initial response 204"
  6. Click iframe-1 "add unload listener" (to prevent bfcache)
  7. Click iframe-1 "Navigate to 'one'"
  8. Click back

Chrome: The traversal is cancelled, meaning you're stuck on the history entry. Hammering the back button doesn't seem to help, but it might be a race.

Firefox: As Chrome. The traversal is cancelled, meaning you're stuck on the history entry. Hammering the back button doesn't seem to help, but it might be a race.

Safari: Traversal happens, but the active document doesn't change. So, clicking back again returns to the new tab page.

Recommendation

The patterns that break the back button seem bad, and potentially abusable.

I like what Safari sometimes does, and I think I can spec it:

Right now, a navigable has a "current session history entry", but I could split this into a "current session history entry" and a "displayed session history entry". These will usually be the same thing, except in cases where you traverse to something that cannot display, such as the cases above.

Take this history:

Screenshot 2021-03-12 at 13 00 16

Where the top row is a top level page and the second row is an iframe in that page.

  1. We're on step 2. The iframe has the /one entry as both its current and displayed entry.
  2. Back clicked, but /frame-start returns a 203. As a result, the iframe has the /frame-start entry as its current entry, but stays with /one as its displayed entry.
  3. Back clicked, traversing the top level page. However, the iframe knows the /frame-start entry is its current entry, so nothing happens to the iframe, even though it's still displaying the document from /one.
  4. Forward clicked, traversing the top level page. However, the iframe knows the /frame-start entry is its current entry, so nothing happens to the iframe, even though it's still displaying the document from /one.
  5. Forward clicked. The iframe now changes its current entry to /one, but since its rendered entry is already /one, it doesn't reload or refresh.

cc @smaug---- @csreis @natechapin @cdumez @domenic

Metadata

Metadata

Assignees

No one assigned

    Labels

    interopImplementations are not interoperable with each othertopic: history

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions