We would like to establish an invariant in |webView:didFinishNavigation| that there is a non-null NavigationContext and NavigationItem associated with the WKNavigation object.
This bug tracks one way this invariant is currently broken in slim-navigation-manager (go/bling-navigation-experiment).
WebUI and native content are loaded in two steps: a placeholder URL is first loaded in WKWebView, and the WebUI or native content is loaded in the |webView:didFinishNavigation| delegate of the placeholder navigation. The NavigationItem is pending and only committed to NavigationManager in the second step.
If a new navigation starts between the |webView:didCommitNavigation| and |webView:didFinishNavigation| delegate callbacks of the placeholder URL load, the old NavigationItem, which is still pending, is clobbered by the new NavigationItem. This makes the unique navigation item index stored in NavigationContext a dangling pointer, and breaks the invariant above.
A possible fix is to store pending NavigationItem in the NavigationContext. However, this is a big departure from the current NavigationManager architecture.
Comment 1 by danyao@chromium.org
, Oct 26