Commit 839d0e82 authored by Eugene But's avatar Eugene But Committed by Commit Bot

Discard Pending Item after opening a universal link.

Also updated the comments to explain when certain code
is executed.

Bug: 849303
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Ib359d1b6291fb9c2c91506ac9fe44b22c9202775
Reviewed-on: https://chromium-review.googlesource.com/1089872Reviewed-by: default avatarMohammad Refaat <mrefaat@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565423}
parent 8489e6b6
......@@ -2974,11 +2974,14 @@ registerLoadRequestForURL:(const GURL&)requestURL
}
if (error.code == web::kWebKitErrorFrameLoadInterruptedByPolicyChange) {
// This method should not be called if the navigation was cancelled by
// embedder.
DCHECK(_pendingNavigationInfo && ![_pendingNavigationInfo cancelled]);
// Handle Frame Load Interrupted errors from WebView. This block is
// executed when web controller rejected the load inside
// decidePolicyForNavigationAction: or decidePolicyForNavigationResponse:.
// Load rejection may happen if embedder denied the load via
// WebStatePolicyDecider or the navigation was a download navigation.
// decidePolicyForNavigationResponse: to handle download or WKWebView
// opened a Universal Link.
NSString* errorURLSpec =
error.userInfo[NSURLErrorFailingURLStringErrorKey];
NSURL* errorURL = [NSURL URLWithString:errorURLSpec];
......@@ -3003,13 +3006,18 @@ registerLoadRequestForURL:(const GURL&)requestURL
}
}
// The load was rejected, because embedder launched an external
// application.
if ([_openedApplicationURL containsObject:errorURL])
if ([_openedApplicationURL containsObject:errorURL]) {
// The load was rejected, because embedder launched an external
// application.
return;
}
if (!navigationContext->IsDownload()) {
// Non-download navigation was cancelled because WKWebView has opened a
// Universal Link and called webView:didFailProvisionalNavigation:.
self.navigationManagerImpl->DiscardNonCommittedItems();
}
// This navigation was a download navigation and embedder now has a chance
// to start the download task.
_webStateImpl->SetIsLoading(false);
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment