electron/patches/chromium/refactor_expose_hostimportmoduledynamically_and.patch
trop[bot] 261954137b
chore: bump chromium to 128.0.6571.0 (32-x-y) (#42767)
* chore: bump chromium in DEPS to 128.0.6571.0

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>

* 5636652: [4/n] Introduce RenderInputRouterClient and move InputRouterClient implementation to RenderInputRouter.

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

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* 5655811: Revert "Reland "Reland "Add toolchains without PartitionAlloc-Everywhere for dump_syms et al"""

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

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* 5581006: [tracing] Forward startup tracing config as shmem

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

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* chore: fixup patch indices

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* 5608450: [Views AX] Move Image Auto Captioning strings to ui/

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

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* 5648900: [Extensions] Move ExtensionAPIEnabledForServiceWorkerScript()

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

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* 5651681: Remove Web Speech API profanity masking

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

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* 5651361: `content::RenderFrame::GetBrowserInterfaceBroker`: return a const-ref.

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

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* 5604943: Start capture of toolbar after gesture end events are received

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

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* 5624392: [BRP] Enforce raw_ptr/ref in Renderer code

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

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* 5659259: Portals: Remove WebContentsView::TransferDragSecurityInfo

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

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* 5230721: Move ComposeStatus to components/compose

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

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* 5647894: [api] Cleanup usages of v8::ReturnValue<void>::Set[NonEmpty](..)

https://chromium-review.googlesource.com/c/v8/v8/+/5647894

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2024-07-03 15:58:15 -04:00

76 lines
3.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <marshallofsound@electronjs.org>
Date: Wed, 8 Mar 2023 13:04:21 -0800
Subject: refactor: expose HostImportModuleDynamically and
HostGetImportMetaProperties to embedders
This is so that Electron can blend Blink's and Node's implementations of these isolate handlers.
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
index 9d584cb0d0741ad8ce41f638aed90d2bfaf116ed..7bb28b4b7b1b47ff66caa67a6813aa78839cd403 100644
--- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
+++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
@@ -628,7 +628,9 @@ bool JavaScriptCompileHintsMagicEnabledCallback(
execution_context);
}
-v8::MaybeLocal<v8::Promise> HostImportModuleDynamically(
+}
+
+v8::MaybeLocal<v8::Promise> V8Initializer::HostImportModuleDynamically(
v8::Local<v8::Context> context,
v8::Local<v8::Data> v8_host_defined_options,
v8::Local<v8::Value> v8_referrer_resource_url,
@@ -706,7 +708,7 @@ v8::MaybeLocal<v8::Promise> HostImportModuleDynamically(
}
// https://html.spec.whatwg.org/C/#hostgetimportmetaproperties
-void HostGetImportMetaProperties(v8::Local<v8::Context> context,
+void V8Initializer::HostGetImportMetaProperties(v8::Local<v8::Context> context,
v8::Local<v8::Module> module,
v8::Local<v8::Object> meta) {
v8::Isolate* isolate = context->GetIsolate();
@@ -749,9 +751,6 @@ std::ostream& operator<<(std::ostream& os, const PrintV8OOM& oom_details) {
return os;
}
-} // namespace
-
-// static
void V8Initializer::InitializeV8Common(v8::Isolate* isolate) {
// Set up garbage collection before setting up anything else as V8 may trigger
// GCs during Blink setup.
@@ -773,9 +772,9 @@ void V8Initializer::InitializeV8Common(v8::Isolate* isolate) {
SharedArrayBufferConstructorEnabledCallback);
isolate->SetJavaScriptCompileHintsMagicEnabledCallback(
JavaScriptCompileHintsMagicEnabledCallback);
- isolate->SetHostImportModuleDynamicallyCallback(HostImportModuleDynamically);
+ isolate->SetHostImportModuleDynamicallyCallback(V8Initializer::HostImportModuleDynamically);
isolate->SetHostInitializeImportMetaObjectCallback(
- HostGetImportMetaProperties);
+ V8Initializer::HostGetImportMetaProperties);
isolate->SetMetricsRecorder(std::make_shared<V8MetricsRecorder>(isolate));
#if BUILDFLAG(IS_WIN)
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_initializer.h b/third_party/blink/renderer/bindings/core/v8/v8_initializer.h
index 2e0fd8cdef733677f8e1d32b3d8e0c635e0a5052..1df4517f9b5926c1dc5333aa6fc9cc1290256c70 100644
--- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.h
+++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.h
@@ -84,6 +84,17 @@ class CORE_EXPORT V8Initializer {
v8::Local<v8::Value> data);
static void PromiseRejectHandlerInMainThread(v8::PromiseRejectMessage data);
+ static v8::MaybeLocal<v8::Promise> HostImportModuleDynamically(
+ v8::Local<v8::Context> context,
+ v8::Local<v8::Data> v8_host_defined_options,
+ v8::Local<v8::Value> v8_referrer_resource_url,
+ v8::Local<v8::String> v8_specifier,
+ v8::Local<v8::FixedArray> v8_import_assertions);
+
+ static void HostGetImportMetaProperties(v8::Local<v8::Context> context,
+ v8::Local<v8::Module> module,
+ v8::Local<v8::Object> meta);
+
static void WasmAsyncResolvePromiseCallback(
v8::Isolate* isolate,
v8::Local<v8::Context> context,