2022-11-10 21:31:20 +00:00
|
|
|
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
|
2023-01-11 10:33:48 +00:00
|
|
|
index 6e1a55adbd0b01383f3e54e924864dfeb6a57f0b..25b02f9904127780c68db9b451a7dfcf02a6fc5e 100644
|
2022-11-10 21:31:20 +00:00
|
|
|
--- a/src/node_builtins.cc
|
|
|
|
+++ b/src/node_builtins.cc
|
2023-01-11 10:33:48 +00:00
|
|
|
@@ -438,6 +438,22 @@ MaybeLocal<Function> BuiltinLoader::LookupAndCompile(
|
2022-11-10 21:31:20 +00:00
|
|
|
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
|
2023-01-11 10:33:48 +00:00
|
|
|
index 8228e57d27b2f883d87ec12274f2745628caa6e1..b07c34a6d247a050f4f307940c9e157fb14d6166 100644
|
2022-11-10 21:31:20 +00:00
|
|
|
--- a/src/node_builtins.h
|
|
|
|
+++ b/src/node_builtins.h
|
2023-01-11 10:33:48 +00:00
|
|
|
@@ -53,6 +53,11 @@ class NODE_EXTERN_PRIVATE BuiltinLoader {
|
2022-11-10 21:31:20 +00:00
|
|
|
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
|