| Index: ios/web/web_state/ui/crw_web_controller.mm
|
| diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
|
| index a072370364a004fa25513f56f7d74ce3e0f4e0c4..0a1ef8e6760fd07c676a15ee65c53274cce1edf8 100644
|
| --- a/ios/web/web_state/ui/crw_web_controller.mm
|
| +++ b/ios/web/web_state/ui/crw_web_controller.mm
|
| @@ -662,6 +662,10 @@ NSError* WKWebViewErrorWithSource(NSError* error, WKWebViewErrorSource source) {
|
| - (void)loadCompleteWithSuccess:(BOOL)loadSuccess;
|
| // Called after URL is finished loading and _loadPhase is set to PAGE_LOADED.
|
| - (void)didFinishWithURL:(const GURL&)currentURL loadSuccess:(BOOL)loadSuccess;
|
| +// Loads a new URL if the current entry is not from a pushState() navigation.
|
| +// |fromEntry| is the CRWSessionEntry that was the current entry prior to the
|
| +// navigation.
|
| +- (void)finishHistoryNavigationFromEntry:(CRWSessionEntry*)fromEntry;
|
| // Informs the native controller if web usage is allowed or not.
|
| - (void)setNativeControllerWebUsageEnabled:(BOOL)webUsageEnabled;
|
| // Called when web controller receives a new message from the web page.
|
| @@ -1135,6 +1139,8 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
|
| DCHECK([NSThread isMainThread]);
|
| DCHECK(_isBeingDestroyed); // 'close' must have been called already.
|
| DCHECK(!_webView);
|
| + // TODO(crbug.com/662860): Don't set the delegate to nil.
|
| + [_containerView setDelegate:nil];
|
| _touchTrackingRecognizer.get().touchTrackingDelegate = nil;
|
| [[_webViewProxy scrollViewProxy] removeObserver:self];
|
| [[NSNotificationCenter defaultCenter] removeObserver:self];
|
| @@ -5397,13 +5403,16 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
|
| GURL webViewURL = net::GURLWithNSURL([_webView URL]);
|
|
|
| // For failed navigations, WKWebView will sometimes revert to the previous URL
|
| - // before resettings its |isLoading| property to NO. If this is the first
|
| - // navigation for the web view, this will result in an empty URL.
|
| - if (webViewURL.is_empty() || webViewURL == _documentURL)
|
| + // before committing the current navigation or resetting the web view's
|
| + // |isLoading| property to NO. If this is the first navigation for the web
|
| + // view, this will result in an empty URL.
|
| + BOOL navigationWasCommitted = _loadPhase != web::LOAD_REQUESTED;
|
| + if (!navigationWasCommitted &&
|
| + (webViewURL.is_empty() || webViewURL == _documentURL)) {
|
| return;
|
| + }
|
|
|
| - if (_loadPhase == web::LOAD_REQUESTED &&
|
| - ![_pendingNavigationInfo cancelled]) {
|
| + if (!navigationWasCommitted && ![_pendingNavigationInfo cancelled]) {
|
| // A fast back/forward within the same origin does not call
|
| // |didCommitNavigation:|, so signal page change explicitly.
|
| DCHECK_EQ(_documentURL.GetOrigin(), webViewURL.GetOrigin());
|
|
|