Fix OnWillRestoreTab() function call order

Desktop / Chromium - Duc Bui [google.com] - 9 August 2017 11:25 EDT

OnWillRestoreTab() is intended to be called before any navigations of a restored WebContents but the original CL (https://chromium-review.googlesource.com/c/588168) places this function far from the creation of restored tabs. With browser-side navigation enabled, the first navigation happens before OnWillRestoreTab(), while without browser-side navigation, OnWillRestoreTab() is called before the first navigation as expected. This makes some browser tests in SessionRestorePageLoadMetricsObserver (https://crrev.com/2930013005) failed when browser-side navigation is enabled.

This CL moves the call of OnWillRestoreTab() to right after the creation of a restored WebContents, before any of its navigations.

Bug: 731901 Change-Id: I8d95fb14b141caffa95ada64838bde363aa10f00 Reviewed-on: https://chromium-review.googlesource.com/601545

70c5972 Fix OnWillRestoreTab() function call order
chrome/browser/sessions/session_restore.cc | 12 +-
chrome/browser/sessions/session_restore.h | 6 +-
.../session_restore_observer_browsertest.cc | 241 +++++++++++++++++++++
chrome/browser/ui/browser_live_tab_context.cc | 6 +-
chrome/browser/ui/browser_tabrestore.cc | 36 ++-
chrome/browser/ui/browser_tabrestore.h | 34 +--
chrome/test/BUILD.gn | 1 +
7 files changed, 289 insertions(+), 47 deletions(-)

Upstream: git.chromium.org


  • Share