New issue
Advanced search Search tips

Issue 635507 link

Starred by 1 user

Issue metadata

Status: Duplicate
Owner:
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

history.pushState ignores the new title set via document.title and creates an entry in the history using the previous (out-dated) title as a label

Reported by matthias...@gmail.com, Aug 8 2016

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0

Steps to reproduce the problem:
According to the HTML 5 specification by the W3C the 2nd parameter of

history.pushState( stateObject, title, url)

is optional and the note below bullet point 8 at chapter 5.5.2 states

"The title is purely advisory. User agents might use the title in the user interface."

This is exactly how Chromium works. However, the following code should lead to the desired result and provide a consistent user experience across all browsers.

    /* do some DOM manipulation, e.g. apply the result of some AJAX request */
    document.title = myTitle;
    history.pushState( myState, myTitle, myURL );

This code also assigns the new title to the document in case the browser's implementation decides to use the UI title as a label for the history entry.

What is the expected behavior?
Expected result: `pushState` should use the new title that has been assigned to `document.title`

What went wrong?
Actual result: Google Chromium actually creates a history entry with the old title as its label. I guess the reason is that the UI is only updated after the JS call stack becomes empty and hence the new document title is not yet applied to the DOM when `pushState` is called.

Did this work before? No 

Chrome version: 51.0.2704.106  Channel: n/a
OS Version: Gentoo (Kernel 4.4.12)
Flash Version: 

Impact: If the user picks an item from the history, the user experiences a weird off-by-one bug. The user is mislead to a different page than the user expects, because the labels of each history entry and the actual  destination of the history entry are out-of-sync by one.
 
Components: -Blink Blink>Loader

Comment 2 by ajha@chromium.org, Aug 9 2016

Cc: ajha@chromium.org
Labels: Needs-Feedback
matthias.h.nagel@: Could you please attach any testfile with the above test case for simple repro.
Here you go:
push-state-test.html
1.5 KB View Download
Labels: -Needs-Feedback Needs-Bisect
Labels: -Needs-Bisect M-54 OS-Mac OS-Windows
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on Windows 7, MAC 10.11.6, Ubuntu 14.04 for chrome stable version 52.0.2743.116 and Issue is a non regression since M24 - 24.0.1300.0. 

On Current Canary version 54.0.2825.0, Unable to click the history entry. 

This is working fine on Firefox.

Untriaging it so that it gets addressed and removing Bisect label.

Thanks.!
Owner: majidvp@chromium.org
Status: Assigned (was: Untriaged)
Loading triager here. majidvp@ can you take a look? It looks like you've done recent work with that API.
Mergedinto: 44140
Status: Duplicate (was: Assigned)
I suspect this is a dupe of bug 44140: we're just ignoring document.title changes in the history system.

Sign in to add a comment