Created attachment 344701 [details] Minimal example to reproduce the bug For back/forward navigation, WebKit's URL and history state are updated before the |webView:decidePolicyForNavigationAction| callback. If the embedder returns WKNavigationActionPolicyCancel, only the URL change is undone, but not the WKWebView.backForwardList.currentItem change. Steps to reproduce: 1. Navigate to a URL in WKWebView, e.g. https://wikipedia.org 2. Navigate to a second URL: e.g. https://apple.com 3. Go back 4. In |webView:decidePolicyForNavigationAction|, return WKNavigationActionPolicyCancel 5. Observe WKWebView.URL and WKWebView.backForwardList.currentItem.URL in URL KVO Expected result: both WKWebView.URL and WKWebView.backForwardList.currentItem.URL are https://apple.com Observed result: WKWebView.URL is https://apple.com. WKWebView.backForwardList.currentItem.URL is https://wikipedia.org. The attached WKWebView project runs through the above states and logs the URLs to debug log. The history state is corrected after starting a new navigation. So this may be a discrepancy between the WebProcess and UIProcess.
In reply to Danyao Wang from comment #0) > So this may be a discrepancy between the WebProcess and UIProcess. FrameLoader::continueLoadAfterNavigationPolicy has logic (in the !canContinue case) to reset back/forward state. Perhaps something is going wrong with sending that change to the UIProcess.
<rdar://problem/42032341>
This bug doesn't seem actionable.