72a089262e
* chore: bump chromium in DEPS to a7249f73ae05d456c04487ef1693325f719556dd * chore: bump chromium in DEPS to 202466fa40b58f0bb9c9a76a037d1c50154c099e * chore: bump chromium in DEPS to 2dd1b25c8d794b50fb0dd911e0c4e909ff39f145 * Update patches * update patches * Revert "[printing] Mojofy PrintHostMsg_CheckForCancel" https://chromium-review.googlesource.com/c/chromium/src/+/2226002 * chore: bump chromium in DEPS to 8c1542e7dd36854fdf4abd1a8021eeb65a6a2e2b * chore: bump chromium in DEPS to 078bc6d796334fb403acd8975b99d1c8ecd028e8 * chore: bump chromium in DEPS to d96e9f16ae852ec9dbd15bf17df3d440402413bb * update patches * chore: update patches * Use ExtensionSystem::is_ready() instead of ExtensionService::is_ready() https://chromium-review.googlesource.com/c/chromium/src/+/2207499 * Remove WebImeTextSpan https://chromium-review.googlesource.com/c/chromium/src/+/2225240 * Remove PDFAnnotations flag altogether. https://chromium-review.googlesource.com/c/chromium/src/+/2229317 * Rework find-from-selection so it's synchronous -- fixes flaky tests https://chromium-review.googlesource.com/c/chromium/src/+/2181570 * fixup! Revert "[printing] Mojofy PrintHostMsg_CheckForCancel" * chore: bump chromium in DEPS to a8a280835830c65145ed8573a9a09f36d3920418 * update sysroots * update patches * update patches * Take RFH as a parameter for DidUpdateFavicon/ManifestURL https://chromium-review.googlesource.com/c/chromium/src/+/2224745 * chore: bump chromium in DEPS to b6149cb5a5e32caf8eab67b97ef3072b72521ca8 * Update patches * Rename net::cookie_util::StripStatuses to StripAccessResults https://chromium-review.googlesource.com/c/chromium/src/+/2212697 * use net::CookieAccessResultList instead of net::CookieAccessResultList * fix mas_no_private_api patch https://chromium-review.googlesource.com/c/chromium/src/+/2230281 * chore: bump chromium in DEPS to a27feee1643d952e48f77c92d8c03aedea14b720 * update patches * fix: add new navigation state REUSE_SITE_INSTANCE To fix the new set of state checks added in https://chromium-review.googlesource.com/c/chromium/src/+/2215141 * chore: bump chromium in DEPS to ff4559a4c13d20888202474e4ab9917dbdad8a9a * update patches * Cleanup usages of old mojo types and remove unused code https://chromium-review.googlesource.com/c/chromium/src/+/2235699 * chore: bump chromium in DEPS to 05279845f76eb22900a8b0d1a11d4fd339a8e53b * chore: bump chromium in DEPS to 821558279767cffec90e3b5b947865f90089fed3 * chore: bump chromium in DEPS to 1aef04e6486be337d3dd820b2d64d6320a1b9c13 * chore: bump chromium in DEPS to dc86386e8fdd796a0f7577e91e42a7f8b7e9bc78 * chore: bump chromium in DEPS to 64f2360794f14643764092ba3e58e2ed8f9fee12 * chore: update patches * refactor: MessageLoop, you are terminated \o/ Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2246173 * refactor: plumb DownloadSchedule to DownloadItem Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2242202 * chore: fix variable typo in IPC * chore: s/BindPipeAndPassReceiver/BindNewPipeAndPassReceiver * chore: update patches * chore: XEvent becomes x11::Event Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2240355 * fixup! refactor: MessageLoop, you are terminated \o/ * fixup! chore: XEvent becomes x11::Event * build: update v8 headers * chore: fix windows build * chore: disable SameSite-by-default changes https://chromium-review.googlesource.com/c/chromium/src/+/2231445 * update printing.patch * chore: bump chromium DEPS to 9ae03ef8f7d4f6ac663f725bcfe70311987652f3 * Convert WidgetHostMsg_SelectionBoundsChanged/TextInputStateChanged https://chromium-review.googlesource.com/c/chromium/src/+/2243531 * chore: update v8 patches * [XProto] Replace usages of XID and ::Window with x11::Window https://chromium-review.googlesource.com/c/chromium/src/+/2249389 * Update VideoFrameMetadata to use base::Optionals https://chromium-review.googlesource.com/c/chromium/src/+/2231706 https://chromium-review.googlesource.com/c/chromium/src/+/2238361 * --disable-dev-shm-usage for gpu process crash * [v8] Allow for 4GB TypedArrays https://chromium-review.googlesource.com/c/v8/v8/+/2249668 * update lib_src_switch_buffer_kmaxlength_to_size_t.patch * disable app.getGPUInfo spec on linux * update patches Co-authored-by: John Kleinschmidt <jkleinsc@github.com> Co-authored-by: Electron Bot <anonymous@electronjs.org> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
219 lines
11 KiB
Diff
219 lines
11 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 be4d33c909a9bb953ed592d245d9bc2caf33f219..cfcfb2a501654f32d6be1b4807e0a097d02d5659 100644
|
|
--- a/content/browser/frame_host/render_frame_host_impl.cc
|
|
+++ b/content/browser/frame_host/render_frame_host_impl.cc
|
|
@@ -4814,6 +4814,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->raw_features, params->body,
|
|
effective_transient_activation_state, params->opener_suppressed,
|
|
&no_javascript_access);
|
|
|
|
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
|
index 36a6d0a1dd0480125d80cda76c49833aa2d48b76..87c8e45cbec22da82bb702412e9f706ff3f5c179 100644
|
|
--- a/content/browser/web_contents/web_contents_impl.cc
|
|
+++ b/content/browser/web_contents/web_contents_impl.cc
|
|
@@ -3086,9 +3086,9 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow(
|
|
}
|
|
|
|
if (delegate_) {
|
|
- delegate_->WebContentsCreated(this, render_process_id,
|
|
- opener->GetRoutingID(), params.frame_name,
|
|
- params.target_url, new_contents_impl);
|
|
+ delegate_->WebContentsCreatedWithFullParams(this, render_process_id,
|
|
+ opener->GetRoutingID(),
|
|
+ params, new_contents_impl);
|
|
}
|
|
|
|
for (auto& observer : observers_) {
|
|
diff --git a/content/common/frame.mojom b/content/common/frame.mojom
|
|
index 322e2f0f4f023cd2e34163f623c5b52eaad51c1d..46ae29207c804ae3474ae3a3dd8f76de93a1deb0 100644
|
|
--- a/content/common/frame.mojom
|
|
+++ b/content/common/frame.mojom
|
|
@@ -277,6 +277,10 @@ struct CreateNewWindowParams {
|
|
|
|
// The window features to use for the new window.
|
|
blink.mojom.WindowFeatures features;
|
|
+
|
|
+ // Extra fields added by Electron.
|
|
+ string raw_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 d2ddb9fae8630310e286174bae1205d46dd20636..456abd7838cff663805f09e8804ab8a2aa2f9b1b 100644
|
|
--- a/content/public/browser/content_browser_client.cc
|
|
+++ b/content/public/browser/content_browser_client.cc
|
|
@@ -530,6 +530,8 @@ bool ContentBrowserClient::CanCreateWindow(
|
|
const std::string& frame_name,
|
|
WindowOpenDisposition disposition,
|
|
const blink::mojom::WindowFeatures& features,
|
|
+ const std::string& raw_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 3236df23868492d3c6a1850517dfa1fb4aecf623..3908e4e3398a53af8634a6a3ef74ab802cdfd33a 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 sandbox {
|
|
@@ -851,6 +852,8 @@ class CONTENT_EXPORT ContentBrowserClient {
|
|
const std::string& frame_name,
|
|
WindowOpenDisposition disposition,
|
|
const blink::mojom::WindowFeatures& features,
|
|
+ const std::string& raw_features,
|
|
+ const scoped_refptr<network::ResourceRequestBody>& body,
|
|
bool user_gesture,
|
|
bool opener_suppressed,
|
|
bool* no_javascript_access);
|
|
diff --git a/content/public/browser/web_contents_delegate.cc b/content/public/browser/web_contents_delegate.cc
|
|
index 50936cd961bf4d0e026ee3d150a34892e94601dd..f62a39dc9904f4edd7cc4e407c3d1ec58c0853c8 100644
|
|
--- a/content/public/browser/web_contents_delegate.cc
|
|
+++ b/content/public/browser/web_contents_delegate.cc
|
|
@@ -26,6 +26,17 @@ namespace content {
|
|
|
|
WebContentsDelegate::WebContentsDelegate() = default;
|
|
|
|
+void WebContentsDelegate::WebContentsCreatedWithFullParams(
|
|
+ WebContents* source_contents,
|
|
+ int opener_render_process_id,
|
|
+ int opener_render_frame_id,
|
|
+ const mojom::CreateNewWindowParams& params,
|
|
+ WebContents* new_contents) {
|
|
+ WebContentsCreated(source_contents, opener_render_process_id,
|
|
+ opener_render_frame_id, params.frame_name,
|
|
+ params.target_url, new_contents);
|
|
+}
|
|
+
|
|
WebContents* WebContentsDelegate::OpenURLFromTab(WebContents* source,
|
|
const OpenURLParams& params) {
|
|
return nullptr;
|
|
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
|
|
index e545ff70c612e98cdd79230303273a3ec7bfcaac..405152e0e90bc76b7de9c3e6946944f3ad852e5d 100644
|
|
--- a/content/public/browser/web_contents_delegate.h
|
|
+++ b/content/public/browser/web_contents_delegate.h
|
|
@@ -16,6 +16,7 @@
|
|
#include "base/strings/string16.h"
|
|
#include "build/build_config.h"
|
|
#include "content/common/content_export.h"
|
|
+#include "content/common/frame.mojom.h"
|
|
#include "content/public/browser/bluetooth_chooser.h"
|
|
#include "content/public/browser/bluetooth_scanning_prompt.h"
|
|
#include "content/public/browser/eye_dropper.h"
|
|
@@ -337,6 +338,13 @@ class CONTENT_EXPORT WebContentsDelegate {
|
|
const std::string& partition_id,
|
|
SessionStorageNamespace* session_storage_namespace);
|
|
|
|
+ virtual void WebContentsCreatedWithFullParams(
|
|
+ WebContents* source_contents,
|
|
+ int opener_render_process_id,
|
|
+ int opener_render_frame_id,
|
|
+ const mojom::CreateNewWindowParams& params,
|
|
+ WebContents* new_contents);
|
|
+
|
|
// Notifies the delegate about the creation of a new WebContents. This
|
|
// typically happens when popups are created.
|
|
virtual void WebContentsCreated(WebContents* source_contents,
|
|
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
|
|
index 29220e08371ad0f7a400c81bd024c55130430767..57447f4529917692155d1861c7658156978fa0be 100644
|
|
--- a/content/renderer/render_view_impl.cc
|
|
+++ b/content/renderer/render_view_impl.cc
|
|
@@ -67,6 +67,7 @@
|
|
#include "content/renderer/history_serialization.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"
|
|
@@ -1238,6 +1239,10 @@ WebView* RenderViewImpl::CreateView(
|
|
}
|
|
params->features = ConvertWebWindowFeaturesToMojoWindowFeatures(features);
|
|
|
|
+ params->raw_features = features.raw_features.Utf8(
|
|
+ WTF::UTF8ConversionMode::kStrictUTF8ConversionReplacingUnpairedSurrogatesWithFFFD);
|
|
+ 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 021b06878da520d5e5576cb01c60a4a2e017b9ad..71d9fc7215180a47b45c924ed95fb8619db598f6 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
|
|
@@ -400,6 +400,8 @@ bool WebTestContentBrowserClient::CanCreateWindow(
|
|
const std::string& frame_name,
|
|
WindowOpenDisposition disposition,
|
|
const blink::mojom::WindowFeatures& features,
|
|
+ const std::string& raw_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 45b6bbbd41bbe19a39edb83b6ced844cb4c97244..90b5c696f4cc6b77d1377a628c9d8166c773bb60 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
|
|
@@ -79,6 +79,8 @@ class WebTestContentBrowserClient : public ShellContentBrowserClient {
|
|
const std::string& frame_name,
|
|
WindowOpenDisposition disposition,
|
|
const blink::mojom::WindowFeatures& features,
|
|
+ const std::string& raw_features,
|
|
+ const scoped_refptr<network::ResourceRequestBody>& body,
|
|
bool user_gesture,
|
|
bool opener_suppressed,
|
|
bool* no_javascript_access) override;
|
|
diff --git a/third_party/blink/public/web/web_window_features.h b/third_party/blink/public/web/web_window_features.h
|
|
index 4f735ad0d97eaac9a57dad137e479f8a7ec33a36..0a3c5821962c85609b64b3625fa6b8d658cd9ab2 100644
|
|
--- a/third_party/blink/public/web/web_window_features.h
|
|
+++ b/third_party/blink/public/web/web_window_features.h
|
|
@@ -31,6 +31,8 @@
|
|
#ifndef THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_WINDOW_FEATURES_H_
|
|
#define THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_WINDOW_FEATURES_H_
|
|
|
|
+#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
|
|
+
|
|
namespace blink {
|
|
|
|
struct WebWindowFeatures {
|
|
@@ -60,6 +62,8 @@ struct WebWindowFeatures {
|
|
bool noreferrer = false;
|
|
bool background = false;
|
|
bool persistent = false;
|
|
+
|
|
+ String raw_features;
|
|
};
|
|
|
|
} // namespace blink
|
|
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
|
index fe54120a9d4166c54311871ff54792ff6e5549b1..1c642c798179c477dab5f5a66a810c5047640162 100644
|
|
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
|
|
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
|
@@ -1985,6 +1985,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
|
|
}
|
|
|
|
WebWindowFeatures window_features = GetWindowFeaturesFromString(features);
|
|
+ window_features.raw_features = features;
|
|
|
|
FrameLoadRequest frame_request(incumbent_window->document(),
|
|
ResourceRequest(completed_url));
|