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 c6381fe498311421d2568b6d91b33539eb72cb0b..90b2457b49cb9c68a0dd269e8e8f64a44cae80cf 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc @@ -3885,6 +3885,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 e227f780d720a80a13699f475757142571094cd1..6984f69e6f9a0d3058b0054df8a3aa9d46f14dbd 100644 --- a/content/common/frame.mojom +++ b/content/common/frame.mojom @@ -299,6 +299,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 1c904cd011b7a5ca9592a994cf4ba0be025eef55..15081967b0a29316ab82746ca6fe7d188a9efc58 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc @@ -484,6 +484,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 07dc81e27ae92e4e7a872134dcdc6a3ba2e08ec5..678b25401338a624dc37a11c45331d65082934e9 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -178,6 +178,7 @@ class RenderFrameHost; class RenderProcessHost; class RenderViewHost; class ResourceContext; +class ResourceRequestBody; class SerialDelegate; class SiteInstance; class SpeechRecognitionManagerDelegate; @@ -767,6 +768,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 a8a2d29739aabb0bd80cb77e28c46de57afe2b10..e3fa35b439e0f945e9e6a95587561fedd1ef4a2c 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" @@ -1346,6 +1347,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 1a159e8d2877e5b1c6778b68aec5b36fb88214fd..f9111b3e20fb7607faa4bb605be1ff4c385e40d6 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 @@ -313,6 +313,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 1a714946de9f0dceaec008e93928d2c414ef01da..34423135e85b3ed7a54c9f22f6674f9c4026a67c 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;