electron/patches/chromium/can_create_window.patch

114 lines
5.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cheng Zhao <zcbenz@gmail.com>
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 0774bc243cf83cbec60b0d1c0a93d56538676354..44a85b814e305e158d58e615901a7d188b813d43 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -3834,6 +3834,7 @@ void RenderFrameHostImpl::CreateNewWindow(
last_committed_origin_, params->window_container_type,
params->target_url, params->referrer.To<Referrer>(),
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 a2fe2dbd0d1c91a0bf5047b5c93f30758a0db277..d9f44fecaae883d861eea94c6cc16727967f0baa 100644
--- a/content/common/frame.mojom
+++ b/content/common/frame.mojom
@@ -305,6 +305,10 @@ struct CreateNewWindowParams {
// The window features to use for the new window.
blink.mojom.WindowFeatures features;
+
+ // Extra fields added by Electron.
+ array<string> 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 546ad19cd1e76474136492076b1d016d02338c42..06984e1da1512c3d8577716432920a1755524cf8 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
@@ -512,6 +512,8 @@ bool ContentBrowserClient::CanCreateWindow(
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
+ const std::vector<std::string>& additional_features,
+ const scoped_refptr<network::ResourceRequestBody>& 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 cc45848df84b5be9b20d9e60f6f605dbc32f36e7..52cf099889768bbc14acc3f32fcfba5ab7640a1d 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -176,6 +176,7 @@ class RenderFrameHost;
class RenderProcessHost;
class RenderViewHost;
class ResourceContext;
+class ResourceRequestBody;
class SerialDelegate;
class SiteInstance;
class SpeechRecognitionManagerDelegate;
@@ -797,6 +798,8 @@ class CONTENT_EXPORT ContentBrowserClient {
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
+ const std::vector<std::string>& additional_features,
+ const scoped_refptr<network::ResourceRequestBody>& 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 d0ca81590d2b5688022ca6045869dcae0ecd778e..7752c1e49dbee49c64a552ec249cabdb4d073109 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/stream/media_stream_device_observer.h"
#include "content/renderer/media/video_capture/video_capture_impl_manager.h"
@@ -1366,6 +1367,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 dacecdd4d0195e999f11fd2e1dfaabe95a639263..c5b88ee2561561c0b8a8032d32255645ce30c450 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
@@ -308,6 +308,8 @@ bool WebTestContentBrowserClient::CanCreateWindow(
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
+ const std::vector<std::string>& additional_features,
+ const scoped_refptr<network::ResourceRequestBody>& 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 4f00217da5a4f6f3d7410b82352fcb94e7f4a8fd..33e30d6a816e87dade0a26710a8f71fc6f630f34 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
@@ -69,6 +69,8 @@ class WebTestContentBrowserClient : public ShellContentBrowserClient {
const std::string& frame_name,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& features,
+ const std::vector<std::string>& additional_features,
+ const scoped_refptr<network::ResourceRequestBody>& body,
bool user_gesture,
bool opener_suppressed,
bool* no_javascript_access) override;