Chromium Code Reviews| 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()) { |