de607cbcde
* chore: bump node in DEPS to v18.14.0 * src: add support for externally shared js builtins https://github.com/nodejs/node/pull/44376 * test: fix test broken under --node-builtin-modules-path https://github.com/nodejs/node/pull/45894 * build: add option to disable shared readonly heap https://github.com/nodejs/node/pull/45887 * src: remove unnecessary semicolons https://github.com/nodejs/node/pull/46171 * src: remove return after abort https://github.com/nodejs/node/pull/46172 * chore: fixup patch indices * test_runner: parse yaml https://github.com/nodejs/node/pull/45815 * src: use simdutf for converting externalized builtins to UTF-16 https://github.com/nodejs/node/pull/46119 * src: rename internal module declaration as internal bindings https://github.com/nodejs/node/pull/45551 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
54 lines
2 KiB
Diff
54 lines
2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Shelley Vohr <shelley.vohr@gmail.com>
|
|
Date: Thu, 13 Oct 2022 17:10:01 +0200
|
|
Subject: fix: expose LookupAndCompile with parameters
|
|
|
|
Node.js removed custom parameters from the public version of LookupAndCompile,
|
|
which we use in Electron. This patch re-exposes a wrapper to allow custom
|
|
parameters.
|
|
|
|
This should be upstreamed.
|
|
|
|
diff --git a/src/node_builtins.cc b/src/node_builtins.cc
|
|
index d3a0dd7cedb0d239ae427d1af2335e155345a454..de0c39234bb4155c56b4e51e42a399df3c4b8f87 100644
|
|
--- a/src/node_builtins.cc
|
|
+++ b/src/node_builtins.cc
|
|
@@ -439,6 +439,22 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompile(
|
|
return maybe;
|
|
}
|
|
|
|
+MaybeLocal<Function> BuiltinLoader::LookupAndCompile(
|
|
+ Local<Context> context,
|
|
+ const char* id,
|
|
+ std::vector<Local<String>>* parameters,
|
|
+ Environment* optional_env) {
|
|
+ Result result;
|
|
+ Isolate* isolate = context->GetIsolate();
|
|
+
|
|
+ MaybeLocal<Function> maybe = GetInstance()->LookupAndCompileInternal(
|
|
+ context, id, parameters, &result);
|
|
+ if (optional_env != nullptr) {
|
|
+ RecordResult(id, result, optional_env);
|
|
+ }
|
|
+ return maybe;
|
|
+}
|
|
+
|
|
bool BuiltinLoader::CompileAllBuiltins(Local<Context> context) {
|
|
BuiltinLoader* loader = GetInstance();
|
|
std::vector<std::string> ids = loader->GetBuiltinIds();
|
|
diff --git a/src/node_builtins.h b/src/node_builtins.h
|
|
index 8d9f7c409659a30747e5feeac6cfec4208791370..34a51c3e5a79154c3633143b352aa9e108497767 100644
|
|
--- a/src/node_builtins.h
|
|
+++ b/src/node_builtins.h
|
|
@@ -50,6 +50,11 @@ class NODE_EXTERN_PRIVATE BuiltinLoader {
|
|
v8::Local<v8::Context> context,
|
|
const char* id,
|
|
Environment* optional_env);
|
|
+ static v8::MaybeLocal<v8::Function> LookupAndCompile(
|
|
+ v8::Local<v8::Context> context,
|
|
+ const char* id,
|
|
+ std::vector<v8::Local<v8::String>>* parameters,
|
|
+ Environment* optional_env);
|
|
|
|
static v8::Local<v8::Object> GetSourceObject(v8::Local<v8::Context> context);
|
|
// Returns config.gypi as a JSON string
|