Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

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: DCHECK_EQ Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« 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..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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698