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..94797002ebab74f59c0a800b4abdd075398c690c 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,17 @@ 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, we can only fall back to the |
Eugene But (OOO till 7-30)
2015/09/14 21:48:55
NIT: please do not use we in the comments.
|
+ // 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| |