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

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

Issue 2726083006: Do not load about:blank if iframe requested to load invalid URL. (Closed)
Patch Set: 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 3e85b266568658499e98974d12770f8dc29bd0be..87741798dc3a2af7380764a90f4b009eaee64d33 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -4774,14 +4774,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