59dd17f2cf
* chore: bump chromium in DEPS to 102.0.4975.0 * chore: bump chromium in DEPS to 102.0.4977.0 * chore: update patches * Remove parameter of OnGpuProcessCrashed() https://chromium-review.googlesource.com/c/chromium/src/+/3543396 * hid: Add exclusionFilters option to requestDevice https://chromium-review.googlesource.com/c/chromium/src/+/3478175 * chore: bump chromium in DEPS to 102.0.4979.0 * chore: bump chromium in DEPS to 102.0.4981.0 * chore: update patches * Deny notification/push permission for documents in non-standard StoragePartitions https://chromium-review.googlesource.com/c/chromium/src/+/3257305 * Improve FrameTreeNode tracking in URLLoaderNetworkContext https://chromium-review.googlesource.com/c/chromium/src/+/3341866 * fixup! Remove parameter of OnGpuProcessCrashed() * chore: fix lint * Reland "Use gfx::Insets[F]::TLBR() and gfx::Insets[F]::VH() in the rest of Chrome" https://chromium-review.googlesource.com/c/chromium/src/+/3554236 * chore: bump chromium in DEPS to 102.0.4983.0 * Ensure EyeDropperView does not access a destroyed window https://chromium-review.googlesource.com/c/chromium/src/+/3561542 * ci: don't delete dawn .git directory 83901: Adds a generated file with the dawn git hash encoded at build time. | https://dawn-review.googlesource.com/c/dawn/+/83901 * ci: update Windows toolchain 3550827: New toolchain for Windows 10 20348 SDK | https://chromium-review.googlesource.com/c/chromium/src/+/3550827 * chore: bump chromium in DEPS to 102.0.4985.0 * chore: update patches * chore: bump chromium in DEPS to 102.0.4987.0 * chore: update patches * 3563432: codehealth: remove uses of DictionaryValue in cbui/webui https://chromium-review.googlesource.com/c/chromium/src/+/3563432 * chore: update patches after rebase * Use gfx::Insets[F]::TLBR() and gfx::Insets[F]::VH() in the rest of Chrome https://chromium-review.googlesource.com/c/chromium/src/+/3554236 * 3565724: Preserve "proper method names" as-is in error.stack. https://chromium-review.googlesource.com/c/v8/v8/+/3565724 * chore: bump chromium in DEPS to 102.0.4989.0 * chore: update patches * fixup ci: don't delete dawn .git directory for Windows * 3560843: Remove multi-parameter version of gfx::Rect[F]::Inset() https://chromium-review.googlesource.com/c/chromium/src/+/3560843 * 3572711: Remove unused IDS_PDF_TOOLTIP_ROTATE_CW resource. https://chromium-review.googlesource.com/c/chromium/src/+/3572711 * 3572926: Reland "[Sysroot] Switch to Debian Bullseye stable" https://chromium-review.googlesource.com/c/chromium/src/+/3572926 * build: fixup sysroots with electron specific dependencies * fixup Remove multi-parameter version of gfx::Rect[F]::Inset() * fixup 3565724: Preserve "proper method names" as-is in error.stack. * fixup Remove multi-parameter version of gfx::Rect[F]::Inset() * test: add spec for navigator.hid.requestDevice({ exclusionFilters: [...] } * fixup 3565724: Preserve "proper method names" as-is in error.stack. * ci: use python3 to get the windows toolchain profile 3525960: Explicitly run everything with python3 | https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3525960 * chore: add diagnostic logging * fix: try calling process.crash() * chore: remove logging Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.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 c9f0b4a30f8df2ba2a12914b447cede52ed1ff85..a5d6618aac35f01e09a90bdafa9f60c8140b088c 100644
|
|
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
|
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
|
@@ -6937,6 +6937,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 6261962f55f065d4edc0641ce8927143468add8a..cf37734d313470c27d2d40bd90cb199234a1e99e 100644
|
|
--- a/content/browser/web_contents/web_contents_impl.cc
|
|
+++ b/content/browser/web_contents/web_contents_impl.cc
|
|
@@ -3943,6 +3943,14 @@ FrameTree* 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_config, session_storage_namespace);
|
|
|
|
@@ -3987,12 +3995,6 @@ FrameTree* 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 28144893598e6b4caa18cd23fea1da3ca1f406b1..8b83eb8c342499ec7a677cd849f0e3c17d955a38 100644
|
|
--- a/content/common/frame.mojom
|
|
+++ b/content/common/frame.mojom
|
|
@@ -569,6 +569,10 @@ struct CreateNewWindowParams {
|
|
|
|
// Governs how downloads are handled if `target_url` results in a download.
|
|
blink.mojom.NavigationDownloadPolicy download_policy;
|
|
+
|
|
+ // 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 2a51c8c4d4cd21c0dc106dbb3b2e4e940a47319b..79479dd5fc7e0a9c27e75b85e1380c38f32f6fe7 100644
|
|
--- a/content/public/browser/content_browser_client.cc
|
|
+++ b/content/public/browser/content_browser_client.cc
|
|
@@ -578,6 +578,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 d6ad990189520f7fc15e04c1c4bd03588d3ee81e..6aa01e2f4e8227f0c1cb78b88009728efccdd998 100644
|
|
--- a/content/public/browser/content_browser_client.h
|
|
+++ b/content/public/browser/content_browser_client.h
|
|
@@ -164,6 +164,7 @@ class NetworkService;
|
|
class TrustedURLLoaderHeaderClient;
|
|
} // namespace mojom
|
|
struct ResourceRequest;
|
|
+class ResourceRequestBody;
|
|
} // namespace network
|
|
|
|
namespace sandbox {
|
|
@@ -953,6 +954,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 f132199113778f6b50972419b61a187e6272300c..7bb1680553c405a9016cfd67eca5fa3c6439b692 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 85335ff06c87ea3986360fad18df6cf01a4a7cca..eeafde1fa6067804665954525eafdd482d8eb3f3 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"
|
|
@@ -338,6 +339,13 @@ class CONTENT_EXPORT WebContentsDelegate {
|
|
const StoragePartitionConfig& partition_config,
|
|
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 f7fbc40e8df8b996d6079f2e691771529ca42497..5580f245477b713d0f1f92ca9d15de847c4f8c92 100644
|
|
--- a/content/renderer/render_view_impl.cc
|
|
+++ b/content/renderer/render_view_impl.cc
|
|
@@ -33,6 +33,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"
|
|
@@ -295,6 +296,10 @@ WebView* RenderViewImpl::CreateView(
|
|
params->impression = blink::ConvertWebImpressionToImpression(*impression);
|
|
}
|
|
|
|
+ params->raw_features = features.raw_features.Utf8(
|
|
+ WTF::UTF8ConversionMode::kStrictUTF8ConversionReplacingUnpairedSurrogatesWithFFFD);
|
|
+ params->body = GetRequestBodyForWebURLRequest(request);
|
|
+
|
|
params->download_policy.ApplyDownloadFramePolicy(
|
|
/*is_opener_navigation=*/false, request.HasUserGesture(),
|
|
// `openee_can_access_opener_origin` only matters for opener navigations,
|
|
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 4379497806bf7c85ade2f4e4554d6a60c4ec966c..fa860bbcf0c12df33dae69d25b01587676a1b79e 100644
|
|
--- a/content/web_test/browser/web_test_content_browser_client.cc
|
|
+++ b/content/web_test/browser/web_test_content_browser_client.cc
|
|
@@ -438,6 +438,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 d4eb4d482b2641585d501131c64b90cc9dbcfd18..132a5d86279b9a2cb4364b9c6d3e89e12d55052e 100644
|
|
--- a/content/web_test/browser/web_test_content_browser_client.h
|
|
+++ b/content/web_test/browser/web_test_content_browser_client.h
|
|
@@ -80,6 +80,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 84d32491a56528a84b4395fba1d54cdbb38d522b..09998a83c449ef8cd9f360fbcdcf7edc0bbfa4a9 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 "third_party/abseil-cpp/absl/types/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.
|
|
absl::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 00af75f5295251fb19c874d2b7d877c4a53f7f12..c0042534907dfca1789b8dde2ffa11956d3e029e 100644
|
|
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
|
|
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
|
@@ -2076,6 +2076,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
|
|
|
|
WebWindowFeatures window_features =
|
|
GetWindowFeaturesFromString(features, incumbent_window);
|
|
+ window_features.raw_features = features;
|
|
|
|
// In fenced frames, we should always use `noopener`.
|
|
if (GetFrame()->IsInFencedFrameTree()) {
|