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 5157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5168 if (web::GetWebClient()->IsAppSpecificURL(_documentURL)) { | 5168 if (web::GetWebClient()->IsAppSpecificURL(_documentURL)) { |
5169 [self abortLoad]; | 5169 [self abortLoad]; |
5170 NavigationManager::WebLoadParams params(webViewURL); | 5170 NavigationManager::WebLoadParams params(webViewURL); |
5171 [self loadWithParams:params]; | 5171 [self loadWithParams:params]; |
5172 } | 5172 } |
5173 return; | 5173 return; |
5174 } else { | 5174 } else { |
5175 [self registerLoadRequest:webViewURL]; | 5175 [self registerLoadRequest:webViewURL]; |
5176 } | 5176 } |
5177 } | 5177 } |
| 5178 |
| 5179 if (![self currentSessionEntry]) { |
| 5180 // In this state CRWWebController will crash in |didCommitNavigation:| |
| 5181 // (crbug.com/676458). It's unclear if web controller could get into this |
| 5182 // state but it's one of the guesses for crbug.com/676458 root cause. Report |
| 5183 // UMA historgam if that happens. |
| 5184 // TODO(crbug.com/677552): Remove this historgam. |
| 5185 UMA_HISTOGRAM_BOOLEAN( |
| 5186 "WebController." |
| 5187 "StartProvisionalNavigationExitedWithEmptyNavigationManager", |
| 5188 true); |
| 5189 } |
| 5190 |
5178 // Ensure the URL is registered and loadPhase is as expected. | 5191 // Ensure the URL is registered and loadPhase is as expected. |
5179 DCHECK(_lastRegisteredRequestURL == webViewURL); | 5192 DCHECK(_lastRegisteredRequestURL == webViewURL); |
5180 DCHECK(self.loadPhase == web::LOAD_REQUESTED); | 5193 DCHECK(self.loadPhase == web::LOAD_REQUESTED); |
5181 } | 5194 } |
5182 | 5195 |
5183 - (void)webView:(WKWebView*)webView | 5196 - (void)webView:(WKWebView*)webView |
5184 didReceiveServerRedirectForProvisionalNavigation:(WKNavigation*)navigation { | 5197 didReceiveServerRedirectForProvisionalNavigation:(WKNavigation*)navigation { |
5185 [_navigationStates setState:web::WKNavigationState::REDIRECTED | 5198 [_navigationStates setState:web::WKNavigationState::REDIRECTED |
5186 forNavigation:navigation]; | 5199 forNavigation:navigation]; |
5187 | 5200 |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5805 } | 5818 } |
5806 | 5819 |
5807 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; | 5820 return web::WEB_VIEW_DOCUMENT_TYPE_GENERIC; |
5808 } | 5821 } |
5809 | 5822 |
5810 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { | 5823 - (NSString*)refererFromNavigationAction:(WKNavigationAction*)action { |
5811 return [action.request valueForHTTPHeaderField:@"Referer"]; | 5824 return [action.request valueForHTTPHeaderField:@"Referer"]; |
5812 } | 5825 } |
5813 | 5826 |
5814 @end | 5827 @end |
OLD | NEW |