Open Bug 1582420 Opened 6 years ago Updated 3 years ago

Back button loses history push state changes when previously on page

Categories

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

69 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: bugzilla, Assigned: smaug)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36

Steps to reproduce:

  1. Start on a page that isn't the same as in step (2) - going directly to a URL in step 2 seems to stop the issue occurring. For example:

https://www.openrent.co.uk/

  1. Navigate to a page that modifies the URL using History PushState, by for example, searching "London". This will redirect you to:

https://www.openrent.co.uk/properties-to-rent/london?term=London

  1. Change the URL using push state, in this example, by using the advanced filter / changing rental amount. This will change the URL for example to:

https://www.openrent.co.uk/properties-to-rent/london?term=London&sortType=1&acceptStudents=true&acceptDSS=true

  1. Navigate to a new page, in this example, by clicking on a property

  2. Click the browser back button

Actual results:

The browser supplies a request (according to the network tab), for the page with the modified URL. You can see it's redirecting to:

https://www.openrent.co.uk/properties-to-rent/london?term=London&sortType=1&acceptStudents=true&acceptDSS=true

As you'd expect.

However, on load, calling window.location returns the original URL (not the modified or requested one), specifically in this example:

https://www.openrent.co.uk/properties-to-rent/london?term=London

Expected results:

On page load, calling window.location should return the modified / requested URL. Specifically in this example:

https://www.openrent.co.uk/properties-to-rent/london?term=London&sortType=1&acceptStudents=true&acceptDSS=true

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Document Navigation
Product: Firefox → Core

I'll try to find time to investigate this some more.

Assignee: nobody → bugs
Priority: -- → P3

OK great! Appreciate it's a bit of an odd one to reproduce, and apologies creating a minimal sample case was difficult in this instance.

Worth noting it's only Firefox that appears to exhibit this behaviour.

I've tried to create a minimal test case for you - but seem to be struggling to do so.

However, perhaps you could explain how the following happens (also see attached screenshot)

  1. Press back button on page, which does get request to correct URL
  2. HTML response has a script tag at the top to log the window location which shows a different URL

I am possibly missing something basic, but this seems like something that shouldn't be possible to me.

After a bit more investigation and debugging, it seems clicking "back" on the browser is triggering a second request, right after the first. Dev tools isn't showing this second request, and is only showing the first.

The second request appears to be to a different URL, and it's not clear why or where that URL is coming from.

This seems like quite a dramatic bug, but at the same time, I'm struggling to reproduce in a simple test case.

Any help appreciated.

I suspect this stack trace may be useful - otherwise, let me know if there is anything else I can supply to help investigate this.

It seems this has been fixed in Firefox 72.0.1, as I can no longer reproduce.

Would be good to confirm this was an intentional bug fix.

Thanks!

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: