5261e08d0c
* chore: bump chromium in DEPS to 113.0.5657.0 * chore: bump chromium in DEPS to 113.0.5660.0 * chore: update patches printing.patch https://chromium-review.googlesource.com/c/chromium/src/+/4347664 https://chromium-review.googlesource.com/c/chromium/src/+/4347664 https://chromium-review.googlesource.com/c/chromium/src/+/4338810 https://chromium-review.googlesource.com/c/chromium/src/+/4339496 mas_disable_remote_layer.patch https://chromium-review.googlesource.com/c/chromium/src/+/4334544 https://chromium-review.googlesource.com/c/chromium/src/+/4335299 * Add API to verify `TOP_LEVEL_STORAGE_ACCESS` permission status https://chromium-review.googlesource.com/c/chromium/src/+/4306712 * Move os_crypt into a sync/ subdirectory. https://chromium-review.googlesource.com/c/chromium/src/+/4336304 * chore: generate libc++ headers --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com>
137 lines
7.9 KiB
Diff
137 lines
7.9 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 6c92a2856e447bdda11c7ed2c64b79b93a0eca26..03dedde2d83e6b09fb7e90be7dfdce246f301d8f 100644
|
|
--- a/content/public/renderer/render_frame_observer.h
|
|
+++ b/content/public/renderer/render_frame_observer.h
|
|
@@ -136,6 +136,8 @@ class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener,
|
|
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 266b52ee18cf3f9cf25cb394780f098c292b9449..23c814d1cecd62121c78702cb0986de3de46df68 100644
|
|
--- a/content/renderer/render_frame_impl.cc
|
|
+++ b/content/renderer/render_frame_impl.cc
|
|
@@ -4382,6 +4382,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 f3b4f9be415f2ced0adb7aca57b26ea339d0ff3d..5d810d33db7c1d0a3e22da8f5588d0f748534fac 100644
|
|
--- a/content/renderer/render_frame_impl.h
|
|
+++ b/content/renderer/render_frame_impl.h
|
|
@@ -606,6 +606,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 082e8ec96fb8f2fea660ea12fd349a248b7422a2..77a7aee67a69fb7728525af3baa45410d866b266 100644
|
|
--- a/third_party/blink/public/web/web_local_frame_client.h
|
|
+++ b/third_party/blink/public/web/web_local_frame_client.h
|
|
@@ -603,6 +603,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 e7d4256fa96f5bc8ad71bd13b6b33feef32b443f..0dfeda68a4dbfd6b442f8d8f928c8cb871dd6aa4 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
|
|
@@ -198,6 +198,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 2e876bbd8687fd99bdfcc4b7f22d23f4a4c9a0ef..1a3e7c682350670baf6e31bd7ef158e56bc25870 100644
|
|
--- a/third_party/blink/renderer/core/frame/local_frame_client.h
|
|
+++ b/third_party/blink/renderer/core/frame/local_frame_client.h
|
|
@@ -318,6 +318,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 2508c036483f018572981b5f18080e71e0028363..02ef80ea9cf52c3c99e1008c38ed4151a041e2f5 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
|
|
@@ -283,6 +283,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 fc562006952b92d4aabf67f2db172797ca193035..ca2b370309ca8fcc0afbca77514430e9f95d9104 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
|
|
@@ -82,6 +82,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 4f34252f45353f2be2222e5878d888ec47e17123..4a670dcf917a1e4448063ef4c241006b66f18891 100644
|
|
--- a/third_party/blink/renderer/core/loader/empty_clients.h
|
|
+++ b/third_party/blink/renderer/core/loader/empty_clients.h
|
|
@@ -402,6 +402,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; }
|