Open Bug 1704809 Opened 4 years ago Updated 3 years ago

history state incorrect on pageshow after another page was visited

Categories

(Core :: DOM: Navigation, defect, P3)

Firefox 87
defect

Tracking

()

People

(Reporter: jackdesbwa, Unassigned)

Details

Attachments

(1 file)

Attached file history_states.html (deleted) —

Probable defect: The history state looks incorrect when the pageshow event is fired after another page was visited
Observed on Firefox 87 on Linux.
Not tested on other platforms.

The attached file is a page with a simple script which show in the console the state on popstate and pageshow, and has a form to add state.

To reproduce:

  1. Add a few states with the form
    Expected: States are added [OK]
    Console:
add 1
add 2
add 3
add 4
add 5
add 6
  1. Visit another page
    Expected: the other page/website is displayed [OK]

  2. Come back on an intermediary state (right click on back button, and select for example the state 2)
    Expected: State 2 is restored [KO]
    Observed: State 6 (i.e. last displayed) is restored
    Console:

pageshow 6

Note: it looks like it is the report to the JS code that is not working, because hitting the forward button gives the expected state.
Console:

popstate 3

It looks like a bug. If not, what is the correct way to get the state in this case?

Depends on: 1706167

@ Olli, we have different unexpected behaviors with bfcache and without bfcache:

  • This bug: When we restore from bfcache, we don't fire popstate.
  • Holding down Back button, the Back button's page titles are wrong (Fission no-bfcache, SHIP only?). I filed bug 1706167 for this variant.
Flags: needinfo?(bugs)
Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
No longer depends on: 1706167
Flags: needinfo?(bugs)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: