New issue
Advanced search Search tips

Issue 787497 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 3
Type: Task

Blocked on:
issue 739844



Sign in to add a comment

Always use |webView.backForwardList.currentItem.URL| inside webView:didCommitNavigation:

Project Member Reported by eugene...@chromium.org, Nov 21 2017

Issue description

This is the right API to get last committed item. Unfortunately that API does not work correctly after loadHTML: (which is used for WebUI) and WKWebView.URL has to be used instead. webView:didCommitNavigation: should  switch to |webView.backForwardList.currentItem.URL| once WebUI is not longer relies on loadHTML:

I think it's a bug that loadHTML: does not change |webView.backForwardList.currentItem.URL|, because loadHTML is not the same thing as a real navigation.
 
Blockedon: 739844

Comment 2 by danyao@chromium.org, Nov 21 2017

It is a legacy behavior in WebKit that loadHTML doesn't update history session. The short version is that this feature was originally added to support displaying an error page when network request to a URL failed. I think it'll be really hard to change this behavior in WebKit (though probably worth a discussion with them).

Another idea: what if we use WKNavigation* to get the URL? WKNavigation* is the definitive identifier of the last committed entry from WKWebView's perspective. We already store additional information associated with WKNavigation* in CRWWKNavigationStates.
Labels: -Restrict-View-Google
I would love if WKNavigation had URL and other properties which we have to guess to fill web::NavigationContext! 

loadHTML: can not be fixed for iOS 10 or 9, but Chrome does not need loadHTML: for WebUI starting from iOS 11 (crrev.com/c/566091). With that I don't think there is much value in asking Apple to fix loadHTML:
Components: Mobile>iOSWeb
Components: -Mobile>WebView>Glue

Sign in to add a comment