OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/web/web_state/ui/crw_web_controller.h" | 5 #import "ios/web/web_state/ui/crw_web_controller.h" |
6 | 6 |
7 #import <WebKit/WebKit.h> | 7 #import <WebKit/WebKit.h> |
8 | 8 |
9 #import <objc/runtime.h> | 9 #import <objc/runtime.h> |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 5113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5124 if (web::GetWebClient()->IsAppSpecificURL(_documentURL)) { | 5124 if (web::GetWebClient()->IsAppSpecificURL(_documentURL)) { |
5125 [self abortLoad]; | 5125 [self abortLoad]; |
5126 NavigationManager::WebLoadParams params(webViewURL); | 5126 NavigationManager::WebLoadParams params(webViewURL); |
5127 [self loadWithParams:params]; | 5127 [self loadWithParams:params]; |
5128 } | 5128 } |
5129 return; | 5129 return; |
5130 } else { | 5130 } else { |
5131 [self registerLoadRequest:webViewURL]; | 5131 [self registerLoadRequest:webViewURL]; |
5132 } | 5132 } |
5133 } | 5133 } |
| 5134 |
| 5135 if (![self currentSessionEntry]) { |
| 5136 // In this state CRWWebController will crash in |didCommitNavigation:| |
| 5137 // (crbug.com/676458). It's unclear if web controller could get into this |
| 5138 // state but it's one of the guesses for crbug.com/676458 root cause. Report |
| 5139 // UMA historgam if that happens. |
| 5140 // TODO(crbug.com/677552): Remove this historgam. |
| 5141 UMA_HISTOGRAM_BOOLEAN( |
| 5142 "WebController." |
| 5143 "StartProvisionalNavigationExitedWithEmptyNavigationManager", |
| 5144 true); |
| 5145 } |
| 5146 |
5134 // Ensure the URL is registered and loadPhase is as expected. | 5147 // Ensure the URL is registered and loadPhase is as expected. |
5135 DCHECK(_lastRegisteredRequestURL == webViewURL); | 5148 DCHECK(_lastRegisteredRequestURL == webViewURL); |
5136 DCHECK(self.loadPhase == web::LOAD_REQUESTED); | 5149 DCHECK(self.loadPhase == web::LOAD_REQUESTED); |
5137 _latestWKNavigation.reset([navigation retain]); | 5150 _latestWKNavigation.reset([navigation retain]); |
5138 } | 5151 } |
5139 | 5152 |
5140 - (void)webView:(WKWebView*)webView | 5153 - (void)webView:(WKWebView*)webView |
5141 didReceiveServerRedirectForProvisionalNavigation:(WKNavigation*)navigation { | 5154 didReceiveServerRedirectForProvisionalNavigation:(WKNavigation*)navigation { |
5142 [self registerLoadRequest:net::GURLWithNSURL(webView.URL) | 5155 [self registerLoadRequest:net::GURLWithNSURL(webView.URL) |
5143 referrer:[self currentReferrer] | 5156 referrer:[self currentReferrer] |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5727 } | 5740 } |
5728 | 5741 |
5729 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5742 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
5730 } | 5743 } |
5731 | 5744 |
5732 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5745 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
5733 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5746 return [action.request valueForHTTPHeaderField:@"Referer"]; |
5734 } | 5747 } |
5735 | 5748 |
5736 @end | 5749 @end |
OLD | NEW |