mirror of
https://github.com/electron/electron.git
synced 2026-01-08 23:18:06 -05:00
* chore: bump chromium in DEPS to 144.0.7543.0 * Pass PipScreenCaptureCoordinatorProxy to ScreenCaptureKitDeviceMac https://chromium-review.googlesource.com/c/chromium/src/+/7157590 * chore: update patches * chore: update filenames.libcxx.gni * 7142359: Spanification of process_singleton_posix.cc https: //chromium-review.googlesource.com/c/chromium/src/+/7142359 Co-Authored-By: Charles Kerr <70381+ckerr@users.noreply.github.com> * Move logging::LoggingSettings to base/logging/logging_settings.h https://chromium-review.googlesource.com/c/chromium/src/+/7173024 * chore: bump chromium in DEPS to 144.0.7545.0 * 7159368: update PluginService API for sync GetPlugins Upstream removed async PluginService APIs: - GetPluginsAsync() removed, use synchronous GetPlugins() - RegisterInternalPlugin() now takes single argument (remove add_at_beginning) - RefreshPlugins() removed entirely Updated ElectronPluginInfoHostImpl to use synchronous plugin loading and simplified ElectronBrowserMainParts internal plugin registration. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7159368 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7159328 Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7159056 (cherry picked from commit88cdf50b0a) * 7159184: add missing base/files/file_path.h include Add explicit include for base/files/file_path.h in electron_browser_context.h. After removal of superfluous Mojo includes from content headers, base::FilePath is no longer transitively included via content/public/browser/browser_context.h. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7159184 (cherry picked from commit6ca8ea03ec) * 7126479: add ShouldForceRefreshTextCheckService parameter to SpellCheckClient Upstream added a force-refresh parameter to WebTextCheckClient::RequestCheckingOfText to bypass spell check cache. Add the new ShouldForceRefreshTextCheckService parameter to SpellCheckClient's override (currently unused in Electron). Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7126479 (cherry picked from commit879c0401c4) * 7083663: remove fingerprinting_protection_ruleset_service override Upstream deleted external references to Fingerprinting Protection Filter (FPF) component. Remove the fingerprinting_protection_ruleset_service() override from BrowserProcessImpl as the method no longer exists in the base class. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7083663 (cherry picked from commit8350d152f9) * 7155287: implement WebContentsView::GetSize and Resize Upstream delegated WebContents::GetSize() and Resize() to WebContentsView, making them pure virtual. Add const qualifier to GetSize() and implement the Resize() override in OffScreenWebContentsView (no-op for offscreen). Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7155287 (cherry picked from commit084eaa568e) * 7184238: add OnUnconfirmedTapConvertedToTap override Upstream added OnUnconfirmedTapConvertedToTap as a pure virtual method to RenderWidgetHostViewBase to inform root view when child frame converts an unconfirmed tap. Add empty override for offscreen rendering. Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7184238 (cherry picked from commitef03400d9a) * 7143586: add widget parameter to OnCommandsChanged GlobalAcceleratorListener::OnCommandsChanged gained a gfx::AcceleratedWidget parameter for window association in the GlobalShortcutListenerLinux implementation. Pass gfx::kNullAcceleratedWidget for Electron's usage. Ref: : Pass parent handle to GlobalAcceleratorListenerLinux::BindShortcuts | https://chromium-review.googlesource.com/c/chromium/src/+/7143586 (cherry picked from commit38306e2bfc) Co-Authored-By: Samuel Attard <MarshallOfSound@users.noreply.github.com> * chore: update patches Co-Authored-By: Samuel Attard <MarshallOfSound@users.noreply.github.com> * chore: bump chromium in DEPS to 144.0.7547.0 * chore: update patches * 7189232: Add support for UnownedUserData in GlobalFeatures https: //chromium-review.googlesource.com/c/chromium/src/+/7189232 * Refactor: Use std::u16string for extension load error messages https://chromium-review.googlesource.com/c/chromium/src/+/7185844 * fixup Add support for UnownedUserData in GlobalFeatures * 7165650: Remove ResourceContext https://chromium-review.googlesource.com/c/chromium/src/+/7165650 * fixup BUILD.gn for lint * 7202164: Reland "Reland "Remove GenericScopedHandle:IsValid"" https://chromium-review.googlesource.com/c/chromium/src/+/7202164 * advance deprecation of v8::ReturnValue<void>::Set(Local<S>). 7168624: [runtime][api] Relax requirements for setter/definer/deleter callbacks | https://chromium-review.googlesource.com/c/v8/v8/+/7168624 * fixup advance deprecation of v8::ReturnValue<void>::Set(Local<S>) * chore: skip setting LPAC ACLs * Revert "chore: skip setting LPAC ACLs" This reverts commite187aec488. * chore: revert Convert to UNSAFE_TODO in sandbox revert https://chromium-review.googlesource.com/c/chromium/src/+/7131661 to see if it fixes the Windows sandbox issue. * Revert "chore: revert Convert to UNSAFE_TODO in sandbox" This reverts commit57afbfefe5. * chore: Revert "Enable network sandbox by default on Windows" see if this fixes the Windows sandbox issue * Enable network sandbox by default on Windows https://chromium-review.googlesource.com/c/chromium/src/+/7204292 * Revert "chore: Revert "Enable network sandbox by default on Windows"" This reverts commit530ab6af82. * fixup! Enable network sandbox by default on Windows | https://chromium-review.googlesource.com/c/chromium/src/+/7204292 * fixup!: Correct flag name, add kLocalNetworkAccessChecks to all platforms --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: Charles Kerr <70381+ckerr@users.noreply.github.com> Co-authored-by: Samuel Attard <sattard@anthropic.com> Co-authored-by: Samuel Attard <MarshallOfSound@users.noreply.github.com> Co-authored-by: John Kleinschmidt <kleinschmidtorama@gmail.com> Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
247 lines
12 KiB
Diff
247 lines
12 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 558ddaf4a329058c229b0ba23f6a84b3a7262d26..b97560e77c6066ad93dc9865a131a0823c5017e2 100644
|
|
--- a/content/browser/renderer_host/render_frame_host_impl.cc
|
|
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
|
@@ -9865,6 +9865,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 6487679d008db662772d4a1c21a9afb2857b775b..87144696ec3a7684bf532ca1946ab8a9bcd20cc9 100644
|
|
--- a/content/browser/web_contents/web_contents_impl.cc
|
|
+++ b/content/browser/web_contents/web_contents_impl.cc
|
|
@@ -5326,6 +5326,10 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
|
create_params.initially_hidden = renderer_started_hidden;
|
|
create_params.initial_popup_url = params.target_url;
|
|
|
|
+ // Potentially allow the delegate to override the create_params.
|
|
+ if (delegate_)
|
|
+ delegate_->MaybeOverrideCreateParamsForNewWindow(&create_params);
|
|
+
|
|
// Even though all codepaths leading here are in response to a renderer
|
|
// trying to open a new window, if the new window ends up in a different
|
|
// browsing instance, then the RenderViewHost, RenderWidgetHost,
|
|
@@ -5378,6 +5382,12 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
|
// Sets the newly created WebContents WindowOpenDisposition.
|
|
new_contents_impl->original_window_open_disposition_ = params.disposition;
|
|
|
|
+ if (delegate_) {
|
|
+ delegate_->WebContentsCreatedWithFullParams(this, render_process_id,
|
|
+ opener->GetRoutingID(),
|
|
+ params, new_contents_impl);
|
|
+ }
|
|
+
|
|
// If the new frame has a name, make sure any SiteInstances that can find
|
|
// this named frame have proxies for it. Must be called after
|
|
// SetSessionStorageNamespace, since this calls CreateRenderView, which uses
|
|
@@ -5419,12 +5429,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 4c55f0abf8df5a3408f3f90d444ceff3c23ee1bc..72bdb5b5a4c2c21a7192b34bb293bd23bafaf50c 100644
|
|
--- a/content/common/frame.mojom
|
|
+++ b/content/common/frame.mojom
|
|
@@ -648,6 +648,10 @@ struct CreateNewWindowParams {
|
|
pending_associated_remote<blink.mojom.Widget> widget;
|
|
pending_associated_receiver<blink.mojom.FrameWidgetHost> frame_widget_host;
|
|
pending_associated_remote<blink.mojom.FrameWidget> frame_widget;
|
|
+
|
|
+ // 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 a0ccc5352495e75e1603fd3f90825eba85276a6a..3cf480086d77bddb3328aa02137e7bb66c2eb511 100644
|
|
--- a/content/public/browser/content_browser_client.cc
|
|
+++ b/content/public/browser/content_browser_client.cc
|
|
@@ -885,6 +885,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 3ca58d5630486cd378f3109b1ca59a4563608187..9f8fe55d6c360e3a709f2e5f05baf02c9ca29101 100644
|
|
--- a/content/public/browser/content_browser_client.h
|
|
+++ b/content/public/browser/content_browser_client.h
|
|
@@ -203,6 +203,7 @@ class NetworkService;
|
|
class TrustedURLLoaderHeaderClient;
|
|
} // namespace mojom
|
|
struct ResourceRequest;
|
|
+class ResourceRequestBody;
|
|
} // namespace network
|
|
|
|
namespace sandbox {
|
|
@@ -1462,6 +1463,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 7544c393932b0dea1f14b722d559cc78f294f20b..badec4ea2cc0ecf1920839cf6cf731a6c81d6940 100644
|
|
--- a/content/public/browser/web_contents_delegate.cc
|
|
+++ b/content/public/browser/web_contents_delegate.cc
|
|
@@ -35,6 +35,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,
|
|
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
|
|
index 0e2ce90fd9c4a4c4aba0caacf026aa7a42c82f3a..d1f16f9c48bb2c60094f4644a9c41526a73a45a0 100644
|
|
--- a/content/public/browser/web_contents_delegate.h
|
|
+++ b/content/public/browser/web_contents_delegate.h
|
|
@@ -18,6 +18,7 @@
|
|
#include "base/types/expected.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/fullscreen_types.h"
|
|
#include "content/public/browser/invalidate_type.h"
|
|
@@ -29,6 +30,7 @@
|
|
#include "content/public/browser/select_audio_output_request.h"
|
|
#include "content/public/browser/serial_chooser.h"
|
|
#include "content/public/browser/storage_partition_config.h"
|
|
+#include "content/public/browser/web_contents.h"
|
|
#include "content/public/common/window_container_type.mojom-forward.h"
|
|
#include "third_party/blink/public/common/input/web_mouse_event.h"
|
|
#include "third_party/blink/public/common/page/drag_operation.h"
|
|
@@ -400,6 +402,16 @@ 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);
|
|
+
|
|
+ virtual void MaybeOverrideCreateParamsForNewWindow(
|
|
+ content::WebContents::CreateParams* create_params) {}
|
|
+
|
|
// 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_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
|
index 5924b040292f3542ae3dd5bc60561024423d02c3..e85e02e0f266836b23c5b2742414e6b15f581d1e 100644
|
|
--- a/content/renderer/render_frame_impl.cc
|
|
+++ b/content/renderer/render_frame_impl.cc
|
|
@@ -6726,6 +6726,10 @@ WebView* RenderFrameImpl::CreateNewWindow(
|
|
request.HasUserGesture(), GetWebFrame()->IsAdFrame(),
|
|
GetWebFrame()->IsAdScriptInStack());
|
|
|
|
+ params->raw_features = features.raw_features.Utf8(
|
|
+ blink::Utf8ConversionMode::kStrictReplacingErrors);
|
|
+ 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 576fd50ec4c27c6c2da9674e68f65fd0a21d1d68..b44304f128fb97523c9c9046b5edece8c09c5c0f 100644
|
|
--- a/content/web_test/browser/web_test_content_browser_client.cc
|
|
+++ b/content/web_test/browser/web_test_content_browser_client.cc
|
|
@@ -538,6 +538,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 790f004d2a3a9ae5a3588fda097732a5daac0c75..83fcc9418b89b669863e730f2049a1d836eef260 100644
|
|
--- a/content/web_test/browser/web_test_content_browser_client.h
|
|
+++ b/content/web_test/browser/web_test_content_browser_client.h
|
|
@@ -98,6 +98,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 d92bab531c12c62a5321a23f4a0cb89691668127..c354a79c7c8dd047264df35b873e90c15fa364a2 100644
|
|
--- a/third_party/blink/public/web/web_window_features.h
|
|
+++ b/third_party/blink/public/web/web_window_features.h
|
|
@@ -35,6 +35,7 @@
|
|
#include <vector>
|
|
|
|
#include "third_party/blink/public/platform/web_string.h"
|
|
+#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
|
|
|
|
namespace blink {
|
|
|
|
@@ -70,6 +71,8 @@ struct WebWindowFeatures {
|
|
// TODO(apaseltiner): Investigate moving this field to a non-public struct
|
|
// since it is only needed within //third_party/blink.
|
|
std::optional<std::vector<WebString>> attribution_srcs;
|
|
+
|
|
+ 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 8d074a93c5da744691143c93eb43bd036d9d8e64..825d538add57641e9d71bc744c5d292961df44ce 100644
|
|
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
|
|
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
|
@@ -2349,6 +2349,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
|
|
WebWindowFeatures window_features =
|
|
GetWindowFeaturesFromString(features, entered_window);
|
|
|
|
+ window_features.raw_features = features;
|
|
+
|
|
// In fenced frames, we should always use `noopener`.
|
|
if (GetFrame()->IsInFencedFrameTree()) {
|
|
window_features.noopener = true;
|