a58bc42ed0
* chore: bump chromium in DEPS to 68d7ef9b31f3f164a967109212e84a8d756cc80f * Update patches * Update location of file_info.h * Update sysroots * chore: bump chromium in DEPS to 47114394b1c8a35438d19da7538142380551a2ce * Update patches * ci: update docker image to pickup new ia32 dep * Skip .info files in dist.zip Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
118 lines
6 KiB
Diff
118 lines
6 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
|
|
|
|
This adds a hook to the window creation flow so that Electron can intercede and
|
|
potentially prevent a window from being created.
|
|
|
|
TODO(loc): this patch is currently broken.
|
|
|
|
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
|
|
index 49587997fa1ebe73dd00e96c95ae0448fcc7fa62..7e203486c32617e325c8aa6305c4ee57c93540f7 100644
|
|
--- a/content/browser/frame_host/render_frame_host_impl.cc
|
|
+++ b/content/browser/frame_host/render_frame_host_impl.cc
|
|
@@ -4487,6 +4487,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 abd2be4bc8e81a28209aa551f4435b9e8d37a249..f33766c98e1a28c89fc41f9e5cfd098ca6bc6150 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 bcdc73fdf89d46e267f0c9568e46172ec89f9f23..930e043a0fdf40ef0e48a19597da567c8603878c 100644
|
|
--- a/content/public/browser/content_browser_client.cc
|
|
+++ b/content/public/browser/content_browser_client.cc
|
|
@@ -505,6 +505,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 51f31b2c7e431004f2f1bf54e043ed497d166d4f..f9601b5813746ce930bb7082178e1f826aaeb62e 100644
|
|
--- a/content/public/browser/content_browser_client.h
|
|
+++ b/content/public/browser/content_browser_client.h
|
|
@@ -146,6 +146,7 @@ class NetworkService;
|
|
class TrustedURLLoaderHeaderClient;
|
|
} // namespace mojom
|
|
struct ResourceRequest;
|
|
+class ResourceRequestBody;
|
|
} // namespace network
|
|
|
|
namespace rappor {
|
|
@@ -831,6 +832,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 bd44565e78aaa70e9402312830d30c4a908ede11..463906df3f761bb321c8580185c5e12dceb96854 100644
|
|
--- a/content/renderer/render_view_impl.cc
|
|
+++ b/content/renderer/render_view_impl.cc
|
|
@@ -69,6 +69,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/render_frame_impl.h"
|
|
#include "content/renderer/render_frame_proxy.h"
|
|
@@ -1276,6 +1277,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 62e1749ae329791ed31374b255958bfc971599ab..64285a53a4baa65216f58412909202ce085fca12 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
|
|
@@ -326,6 +326,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 5f985e2f11ebef42ed676260297e5e699096ba4a..2f3e68199f50b0e85dbb0d5cb95388279a194028 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
|
|
@@ -66,6 +66,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;
|