| Index: ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
|
| diff --git a/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm b/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
|
| index 0d1845039df51e0c8d9b331d76f3f73df2746cab..3422548fa62ceee5caacab1d2a6ad1cdf3385130 100644
|
| --- a/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
|
| +++ b/ios/web/web_state/ui/crw_wk_web_view_web_controller.mm
|
| @@ -449,19 +449,18 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) {
|
| [self loadRequest:[self requestForCurrentNavigationItem]];
|
| };
|
|
|
| - // If there is no corresponding WKBackForwardListItem, fall back to
|
| - // the standard loading mechanism.
|
| + // If there is no corresponding WKBackForwardListItem, or the item is not in
|
| + // the current WKWebView's back-forward list, navigating using WKWebView API
|
| + // is not possible. In this case, fall back to the default navigation
|
| + // mechanism.
|
| web::WKBackForwardListItemHolder* holder =
|
| [self currentBackForwardListItemHolder];
|
| - if (!holder->back_forward_list_item()) {
|
| + if (!holder->back_forward_list_item() ||
|
| + ![self isBackForwardListItemValid:holder->back_forward_list_item()]) {
|
| defaultNavigationBlock();
|
| return;
|
| }
|
|
|
| - // The current back-forward list item MUST be in the WKWebView's back-forward
|
| - // list to be valid.
|
| - DCHECK([self isBackForwardListItemValid:holder->back_forward_list_item()]);
|
| -
|
| ProceduralBlock webViewNavigationBlock = ^{
|
| // If the current navigation URL is the same as the URL of the visible
|
| // page, that means the user requested a reload. |goToBackForwardListItem|
|
|
|