28eda03aba
* chore: bump chromium in DEPS to 119.0.6018.4 * chore: update patches * chore: bump chromium in DEPS to 119.0.6019.2 * chore: update patches * 4876292: Roll libc++ from 7cee6b00d34a to 3e8a3b3c5d49 (6 revisions) https://chromium-review.googlesource.com/c/chromium/src/+/4876292 * 4851616: [Extensions] Enable matchOriginAsFallback for dynamic content scripts https://chromium-review.googlesource.com/c/chromium/src/+/4851616 * 4869393: [Extensions UserScripts] Add error messages for script matching errors https://chromium-review.googlesource.com/c/chromium/src/+/4869393 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
75 lines
3.6 KiB
Diff
75 lines
3.6 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 965e9562f0e891ab043cd7dfab0f53d1bb08192d..d9a8af76ff98547e5c048e1020270f7b9077c5b6 100644
|
|
--- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
|
|
+++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
|
|
@@ -589,7 +589,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,
|
|
@@ -665,7 +667,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) {
|
|
ScriptState* script_state = ScriptState::From(context);
|
|
@@ -692,6 +694,8 @@ void HostGetImportMetaProperties(v8::Local<v8::Context> context,
|
|
meta->CreateDataProperty(context, resolve_key, resolve_value).ToChecked();
|
|
}
|
|
|
|
+namespace {
|
|
+
|
|
void InitializeV8Common(v8::Isolate* isolate) {
|
|
// Set up garbage collection before setting up anything else as V8 may trigger
|
|
// GCs during Blink setup.
|
|
@@ -711,9 +715,9 @@ void 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 9e628b96a845322d407f9da30a63c04ef5de9c24..8f5e4602f5e3f6787a9e54d510b39519074d51e6 100644
|
|
--- a/third_party/blink/renderer/bindings/core/v8/v8_initializer.h
|
|
+++ b/third_party/blink/renderer/bindings/core/v8/v8_initializer.h
|
|
@@ -76,6 +76,17 @@ class CORE_EXPORT V8Initializer {
|
|
v8::Local<v8::Context> context,
|
|
v8::Local<v8::String> source);
|
|
|
|
+ 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,
|