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

Side by Side 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, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 805
806 // Allow the delegate to cancel the transfer. 806 // Allow the delegate to cancel the transfer.
807 if (!delegate_->ShouldTransferNavigation( 807 if (!delegate_->ShouldTransferNavigation(
808 render_frame_host->frame_tree_node()->IsMainFrame())) 808 render_frame_host->frame_tree_node()->IsMainFrame()))
809 return; 809 return;
810 810
811 GURL dest_url(url); 811 GURL dest_url(url);
812 Referrer referrer_to_use(referrer); 812 Referrer referrer_to_use(referrer);
813 FrameTreeNode* node = render_frame_host->frame_tree_node(); 813 FrameTreeNode* node = render_frame_host->frame_tree_node();
814 SiteInstance* current_site_instance = render_frame_host->GetSiteInstance(); 814 SiteInstance* current_site_instance = render_frame_host->GetSiteInstance();
815 if (!GetContentClient()->browser()->ShouldAllowOpenURL(current_site_instance, 815 // It is important to pass in the source_site_instance if it is available
816 url)) { 816 // (such as when navigating a proxy). See https://crbug.com/656752.
817 dest_url = GURL(url::kAboutBlankURL); 817 if (!GetContentClient()->browser()->ShouldAllowOpenURL(
818 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
819 url)) {
820 // It is important to return here, rather than rewrite the dest_url to
821 // about:blank. The latter won't actually have any effect when
822 // transferring, as NavigateToEntry will think that the transfer is to the
823 // same RFH that started the navigation and let the existing navigation
824 // (for the disallowed URL) proceed.
825 return;
818 } 826 }
819 827
820 // TODO(creis): Determine if this transfer started as a browser-initiated 828 // TODO(creis): Determine if this transfer started as a browser-initiated
821 // navigation. See https://crbug.com/495161. 829 // navigation. See https://crbug.com/495161.
822 bool is_renderer_initiated = true; 830 bool is_renderer_initiated = true;
823 if (render_frame_host->web_ui()) { 831 if (render_frame_host->web_ui()) {
824 // Web UI pages sometimes want to override the page transition type for 832 // Web UI pages sometimes want to override the page transition type for
825 // link clicks (e.g., so the new tab page can specify AUTO_BOOKMARK for 833 // link clicks (e.g., so the new tab page can specify AUTO_BOOKMARK for
826 // automatically generated suggestions). We don't override other types 834 // automatically generated suggestions). We don't override other types
827 // like TYPED because they have different implications (e.g., autocomplete). 835 // like TYPED because they have different implications (e.g., autocomplete).
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 if (navigation_handle) 1259 if (navigation_handle)
1252 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); 1260 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID());
1253 1261
1254 controller_->SetPendingEntry(std::move(entry)); 1262 controller_->SetPendingEntry(std::move(entry));
1255 if (delegate_) 1263 if (delegate_)
1256 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 1264 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
1257 } 1265 }
1258 } 1266 }
1259 1267
1260 } // namespace content 1268 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698