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 8fbeae696f02303a6b1a821a590e8772310610e5..87a1d5590a8acd8c41492e995b772ff12796461e 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 |
@@ -212,6 +212,9 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) { |
// YES if the user has interacted with the content area since the last URL |
// change. |
BOOL _interactionRegisteredSinceLastURLChange; |
+ |
+ // YES if the web process backing _wkWebView is believed to currently be dead. |
+ BOOL _webProcessIsDead; |
} |
// Dictionary where keys are the names of WKWebView properties and values are |
@@ -887,6 +890,7 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) { |
} |
- (void)webViewWebProcessDidCrash { |
+ _webProcessIsDead = YES; |
if ([self.delegate respondsToSelector: |
@selector(webControllerWebProcessDidCrash:)]) { |
[self.delegate webControllerWebProcessDidCrash:self]; |
@@ -1478,6 +1482,13 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) { |
} |
- (void)webViewTitleDidChange { |
+ // WKWebView's title becomes empty when the web process dies; ignore that |
+ // update. |
+ if (_webProcessIsDead) { |
+ DCHECK_EQ(self.title.length, 0U); |
+ return; |
+ } |
+ |
if ([self.delegate respondsToSelector: |
@selector(webController:titleDidChange:)]) { |
DCHECK(self.title); |
@@ -1550,6 +1561,7 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) { |
decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction |
decisionHandler: |
(void (^)(WKNavigationActionPolicy))decisionHandler { |
+ _webProcessIsDead = NO; |
if (self.isBeingDestroyed) { |
decisionHandler(WKNavigationActionPolicyCancel); |
return; |