summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuartmorgan <stuartmorgan@chromium.org>2015-11-23 15:19:40 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-23 23:20:23 +0000
commit8915d5073ac9a5f3e5116f1cb1d496afb7293518 (patch)
tree2365929b122634c888b0012929d9f7ae9a48ee51
parent708e3609f90afdae12e3cbe70c245dd0409c7ba7 (diff)
downloadchromium_src-8915d5073ac9a5f3e5116f1cb1d496afb7293518.zip
chromium_src-8915d5073ac9a5f3e5116f1cb1d496afb7293518.tar.gz
chromium_src-8915d5073ac9a5f3e5116f1cb1d496afb7293518.tar.bz2
Ignore title changes from WKWebView when the web process dies
WKWebView sets the title to blank when the web process dies; ignore that update so that the navigation item won't end up with a blank title. BUG=558178 Review URL: https://codereview.chromium.org/1461413004 Cr-Commit-Position: refs/heads/master@{#361214}
-rw-r--r--ios/web/web_state/ui/crw_wk_web_view_web_controller.mm12
1 files changed, 12 insertions, 0 deletions
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 c1be173..3406174 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
@@ -878,6 +881,7 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) {
}
- (void)webViewWebProcessDidCrash {
+ _webProcessIsDead = YES;
if ([self.delegate respondsToSelector:
@selector(webControllerWebProcessDidCrash:)]) {
[self.delegate webControllerWebProcessDidCrash:self];
@@ -1469,6 +1473,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);
@@ -1541,6 +1552,7 @@ WKWebViewErrorSource WKWebViewErrorSourceFromError(NSError* error) {
decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
decisionHandler:
(void (^)(WKNavigationActionPolicy))decisionHandler {
+ _webProcessIsDead = NO;
if (self.isBeingDestroyed) {
decisionHandler(WKNavigationActionPolicyCancel);
return;