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

Issue 668454 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug-Regression

Blocking:
issue 669776



Sign in to add a comment

Regression : NTP does not get updated according to the default search engine.

Reported by yfulgaon...@etouch.net, Nov 24 2016

Issue description

Chrome 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
 
Actual_Result_1.mov
5.8 MB Download
Expected_Result_1.mov
5.4 MB Download
Labels: hasbisect-per-revision Proj-MaterialDesign-WebUI
Owner: toyoshim@chromium.org
Status: Assigned (was: Unconfirmed)
Using the per-revision bisect providing the bisect results,
Good build: 54.0.2791.0 (Revision: 404283).
Bad build: 54.0.2793.0 (Revision: 404564).

You are probably looking for a change made after 404320 (known good), but no later than 404321 (first known bad).
CHANGELOG URL:
  https://chromium.googlesource.com/chromium/src/+log/bace6ed0fd91cd357569dc9ad1d285ff2390520e..7ae0fd5c2969a7253c23fdad6993898323aba694

@toyoshim -- Could you please look into the issue, pardon me if it has nothing to do with your changes and if possible please assign it to concern owner.

Thank You.
Cc: toyoshim@chromium.org
Owner: steve...@chromium.org
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.
Components: UI>Browser>NewTabPage
Labels: Reload
Set NTP label.

Comment 4 by treib@chromium.org, 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 :)
Cc: steve...@chromium.org
Owner: ----
Status: Available (was: Assigned)
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.
> 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.

Comment 7 by treib@chromium.org, Nov 25 2016

Cc: -toyoshim@chromium.org treib@chromium.org
Owner: toyoshim@chromium.org
Status: Assigned (was: Available)
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!
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.

Comment 9 by treib@chromium.org, 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"?
I mean Google search box in the NTP that is shown only when Google is selected as a default search engine.

Comment 11 by treib@chromium.org, 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.
Status: Started (was: Assigned)
Thanks, that information would help me to investigate.
But, sorry time is already up today. I'd investigate this next week.
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.

Comment 14 by treib@chromium.org, Nov 28 2016

Labels: -Proj-MaterialDesign-WebUI
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?
Cc: dbeam@chromium.org
+dbeam
OK, I have a fix. I'd send a CL for review soon.
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.

Comment 19 by dbeam@chromium.org, 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

Comment 20 by treib@chromium.org, 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.
Blocking: 669776
Project Member

Comment 22 by bugdroid1@chromium.org, 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

Status: Fixed (was: Started)

Sign in to add a comment