Open Bug 790068 Opened 8 years ago Updated 2 years ago

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


(Core :: DOM: Navigation, defect)

15 Branch
Not set





(Reporter: eric, Unassigned)


(Keywords: testcase)


(2 files)

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:


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:


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.
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
Component: History: Global → Document Navigation
You need to log in before you can comment on or make changes to this bug.