Skip to content

Commit

Permalink
Use FrameTreeNodeId to find delay loaded iframes for OnBeforeBrowse (…
Browse files Browse the repository at this point in the history
…fixes issue chromiumembedded#2675, see issue chromiumembedded#2498)
  • Loading branch information
magreenblatt committed Jun 12, 2019
1 parent 699a922 commit 3f2a3b1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions libcef/browser/browser_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1576,6 +1576,11 @@ CefRefPtr<CefFrame> CefBrowserHostImpl::GetFrameForHost(
return browser_info_->GetFrameForHost(host);
}

CefRefPtr<CefFrame> 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,
Expand Down
3 changes: 3 additions & 0 deletions libcef/browser/browser_host_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Returns the frame associated with the specified RenderFrameHost.
CefRefPtr<CefFrame> GetFrameForHost(const content::RenderFrameHost* host);

// Returns the frame associated with the specified FrameTreeNode ID.
CefRefPtr<CefFrame> GetFrameForFrameTreeNode(int frame_tree_node_id);

// Load the specified URL in the main frame.
void LoadMainFrameURL(const std::string& url,
const content::Referrer& referrer,
Expand Down
7 changes: 5 additions & 2 deletions libcef/browser/content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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
Expand Down Expand Up @@ -1115,7 +1118,7 @@ CefContentBrowserClient::CreateThrottlesForNavigation(
std::make_unique<navigation_interception::InterceptNavigationThrottle>(
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));

Expand Down

0 comments on commit 3f2a3b1

Please sign in to comment.