Chromium Code Reviews

Unified Diff: ios/web/web_state/ui/crw_wk_web_view_web_controller.mm

Issue 1461413004: Ignore title changes from WKWebView when the web process dies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b1014763fcb54ea0ef73c18edfe92b86084f57ac 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(self.title.length == 0);
Eugene But (OOO till 7-30) 2015/11/20 23:24:40 Optional NIT: DCHECK_EQ
stuartmorgan 2015/11/23 22:45:07 Done.
+ 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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine