Regression : NTP does not get updated according to the default search engine.
Reported by
yfulgaon...@etouch.net,
Nov 24 2016
|
||||||||||
Issue descriptionChrome Version : 57.0.2929.4 82367cc74e9f970cf4cfe84f62db913f06d0fc95-refs/branch-heads/2929@{#5} 32/64 bit OS : Mac(10.11.6, 10.12.1, 10.12), Windows(7,8,8.1,10), Linux (14.04 LTS) What steps will reproduce the problem? 1. Launch chrome and navigate to chrome://md-settings. 2. Scroll down to the ‘Search engine’ section and change default search engine to “Yahoo! India”. 3. Open NTP (do not close the NTP), again go to chrome://md-settings page and change default search engine to “Google”. 4. Again switch to NTP (opened in step 3) and observe the NTP. Actual : NTP contents does not get updated when changing the default search engine from “Google” to “Yahoo! India” and vice versa. Expected : NTP contents should get updated after changing the default search engine. This is a regression issue broken in ‘M-54’, below is the Manual Regression range and will soon update other info. Good build : 54.0.2791.0 Bad build : 54.0.2793.0
,
Nov 25 2016
stevenjb@ can you take a look? My CL changed a reload behavior not to force revalidating sub-resources. Since I do not understand how NTP work, I have no idea what is the best fix here. When I change the search engine, existing NTP pages seem to be reloaded automatically. But it could not pick up contents for newly specified search engine. FYI, newly opened NTP shows new search engine correctly.
,
Nov 25 2016
Set NTP label.
,
Nov 25 2016
The relevant NTP code is in BrowserInstantController::DefaultSearchProviderChanged, in particular here: https://cs.chromium.org/chromium/src/chrome/browser/ui/browser_instant_controller.cc?rcl=0&l=192 Not sure why that would be affected by the change above, but maybe this helps someone else figure it out :)
,
Nov 25 2016
I notice that this happens even on chrome://settings. Also, it's a little racy. Sometime it reloads correctly, and sometime it doesn't. So probably, I need a help from NTP team. One possible reason is that my change makes reload faster than before, and it loads something before something is ready to reflect search engine updates.
,
Nov 25 2016
> One possible reason is Ah, this isn't possible because when I saw it does not reload correctly, manual reloads do not work at all.
,
Nov 25 2016
I can be the person on the NTP side, but I know nothing about this reload change. Could you take a look at the code I linked above and see if anything there looks fishy to you? Thanks!
,
Nov 25 2016
Before investigating actual code, I have some questions about the NTP implementation. - How is the main document provided? - How is the search box content provided? If provided in a different resource, what resource URI is? If the search box isn't part of the main document, memory cache or disk cache would cache the previous content and loading follows the cache control protocol.
,
Nov 25 2016
Thanks for looking into this! The main document is a web page served from https://www.google.com/_/chrome/newtab (cached by a ServiceWorker, but that shouldn't matter). I'm not sure what you mean by "search box content"?
,
Nov 25 2016
I mean Google search box in the NTP that is shown only when Google is selected as a default search engine.
,
Nov 25 2016
Ah - that's a regular part of the web page. It's actually not really a search box at all; when you start typing, it just redirects focus to the Omnibox. I don't think that's related to the problem. Some background on the reload logic: For NTPs, Chrome provides some special Javascript APIs (such as the focus mangling above). What's considered an NTP depends on the chosen search engine, so when the search engine changes, then what used to be an NTP isn't an NTP anymore. That's what the reload in BrowserInstantController is for: We load the page again, the page detects that the special NTP APIs aren't there anymore, and so it redirects to a standard Google home page.
,
Nov 25 2016
Thanks, that information would help me to investigate. But, sorry time is already up today. I'd investigate this next week.
,
Nov 28 2016
On reload, chrome-search://local-ntp/local-ntp.html is loaded that includes two scripts in the head tag.
<script src="chrome-search://local-ntp/config.js"></script>
<script src="chrome-search://local-ntp/local-ntp.js"></script>
But after my reload change, these scripts are served from memory cache in Blink.
As a result, config.js contains old configData that says { "isGooglePage": true } even after changing the search engine to a different one.
This is what I said, sub-resource loading should follow cache protocol. To avoid this problem, if these are served by http(s), it needs to return cache control headers, ETag, and so on correctly. Or using different URI for different contents will solve the problem.
,
Nov 28 2016
Thanks for the investigation! Using a different URI won't work; the whole point of that config.js is to pass options to the page. Setting cache headers should be possible though. I'm a bit confused about the "http(s)" comment - these scripts are served from chrome-search://, not http(s). But I guess at that cache layer in Blink, that amounts to the same thing?
,
Nov 28 2016
+dbeam
,
Nov 29 2016
OK, I have a fix. I'd send a CL for review soon.
,
Nov 29 2016
https://cs.chromium.org/chromium/src/content/browser/webui/web_ui_data_source_impl.cc?sq=package:chromium&dr=CSs&rcl=1480378899&l=60 just override AllowCaching to return false in LocalNtpSource https://cs.chromium.org/chromium/src/chrome/browser/search/local_ntp_source.h?q=localntpsource&sq=package:chromium&l=16&dr=CSs
,
Nov 29 2016
Yeah, but is it ok to return false for all resources in terms of performance impact? If there is a concern, I'd split non-cachable resources into LocalNtpNonCacheSource.
,
Nov 29 2016
i'll let treib@ answer that definitively, but I assume it's OK because fairly little is being done to generate the contents of those URLs: https://cs.chromium.org/chromium/src/chrome/browser/search/local_ntp_source.cc?sq=package:chromium&dr=CSs&rcl=1480378899&l=149,169
,
Nov 29 2016
Yeah, caching in Blink or just getting the files from LocalNtpSource again shouldn't make much of a difference in terms of performance. I've also tried it locally and there doesn't seem to be a big difference (though the timings are somewhat noisy and it's hard to judge). I'll keep an eye on the UMA metrics after the change lands, but let's assume it's all good.
,
Nov 30 2016
,
Nov 30 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/501ba310da88bd1b84202f3f4c9b38cc5e6ea899 commit 501ba310da88bd1b84202f3f4c9b38cc5e6ea899 Author: toyoshim <toyoshim@chromium.org> Date: Wed Nov 30 08:25:55 2016 New Tab Page: chrome-search://local-ntp/ files should not be cachable Under chrome-search://local-ntp/, there is a file that can be modified dynamically, e.g., config.js, and such a file should not be cachable so that reload operations can load new data correctly. This wasn't a problem before because Chrome's reload revalidates all resources forcibly, but recent change made a normal reload revalidate not all-resources, but only main resource. BUG= 668454 Review-Url: https://codereview.chromium.org/2533203002 Cr-Commit-Position: refs/heads/master@{#435166} [modify] https://crrev.com/501ba310da88bd1b84202f3f4c9b38cc5e6ea899/chrome/browser/search/local_ntp_source.cc [modify] https://crrev.com/501ba310da88bd1b84202f3f4c9b38cc5e6ea899/chrome/browser/search/local_ntp_source.h
,
Nov 30 2016
|
||||||||||
►
Sign in to add a comment |
||||||||||
Comment 1 by msrchandra@chromium.org
, Nov 24 2016Owner: toyoshim@chromium.org
Status: Assigned (was: Unconfirmed)