diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index 974de0fab..1a99eac99 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -1576,6 +1576,11 @@ CefRefPtr CefBrowserHostImpl::GetFrameForHost( return browser_info_->GetFrameForHost(host); } +CefRefPtr CefBrowserHostImpl::GetFrameForFrameTreeNode( + int frame_tree_node_id) { + return browser_info_->GetFrameForFrameTreeNode(frame_tree_node_id, nullptr); +} + void CefBrowserHostImpl::LoadMainFrameURL(const std::string& url, const content::Referrer& referrer, ui::PageTransition transition, diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/browser_host_impl.h index 807770d7d..94e687089 100644 --- a/libcef/browser/browser_host_impl.h +++ b/libcef/browser/browser_host_impl.h @@ -299,6 +299,9 @@ class CefBrowserHostImpl : public CefBrowserHost, // Returns the frame associated with the specified RenderFrameHost. CefRefPtr GetFrameForHost(const content::RenderFrameHost* host); + // Returns the frame associated with the specified FrameTreeNode ID. + CefRefPtr GetFrameForFrameTreeNode(int frame_tree_node_id); + // Load the specified URL in the main frame. void LoadMainFrameURL(const std::string& url, const content::Referrer& referrer, diff --git a/libcef/browser/content_browser_client.cc b/libcef/browser/content_browser_client.cc index e8dc210d6..b5c738e70 100644 --- a/libcef/browser/content_browser_client.cc +++ b/libcef/browser/content_browser_client.cc @@ -429,6 +429,7 @@ bool NavigationOnUIThread( bool is_main_frame, int64_t frame_id, int64_t parent_frame_id, + int frame_tree_node_id, content::WebContents* source, const navigation_interception::NavigationParams& params) { CEF_REQUIRE_UIT(); @@ -447,7 +448,9 @@ bool NavigationOnUIThread( frame = browser->GetMainFrame(); } else if (frame_id >= 0) { frame = browser->GetFrame(frame_id); - DCHECK(frame); + } + if (!frame && frame_tree_node_id >= 0) { + frame = browser->GetFrameForFrameTreeNode(frame_tree_node_id); } if (!frame) { // Create a temporary frame object for navigation of sub-frames that @@ -1115,7 +1118,7 @@ CefContentBrowserClient::CreateThrottlesForNavigation( std::make_unique( navigation_handle, base::Bind(&NavigationOnUIThread, is_main_frame, frame_id, - parent_frame_id), + parent_frame_id, navigation_handle->GetFrameTreeNodeId()), navigation_interception::SynchronyMode::kSync); throttles.push_back(std::move(throttle));