diff --git a/atom/browser/api/atom_api_app.cc b/atom/browser/api/atom_api_app.cc index fbf9b961435a..ee629fe53ccb 100644 --- a/atom/browser/api/atom_api_app.cc +++ b/atom/browser/api/atom_api_app.cc @@ -656,14 +656,11 @@ void App::OnCreateWindow( WindowOpenDisposition disposition, const std::vector& features, const scoped_refptr& body, - int render_process_id, - int render_frame_id) { + content::RenderFrameHost* opener) { v8::Locker locker(isolate()); v8::HandleScope handle_scope(isolate()); - content::RenderFrameHost* rfh = - content::RenderFrameHost::FromID(render_process_id, render_frame_id); content::WebContents* web_contents = - content::WebContents::FromRenderFrameHost(rfh); + content::WebContents::FromRenderFrameHost(opener); if (web_contents) { auto api_web_contents = WebContents::CreateFrom(isolate(), web_contents); api_web_contents->OnCreateWindow(target_url, diff --git a/atom/browser/api/atom_api_app.h b/atom/browser/api/atom_api_app.h index 63ed7e500003..98e6f1fdb885 100644 --- a/atom/browser/api/atom_api_app.h +++ b/atom/browser/api/atom_api_app.h @@ -81,8 +81,7 @@ class App : public AtomBrowserClient::Delegate, WindowOpenDisposition disposition, const std::vector& features, const scoped_refptr& body, - int render_process_id, - int render_frame_id); + content::RenderFrameHost* opener); #if defined(USE_NSS_CERTS) void OnCertificateManagerModelCreated( diff --git a/atom/browser/atom_browser_client.cc b/atom/browser/atom_browser_client.cc index 79d0a3d27cc2..51e98dbecd8e 100644 --- a/atom/browser/atom_browser_client.cc +++ b/atom/browser/atom_browser_client.cc @@ -333,8 +333,7 @@ void AtomBrowserClient::ResourceDispatcherHostCreated() { } bool AtomBrowserClient::CanCreateWindow( - int opener_render_process_id, - int opener_render_frame_id, + content::RenderFrameHost* opener, const GURL& opener_url, const GURL& opener_top_level_frame_url, const GURL& source_origin, @@ -348,10 +347,11 @@ bool AtomBrowserClient::CanCreateWindow( const scoped_refptr& body, bool user_gesture, bool opener_suppressed, - content::ResourceContext* context, bool* no_javascript_access) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + int opener_render_process_id = opener->GetProcess()->GetID(); + if (IsRendererSandboxed(opener_render_process_id)) { *no_javascript_access = false; return true; @@ -377,8 +377,7 @@ bool AtomBrowserClient::CanCreateWindow( disposition, additional_features, body, - opener_render_process_id, - opener_render_frame_id)); + opener)); } return false; diff --git a/atom/browser/atom_browser_client.h b/atom/browser/atom_browser_client.h index 2352c9b69196..968afa9a6151 100644 --- a/atom/browser/atom_browser_client.h +++ b/atom/browser/atom_browser_client.h @@ -81,8 +81,7 @@ class AtomBrowserClient : public brightray::BrowserClient, std::unique_ptr delegate) override; void ResourceDispatcherHostCreated() override; bool CanCreateWindow( - int opener_render_process_id, - int opener_render_frame_id, + content::RenderFrameHost* opener, const GURL& opener_url, const GURL& opener_top_level_frame_url, const GURL& source_origin, @@ -96,7 +95,6 @@ class AtomBrowserClient : public brightray::BrowserClient, const scoped_refptr& body, bool user_gesture, bool opener_suppressed, - content::ResourceContext* context, bool* no_javascript_access) override; void GetAdditionalAllowedSchemesForFileSystem( std::vector* schemes) override;