This fails because for both pushState and replaceState, neither DidStartNavigation nor DidFinishNavigation gets called on the WebStateObserver.
When using LegacyNavigationManager, navigation.js (injected into the WKWebView) intercepts pushState calls, and sends a didPushState message. This is handled by [CRWWebController handleWindowHistoryDidPushStateMessage] which calls pushStateWithPageURL, which in turn calls WebStateImpl::OnNavigationStarted (leading to DidStartNavigation) and WebStateImpl::OnNavigationFinished (leading to DidFinishNavigation). didReplaceState is handled similarly.
But navigation.js isn't injected when using WKBasedNavigationManager. Are there other ways to detect pushState and replaceState? Do we still need this functionality (does anything depend on the WebStateObserver observing pushState and replaceState navigation)?
Comment 1 by danyao@chromium.org
, Oct 19 2017