electron/patches/chromium/add_didinstallconditionalfeatures.patch
electron-roller[bot] 4bcbc955dd
chore: bump chromium to 130.0.6695.0 (main) (#43454)
* chore: bump chromium in DEPS to 130.0.6673.0

* chore: bump chromium in DEPS to 130.0.6675.0

* chore: bump chromium in DEPS to 130.0.6677.2

* chore: bump chromium in DEPS to 130.0.6679.0

* 5802981: [Partitioned Popins] UKM

https://chromium-review.googlesource.com/c/chromium/src/+/5802981

* 5799275: ash: Create //chrome/browser/ui/ash/web_view

https://chromium-review.googlesource.com/c/chromium/src/+/5799275

* 5791853: [PWA] Allow WebContentsImpl::CreateNewWindow() to use new web contents for loading url

https://chromium-review.googlesource.com/c/chromium/src/+/5791853

* 5805208: Move third_party/jacoco to a cipd/ subdirectory.

https://chromium-review.googlesource.com/c/chromium/src/+/5805208

* chore: fixup patch indices

* 5771091: Introduce InputManager class for handling input in Viz.

https://chromium-review.googlesource.com/c/chromium/src/+/5771091

* 5498921: [Permission] Remove SubscribeToPermissionStatusChange from PermissionManager

https://chromium-review.googlesource.com/c/chromium/src/+/5498921

* 5791853: [PWA] Allow WebContentsImpl::CreateNewWindow() to use new web contents for loading url

https://chromium-review.googlesource.com/c/chromium/src/+/5791853

* 5801311: Don't use int for bindings

https://chromium-review.googlesource.com/c/chromium/src/+/5801311

* 5548827: [Web Install] Define the web-app-installation PermissionPolicy

https://chromium-review.googlesource.com/c/chromium/src/+/5548827

* 5786325: Add Infrastructure for Hand tracking permission

https://chromium-review.googlesource.com/c/chromium/src/+/5786325

* chore: fixup patch indices

* chore: bump chromium in DEPS to 130.0.6681.0

* [Views AX] Move BrowserAccessibility* to //ui/accessibility/platform

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5520052

* chore: e patches all

* Don't have default arguments on virtual functions in render_frame_host.h

https://chromium-review.googlesource.com/c/chromium/src/+/5809399

* test: log if loadURL fails in base url test

* chore: bump chromium in DEPS to 130.0.6683.2

* chore: fix support_mixed_sandbox_with_zygote.patch

content: restore old DisableJit behavior

https://chromium-review.googlesource.com/c/chromium/src/+/5804255

* chore: update patch indices

* chore: bump chromium in DEPS to 130.0.6685.0

* Parallel process launching

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/5015584

* chore: update feat_expose_documentloader_setdefersloading_on_webdocumentloader.patch

No manual changes; patch applied with fuzz 1

* chore: e patches all

* chore: bump chromium in DEPS to 130.0.6687.0

* chore: bump chromium in DEPS to 130.0.6689.0

* chore: bump chromium in DEPS to 130.0.6691.0

* chore: bump chromium in DEPS to 130.0.6693.0

* chore: update patches

* chore: bump chromium in DEPS to 130.0.6695.0

* chore: free up macos disk space as soon as possible

* 5824143: Use checked in source lists for third_party/boringssl

https://chromium-review.googlesource.com/c/chromium/src/+/5824143

* chore: update patches

* 5824122: Extensions: Add a new view type enum for developer tools contexts

https://chromium-review.googlesource.com/c/chromium/src/+/5824122

* 5806109: Option for JavaScriptExecuteRequestForTests() to ignore content settings

https://chromium-review.googlesource.com/c/chromium/src/+/5806109

* build: free up disk space on gn check too

* 5799369: [Refactoring] Make allow_http1_for_streaming_upload flags false.

https://chromium-review.googlesource.com/c/chromium/src/+/5799369

* fixup! 5015584: Parallel process launching | https://chromium-review.googlesource.com/c/chromium/src/+/5015584

* Disable failing test for short-term

See: https://github.com/electron/electron/issues/43730

* oops

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: clavin <clavin@electronjs.org>
2024-09-17 18:12:11 -07:00

137 lines
7.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jeremy Apthorp <nornagon@nornagon.net>
Date: Wed, 15 Jan 2020 16:35:18 -0800
Subject: add DidInstallConditionalFeatures
This adds a hook on script context creation _after conditional features
have been installed_. Electron uses this to run preload scripts and
various other initialization. This is necessary because at the time
DidCreateScriptContext is called, not all JS APIs are available in the
context, which can cause some preload scripts to trip.
diff --git a/content/public/renderer/render_frame_observer.h b/content/public/renderer/render_frame_observer.h
index ad0092ef2e13853e4bb8b923481559a043b00ab7..1c2dfd23f18733e21312992877ae1499634d3849 100644
--- a/content/public/renderer/render_frame_observer.h
+++ b/content/public/renderer/render_frame_observer.h
@@ -150,6 +150,8 @@ class CONTENT_EXPORT RenderFrameObserver
virtual void DidHandleOnloadEvents() {}
virtual void DidCreateScriptContext(v8::Local<v8::Context> context,
int32_t world_id) {}
+ virtual void DidInstallConditionalFeatures(v8::Local<v8::Context> context,
+ int32_t world_id) {}
virtual void WillReleaseScriptContext(v8::Local<v8::Context> context,
int32_t world_id) {}
virtual void DidClearWindowObject() {}
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 1fd800fe2d56c510aed0d532dc3d370538da348f..85257faa0446475f21eb762d53038ce33528d569 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -4773,6 +4773,12 @@ void RenderFrameImpl::DidCreateScriptContext(v8::Local<v8::Context> context,
observer.DidCreateScriptContext(context, world_id);
}
+void RenderFrameImpl::DidInstallConditionalFeatures(
+ v8::Local<v8::Context> context, int world_id) {
+ for (auto& observer : observers_)
+ observer.DidInstallConditionalFeatures(context, world_id);
+}
+
void RenderFrameImpl::WillReleaseScriptContext(v8::Local<v8::Context> context,
int world_id) {
for (auto& observer : observers_)
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index 12a8d900d76119fa3a3372d55cb545d581659b51..5d3cfd296e9296941cf756f58e227558f5b4fdce 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -648,6 +648,8 @@ class CONTENT_EXPORT RenderFrameImpl
void DidObserveLayoutShift(double score, bool after_input_or_scroll) override;
void DidCreateScriptContext(v8::Local<v8::Context> context,
int world_id) override;
+ void DidInstallConditionalFeatures(v8::Local<v8::Context> context,
+ int world_id) override;
void WillReleaseScriptContext(v8::Local<v8::Context> context,
int world_id) override;
void DidChangeScrollOffset() override;
diff --git a/third_party/blink/public/web/web_local_frame_client.h b/third_party/blink/public/web/web_local_frame_client.h
index 5031b829fa08c8cae8c8b9890b0fa0b3bfb4f9f4..5f3d93352f5c8388fcfe495fb66c5cbd05024852 100644
--- a/third_party/blink/public/web/web_local_frame_client.h
+++ b/third_party/blink/public/web/web_local_frame_client.h
@@ -661,6 +661,9 @@ class BLINK_EXPORT WebLocalFrameClient {
virtual void DidCreateScriptContext(v8::Local<v8::Context>,
int32_t world_id) {}
+ virtual void DidInstallConditionalFeatures(v8::Local<v8::Context>,
+ int32_t world_id) {}
+
// WebKit is about to release its reference to a v8 context for a frame.
virtual void WillReleaseScriptContext(v8::Local<v8::Context>,
int32_t world_id) {}
diff --git a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
index f7e0144c74f879e9b29871d7c372b99e127966bb..c3cd7b77ed282f212a56d151dc3fbec36d183701 100644
--- a/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
+++ b/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
@@ -217,6 +217,7 @@ void LocalWindowProxy::Initialize() {
}
InstallConditionalFeatures();
+ GetFrame()->Client()->DidInstallConditionalFeatures(context, world_->GetWorldId());
if (World().IsMainWorld()) {
probe::DidCreateMainWorldContext(GetFrame());
diff --git a/third_party/blink/renderer/core/frame/local_frame_client.h b/third_party/blink/renderer/core/frame/local_frame_client.h
index 2cffa645b83caf8ce2e0beffd085abbc980a7db3..34c8c20723cdf1d27296cd8ef608c493ffbaba8a 100644
--- a/third_party/blink/renderer/core/frame/local_frame_client.h
+++ b/third_party/blink/renderer/core/frame/local_frame_client.h
@@ -301,6 +301,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient {
virtual void DidCreateScriptContext(v8::Local<v8::Context>,
int32_t world_id) = 0;
+ virtual void DidInstallConditionalFeatures(v8::Local<v8::Context>,
+ int32_t world_id) = 0;
virtual void WillReleaseScriptContext(v8::Local<v8::Context>,
int32_t world_id) = 0;
virtual bool AllowScriptExtensions() = 0;
diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
index bff19ab30f8e399d16069c05364d4180ec464864..8f557753ea2fe370f7964e3f41019ebf5d6d6df6 100644
--- a/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
+++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.cc
@@ -294,6 +294,13 @@ void LocalFrameClientImpl::DidCreateScriptContext(
web_frame_->Client()->DidCreateScriptContext(context, world_id);
}
+void LocalFrameClientImpl::DidInstallConditionalFeatures(
+ v8::Local<v8::Context> context,
+ int32_t world_id) {
+ if (web_frame_->Client())
+ web_frame_->Client()->DidInstallConditionalFeatures(context, world_id);
+}
+
void LocalFrameClientImpl::WillReleaseScriptContext(
v8::Local<v8::Context> context,
int32_t world_id) {
diff --git a/third_party/blink/renderer/core/frame/local_frame_client_impl.h b/third_party/blink/renderer/core/frame/local_frame_client_impl.h
index b9f3c7cb372bd0ba2b8131594e175c3bcda28771..9d1cd076a97474a451504a866c7a02bd16a70d1c 100644
--- a/third_party/blink/renderer/core/frame/local_frame_client_impl.h
+++ b/third_party/blink/renderer/core/frame/local_frame_client_impl.h
@@ -83,6 +83,8 @@ class CORE_EXPORT LocalFrameClientImpl final : public LocalFrameClient {
void DidCreateScriptContext(v8::Local<v8::Context>,
int32_t world_id) override;
+ void DidInstallConditionalFeatures(v8::Local<v8::Context>,
+ int32_t world_id) override;
void WillReleaseScriptContext(v8::Local<v8::Context>,
int32_t world_id) override;
diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h
index 821447d9510b7bffce71bb9cb797c95e526fe890..b1f4f8abdd2b4d1a669274f55588d6d936f0c691 100644
--- a/third_party/blink/renderer/core/loader/empty_clients.h
+++ b/third_party/blink/renderer/core/loader/empty_clients.h
@@ -416,6 +416,8 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient {
void DidCreateScriptContext(v8::Local<v8::Context>,
int32_t world_id) override {}
+ void DidInstallConditionalFeatures(v8::Local<v8::Context>,
+ int32_t world_id) override {}
void WillReleaseScriptContext(v8::Local<v8::Context>,
int32_t world_id) override {}
bool AllowScriptExtensions() override { return false; }