| 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 a1f5aa0211eef998ec0e47ebedb88e7325a85d75..4b3851642a5e02d492e6878998756f4ae43df959 100644
|
| --- a/ios/web/web_state/ui/crw_web_controller.mm
|
| +++ b/ios/web/web_state/ui/crw_web_controller.mm
|
| @@ -4963,6 +4963,19 @@ - (void)webView:(WKWebView*)webView
|
| // retrieved state will be pending until |didCommitNavigation| callback.
|
| [self updatePendingNavigationInfoFromNavigationAction:action];
|
|
|
| + // Invalid URLs should not be loaded. However, simply doing nothing upon
|
| + // tapping a link or button is a jarring user experience. Instead, cancel
|
| + // the invalid navigation and load about:blank.
|
| + GURL requestURL = net::GURLWithNSURL(action.request.URL);
|
| + if (!requestURL.is_valid()) {
|
| + decisionHandler(WKNavigationActionPolicyCancel);
|
| + GURL aboutBlankURL(url::kAboutBlankURL);
|
| + web::NavigationManager::WebLoadParams loadParams(aboutBlankURL);
|
| + loadParams.referrer = [self currentReferrer];
|
| + self.webState->GetNavigationManager()->LoadURLWithParams(loadParams);
|
| + return;
|
| + }
|
| +
|
| BOOL allowLoad = [self shouldAllowLoadWithNavigationAction:action];
|
|
|
| if (allowLoad) {
|
|
|