2eb3bddb05
* chore: bump chromium in DEPS to 92.0.4500.2
* resolve conflicts
* update patches
* chore: cherry-pick 82434206f306 from chromium (#29060)
* fix patch
* chore: bump chromium in DEPS to 92.0.4501.0
* chore: bump chromium in DEPS to 92.0.4502.0
* chore: bump chromium in DEPS to 92.0.4503.0
* chore: update patches
* 2869869
: [Code Health] Refactor ListValue::Insert in gpu compositor
https://chromium-review.googlesource.com/c/chromium/src/+/2869869
* 2877924: Separate InkDropHost from InkDropHostView
https://chromium-review.googlesource.com/c/chromium/src/+/2877924
* chore: bump chromium in DEPS to 92.0.4504.0
* update patches
* Fixup for Separate InkDropHost from InkDropHostView
https://chromium-review.googlesource.com/c/chromium/src/+/2877924
* 2873469: Compute hashes of .pak files during the build, and check it at runtime.
https://chromium-review.googlesource.com/c/chromium/src/+/2873469
* 2874397: Remove flag to disable microtasks scope consistency checks
https://chromium-review.googlesource.com/c/v8/v8/+/2874397
* 2881471: Remove unneeded trace_event.h includes in headers.
https://chromium-review.googlesource.com/c/chromium/src/+/2881471
* 2844717: [Keyboard Tooltip] Rename RWHV*::SetTooltipText to UpdateTooltipUnderCursor
https://chromium-review.googlesource.com/c/chromium/src/+/2844717
* chore: bump chromium in DEPS to 92.0.4505.0
* chore: update patches
* 2883887: Retire ScopedObserver in /chrome/browser/predictors.
https://chromium-review.googlesource.com/c/chromium/src/+/2883887
* 2883694: Retire ScopedObserver in /chrome/browser.
https://chromium-review.googlesource.com/c/chromium/src/+/2883694
* fixup after merge
* fixup: Remove flag to disable microtasks scope consistency checks
* Temporarily disable setcallhandler-test.js nan test
This test should be renabled once https://github.com/electron/electron/pull/29028 lands
* Use gin_helper::MicrotasksScope instead of v8::MicrotasksScope
* chore: bump chromium in DEPS to 92.0.4506.0
* update patches
* Revert "update patches"
This reverts commit 333ec0d4c205bd3cbee28d2bc3d068871dbb900a.
* Revert "chore: bump chromium in DEPS to 92.0.4506.0"
This reverts commit 2bd52f8cd89b173c8b15a61d74fa7539cdbf574b.
* Fixup: Use gin_helper::MicrotasksScope instead of v8::MicrotasksScope
* Fixup: Use gin_helper::MicrotasksScope instead of v8::MicrotasksScope
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
233 lines
11 KiB
Diff
233 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/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
|
|
index a192ba52723032cbe6daaff20a64f278a1967777..d8200f463443f11dafd84f4620b9c7f109912cdd 100644
|
|
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
|
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
|
@@ -5718,6 +5718,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 92ed79fc561b0789ab164b2c28a7860159c60c38..aed19709076c8b3d0df42b4dcb994f8bbe2d6026 100644
|
|
--- a/content/browser/web_contents/web_contents_impl.cc
|
|
+++ b/content/browser/web_contents/web_contents_impl.cc
|
|
@@ -3650,6 +3650,14 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow(
|
|
}
|
|
auto* new_contents_impl = new_contents.get();
|
|
|
|
+ // Call this earlier than Chrome to associate the web preferences with the
|
|
+ // WebContents before the view gets created.
|
|
+ if (delegate_) {
|
|
+ delegate_->WebContentsCreatedWithFullParams(this, render_process_id,
|
|
+ opener->GetRoutingID(),
|
|
+ params, new_contents_impl);
|
|
+ }
|
|
+
|
|
new_contents_impl->GetController().SetSessionStorageNamespace(
|
|
partition_id, session_storage_namespace);
|
|
|
|
@@ -3692,12 +3700,6 @@ RenderFrameHostDelegate* WebContentsImpl::CreateNewWindow(
|
|
AddWebContentsDestructionObserver(new_contents_impl);
|
|
}
|
|
|
|
- if (delegate_) {
|
|
- delegate_->WebContentsCreated(this, render_process_id,
|
|
- opener->GetRoutingID(), params.frame_name,
|
|
- params.target_url, new_contents_impl);
|
|
- }
|
|
-
|
|
observers_.NotifyObservers(&WebContentsObserver::DidOpenRequestedURL,
|
|
new_contents_impl, opener, params.target_url,
|
|
params.referrer.To<Referrer>(), params.disposition,
|
|
diff --git a/content/common/frame.mojom b/content/common/frame.mojom
|
|
index 6907ba65bfe130b9b1b0490b13fdc5923830d39d..c7854c3306bdd960bb6a76733f235c633449ecb8 100644
|
|
--- a/content/common/frame.mojom
|
|
+++ b/content/common/frame.mojom
|
|
@@ -455,6 +455,10 @@ struct CreateNewWindowParams {
|
|
// The impression associated with the navigation in the new window, if
|
|
// one is specified.
|
|
Impression? impression;
|
|
+
|
|
+ // 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 338c0091490bd3e3d4517cf815fd3caf253d2164..2361f649d7c9cfb7dd8326ae682f4486d2d21167 100644
|
|
--- a/content/public/browser/content_browser_client.cc
|
|
+++ b/content/public/browser/content_browser_client.cc
|
|
@@ -561,6 +561,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 ccd0247f99eeef26de3b2f3206fd66fc4f690546..0e19f40fdd18746dee8813bf403a7759f6c0f46d 100644
|
|
--- a/content/public/browser/content_browser_client.h
|
|
+++ b/content/public/browser/content_browser_client.h
|
|
@@ -158,6 +158,7 @@ class NetworkService;
|
|
class TrustedURLLoaderHeaderClient;
|
|
} // namespace mojom
|
|
struct ResourceRequest;
|
|
+class ResourceRequestBody;
|
|
} // namespace network
|
|
|
|
namespace sandbox {
|
|
@@ -928,6 +929,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 bf70b55e6b643686c6b57fbd4a51ad4f6927fa56..1d7b049404282bddb26ea04ab26a0fa726d5a958 100644
|
|
--- a/content/public/browser/web_contents_delegate.cc
|
|
+++ b/content/public/browser/web_contents_delegate.cc
|
|
@@ -27,6 +27,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 b1cfa654259d431adfada00a00f9bfc8ae5ab292..484d36de2ac0ef3b1d19bbd0d6c79db84e53b7fb 100644
|
|
--- a/content/public/browser/web_contents_delegate.h
|
|
+++ b/content/public/browser/web_contents_delegate.h
|
|
@@ -16,6 +16,7 @@
|
|
#include "base/memory/scoped_refptr.h"
|
|
#include "build/build_config.h"
|
|
#include "content/common/content_export.h"
|
|
+#include "content/common/frame.mojom.h"
|
|
#include "content/public/browser/eye_dropper.h"
|
|
#include "content/public/browser/invalidate_type.h"
|
|
#include "content/public/browser/media_stream_request.h"
|
|
@@ -340,6 +341,13 @@ class CONTENT_EXPORT WebContentsDelegate {
|
|
const StoragePartitionId& 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 2f302654b22364e0579310571bed92c716eed342..d094fb4cf201305ce14f07eac5840e5a492c8736 100644
|
|
--- a/content/renderer/render_view_impl.cc
|
|
+++ b/content/renderer/render_view_impl.cc
|
|
@@ -27,6 +27,7 @@
|
|
#include "third_party/blink/public/platform/impression_conversions.h"
|
|
#include "third_party/blink/public/platform/modules/video_capture/web_video_capture_impl_manager.h"
|
|
#include "third_party/blink/public/platform/url_conversion.h"
|
|
+#include "third_party/blink/public/platform/web_url_request_util.h"
|
|
#include "third_party/blink/public/web/modules/mediastream/web_media_stream_device_observer.h"
|
|
#include "third_party/blink/public/web/web_frame_widget.h"
|
|
#include "third_party/blink/public/web/web_local_frame.h"
|
|
@@ -317,6 +318,10 @@ WebView* RenderViewImpl::CreateView(
|
|
params->impression = blink::ConvertWebImpressionToImpression(*impression);
|
|
}
|
|
|
|
+ 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/web_test/browser/web_test_content_browser_client.cc b/content/web_test/browser/web_test_content_browser_client.cc
|
|
index 5e9b1a409f5fb0dd683cc67318bae9c542816451..e2a3780b6ea5e15839b89ff92c85e57e7c48b017 100644
|
|
--- a/content/web_test/browser/web_test_content_browser_client.cc
|
|
+++ b/content/web_test/browser/web_test_content_browser_client.cc
|
|
@@ -450,6 +450,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/web_test/browser/web_test_content_browser_client.h b/content/web_test/browser/web_test_content_browser_client.h
|
|
index c65d30c9187dd275488ed74bcc3a4eb918d2cbce..e4c6c828150e91f555b1b42e1988a1013ab1a1f0 100644
|
|
--- a/content/web_test/browser/web_test_content_browser_client.h
|
|
+++ b/content/web_test/browser/web_test_content_browser_client.h
|
|
@@ -83,6 +83,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 888a2a26e67dae0d42353e5e906d26ea30c66cb3..7e48698a4b18d4d805667b93f79962524e090044 100644
|
|
--- a/third_party/blink/public/web/web_window_features.h
|
|
+++ b/third_party/blink/public/web/web_window_features.h
|
|
@@ -34,6 +34,7 @@
|
|
#include "base/optional.h"
|
|
|
|
#include "third_party/blink/public/platform/web_impression.h"
|
|
+#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
|
|
|
|
namespace blink {
|
|
|
|
@@ -68,6 +69,8 @@ struct WebWindowFeatures {
|
|
// Represents the attribution source declared by Attribution Reporting related
|
|
// window features, if any.
|
|
base::Optional<WebImpression> impression;
|
|
+
|
|
+ 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 fae11495f6e2925db0dca463eac6432e3ad70cf7..6116660721387cb4dee3f84be99b0f7f7ed72585 100644
|
|
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
|
|
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
|
@@ -1976,6 +1976,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
|
|
|
|
WebWindowFeatures window_features =
|
|
GetWindowFeaturesFromString(features, incumbent_window);
|
|
+ window_features.raw_features = features;
|
|
|
|
FrameLoadRequest frame_request(incumbent_window,
|
|
ResourceRequest(completed_url));
|