Use FrameTreeNodeId to find delay loaded iframes for OnBeforeBrowse (fixes issue #2675, see issue #2498)

This commit is contained in:
Marshall Greenblatt 2019-06-12 11:48:57 +02:00
parent d277dcd5d7
commit 0b7c0be29a
3 changed files with 13 additions and 2 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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_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));