back button history does not always update when using window.history.go

UNCONFIRMED
Unassigned

Status

()

Core
Document Navigation
UNCONFIRMED
5 years ago
5 months ago

People

(Reporter: Eric Rasmussen, Unassigned)

Tracking

({testcase})

15 Branch
x86
Linux
testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

5 years ago
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:15.0) Gecko/20100101 Firefox/15.0
Build ID: 20120825192214

Steps to reproduce:

1) Follow a link from one file (first.html) to another (second.html)
2) In second.html, use javascript to push states #loading and #done
3) In second.html, set a popstate listener to call window.history.go(-2) if the current hash tag is #loading
3) Click the back button in the browser (navigates back to #loading)



Actual results:

If you click and hold the back button before going back, you see the previous pages in the history list as expected:

second.html#loading
second.html
first.html

If you click back once it goes to second.html#loading and the popstate function is called (which calls window.history.go(-2)). first.html is loaded in the browser window as expected, but the history list is not updated.

If you now click and hold the back button, you still see:

second.html#loading
second.html
first.html

And second.html#loading is highlighted, even though the displayed page is first.html.

Consequently, clicking back again goes to second.html and begins the process again.

This does not occur in any other browser we have tested.


Expected results:

The history list (seen by clicking and holding the back button) should have moved back to first.html and prevented the user from clicking back again.

IMPORTANT NOTE: this has occurred on 3 out of 5 tested computers, spanning Windows and Linux and all Firefox versions from 12 to 15. There doesn't seem to be a pattern here. We tested two copies of Ubuntu with the same version of Firefox 15 and saw this occur on one but not the other.

However, it is not an intermittent error. If it happens once it appears to happen every time, and on affected machines the best workaround is to set an interval before calling window.history.go.

I've attached example files first.html and second.html (a reduced test case from the real website this was found on).

I'm happy to provide any other info you need so please review and let me know.
(Reporter)

Comment 1

5 years ago
Created attachment 659859 [details]
first of two example files. put both in the same folder and open in firefox
(Reporter)

Comment 2

5 years ago
Created attachment 659860 [details]
reduced javascript test case

put this and first.html in the same folder, then open first.html and follow the link. note that as described in the bug report this does not happen on all systems, but it did happen on 3 out of 5 systems we tested.
Component: Untriaged → History: Global
Product: Firefox → Core
Keywords: testcase

Updated

5 months ago
Component: History: Global → Document Navigation
You need to log in before you can comment on or make changes to this bug.