New Tab title is reset with a replaceState |
|||||
Issue descriptionChrome 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.
,
Mar 17 2017
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.
,
Mar 17 2017
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.)
,
Mar 17 2017
See also https://codereview.chromium.org/78443005/ where this approach was first introduced (obviously, it's gotten somewhat more complicated since then :)).
,
Mar 18 2017
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.
,
Mar 20 2017
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.
,
Mar 20 2017
Longer-term, I'm also working towards removing the remote NTP entirely, see bug 583289. That would avoid this problem completely.
,
Sep 5 2017
Hm, on second though, the local NTP will not actually make this obsolete, as we'll still have third-party remote NTPs.
,
Jan 11 2018
,
Sep 16
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by creis@chromium.org
, Mar 17 2017Owner: treib@chromium.org