Use FrameTreeNodeId to find delay loaded iframes for OnBeforeBrowse (fixes issue #2675, see issue #2498)
This commit is contained in:
parent
d277dcd5d7
commit
0b7c0be29a
|
@ -1576,6 +1576,11 @@ CefRefPtr<CefFrame> CefBrowserHostImpl::GetFrameForHost(
|
||||||
return browser_info_->GetFrameForHost(host);
|
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,
|
void CefBrowserHostImpl::LoadMainFrameURL(const std::string& url,
|
||||||
const content::Referrer& referrer,
|
const content::Referrer& referrer,
|
||||||
ui::PageTransition transition,
|
ui::PageTransition transition,
|
||||||
|
|
|
@ -299,6 +299,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||||
// Returns the frame associated with the specified RenderFrameHost.
|
// Returns the frame associated with the specified RenderFrameHost.
|
||||||
CefRefPtr<CefFrame> GetFrameForHost(const content::RenderFrameHost* host);
|
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.
|
// Load the specified URL in the main frame.
|
||||||
void LoadMainFrameURL(const std::string& url,
|
void LoadMainFrameURL(const std::string& url,
|
||||||
const content::Referrer& referrer,
|
const content::Referrer& referrer,
|
||||||
|
|
|
@ -429,6 +429,7 @@ bool NavigationOnUIThread(
|
||||||
bool is_main_frame,
|
bool is_main_frame,
|
||||||
int64_t frame_id,
|
int64_t frame_id,
|
||||||
int64_t parent_frame_id,
|
int64_t parent_frame_id,
|
||||||
|
int frame_tree_node_id,
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
const navigation_interception::NavigationParams& params) {
|
const navigation_interception::NavigationParams& params) {
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
|
@ -447,7 +448,9 @@ bool NavigationOnUIThread(
|
||||||
frame = browser->GetMainFrame();
|
frame = browser->GetMainFrame();
|
||||||
} else if (frame_id >= 0) {
|
} else if (frame_id >= 0) {
|
||||||
frame = browser->GetFrame(frame_id);
|
frame = browser->GetFrame(frame_id);
|
||||||
DCHECK(frame);
|
}
|
||||||
|
if (!frame && frame_tree_node_id >= 0) {
|
||||||
|
frame = browser->GetFrameForFrameTreeNode(frame_tree_node_id);
|
||||||
}
|
}
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
// Create a temporary frame object for navigation of sub-frames that
|
// Create a temporary frame object for navigation of sub-frames that
|
||||||
|
@ -1115,7 +1118,7 @@ CefContentBrowserClient::CreateThrottlesForNavigation(
|
||||||
std::make_unique<navigation_interception::InterceptNavigationThrottle>(
|
std::make_unique<navigation_interception::InterceptNavigationThrottle>(
|
||||||
navigation_handle,
|
navigation_handle,
|
||||||
base::Bind(&NavigationOnUIThread, is_main_frame, frame_id,
|
base::Bind(&NavigationOnUIThread, is_main_frame, frame_id,
|
||||||
parent_frame_id),
|
parent_frame_id, navigation_handle->GetFrameTreeNodeId()),
|
||||||
navigation_interception::SynchronyMode::kSync);
|
navigation_interception::SynchronyMode::kSync);
|
||||||
throttles.push_back(std::move(throttle));
|
throttles.push_back(std::move(throttle));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue