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

Unified Diff: content/public/browser/web_contents.h

Issue 2856653004: Require a process ID when looking up RFHs by FrameTreeNode ID. (Closed)
Patch Set: Simplify ExtNavThrottle Created 3 years, 8 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/public/browser/web_contents.h
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index b4ac5c96864391a7ee595cda8f85ebe9f9d587f8..14c614c765bb744d29a5c18920dbf5a692e0746e 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -245,9 +245,22 @@ class WebContents : public PageNavigator,
virtual RenderFrameHost* GetFocusedFrame() = 0;
// Returns the current RenderFrameHost for a given FrameTreeNode ID if it is
- // part of this tab. See RenderFrameHost::GetFrameTreeNodeId for documentation
- // on this ID.
- virtual RenderFrameHost* FindFrameByFrameTreeNodeId(
+ // part of this frame tree, not including frames in any inner WebContents.
+ // Returns nullptr if |process_id| does not match the current
+ // RenderFrameHost's process ID, to avoid security bugs where callers do not
+ // realize a cross-process navigation (and thus privilege change) has taken
+ // place. See RenderFrameHost::GetFrameTreeNodeId for documentation on
+ // frame_tree_node_id.
+ virtual RenderFrameHost* FindFrameByFrameTreeNodeId(int frame_tree_node_id,
+ int process_id) = 0;
+
+ // NOTE: This is generally unsafe to use. Use FindFrameByFrameTreeNodeId
+ // instead.
+ // Returns the current RenderFrameHost for a given FrameTreeNode ID if it is
+ // part of this frame tree. This may not match the caller's expectation, if a
+ // cross-process navigation (and thus privilege change) has taken place.
+ // See RenderFrameHost::GetFrameTreeNodeId for documentation on this ID.
+ virtual RenderFrameHost* UnsafeFindFrameByFrameTreeNodeId(
int frame_tree_node_id) = 0;
// Calls |on_frame| for each frame in the currently active view.

Powered by Google App Engine
This is Rietveld 408576698