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

Unified Diff: extensions/browser/extension_api_frame_id_map.cc

Issue 2856653004: Require a process ID when looking up RFHs by FrameTreeNode ID. (Closed)
Patch Set: Add comment. 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: extensions/browser/extension_api_frame_id_map.cc
diff --git a/extensions/browser/extension_api_frame_id_map.cc b/extensions/browser/extension_api_frame_id_map.cc
index bd0e19c8625cf687358a7c6ec2b8e4fce5880161..d3c43d55fcb8b4bbf36241b1d0a8f7d9cf8549c0 100644
--- a/extensions/browser/extension_api_frame_id_map.cc
+++ b/extensions/browser/extension_api_frame_id_map.cc
@@ -148,7 +148,12 @@ content::RenderFrameHost* ExtensionApiFrameIdMap::GetRenderFrameHostById(
return web_contents->GetMainFrame();
DCHECK_GE(frame_id, 1);
- return web_contents->FindFrameByFrameTreeNodeId(frame_id);
+
+ // Unfortunately, extension APIs do not know which process to expect for a
+ // given frame ID, so we must use an unsafe API here that could return a
+ // different RenderFrameHost than the caller may have expected (e.g., one that
+ // changed after a cross-process navigation).
+ return web_contents->UnsafeFindFrameByFrameTreeNodeId(frame_id);
}
ExtensionApiFrameIdMap::FrameData ExtensionApiFrameIdMap::KeyToValue(
« content/public/browser/web_contents.h ('K') | « content/public/browser/web_contents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698