Issue metadata
Sign in to add a comment
|
Address incorrect foreground tracking due to browser side navigation |
||||||||||||||||||||||||
Issue descriptionIn page load metrics, with browser side navigation enabled, some page loads that start in the foreground are incorrectly classified as having started in the background. clamy explains: """ the background/foreground issue seems to be due to the ordering of calls in chrome/browser/ui/browser_navigator.cc when we create a new tab. What happens is: - we first create a WebContents and ask it to navigate (https://cs.chromium.org/chromium/src/chrome/browser/ui/browser_navigator.cc?type=cs&l=557). This result in the creation of a NavigationHandle, so we fire DidStartNavigation. In the current architecture, we fire DidStartNavigation after receiving a DidStartProvisionalLoad. - then we insert the WebContents in the tab strip (https://cs.chromium.org/chromium/src/chrome/browser/ui/browser_navigator.cc?type=cs&l=589). This fires WebContentsImpl::WasShown. """ We may wish to try to address this by heuristically correcting for it in the page load metrics code, or by inverting the ordering of nav start vs insertion into the tab strip.
,
Apr 28 2017
I have tried very hard to change the ordering when fixing webNavigation extension API to work with PlzNavigate. However, it turns out it is not simple at all and is fraught with peril. I resorted to handling this case explicitly in the webNavigation code internally. I would suggest if possible to actually account for this case within the page load metrics code. Let me know if I can be of help.
,
May 1 2017
Bryan, PLM code is currently using NavigationThrottle::WillStartRequest instead of WebContentsObserver::DidStartNavigation. And I see the comment in metrics_navigation_throttle.h that "Data from the NavigationHandle accessed at this point is used to obtain more reliable abort metrics (like page transition type)." Why is that more reliable?
,
May 1 2017
Good question - some of the properties of NavigationHandle that we care about, such as HasUserGesture IIRC, are not available in DidStartNavigation, but are available in WillStartRequest. The reason for this seems to be historical & some of these getters could be made available at construction time, but it requires refactoring. I did try to refactor nav handle and related code a bit to fix this for user gesture tracking, but my change regressed an android test that wasn't part of the CQ so I had to revert it & I decided to table the work so never re-landed.
Ideally all of the properties we care about would be available in DidStartNavigation but that's not currently the case, so we hook WillStartRequest instead.
You can get a sense for which properties are available at which times by looking at the state_-related DCHECKs in the getters in navigation_handle_impl.cc, for example:
bool NavigationHandleImpl::HasUserGesture() {
CHECK_NE(INITIAL, state_)
<< "This accessor should not be called before the request is started.";
return has_user_gesture_;
}
PageTransition is another example of a property not available until WillStartRequest.
Note too that some of these properties can be 'updated' at commit time, for reasons that weren't always totally clear. It's probably best to trace how each navhandle property you are interested in is updated to understand its unique constraints / properties.
,
May 25 2017
|
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by bmcquade@chromium.org
, Apr 28 2017