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

Unified Diff: content/browser/frame_host/navigator_impl.cc

Issue 2454563003: Fix web accessible resource checks in ShouldAllowOpenURL (Closed)
Patch Set: Tighten check a bit more Created 4 years, 2 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: content/browser/frame_host/navigator_impl.cc
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index b2838218b226b055177d6dd37aed44d9a2ef6a32..4719245a07c23610cf4afa50576ab9ba786edcaa 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -812,9 +812,17 @@ void NavigatorImpl::RequestTransferURL(
Referrer referrer_to_use(referrer);
FrameTreeNode* node = render_frame_host->frame_tree_node();
SiteInstance* current_site_instance = render_frame_host->GetSiteInstance();
- if (!GetContentClient()->browser()->ShouldAllowOpenURL(current_site_instance,
- url)) {
- dest_url = GURL(url::kAboutBlankURL);
+ // It is important to pass in the source_site_instance if it is available
+ // (such as when navigating a proxy). See https://crbug.com/656752.
+ if (!GetContentClient()->browser()->ShouldAllowOpenURL(
+ source_site_instance ? source_site_instance : current_site_instance,
alexmos 2016/10/28 00:29:42 We could get here two ways: from RFPH::OnOpenURL o
ncarter (slow) 2016/10/28 21:45:03 I looked at the extension protocol handler code, r
alexmos 2016/10/31 23:34:48 Yes, that's very surprising. Sounds like it's wor
+ url)) {
+ // It is important to return here, rather than rewrite the dest_url to
+ // about:blank. The latter won't actually have any effect when
+ // transferring, as NavigateToEntry will think that the transfer is to the
+ // same RFH that started the navigation and let the existing navigation
+ // (for the disallowed URL) proceed.
+ return;
}
// TODO(creis): Determine if this transfer started as a browser-initiated

Powered by Google App Engine
This is Rietveld 408576698