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

Unified Diff: extensions/browser/extension_navigation_throttle.cc

Issue 2856653004: Require a process ID when looking up RFHs by FrameTreeNode ID. (Closed)
Patch Set: Simplify ExtNavThrottle 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
« no previous file with comments | « extensions/browser/extension_api_frame_id_map.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_navigation_throttle.cc
diff --git a/extensions/browser/extension_navigation_throttle.cc b/extensions/browser/extension_navigation_throttle.cc
index cf4e5e43ca2ccd6a7d94db9b70b4ece2e00dd78c..5d026c5d7d649db24e2476ee38bb38b7353f9b26 100644
--- a/extensions/browser/extension_navigation_throttle.cc
+++ b/extensions/browser/extension_navigation_throttle.cc
@@ -108,18 +108,7 @@ ExtensionNavigationThrottle::WillStartRequest() {
// The subframe which is navigated needs to have all of its ancestors be
// at the same origin, otherwise the resource needs to be explicitly listed
// in web_accessible_resources.
- // Since the RenderFrameHost is not known until navigation has committed,
- // we can't get it from NavigationHandle. However, this code only cares about
- // the ancestor chain, so find the current RenderFrameHost and use it to
- // traverse up to the main frame.
- content::RenderFrameHost* navigating_frame =
- web_contents->FindFrameByFrameTreeNodeId(
- navigation_handle()->GetFrameTreeNodeId());
- DCHECK(navigating_frame);
-
- // Traverse the chain of parent frames, checking if they are the same origin
- // as the URL of this navigation.
- content::RenderFrameHost* ancestor = navigating_frame->GetParent();
+ content::RenderFrameHost* ancestor = navigation_handle()->GetParentFrame();
Charlie Reis 2017/05/04 16:29:58 ekaramad/lazyboy: I'm further simplifying your rec
EhsanK 2017/05/04 18:01:38 Thanks! This is quite useful in my current works s
bool external_ancestor = false;
while (ancestor) {
if (ancestor->GetLastCommittedURL().GetOrigin() != url.GetOrigin()) {
« no previous file with comments | « extensions/browser/extension_api_frame_id_map.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698