| 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 4576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4587 [self abortLoad]; | 4587 [self abortLoad]; |
| 4588 NavigationManager::WebLoadParams params(webViewURL); | 4588 NavigationManager::WebLoadParams params(webViewURL); |
| 4589 [self loadWithParams:params]; | 4589 [self loadWithParams:params]; |
| 4590 } | 4590 } |
| 4591 return; | 4591 return; |
| 4592 } else { | 4592 } else { |
| 4593 [self registerLoadRequest:webViewURL]; | 4593 [self registerLoadRequest:webViewURL]; |
| 4594 } | 4594 } |
| 4595 } | 4595 } |
| 4596 | 4596 |
| 4597 if (![self currentSessionEntry]) { | |
| 4598 // In this state CRWWebController will crash in |didCommitNavigation:| | |
| 4599 // (crbug.com/676458). It's unclear if web controller could get into this | |
| 4600 // state but it's one of the guesses for crbug.com/676458 root cause. Report | |
| 4601 // UMA historgam if that happens. | |
| 4602 // TODO(crbug.com/677552): Remove this historgam. | |
| 4603 UMA_HISTOGRAM_BOOLEAN( | |
| 4604 "WebController." | |
| 4605 "StartProvisionalNavigationExitedWithEmptyNavigationManager", | |
| 4606 true); | |
| 4607 } | |
| 4608 | |
| 4609 // Ensure the URL is registered and loadPhase is as expected. | 4597 // Ensure the URL is registered and loadPhase is as expected. |
| 4610 DCHECK(_lastRegisteredRequestURL == webViewURL); | 4598 DCHECK(_lastRegisteredRequestURL == webViewURL); |
| 4611 DCHECK(self.loadPhase == web::LOAD_REQUESTED); | 4599 DCHECK(self.loadPhase == web::LOAD_REQUESTED); |
| 4612 } | 4600 } |
| 4613 | 4601 |
| 4614 - (void)webView:(WKWebView*)webView | 4602 - (void)webView:(WKWebView*)webView |
| 4615 didReceiveServerRedirectForProvisionalNavigation:(WKNavigation*)navigation { | 4603 didReceiveServerRedirectForProvisionalNavigation:(WKNavigation*)navigation { |
| 4616 [_navigationStates setState:web::WKNavigationState::REDIRECTED | 4604 [_navigationStates setState:web::WKNavigationState::REDIRECTED |
| 4617 forNavigation:navigation]; | 4605 forNavigation:navigation]; |
| 4618 | 4606 |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5239 - (void)simulateLoadRequestWithURL:(const GURL&)URL { | 5227 - (void)simulateLoadRequestWithURL:(const GURL&)URL { |
| 5240 _lastRegisteredRequestURL = URL; | 5228 _lastRegisteredRequestURL = URL; |
| 5241 _loadPhase = web::LOAD_REQUESTED; | 5229 _loadPhase = web::LOAD_REQUESTED; |
| 5242 } | 5230 } |
| 5243 | 5231 |
| 5244 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { | 5232 - (NSString*)referrerFromNavigationAction:(WKNavigationAction*)action { |
| 5245 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; | 5233 return [action.request valueForHTTPHeaderField:kReferrerHeaderName]; |
| 5246 } | 5234 } |
| 5247 | 5235 |
| 5248 @end | 5236 @end |
| OLD | NEW |