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

Unified Diff: ios/web/navigation/crw_session_controller.mm

Issue 2918013002: Do not rewrite about urls to chrome:// for cetain renderer-initated loads (Closed)
Patch Set: Self review Created 3 years, 7 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
Index: ios/web/navigation/crw_session_controller.mm
diff --git a/ios/web/navigation/crw_session_controller.mm b/ios/web/navigation/crw_session_controller.mm
index 21f7ffe36f3fecc90c6993252bcfc7de068e7fe8..5b3e0c540ee7151db9cb2c38a73a0a1fc1b9c13f 100644
--- a/ios/web/navigation/crw_session_controller.mm
+++ b/ios/web/navigation/crw_session_controller.mm
@@ -659,6 +659,20 @@ initiationType:(web::NavigationInitiationType)initiationType {
&loaded_url, _browserState);
}
+ if (initiationType == web::NavigationInitiationType::RENDERER_INITIATED &&
+ loaded_url != url && web::GetWebClient()->IsAppSpecificURL(loaded_url)) {
+ bool lastCommittedURLIsAppSpecific =
+ self.lastCommittedItem &&
+ web::GetWebClient()->IsAppSpecificURL(self.lastCommittedItem->GetURL());
+ if (!lastCommittedURLIsAppSpecific) {
+ // The URL should not be changed to app-specific URL if the load was
+ // renderer-initiated requested by non app-specific URL. Pages with
+ // app-specific urls have elevated previledges and should not be allowed
+ // to open app-specific URLs.
+ loaded_url = url;
+ }
+ }
+
std::unique_ptr<web::NavigationItemImpl> item(new web::NavigationItemImpl());
item->SetOriginalRequestURL(loaded_url);
item->SetURL(loaded_url);
« no previous file with comments | « ios/chrome/browser/web/window_open_by_dom_egtest.mm ('k') | ios/web/navigation/navigation_manager_impl_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698