Fix opening of popups from sandboxed iframes (issue #2121)

This commit is contained in:
Marshall Greenblatt
2017-03-15 18:04:16 -04:00
parent 608f2d4170
commit bab532b35b
5 changed files with 30 additions and 26 deletions

View File

@@ -2243,10 +2243,13 @@ bool CefBrowserHostImpl::CanDragEnter(
void CefBrowserHostImpl::GetCustomWebContentsView(
content::WebContents* web_contents,
const GURL& target_url,
int opener_render_process_id,
int opener_render_frame_id,
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view) {
CefBrowserInfoManager::GetInstance()->GetCustomWebContentsView(
web_contents, target_url, view, delegate_view);
target_url, opener_render_process_id, opener_render_frame_id, view,
delegate_view);
}
void CefBrowserHostImpl::WebContentsCreated(
@@ -2261,8 +2264,8 @@ void CefBrowserHostImpl::WebContentsCreated(
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate;
CefBrowserInfoManager::GetInstance()->WebContentsCreated(
source_contents, target_url, new_contents, settings, client,
platform_delegate);
target_url, opener_render_process_id, opener_render_frame_id, settings,
client, platform_delegate);
scoped_refptr<CefBrowserInfo> info =
CefBrowserInfoManager::GetInstance()->CreatePopupBrowserInfo(

View File

@@ -405,6 +405,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
void GetCustomWebContentsView(
content::WebContents* web_contents,
const GURL& target_url,
int opener_render_process_id,
int opener_render_frame_id,
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view) override;
void WebContentsCreated(content::WebContents* source_contents,

View File

@@ -247,15 +247,14 @@ bool CefBrowserInfoManager::CanCreateWindow(
}
void CefBrowserInfoManager::GetCustomWebContentsView(
content::WebContents* web_contents,
const GURL& target_url,
int opener_render_process_id,
int opener_render_frame_id,
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view) {
content::RenderFrameHost* host =
web_contents->GetRenderViewHost()->GetMainFrame();
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup =
PopPendingPopup(CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW,
host->GetProcess()->GetID(), host->GetRoutingID(),
opener_render_process_id, opener_render_frame_id,
target_url);
DCHECK(pending_popup.get());
DCHECK(pending_popup->platform_delegate.get());
@@ -271,22 +270,16 @@ void CefBrowserInfoManager::GetCustomWebContentsView(
}
void CefBrowserInfoManager::WebContentsCreated(
content::WebContents* source_contents,
const GURL& target_url,
content::WebContents* new_contents,
int opener_render_process_id,
int opener_render_frame_id,
CefBrowserSettings& settings,
CefRefPtr<CefClient>& client,
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate) {
DCHECK(source_contents);
DCHECK(new_contents);
content::RenderFrameHost* host =
source_contents->GetRenderViewHost()->GetMainFrame();
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup =
PopPendingPopup(
CefBrowserInfoManager::PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW,
host->GetProcess()->GetID(), host->GetRoutingID(),
target_url);
opener_render_process_id, opener_render_frame_id, target_url);
DCHECK(pending_popup.get());
DCHECK(pending_popup->platform_delegate.get());

View File

@@ -75,17 +75,18 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
// Called from CefBrowserHostImpl::GetCustomWebContentsView. See comments on
// PendingPopup for more information.
void GetCustomWebContentsView(
content::WebContents* web_contents,
const GURL& target_url,
int opener_render_process_id,
int opener_render_frame_id,
content::WebContentsView** view,
content::RenderViewHostDelegateView** delegate_view);
// Called from CefBrowserHostImpl::WebContentsCreated. See comments on
// PendingPopup for more information.
void WebContentsCreated(
content::WebContents* source_contents,
const GURL& target_url,
content::WebContents* new_contents,
int opener_render_process_id,
int opener_render_frame_id,
CefBrowserSettings& settings,
CefRefPtr<CefClient>& client,
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate);