Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: ios/web/web_state/ui/crw_web_controller.mm

Issue 2709383002: Do not load about:blank if iframe requested to load invalid URL. (Closed)
Patch Set: Corrected frame check Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 45a5e8b1532b33c6905f7aac8b831d5925d9bfbf..fc387994c56e2a631582eb670ae05c9be6342830 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -4479,14 +4479,17 @@ const NSTimeInterval kSnapshotOverlayTransition = 0.5;
// 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.
+ // the invalid navigation and load about:blank if navigation was requested for
+ // the main frame.
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);
+ if (action.targetFrame.mainFrame) {
+ GURL aboutBlankURL(url::kAboutBlankURL);
+ web::NavigationManager::WebLoadParams loadParams(aboutBlankURL);
+ loadParams.referrer = [self currentReferrer];
+ self.webState->GetNavigationManager()->LoadURLWithParams(loadParams);
+ }
return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698