From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 20 Sep 2018 17:45:32 -0700 Subject: can_create_window.patch diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index 269bffc6ebfcf926718aed78f0c1d65e0c21b8b4..98069a4d2e2ab2cf1d880392ece8578c5317a6ef 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc @@ -3871,6 +3871,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To(), params->frame_name, params->disposition, *params->features, + params->additional_features, params->body, effective_transient_activation_state, params->opener_suppressed, &no_javascript_access); diff --git a/content/common/frame.mojom b/content/common/frame.mojom index 380029a373ce17816824c18803ed68380276eaa1..3a846621febecab61a26b31753fdd1d63958ec47 100644 --- a/content/common/frame.mojom +++ b/content/common/frame.mojom @@ -303,6 +303,10 @@ struct CreateNewWindowParams { // The window features to use for the new window. blink.mojom.WindowFeatures features; + + // Extra fields added by Electron. + array additional_features; + network.mojom.URLRequestBody? body; }; // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc index d9f7d1d1aed10c7cd8e7c2938d1fb824b2dce96d..4d4710e8c5382ac9391bb693dc1fd42258efd181 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc @@ -475,6 +475,8 @@ bool ContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, + const std::vector& additional_features, + const scoped_refptr& body, bool user_gesture, bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index 02a0dbcbc2df521079519ecd5464ecd251fdcaec..897c2c1435a8c1a495aa84c928c360d74218bfa7 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -177,6 +177,7 @@ class RenderFrameHost; class RenderProcessHost; class RenderViewHost; class ResourceContext; +class ResourceRequestBody; class SerialDelegate; class SiteInstance; class SpeechRecognitionManagerDelegate; @@ -759,6 +760,8 @@ class CONTENT_EXPORT ContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, + const std::vector& additional_features, + const scoped_refptr& body, bool user_gesture, bool opener_suppressed, bool* no_javascript_access); diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 31790be7369a450dec9c2c9a53d0b1a80ee4c41e..e7f22166a777b05f28a78e51934bfc1eb5ea99c8 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -75,6 +75,7 @@ #include "content/renderer/ime_event_guard.h" #include "content/renderer/internal_document_state_data.h" #include "content/renderer/loader/request_extra_data.h" +#include "content/renderer/loader/web_url_request_util.h" #include "content/renderer/media/audio/audio_device_factory.h" #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" #include "content/renderer/media/webrtc/rtc_peer_connection_handler.h" @@ -1358,6 +1359,8 @@ WebView* RenderViewImpl::CreateView( } params->features = ConvertWebWindowFeaturesToMojoWindowFeatures(features); + params->body = GetRequestBodyForWebURLRequest(request); + // We preserve this information before sending the message since |params| is // moved on send. bool is_background_tab = diff --git a/content/shell/browser/web_test/web_test_content_browser_client.cc b/content/shell/browser/web_test/web_test_content_browser_client.cc index 4c639ff453f778bee39726231c920fa6e0b65134..3367f6982e047dcc3654ed20e21b74dbb90dc9cc 100644 --- a/content/shell/browser/web_test/web_test_content_browser_client.cc +++ b/content/shell/browser/web_test/web_test_content_browser_client.cc @@ -305,6 +305,8 @@ bool WebTestContentBrowserClient::CanCreateWindow( const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, + const std::vector& additional_features, + const scoped_refptr& body, bool user_gesture, bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/shell/browser/web_test/web_test_content_browser_client.h b/content/shell/browser/web_test/web_test_content_browser_client.h index 8fe2e1d0b24f42ba7b2c7e40db78a3ed1d6f8341..7e6459e68ad3611b128d7f7f7604b77a66c40435 100644 --- a/content/shell/browser/web_test/web_test_content_browser_client.h +++ b/content/shell/browser/web_test/web_test_content_browser_client.h @@ -67,6 +67,8 @@ class WebTestContentBrowserClient : public ShellContentBrowserClient { const std::string& frame_name, WindowOpenDisposition disposition, const blink::mojom::WindowFeatures& features, + const std::vector& additional_features, + const scoped_refptr& body, bool user_gesture, bool opener_suppressed, bool* no_javascript_access) override;