New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 702621 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 3
Type: Bug



Sign in to add a comment

New Tab title is reset with a replaceState

Project Member Reported by samarth@chromium.org, Mar 17 2017

Issue description

Chrome Version: All
OS: All

What steps will reproduce the problem?
(1) Set Google as your DSP
(2) Load NTP (reload to work around  crbug.com/702043 )
(3) Observe that title is "New Tab"
(4) In the console, type
> history.replaceState({}, '', '/_/chrome/newtab?espv=2&ie=UTF-8');

What is the expected result?
Title doesn't change.

What happens instead?
Title gets set to "chrome://newtab"

Please use labels and text to provide additional information.


 

Comment 1 by creis@chromium.org, Mar 17 2017

Cc: creis@chromium.org samarth@chromium.org
Owner: treib@chromium.org
I'm not familiar with how the NTP logic changes the title.  treib@, do you know someone on the NTP team that can look at this, or at least point out where the bug is?

Comment 2 by treib@chromium.org, Mar 17 2017

Status: Assigned (was: Untriaged)
I'm not familiar with this either, but I'm the only one actively working on the desktop NTP. I'll take a look at some point.
It's been a long time since I looked at this in Chrome. IIRC, SearchTabHelper listens for navigation changes and sets the title (assuming the NTP hasn't overridden it server side). See:
https://cs.chromium.org/search/?q=IDS_NEW_TAB_TITLE+package:%5Echromium$+f:search_tab_helper.cc&type=cs

I suspect replaceState is resulting in a type of navigation change that isn't handled here.  So one possible fix might be to add another listener.

(Of course, there might be a better, less brittle way of doing this as well.)
See also https://codereview.chromium.org/78443005/ where this approach was first introduced (obviously, it's gotten somewhat more complicated since then :)).
So, maybe I'm dumb... but why can't the NTP content have <title>New Tab</title>?  Yes, that would let custom new tabs overridden by some other default search provider call themselves something else; I'm not sure that's so bad.
Search providers can already do that. The "API" here is: the server NTP can set a title and it will get used, or it can omit a title, and Chrome uses its standard title for NTPs.

The downside for the server picking the title is that the server can't use Chrome's translations/string resources and so has to re-create all of this (which languages to support, etc) and so things will differ slightly. If Chrome ever changes what it wants to title the NTP, this would need to be coordinated as well.  This is also why this wasn't an option for a quick fix here: we don't have translations available right now on the server.

But: it seems like having Chrome set the title when unset has turned out to be surprisingly convoluted (e.g. compare the original version in https://codereview.chromium.org/78443005/ to what we have now). So it's not unreasonable now to just give up on this and have the server set the title.

Comment 7 by treib@chromium.org, Mar 20 2017

Longer-term, I'm also working towards removing the remote NTP entirely, see bug 583289. That would avoid this problem completely.

Comment 8 by treib@chromium.org, Sep 5 2017

Labels: OS-Chrome OS-Linux OS-Mac OS-Windows
Hm, on second though, the local NTP will not actually make this obsolete, as we'll still have third-party remote NTPs.

Comment 9 by treib@chromium.org, Jan 11 2018

Owner: ----
Status: Available (was: Assigned)
Labels: ntp-starter-bug

Sign in to add a comment