chore: bump node to v20.14.0 (31-x-y) (#42295)

* chore: bump node in DEPS to v20.13.1

* chore: bump node in DEPS to v20.14.0

* crypto: enable NODE_EXTRA_CA_CERTS with BoringSSL

https://github.com/nodejs/node/pull/52217

* test: skip test for dynamically linked OpenSSL

https://github.com/nodejs/node/pull/52542

* lib, url: add a `windows` option to path parsing

https://github.com/nodejs/node/pull/52509

* src: use dedicated routine to compile function for builtin CJS loader

https://github.com/nodejs/node/pull/52016

* test: mark test as flaky

https://github.com/nodejs/node/pull/52671

* build,tools: add test-ubsan ci

https://github.com/nodejs/node/pull/46297

* src: preload function for Environment

https://github.com/nodejs/node/pull/51539

* chore: fixup patch indices

* deps: update c-ares to 1.28.1

https://github.com/nodejs/node/pull/52285

* chore: handle updated filenames

* events: extract addAbortListener for safe internal use

https://github.com/nodejs/node/pull/52081

* module: print location of unsettled top-level await in entry points

https://github.com/nodejs/node/pull/51999

* fs: add stacktrace to fs/promises

https://github.com/nodejs/node/pull/49849

* chore: fixup patch indices

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
electron-roller[bot] 2024-05-31 23:37:42 +02:00 коммит произвёл GitHub
Родитель bd4d0ae2d3
Коммит 9a879385c1
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
37 изменённых файлов: 140 добавлений и 448 удалений

2
DEPS
Просмотреть файл

@ -4,7 +4,7 @@ vars = {
'chromium_version':
'126.0.6445.0',
'node_version':
'v20.12.2',
'v20.14.0',
'nan_version':
'e14bdcd1f72d62bca1d541b66da43130384ec213',
'squirrel.mac_version':

Просмотреть файл

@ -200,11 +200,11 @@ delete process.appCodeLoaded;
if (packagePath) {
// Finally load app's main.js and transfer control to C++.
if ((packageJson.type === 'module' && !mainStartupScript.endsWith('.cjs')) || mainStartupScript.endsWith('.mjs')) {
const { loadESM } = __non_webpack_require__('internal/process/esm_loader');
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main');
const main = (require('url') as typeof url).pathToFileURL(path.join(packagePath, mainStartupScript));
loadESM(async (esmLoader: any) => {
runEntryPointWithESMLoader(async (cascadedLoader: any) => {
try {
await esmLoader.import(main.toString(), undefined, Object.create(null));
await cascadedLoader.import(main.toString(), undefined, Object.create(null));
appCodeLoaded!();
} catch (err) {
appCodeLoaded!();

Просмотреть файл

@ -494,7 +494,7 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
};
const { access } = fs;
fs.access = function (pathArgument: string, mode: any, callback: any) {
fs.access = function (pathArgument: string, mode: number, callback: any) {
const pathInfo = splitPath(pathArgument);
if (!pathInfo.isAsar) return access.apply(this, arguments);
const { asarPath, filePath } = pathInfo;
@ -539,7 +539,16 @@ export const wrapFsWithAsar = (fs: Record<string, any>) => {
nextTick(callback);
};
fs.promises.access = util.promisify(fs.access);
const { access: accessPromise } = fs.promises;
fs.promises.access = function (pathArgument: string, mode: number) {
const pathInfo = splitPath(pathArgument);
if (!pathInfo.isAsar) {
return accessPromise.apply(this, arguments);
}
const p = util.promisify(fs.access);
return p(pathArgument, mode);
};
const { accessSync } = fs;
fs.accessSync = function (pathArgument: string, mode: any) {

Просмотреть файл

@ -150,12 +150,12 @@ if (cjsPreloads.length) {
}
}
if (esmPreloads.length) {
const { loadESM } = __non_webpack_require__('internal/process/esm_loader');
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main');
loadESM(async (esmLoader: any) => {
runEntryPointWithESMLoader(async (cascadedLoader: any) => {
// Load the preload scripts.
for (const preloadScript of esmPreloads) {
await esmLoader.import(pathToFileURL(preloadScript).toString(), undefined, Object.create(null)).catch((err: Error) => {
await cascadedLoader.import(pathToFileURL(preloadScript).toString(), undefined, Object.create(null)).catch((err: Error) => {
console.error(`Unable to load preload script: ${preloadScript}`);
console.error(err);

Просмотреть файл

@ -36,11 +36,12 @@ parentPort.on('removeListener', (name: string) => {
});
// Finally load entry script.
const { loadESM } = __non_webpack_require__('internal/process/esm_loader');
const { runEntryPointWithESMLoader } = __non_webpack_require__('internal/modules/run_main');
const mainEntry = pathToFileURL(entryScript);
loadESM(async (esmLoader: any) => {
runEntryPointWithESMLoader(async (cascadedLoader: any) => {
try {
await esmLoader.import(mainEntry.toString(), undefined, Object.create(null));
await cascadedLoader.import(mainEntry.toString(), undefined, Object.create(null));
} catch (err) {
// @ts-ignore internalBinding is a secret internal global that we shouldn't
// really be using, so we ignore the type error instead of declaring it in types

Просмотреть файл

@ -42,7 +42,6 @@ test_make_test-node-output-v8-warning_generic.patch
test_match_wpt_streams_transferable_transform-stream-members_any_js.patch
build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch
fix_revert_src_lb_reducing_c_calls_of_esm_legacy_main_resolve.patch
src_preload_function_for_environment.patch
deprecate_vector_v8_local_in_v8.patch
fix_remove_deprecated_errno_constants.patch
build_enable_perfetto.patch

Просмотреть файл

@ -537,10 +537,10 @@ index 0e69d7383762f6b81c5b57698aa9d121d5a9c401..35bbeb37acc7ccb14b4b8a644ec3d4c7
cflags_c = [
"-mavx512vl",
diff --git a/deps/cares/BUILD.gn b/deps/cares/BUILD.gn
index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..1717143998ae15e65e9af12650b796226508a137 100644
index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..3f253daee0f9b1faa50857f61d76de001bd8947e 100644
--- a/deps/cares/BUILD.gn
+++ b/deps/cares/BUILD.gn
@@ -1,14 +1,165 @@
@@ -1,14 +1,163 @@
-##############################################################################
-# #
-# DO NOT EDIT THIS FILE! #
@ -587,7 +587,6 @@ index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..1717143998ae15e65e9af12650b79622
+ "src/lib/ares__llist.c",
+ "src/lib/ares__llist.h",
+ "src/lib/ares__parse_into_addrinfo.c",
+ "src/lib/ares__read_line.c",
+ "src/lib/ares__slist.c",
+ "src/lib/ares__slist.h",
+ "src/lib/ares__socket.c",
@ -635,7 +634,6 @@ index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..1717143998ae15e65e9af12650b79622
+ "src/lib/ares_library_init.c",
+ "src/lib/ares_ipv6.h",
+ "src/lib/ares_math.c",
+ "src/lib/ares_mkquery.c",
+ "src/lib/ares_options.c",
+ "src/lib/ares_parse_a_reply.c",
+ "src/lib/ares_parse_aaaa_reply.c",
@ -1258,7 +1256,7 @@ index 0000000000000000000000000000000000000000..af9cbada10203b387fb9732b346583b1
+}
diff --git a/filenames.json b/filenames.json
new file mode 100644
index 0000000000000000000000000000000000000000..424b6f4f9d89c43a2c0404d1a5cb03828f29d906
index 0000000000000000000000000000000000000000..1a9cba024f1762b0dfe31da92213b51e112101ec
--- /dev/null
+++ b/filenames.json
@@ -0,0 +1,739 @@
@ -1532,6 +1530,7 @@ index 0000000000000000000000000000000000000000..424b6f4f9d89c43a2c0404d1a5cb0382
+ "lib/internal/error_serdes.js",
+ "lib/internal/errors.js",
+ "lib/internal/event_target.js",
+ "lib/internal/events/abort_listener.js",
+ "lib/internal/events/symbols.js",
+ "lib/internal/file.js",
+ "lib/internal/fixed_queue.js",
@ -1568,7 +1567,6 @@ index 0000000000000000000000000000000000000000..424b6f4f9d89c43a2c0404d1a5cb0382
+ "lib/internal/modules/esm/fetch_module.js",
+ "lib/internal/modules/esm/formats.js",
+ "lib/internal/modules/esm/get_format.js",
+ "lib/internal/modules/esm/handle_process_exit.js",
+ "lib/internal/modules/esm/hooks.js",
+ "lib/internal/modules/esm/initialize_import_meta.js",
+ "lib/internal/modules/esm/load.js",
@ -1603,7 +1601,6 @@ index 0000000000000000000000000000000000000000..424b6f4f9d89c43a2c0404d1a5cb0382
+ "lib/internal/policy/manifest.js",
+ "lib/internal/policy/sri.js",
+ "lib/internal/priority_queue.js",
+ "lib/internal/process/esm_loader.js",
+ "lib/internal/process/execution.js",
+ "lib/internal/process/per_thread.js",
+ "lib/internal/process/permission.js",
@ -1781,6 +1778,7 @@ index 0000000000000000000000000000000000000000..424b6f4f9d89c43a2c0404d1a5cb0382
+ "src/handle_wrap.cc",
+ "src/heap_utils.cc",
+ "src/histogram.cc",
+ "src/internal_only_v8.cc",
+ "src/js_native_api.h",
+ "src/js_native_api_types.h",
+ "src/js_native_api_v8.cc",
@ -2365,7 +2363,7 @@ index 0000000000000000000000000000000000000000..9be3ac447f9a4dde23fefc26e0b922b4
+ transformed_f.write(transformed_contents)
+
diff --git a/tools/install.py b/tools/install.py
index 17b0947aaca4cd63ce6b57ffc4835eae7f74e76e..c6fa8a931f6a1357592a8447b1abbfe0c894aefd 100755
index b132c7bf26c02886a7ab341a1973bf449744ba0f..171b383a4b6c2528d11dd5f89a6837fd071bcf4b 100755
--- a/tools/install.py
+++ b/tools/install.py
@@ -284,6 +284,7 @@ def headers(options, action):
@ -2388,7 +2386,7 @@ index 17b0947aaca4cd63ce6b57ffc4835eae7f74e76e..c6fa8a931f6a1357592a8447b1abbfe0
diff --git a/tools/js2c.cc b/tools/js2c.cc
old mode 100644
new mode 100755
index 0fa9c5954d24a555a1e7c50fdb4b43c17cb1452d..9a77af51630aec5437a09aae1d7296e2e1238809
index e0f3d8844718ab8a6478c40ff713c1fd6bcff95a..c73a5b666dbaf555c749d836c20a7ae19a840847
--- a/tools/js2c.cc
+++ b/tools/js2c.cc
@@ -30,6 +30,7 @@ namespace js2c {

Просмотреть файл

@ -7,10 +7,10 @@ Subject: build: ensure native module compilation fails if not using a new
This should not be upstreamed, it is a quality-of-life patch for downstream module builders.
diff --git a/common.gypi b/common.gypi
index 292cd621dd6d2a6bfcbf959c5910563446492fd9..722b4c3d376ce6eaa683397b693f9bad8f2aa584 100644
index 9a27610992612b59eadcc8e481683cf1e6a5dbb6..1fad20645d059ad5f3efaa9279f582f99cb1006b 100644
--- a/common.gypi
+++ b/common.gypi
@@ -86,6 +86,8 @@
@@ -87,6 +87,8 @@
'v8_use_perfetto': 0,
'tsan%': 0,
@ -19,7 +19,7 @@ index 292cd621dd6d2a6bfcbf959c5910563446492fd9..722b4c3d376ce6eaa683397b693f9bad
##### end V8 defaults #####
# When building native modules using 'npm install' with the system npm,
@@ -285,6 +287,7 @@
@@ -286,6 +288,7 @@
# Defines these mostly for node-gyp to pickup.
'defines': [
'_GLIBCXX_USE_CXX11_ABI=1',
@ -27,7 +27,7 @@ index 292cd621dd6d2a6bfcbf959c5910563446492fd9..722b4c3d376ce6eaa683397b693f9bad
],
# Forcibly disable -Werror. We support a wide range of compilers, it's
@@ -391,6 +394,11 @@
@@ -415,6 +418,11 @@
}],
],
}],
@ -40,10 +40,10 @@ index 292cd621dd6d2a6bfcbf959c5910563446492fd9..722b4c3d376ce6eaa683397b693f9bad
# list in v8/BUILD.gn.
['v8_enable_v8_checks == 1', {
diff --git a/configure.py b/configure.py
index 00c8513d6820ec862bffb06063e9b1ae27d6043d..8169c674d672b7206b3765bcbf68cde04ba2d915 100755
index 11c0df455451d4ab4bea066a8361246cbf10bf1d..c30052f02f97df78e0d9294784cb3efb3fd2d1a7 100755
--- a/configure.py
+++ b/configure.py
@@ -1496,6 +1496,7 @@ def configure_library(lib, output, pkgname=None):
@@ -1501,6 +1501,7 @@ def configure_library(lib, output, pkgname=None):
def configure_v8(o):
@ -52,7 +52,7 @@ index 00c8513d6820ec862bffb06063e9b1ae27d6043d..8169c674d672b7206b3765bcbf68cde0
o['variables']['v8_enable_javascript_promise_hooks'] = 1
o['variables']['v8_enable_lite_mode'] = 1 if options.v8_lite_mode else 0
diff --git a/src/node.h b/src/node.h
index 13e29b98d0c91badee41b53c37b4763f73e02e87..16c3ad349e942b83764c7772178baa5057cd64f3 100644
index c267ed1eeaa2d8b6ecd5a1563a4e9440bf0cca00..e55256996f2c85b0ae3854cbd1b83ca88a3e22cb 100644
--- a/src/node.h
+++ b/src/node.h
@@ -22,6 +22,12 @@

Просмотреть файл

@ -10,10 +10,10 @@ in.
This should be upstreamed.
diff --git a/common.gypi b/common.gypi
index 722b4c3d376ce6eaa683397b693f9bad8f2aa584..b003ddf5763a0f5c3289a7ff39d71f3d828b73db 100644
index 1fad20645d059ad5f3efaa9279f582f99cb1006b..4fbb33550e8a044b92997a42eb6603f151ba1043 100644
--- a/common.gypi
+++ b/common.gypi
@@ -133,6 +133,7 @@
@@ -134,6 +134,7 @@
['target_arch in "arm ia32 mips mipsel ppc"', {
'v8_enable_pointer_compression': 0,
'v8_enable_31bit_smis_on_64bit_arch': 0,
@ -22,10 +22,10 @@ index 722b4c3d376ce6eaa683397b693f9bad8f2aa584..b003ddf5763a0f5c3289a7ff39d71f3d
['target_arch in "ppc64 s390x"', {
'v8_enable_backtrace': 1,
diff --git a/configure.py b/configure.py
index 8169c674d672b7206b3765bcbf68cde04ba2d915..ac5990cf48703ae2e10ad86915aacdad25206f0e 100755
index c30052f02f97df78e0d9294784cb3efb3fd2d1a7..5fb89e56fde52d01b3806ec4e8549cbeb5ffca66 100755
--- a/configure.py
+++ b/configure.py
@@ -1510,6 +1510,7 @@ def configure_v8(o):
@@ -1515,6 +1515,7 @@ def configure_v8(o):
o['variables']['v8_use_siphash'] = 0 if options.without_siphash else 1
o['variables']['v8_enable_maglev'] = 1 if options.v8_enable_maglev else 0
o['variables']['v8_enable_pointer_compression'] = 1 if options.enable_pointer_compression else 0

Просмотреть файл

@ -33,7 +33,7 @@ index 2ce1e8a7dcca2ba153d387d11970c72b5f43c167..590303d1b78e2c28d7c3338196b12fcf
node_platform = "win32"
} else if (target_os == "mac") {
diff --git a/src/env.cc b/src/env.cc
index 9f83720fefc77342dd45cdf1eebfac613262ad63..309b39fb2b1116824c0c1c2ae86d8e1113e31c3d 100644
index 5c75e5b99d9415163640ab90f5891c0fee067a88..5f8bb37d117d82123b81f5f4b32735150184fa74 100644
--- a/src/env.cc
+++ b/src/env.cc
@@ -557,7 +557,8 @@ IsolateData::IsolateData(Isolate* isolate,

Просмотреть файл

@ -8,7 +8,7 @@ modules from being used in the renderer process. This should be upstreamed as
a customizable error message.
diff --git a/src/node_binding.cc b/src/node_binding.cc
index 8cdee730101fbdc79415654aa6fe401573979c0e..34d5e146ffef255019dd33d8c23b0847d91ddee9 100644
index 4e750be66452de47040e3a46555c062dfccf7807..5e1caeee18e447cc76b980df712521cf8b60e8da 100644
--- a/src/node_binding.cc
+++ b/src/node_binding.cc
@@ -4,6 +4,7 @@
@ -19,7 +19,7 @@ index 8cdee730101fbdc79415654aa6fe401573979c0e..34d5e146ffef255019dd33d8c23b0847
#include "util.h"
#include <string>
@@ -480,7 +481,12 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
@@ -483,7 +484,12 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
if (mp->nm_context_register_func == nullptr) {
if (env->force_context_aware()) {
dlib->Close();

Просмотреть файл

@ -8,10 +8,10 @@ they use themselves as the entry point. We should try to upstream some form
of this.
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
index 46140285cf6b73c154a067c5f0f0931add5e9275..fb4e675c9dca33b99dbbf347adf6a6938ff91a7a 100644
index 155485dbab0d46bb225fa40e99f555d805659c4f..8183cffe9d7060571c08f696abb7c090e6df3be8 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -1342,6 +1342,13 @@ Module.prototype._compile = function(content, filename) {
@@ -1331,6 +1331,13 @@ Module.prototype._compile = function(content, filename) {
if (getOptionValue('--inspect-brk') && process._eval == null) {
if (!resolvedArgv) {
// We enter the repl if we're not given a filename argument.
@ -26,10 +26,10 @@ index 46140285cf6b73c154a067c5f0f0931add5e9275..fb4e675c9dca33b99dbbf347adf6a693
try {
resolvedArgv = Module._resolveFilename(process.argv[1], null, false);
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
index 9d80d2a55c72d2035480ddfb5d54c14ef52844ea..2fc9e2da8aa920acffc101b2c341a5d9b16fe90a 100644
index 16e291484bfe85d5614557f070ab0d2ae59655d4..b4272f01e84d7fec263dcad444d92459743780a8 100644
--- a/lib/internal/process/pre_execution.js
+++ b/lib/internal/process/pre_execution.js
@@ -241,12 +241,14 @@ function patchProcessObject(expandArgv1) {
@@ -244,12 +244,14 @@ function patchProcessObject(expandArgv1) {
if (expandArgv1 && process.argv[1] &&
!StringPrototypeStartsWith(process.argv[1], '-')) {
// Expand process.argv[1] into a full path.

Просмотреть файл

@ -11,7 +11,7 @@ its own blended handler between Node and Blink.
Not upstreamable.
diff --git a/lib/internal/modules/esm/utils.js b/lib/internal/modules/esm/utils.js
index 39e87338dc5a799a8a30bd2399b8ec5d6b554fad..7b1939fa25379b333f2be07f4ff483f53d8a2ac6 100644
index d7867864bba7141b7ba12b171d185a94ed25d01d..d93a248d8a96fe1dffa08b39cfe3ea7b368db54a 100644
--- a/lib/internal/modules/esm/utils.js
+++ b/lib/internal/modules/esm/utils.js
@@ -24,7 +24,7 @@ const {
@ -23,7 +23,7 @@ index 39e87338dc5a799a8a30bd2399b8ec5d6b554fad..7b1939fa25379b333f2be07f4ff483f5
const {
loadPreloadModules,
initializeFrozenIntrinsics,
@@ -239,12 +239,13 @@ let _forceDefaultLoader = false;
@@ -236,12 +236,13 @@ let _forceDefaultLoader = false;
* @param {boolean} [forceDefaultLoader=false] - A boolean indicating disabling custom loaders.
*/
function initializeESM(forceDefaultLoader = false) {

Просмотреть файл

@ -9,10 +9,10 @@ This patch can be removed when Node.js upgrades to a version of V8 containing
the above CL.
diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml
index 834e2a1d814d7a215284554b95e38100f54f6471..dbd563061b01bc8796f95e004e07dd0097b8499b 100644
index 0cf84a0da5ee9e63d7b01d0a27946fc29090e516..ee16099ddc9abe5c19b319c111d1319c33b17be4 100644
--- a/lib/.eslintrc.yaml
+++ b/lib/.eslintrc.yaml
@@ -33,10 +33,6 @@ rules:
@@ -30,10 +30,6 @@ rules:
message: Use `const { AbortController } = require('internal/abort_controller');` instead of the global.
- name: AbortSignal
message: Use `const { AbortSignal } = require('internal/abort_controller');` instead of the global.
@ -24,7 +24,7 @@ index 834e2a1d814d7a215284554b95e38100f54f6471..dbd563061b01bc8796f95e004e07dd00
message: Use `const { Blob } = require('buffer');` instead of the global.
- name: BroadcastChannel
diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js
index 56697c3b2c2209ff58b8fefbccec03c7e3d9f9a0..4eb7230edcd0fb3d21e80218f6a912eb308fc89d 100644
index 30f7a5f79e50fdeb4e1775a0e56dafa4c6908898..f7250985277c4127425ef36dff566c1fe06603e2 100644
--- a/lib/internal/main/worker_thread.js
+++ b/lib/internal/main/worker_thread.js
@@ -112,7 +112,7 @@ port.on('message', (message) => {

Просмотреть файл

@ -33,7 +33,7 @@ index af23e674cb361ed81dafa22670d5633559cd1144..1dd59990cb7cdba8aecf4f499ee6b92e
+ await once(spawn(process.execPath, ['-r', reset, '--test', '--test-reporter', 'tap', test], { stdio: 'inherit', env: { ELECTRON_RUN_AS_NODE: 1 } }), 'exit');
})().then(common.mustCall());
diff --git a/test/parallel/test-node-output-console.mjs b/test/parallel/test-node-output-console.mjs
index 5a1b9feb6c8bedb50b89f5c4f3c5983455bb042d..efca7811dc0b6a590c5ee023c71801703a642882 100644
index f995c170540ffaa80b1b5f8b95dbd8f52bbd5431..6455dbdd015477e16c414b6d2113139327fea4b3 100644
--- a/test/parallel/test-node-output-console.mjs
+++ b/test/parallel/test-node-output-console.mjs
@@ -31,6 +31,7 @@ describe('console output', { concurrency: true }, () => {
@ -41,9 +41,9 @@ index 5a1b9feb6c8bedb50b89f5c4f3c5983455bb042d..efca7811dc0b6a590c5ee023c7180170
for (const { name, transform, env } of tests) {
it(name, async () => {
+ if (env) env.ELECTRON_RUN_AS_NODE = 1;
await snapshot.spawnAndAssert(fixtures.path(name), transform ?? defaultTransform, { env });
});
}
await snapshot.spawnAndAssert(
fixtures.path(name),
transform ?? defaultTransform,
diff --git a/test/parallel/test-node-output-errors.mjs b/test/parallel/test-node-output-errors.mjs
index c0acee2bfc8c124e9d9b254041589a49c8301b8f..0e266899ffc0918b2f94e8f636043a6ec5f0870f 100644
--- a/test/parallel/test-node-output-errors.mjs

Просмотреть файл

@ -8,7 +8,7 @@ to child processes spawned with `ELECTRON_RUN_AS_NODE` which is used
by the crashpad client to connect with the handler process.
diff --git a/lib/child_process.js b/lib/child_process.js
index 449013906e93e59568a90264d5372a3962db6cb0..168163001f13b641bc284fd01a71f075e1ada94f 100644
index c09fca512584ce2c674ae1d05136ff4cd8ea8471..3947e231f4e641b97d12c9639a736fab8836787b 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -61,6 +61,7 @@ let debug = require('internal/util/debuglog').debuglog(

Просмотреть файл

@ -9,10 +9,10 @@ modules to sandboxed renderers.
TODO(codebytere): remove and replace with a public facing API.
diff --git a/src/node_binding.cc b/src/node_binding.cc
index 97257d47c6173872e55facf6f92801bd2fc3564b..8cdee730101fbdc79415654aa6fe401573979c0e 100644
index 6b0297d8984ccb34b8d0019fedd1307d48cf49f8..4e750be66452de47040e3a46555c062dfccf7807 100644
--- a/src/node_binding.cc
+++ b/src/node_binding.cc
@@ -638,6 +638,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
@@ -641,6 +641,10 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
args.GetReturnValue().Set(exports);
}

Просмотреть файл

@ -7,10 +7,10 @@ Subject: feat: add kNoStartDebugSignalHandler to Environment to prevent
This patch should be upstreamed, it allows embedders to prevent the call to StartDebugSignalHandler which handles SIGUSR1 and starts the inspector agent. Apps that have --inspect disabled also don't want SIGUSR1 to have this affect.
diff --git a/src/env-inl.h b/src/env-inl.h
index 022f1507ce6a72d0ef140409efba476c7ef7825a..ac4295f495e240331a183b4a0a22d7437fc85271 100644
index 099e7352e68af6179f143741c626d8f539b568bb..63ce35ba68b48a55d8150395304bf86c2bf23aae 100644
--- a/src/env-inl.h
+++ b/src/env-inl.h
@@ -669,6 +669,10 @@ inline bool Environment::no_global_search_paths() const {
@@ -677,6 +677,10 @@ inline bool Environment::no_global_search_paths() const {
!options_->global_search_paths;
}
@ -22,7 +22,7 @@ index 022f1507ce6a72d0ef140409efba476c7ef7825a..ac4295f495e240331a183b4a0a22d743
// configure --no-browser-globals
#ifdef NODE_NO_BROWSER_GLOBALS
diff --git a/src/env.h b/src/env.h
index bb84f5ab43cb5be42019921e5dc2fc010d7b9018..f0a1d5ef2b45d4c27c5660177c9805acee19e5f2 100644
index c0c99456471788d40218152291a32db5fbdf1101..910c69b6d1d17ef25201dbb39d3d074f4f3f011f 100644
--- a/src/env.h
+++ b/src/env.h
@@ -801,6 +801,7 @@ class Environment : public MemoryRetainer {
@ -51,10 +51,10 @@ index 63c8ae14abb3dee3c4a628d1042c2e9e25688806..4e1eb17dd174e18a814fce6b170d75d1
parent_env_->AddCleanupHook([](void* data) {
Environment* env = static_cast<Environment*>(data);
diff --git a/src/node.h b/src/node.h
index dbe6aa42075524f66a8f76bb945255f5195359cd..13e29b98d0c91badee41b53c37b4763f73e02e87 100644
index 24dd1d9fe8de5993863f9fcd0ce7f65ec5460cce..c267ed1eeaa2d8b6ecd5a1563a4e9440bf0cca00 100644
--- a/src/node.h
+++ b/src/node.h
@@ -657,7 +657,11 @@ enum Flags : uint64_t {
@@ -658,7 +658,11 @@ enum Flags : uint64_t {
// This control is needed by embedders who may not want to initialize the V8
// inspector in situations where one has already been created,
// e.g. Blink's in Chromium.

Просмотреть файл

@ -10,7 +10,7 @@ already been called.
This should be upstreamed.
diff --git a/src/node.cc b/src/node.cc
index 012dd487e8db232d068bce358ad44b14e78d0fe9..a1062226bebd18ec84302ebdc4c4dbac352f51ae 100644
index 3e4f1b5d730865fae61f8bfbc58c14c6a59fb33a..7478ef81eb9b275eb5f45b528582e5bbd30e60ec 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -650,6 +650,7 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) {
@ -22,7 +22,7 @@ index 012dd487e8db232d068bce358ad44b14e78d0fe9..a1062226bebd18ec84302ebdc4c4dbac
#endif // NODE_USE_V8_WASM_TRAP_HANDLER
}
diff --git a/src/node.h b/src/node.h
index 16c3ad349e942b83764c7772178baa5057cd64f3..5ade64874ec08474f05db226cf19a043fa26592e 100644
index e55256996f2c85b0ae3854cbd1b83ca88a3e22cb..76e2459eceed127e69c686f26fd5bd369b81f1af 100644
--- a/src/node.h
+++ b/src/node.h
@@ -275,6 +275,10 @@ enum Flags : uint32_t {

Просмотреть файл

@ -28,10 +28,10 @@ In file included from ../../third_party/electron_node/src/env-inl.h:32:
1 error generated.
diff --git a/src/util.h b/src/util.h
index e5f508b5090b2a0a95dc280e010ddcc731ad0dd2..d1d78c5b2f0409c7a399444875079eb5c487a3e7 100644
index cd4fe2e422a7843f5a3f0f4b336a8625a0b24bcf..8edd50e598d8612144b8da9236e63f9079b99156 100644
--- a/src/util.h
+++ b/src/util.h
@@ -145,9 +145,9 @@ void DumpJavaScriptBacktrace(FILE* fp);
@@ -146,9 +146,9 @@ void DumpJavaScriptBacktrace(FILE* fp);
do { \
/* Make sure that this struct does not end up in inline code, but */ \
/* rather in a read-only data section when modifying this code. */ \

Просмотреть файл

@ -7,10 +7,10 @@ common.gypi is a file that's included in the node header bundle, despite
the fact that we do not build node with gyp.
diff --git a/common.gypi b/common.gypi
index efcd8da848150de3201ac5105470e908127015c3..292cd621dd6d2a6bfcbf959c5910563446492fd9 100644
index 0af8af37c6cf02d99456d30e4639bbddf8e6ace9..9a27610992612b59eadcc8e481683cf1e6a5dbb6 100644
--- a/common.gypi
+++ b/common.gypi
@@ -88,6 +88,23 @@
@@ -89,6 +89,23 @@
##### end V8 defaults #####

Просмотреть файл

@ -44,7 +44,7 @@ index 9dfcf80a913942c93b206c6f871ac7807c7a7e81..4d25a22aedf7d7182bb709864e29b7e7
let filename = call.getFileName();
const line = call.getLineNumber() - 1;
diff --git a/src/api/environment.cc b/src/api/environment.cc
index a9c7b009a74fab07afafa72e5f883bee88cf492a..7c2e4430299e0d78539d43070942ea3a585b559c 100644
index f9d29f0065b1de63a62cfdce74a9705c22dd87d7..3f44160f1bd40fc2d4658f10edf0d0b374732ca2 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -277,6 +277,9 @@ void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
@ -58,10 +58,10 @@ index a9c7b009a74fab07afafa72e5f883bee88cf492a..7c2e4430299e0d78539d43070942ea3a
}
diff --git a/src/node_options.cc b/src/node_options.cc
index e46c71ee467ce1390f0e14794f3514196856b424..a02dcca456556a7cbb2a262edc5fa4a3b25297ed 100644
index dae3237abc95362db81a1f529becfac43454d709..ee8e6f342bf4956c5f186337b6c051e1d62a6dcd 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -1283,6 +1283,11 @@ void GetEmbedderOptions(const FunctionCallbackInfo<Value>& args) {
@@ -1301,6 +1301,11 @@ void GetEmbedderOptions(const FunctionCallbackInfo<Value>& args) {
Local<Context> context = env->context();
Local<Object> ret = Object::New(isolate);

Просмотреть файл

@ -24,10 +24,10 @@ index 69e2a389f9e1480a1a4ba37f5df5356b42f7d52d..0c29b00298b44b97f88a63aa5b89f1c2
wrap->object()->Has(env->context(), env->handle_onclose_symbol())
.FromMaybe(false)) {
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index e9d50ac402b01208eb06504afcdfaf8d1e982bcd..c728c11145bdc7bfce59c3c20fa43508ea4482fb 100644
index ca8575e9a21b9a0b8089484a04abe702b2fe6d4e..df1d9cb4fd0442ec6ce6164a136b7a5fbcbe5b67 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -459,6 +459,7 @@ bool ContextifyContext::IsStillInitializing(const ContextifyContext* ctx) {
@@ -460,6 +460,7 @@ bool ContextifyContext::IsStillInitializing(const ContextifyContext* ctx) {
void ContextifyContext::PropertyGetterCallback(
Local<Name> property,
const PropertyCallbackInfo<Value>& args) {
@ -35,7 +35,7 @@ index e9d50ac402b01208eb06504afcdfaf8d1e982bcd..c728c11145bdc7bfce59c3c20fa43508
ContextifyContext* ctx = ContextifyContext::Get(args);
// Still initializing
@@ -466,6 +467,8 @@ void ContextifyContext::PropertyGetterCallback(
@@ -467,6 +468,8 @@ void ContextifyContext::PropertyGetterCallback(
Local<Context> context = ctx->context();
Local<Object> sandbox = ctx->sandbox();
@ -44,7 +44,7 @@ index e9d50ac402b01208eb06504afcdfaf8d1e982bcd..c728c11145bdc7bfce59c3c20fa43508
MaybeLocal<Value> maybe_rv =
sandbox->GetRealNamedProperty(context, property);
if (maybe_rv.IsEmpty()) {
@@ -475,6 +478,11 @@ void ContextifyContext::PropertyGetterCallback(
@@ -476,6 +479,11 @@ void ContextifyContext::PropertyGetterCallback(
Local<Value> rv;
if (maybe_rv.ToLocal(&rv)) {

Просмотреть файл

@ -549,7 +549,7 @@ index 1785f5eef3d202976666081d09850ed744d83446..e88227a215ba4f7fa196f7642ae694a5
});
diff --git a/test/parallel/test-crypto-rsa-dsa.js b/test/parallel/test-crypto-rsa-dsa.js
index 438037acc867c2bd6e34ffdcd1e706f8d0ff6a57..65611c79d0e93bf7f91948b2a0105cdc3192b2f2 100644
index ecda345989789d0745b631385e7411305c1c6375..542a0a16f3f2eba4efd31e807a3bc34b6752d798 100644
--- a/test/parallel/test-crypto-rsa-dsa.js
+++ b/test/parallel/test-crypto-rsa-dsa.js
@@ -28,12 +28,11 @@ const dsaPkcs8KeyPem = fixtures.readKey('dsa_private_pkcs8.pem');
@ -570,18 +570,17 @@ index 438037acc867c2bd6e34ffdcd1e706f8d0ff6a57..65611c79d0e93bf7f91948b2a0105cdc
};
const decryptError = common.hasOpenSSL3 ?
@@ -221,8 +220,8 @@ function test_rsa(padding, encryptOaepHash, decryptOaepHash) {
oaepHash: encryptOaepHash
@@ -222,7 +221,8 @@ function test_rsa(padding, encryptOaepHash, decryptOaepHash) {
}, bufferToEncrypt);
-
- if (padding === constants.RSA_PKCS1_PADDING) {
+ // BoringSSL does not support RSA_PKCS1_PADDING.
+ if (false) {
assert.throws(() => {
crypto.privateDecrypt({
key: rsaKeyPem,
@@ -415,7 +414,7 @@ assert.throws(() => {
// TODO(richardlau): see if it's possible to determine implicit rejection
// support when dynamically linked against OpenSSL.
if (!process.config.variables.node_shared_openssl) {
@@ -419,7 +419,7 @@ assert.throws(() => {
assert.strictEqual(verify2.verify(publicKey, signature, 'hex'), true);
}
@ -590,13 +589,13 @@ index 438037acc867c2bd6e34ffdcd1e706f8d0ff6a57..65611c79d0e93bf7f91948b2a0105cdc
//
// Test DSA signing and verification
//
@@ -490,3 +489,4 @@ const input = 'I AM THE WALRUS';
@@ -494,3 +494,4 @@ const input = 'I AM THE WALRUS';
assert.strictEqual(verify.verify(dsaPubPem, signature, 'hex'), true);
}
+*/
diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js
index b39ec22dceb5b704f8c262bd38163d93ac1a3b47..89cfa9fc49719e5a6f2c5b96f25c61340286cadb 100644
index 56e5c16c2867f019caccf42f228193cae6167150..dc585c44db9894ae57a5e11d453af03e1ea4f211 100644
--- a/test/parallel/test-crypto-sign-verify.js
+++ b/test/parallel/test-crypto-sign-verify.js
@@ -28,6 +28,7 @@ const keySize = 2048;

Просмотреть файл

@ -19,10 +19,10 @@ index 449131b9af99744c08d62d73f8d124cef5c9cc71..3df06eff63106aece1009d88fd01df2a
context = { __proto__: context, source };
}
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
index 4831f3678cde9b4edad04922932c8239a7908a04..e364c76e2eccafdd795544cb224e43f3df456fbb 100644
index 5e79fc2c04ffb6006229920cc1ab61b537fed4c0..d62565bf4fe51be41d9ce6ef3ffc04ed34d17e1a 100644
--- a/lib/internal/modules/esm/translators.js
+++ b/lib/internal/modules/esm/translators.js
@@ -397,6 +397,9 @@ function cjsPreparseModuleExports(filename, source) {
@@ -379,6 +379,9 @@ function cjsPreparseModuleExports(filename, source) {
if (cached) {
return { module, exportNames: cached.exportNames };
}
@ -33,7 +33,7 @@ index 4831f3678cde9b4edad04922932c8239a7908a04..e364c76e2eccafdd795544cb224e43f3
const loaded = Boolean(module);
if (!loaded) {
diff --git a/lib/internal/modules/run_main.js b/lib/internal/modules/run_main.js
index 1f03c313121db054ff824d07e57c57c749005497..2c8aa6461497f39062ec350ef8a063b9b0ac1edf 100644
index ca401044c0178c46db9b439b27c440a5d7924c84..dc1a682f0a3cf1ba1095c60bf6a6ca992d6043b3 100644
--- a/lib/internal/modules/run_main.js
+++ b/lib/internal/modules/run_main.js
@@ -2,6 +2,7 @@
@ -44,7 +44,7 @@ index 1f03c313121db054ff824d07e57c57c749005497..2c8aa6461497f39062ec350ef8a063b9
} = primordials;
const { containsModuleSyntax } = internalBinding('contextify');
@@ -13,6 +14,13 @@ const path = require('path');
@@ -22,6 +23,13 @@ const {
* @param {string} main - Entry point path
*/
function resolveMainPath(main) {
@ -58,7 +58,7 @@ index 1f03c313121db054ff824d07e57c57c749005497..2c8aa6461497f39062ec350ef8a063b9
const defaultType = getOptionValue('--experimental-default-type');
/** @type {string} */
let mainPath;
@@ -50,6 +58,13 @@ function resolveMainPath(main) {
@@ -59,6 +67,13 @@ function resolveMainPath(main) {
* @param {string} mainPath - Absolute path to the main entry point
*/
function shouldUseESMLoader(mainPath) {

Просмотреть файл

@ -73,10 +73,10 @@ index b56ad6cc833f00f58bf3925e9fd82a8f5b7b9bd7..8c9e8bfb4e828d044b236a11c0890cb4
parsePackageName(specifier, base);
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
index ca547699d00ed125fd3b9d383d67b9606f89d199..11d64bfd66259a5c5cf089de713af35ec9cde2aa 100644
index 6772bbffd989d2257593bde76c94449dbd9272a8..232cf43c500056896eb754c15334858038b0525c 100644
--- a/lib/internal/modules/esm/translators.js
+++ b/lib/internal/modules/esm/translators.js
@@ -301,7 +301,7 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) {
@@ -283,7 +283,7 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) {
const { exportNames, module } = cjsPreparseModuleExports(filename, source);
cjsCache.set(url, module);
@ -85,7 +85,7 @@ index ca547699d00ed125fd3b9d383d67b9606f89d199..11d64bfd66259a5c5cf089de713af35e
[...exportNames] : ['default', ...exportNames];
if (isMain) {
@@ -323,8 +323,8 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) {
@@ -305,8 +305,8 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) {
({ exports } = module);
}
for (const exportName of exportNames) {
@ -96,7 +96,7 @@ index ca547699d00ed125fd3b9d383d67b9606f89d199..11d64bfd66259a5c5cf089de713af35e
continue;
}
// We might trigger a getter -> dont fail.
@@ -349,6 +349,10 @@ translators.set('require-commonjs', (url, source, isMain) => {
@@ -331,6 +331,10 @@ translators.set('require-commonjs', (url, source, isMain) => {
return createCJSModuleWrap(url, source);
});
@ -108,10 +108,10 @@ index ca547699d00ed125fd3b9d383d67b9606f89d199..11d64bfd66259a5c5cf089de713af35e
// or as the initial entry point when the ESM loader handles a CommonJS entry.
translators.set('commonjs', async function commonjsStrategy(url, source,
diff --git a/lib/internal/url.js b/lib/internal/url.js
index 428c2f1bec4a8e149b8058406d1393a6690ff31a..979455cb44f5edba6d178a6c36a330d707a2395e 100644
index 34fb672ecb62b83cfb6a3a7484354165f4b02a85..679cb1302dfeb4a50d34219efccc73b518587066 100644
--- a/lib/internal/url.js
+++ b/lib/internal/url.js
@@ -1457,6 +1457,8 @@ function fileURLToPath(path) {
@@ -1459,6 +1459,8 @@ function fileURLToPath(path, options = kEmptyObject) {
path = new URL(path);
else if (!isURL(path))
throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path);
@ -119,4 +119,4 @@ index 428c2f1bec4a8e149b8058406d1393a6690ff31a..979455cb44f5edba6d178a6c36a330d7
+ return 'electron';
if (path.protocol !== 'file:')
throw new ERR_INVALID_URL_SCHEME('file');
return isWindows ? getPathFromURLWin32(path) : getPathFromURLPosix(path);
return (windows ?? isWindows) ? getPathFromURLWin32(path) : getPathFromURLPosix(path);

Просмотреть файл

@ -7,10 +7,10 @@ Subject: fix: expose tracing::Agent and use tracing::TracingController instead
This API is used by Electron to create Node's tracing controller.
diff --git a/src/api/environment.cc b/src/api/environment.cc
index 29826aa2d79586f0ccef65e2735237ffa06b53c1..ed730db22ed1c16041f4d1078f6798d4d2c55443 100644
index cdc2f7aaa8efd8b5d9090455c92d81b2bef460b7..12414204361e7227f7f7736a07388ade3f093e00 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -583,6 +583,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) {
@@ -591,6 +591,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) {
return env->platform();
}
@ -22,7 +22,7 @@ index 29826aa2d79586f0ccef65e2735237ffa06b53c1..ed730db22ed1c16041f4d1078f6798d4
int thread_pool_size,
node::tracing::TracingController* tracing_controller) {
diff --git a/src/node.h b/src/node.h
index bf3382f4c952ca161a5b31c6d76bc11ff6f2cfa5..dbe6aa42075524f66a8f76bb945255f5195359cd 100644
index 58c021f67e92c3fdcb4b173c00acae0722994222..24dd1d9fe8de5993863f9fcd0ce7f65ec5460cce 100644
--- a/src/node.h
+++ b/src/node.h
@@ -133,6 +133,7 @@ struct SnapshotData;
@ -33,7 +33,7 @@ index bf3382f4c952ca161a5b31c6d76bc11ff6f2cfa5..dbe6aa42075524f66a8f76bb945255f5
class TracingController;
}
@@ -802,6 +803,8 @@ NODE_EXTERN void GetNodeReport(Environment* env,
@@ -824,6 +825,8 @@ NODE_EXTERN void GetNodeReport(Environment* env,
NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(Environment* env);
NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env);

Просмотреть файл

@ -17,7 +17,7 @@ Upstreams:
- https://github.com/nodejs/node/pull/39136
diff --git a/src/crypto/crypto_cipher.cc b/src/crypto/crypto_cipher.cc
index 99a16a667baa20138715b0901e3255e41f5f1052..a7f210031085a348f752e7e7e963d2f040bc2000 100644
index 67cd4f2adf15e7d8511f561c54163b1842e971af..7e0e1a62289289b8362870ba4869c97494b9298a 100644
--- a/src/crypto/crypto_cipher.cc
+++ b/src/crypto/crypto_cipher.cc
@@ -28,7 +28,8 @@ using v8::Value;
@ -30,7 +30,7 @@ index 99a16a667baa20138715b0901e3255e41f5f1052..a7f210031085a348f752e7e7e963d2f0
case EVP_CIPH_CCM_MODE:
case EVP_CIPH_GCM_MODE:
#ifndef OPENSSL_NO_OCB
@@ -1062,7 +1063,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
@@ -1088,7 +1089,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
if (EVP_PKEY_decrypt_init(ctx.get()) <= 0) {
return ThrowCryptoError(env, ERR_get_error());
}
@ -39,7 +39,7 @@ index 99a16a667baa20138715b0901e3255e41f5f1052..a7f210031085a348f752e7e7e963d2f0
int rsa_pkcs1_implicit_rejection =
EVP_PKEY_CTX_ctrl_str(ctx.get(), "rsa_pkcs1_implicit_rejection", "1");
// From the doc -2 means that the option is not supported.
@@ -1078,6 +1079,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
@@ -1104,6 +1105,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
"RSA_PKCS1_PADDING is no longer supported for private decryption,"
" this can be reverted with --security-revert=CVE-2023-46809");
}
@ -48,7 +48,7 @@ index 99a16a667baa20138715b0901e3255e41f5f1052..a7f210031085a348f752e7e7e963d2f0
const EVP_MD* digest = nullptr;
diff --git a/src/crypto/crypto_common.cc b/src/crypto/crypto_common.cc
index c6120a655ec853aef11c66ed37d7ca0ffb957dd3..a52ca15cb0ab592d4196d4bd0f1133240967d70c 100644
index 3517c39ad0b71a4d3efefeee2a3d55b70494bc1d..7164e539880e6d33ee1ea1fb77bae8adf4095708 100644
--- a/src/crypto/crypto_common.cc
+++ b/src/crypto/crypto_common.cc
@@ -158,7 +158,7 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) {
@ -101,7 +101,7 @@ index c6120a655ec853aef11c66ed37d7ca0ffb957dd3..a52ca15cb0ab592d4196d4bd0f113324
const char* X509ErrorCode(long err) { // NOLINT(runtime/int)
const char* code = "UNSPECIFIED";
@@ -1044,14 +1051,14 @@ MaybeLocal<Array> GetClientHelloCiphers(
@@ -1042,14 +1049,14 @@ MaybeLocal<Array> GetClientHelloCiphers(
Environment* env,
const SSLPointer& ssl) {
EscapableHandleScope scope(env->isolate());
@ -375,7 +375,7 @@ index 5734d8fdc5505e1586f571c19b840bd56e9c9f1f..3034b114e081e2b32dd5b71653927a41
} // namespace
diff --git a/src/env.h b/src/env.h
index 994b9573822fd3eb0588e87edaa0e505aa5102fb..bb84f5ab43cb5be42019921e5dc2fc010d7b9018 100644
index 904dda4caf9695acec72bd95ba235b92b07eabe2..c0c99456471788d40218152291a32db5fbdf1101 100644
--- a/src/env.h
+++ b/src/env.h
@@ -49,7 +49,7 @@
@ -387,7 +387,7 @@ index 994b9573822fd3eb0588e87edaa0e505aa5102fb..bb84f5ab43cb5be42019921e5dc2fc01
#include <openssl/evp.h>
#endif
@@ -1032,7 +1032,7 @@ class Environment : public MemoryRetainer {
@@ -1035,7 +1035,7 @@ class Environment : public MemoryRetainer {
kExitInfoFieldCount
};
@ -396,36 +396,6 @@ index 994b9573822fd3eb0588e87edaa0e505aa5102fb..bb84f5ab43cb5be42019921e5dc2fc01
#if OPENSSL_VERSION_MAJOR >= 3
// We declare another alias here to avoid having to include crypto_util.h
using EVPMDPointer = DeleteFnPtr<EVP_MD, EVP_MD_free>;
diff --git a/src/node.cc b/src/node.cc
index 10e04ed8a28bd010e4887ad5b9af3886f7b32a53..012dd487e8db232d068bce358ad44b14e78d0fe9 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -1079,7 +1079,8 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
}
if (!(flags & ProcessInitializationFlags::kNoInitOpenSSL)) {
-#if HAVE_OPENSSL && !defined(OPENSSL_IS_BORINGSSL)
+#if HAVE_OPENSSL
+#if !defined(OPENSSL_IS_BORINGSSL)
auto GetOpenSSLErrorString = []() -> std::string {
std::string ret;
ERR_print_errors_cb(
@@ -1179,13 +1180,13 @@ InitializeOncePerProcessInternal(const std::vector<std::string>& args,
CHECK(crypto::CSPRNG(buffer, length).is_ok());
return true;
});
-
+#endif // !defined(OPENSSL_IS_BORINGSSL)
{
std::string extra_ca_certs;
if (credentials::SafeGetenv("NODE_EXTRA_CA_CERTS", &extra_ca_certs))
crypto::UseExtraCaCerts(extra_ca_certs);
}
-#endif // HAVE_OPENSSL && !defined(OPENSSL_IS_BORINGSSL)
+#endif // HAVE_OPENSSL
}
if (!(flags & ProcessInitializationFlags::kNoInitializeNodeV8Platform)) {
diff --git a/src/node_metadata.cc b/src/node_metadata.cc
index 844c5ac2c2b948b3be35cb3e447717a510a463a6..72a75ee0bf391ea508441f49413f85c5b735b259 100644
--- a/src/node_metadata.cc
@ -453,7 +423,7 @@ index cf051585e779e2b03bd7b95fe5008b89cc7f8162..9de49c6828468fdf846dcd4ad445390f
#if NODE_OPENSSL_HAS_QUIC
#include <openssl/quic.h>
diff --git a/src/node_options.cc b/src/node_options.cc
index fa09d4503980e144a0b3b6f15e858fcad6c6f5b2..e46c71ee467ce1390f0e14794f3514196856b424 100644
index 937ce44696175dc80edabcd9fc2709a6716d1a66..dae3237abc95362db81a1f529becfac43454d709 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -6,7 +6,7 @@
@ -466,7 +436,7 @@ index fa09d4503980e144a0b3b6f15e858fcad6c6f5b2..e46c71ee467ce1390f0e14794f351419
#endif
diff --git a/src/node_options.h b/src/node_options.h
index 293642d79fa168e12a5875e98f9b9e39cca533be..440bb9ebdf72b9883a1f6a997f23e0344d26ae5f 100644
index 0a2f5512f689f87b73aa582782c484f73a4ebc43..e1985f2188eec6869521aecd39d2d74d5cc1616a 100644
--- a/src/node_options.h
+++ b/src/node_options.h
@@ -11,7 +11,7 @@

Просмотреть файл

@ -78,11 +78,11 @@ index 8c9e8bfb4e828d044b236a11c0890cb4f0161050..30f6abd5d2d3fb7aceaa6191ebd99642
// Check for !stat.isDirectory()
if (stat !== 1) {
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
index 11d64bfd66259a5c5cf089de713af35ec9cde2aa..4831f3678cde9b4edad04922932c8239a7908a04 100644
index 232cf43c500056896eb754c15334858038b0525c..5e79fc2c04ffb6006229920cc1ab61b537fed4c0 100644
--- a/lib/internal/modules/esm/translators.js
+++ b/lib/internal/modules/esm/translators.js
@@ -32,7 +32,7 @@ function lazyTypes() {
const { containsModuleSyntax } = internalBinding('contextify');
@@ -36,7 +36,7 @@ const {
const { BuiltinModule } = require('internal/bootstrap/realm');
const assert = require('internal/assert');
-const { readFileSync } = require('fs');
@ -90,7 +90,7 @@ index 11d64bfd66259a5c5cf089de713af35ec9cde2aa..4831f3678cde9b4edad04922932c8239
const { dirname, extname, isAbsolute } = require('path');
const {
loadBuiltinModule,
@@ -376,7 +376,7 @@ translators.set('commonjs', async function commonjsStrategy(url, source,
@@ -358,7 +358,7 @@ translators.set('commonjs', async function commonjsStrategy(url, source,
try {
// We still need to read the FS to detect the exports.
@ -99,7 +99,7 @@ index 11d64bfd66259a5c5cf089de713af35ec9cde2aa..4831f3678cde9b4edad04922932c8239
} catch {
// Continue regardless of error.
}
@@ -445,7 +445,7 @@ function cjsPreparseModuleExports(filename, source) {
@@ -427,7 +427,7 @@ function cjsPreparseModuleExports(filename, source) {
isAbsolute(resolved)) {
// TODO: this should be calling the `load` hook chain to get the source
// (and fallback to reading the FS only if the source is nullish).

Просмотреть файл

@ -86,10 +86,10 @@ index 149c7c107322919dfeea1dfe89dc223f78b0e979..e4e8dac6b8b5924a7eae83935031e091
NODE_DEFINE_CONSTANT(target, ETIMEDOUT);
#endif
diff --git a/src/node_errors.cc b/src/node_errors.cc
index 7ef6ea7f07998f25385c3dee2feb5a68923c4726..56eba10cf791cce2de760f8ed2b34e040676fc8b 100644
index ff091fd20d915b58a7a23dd393d46e1021bdb2f5..8c2cf5d65bb8b1d9461286c9a54be8ac9786900a 100644
--- a/src/node_errors.cc
+++ b/src/node_errors.cc
@@ -842,10 +842,6 @@ const char* errno_string(int errorno) {
@@ -852,10 +852,6 @@ const char* errno_string(int errorno) {
ERRNO_CASE(ENOBUFS);
#endif
@ -100,7 +100,7 @@ index 7ef6ea7f07998f25385c3dee2feb5a68923c4726..56eba10cf791cce2de760f8ed2b34e04
#ifdef ENODEV
ERRNO_CASE(ENODEV);
#endif
@@ -884,14 +880,6 @@ const char* errno_string(int errorno) {
@@ -894,14 +890,6 @@ const char* errno_string(int errorno) {
ERRNO_CASE(ENOSPC);
#endif
@ -115,7 +115,7 @@ index 7ef6ea7f07998f25385c3dee2feb5a68923c4726..56eba10cf791cce2de760f8ed2b34e04
#ifdef ENOSYS
ERRNO_CASE(ENOSYS);
#endif
@@ -974,10 +962,6 @@ const char* errno_string(int errorno) {
@@ -984,10 +972,6 @@ const char* errno_string(int errorno) {
ERRNO_CASE(ESTALE);
#endif

Просмотреть файл

@ -142,7 +142,7 @@ index 30f6abd5d2d3fb7aceaa6191ebd99642e34d9ee4..cd5f59a5c27afd74f68c920a6ab5b8bc
const encodedSepRegEx = /%2F|%5C/i;
diff --git a/src/node_file.cc b/src/node_file.cc
index 1a14b30e00778b6bdb8b75a380e92b7140b18595..9e4be8909311634c49ffac7cc6d32ecf5cf25108 100644
index 0ec5c6f4845e7b1f279caabca43a06ab41193d00..1e66de2fb7860a0d0dcab6c7bded90a048886cf8 100644
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@ -19,14 +19,11 @@
@ -160,7 +160,7 @@ index 1a14b30e00778b6bdb8b75a380e92b7140b18595..9e4be8909311634c49ffac7cc6d32ecf
#include "node_process-inl.h"
#include "node_stat_watcher.h"
#include "node_url.h"
@@ -2979,134 +2976,6 @@ constexpr std::array<std::string_view, 10> legacy_main_extensions = {
@@ -3116,134 +3113,6 @@ constexpr std::array<std::string_view, 10> legacy_main_extensions = {
} // namespace
@ -295,7 +295,7 @@ index 1a14b30e00778b6bdb8b75a380e92b7140b18595..9e4be8909311634c49ffac7cc6d32ecf
void BindingData::MemoryInfo(MemoryTracker* tracker) const {
tracker->TrackField("stats_field_array", stats_field_array);
tracker->TrackField("stats_field_bigint_array", stats_field_bigint_array);
@@ -3206,19 +3075,6 @@ InternalFieldInfoBase* BindingData::Serialize(int index) {
@@ -3343,19 +3212,6 @@ InternalFieldInfoBase* BindingData::Serialize(int index) {
return info;
}
@ -315,7 +315,7 @@ index 1a14b30e00778b6bdb8b75a380e92b7140b18595..9e4be8909311634c49ffac7cc6d32ecf
static void CreatePerIsolateProperties(IsolateData* isolate_data,
Local<ObjectTemplate> target) {
Isolate* isolate = isolate_data->isolate();
@@ -3273,7 +3129,6 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data,
@@ -3410,7 +3266,6 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data,
SetMethod(isolate, target, "mkdtemp", Mkdtemp);
StatWatcher::CreatePerIsolateProperties(isolate_data, target);
@ -323,7 +323,7 @@ index 1a14b30e00778b6bdb8b75a380e92b7140b18595..9e4be8909311634c49ffac7cc6d32ecf
target->Set(
FIXED_ONE_BYTE_STRING(isolate, "kFsStatsFieldsNumber"),
@@ -3346,7 +3201,6 @@ BindingData* FSReqBase::binding_data() {
@@ -3483,7 +3338,6 @@ BindingData* FSReqBase::binding_data() {
void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
registry->Register(Access);
StatWatcher::RegisterExternalReferences(registry);

Просмотреть файл

@ -6,10 +6,10 @@ Subject: Pass all globals through "require"
(cherry picked from commit 7d015419cb7a0ecfe6728431a4ed2056cd411d62)
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
index 2c48ff9512c225eb40cd34b844663e063b3695a9..e384e3e6c4e584132bb6a9831a554502f289133a 100644
index 7bbd59e16330b59f6c71aa8e6ff59659e42f6cee..276ab42c22b796ee07ce66744187adca6a8b8da4 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -146,6 +146,13 @@ const {
@@ -148,6 +148,13 @@ const {
CHAR_FORWARD_SLASH,
} = require('internal/constants');
@ -23,7 +23,7 @@ index 2c48ff9512c225eb40cd34b844663e063b3695a9..e384e3e6c4e584132bb6a9831a554502
const {
isProxy,
} = require('internal/util/types');
@@ -1364,10 +1371,12 @@ Module.prototype._compile = function(content, filename) {
@@ -1353,10 +1360,12 @@ Module.prototype._compile = function(content, filename) {
setHasStartedUserCJSExecution();
if (inspectorWrapper) {
result = inspectorWrapper(compiledWrapper, thisValue, exports,

Просмотреть файл

@ -7,7 +7,7 @@ We use this to allow node's 'fs' module to read from ASAR files as if they were
a real filesystem.
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js
index 8812c3b35184b2f58f3d1e1a1b4f14b7120325cc..932f5035d7f4e11113420dc095014682778a79a6 100644
index d42e766555a83ec7421b13c2bf75bfd28f086102..57125a271394dda0d3aa3a261ba087c978582c29 100644
--- a/lib/internal/bootstrap/node.js
+++ b/lib/internal/bootstrap/node.js
@@ -134,6 +134,10 @@ process.domain = null;
@ -22,10 +22,10 @@ index 8812c3b35184b2f58f3d1e1a1b4f14b7120325cc..932f5035d7f4e11113420dc095014682
const binding = internalBinding('builtins');
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
index e384e3e6c4e584132bb6a9831a554502f289133a..46140285cf6b73c154a067c5f0f0931add5e9275 100644
index 276ab42c22b796ee07ce66744187adca6a8b8da4..155485dbab0d46bb225fa40e99f555d805659c4f 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -100,7 +100,7 @@ const { containsModuleSyntax } = internalBinding('contextify');
@@ -102,7 +102,7 @@ const {
const assert = require('internal/assert');
const fs = require('fs');
const path = require('path');
@ -34,7 +34,7 @@ index e384e3e6c4e584132bb6a9831a554502f289133a..46140285cf6b73c154a067c5f0f0931a
const { safeGetenv } = internalBinding('credentials');
const {
privateSymbols: {
@@ -194,7 +194,7 @@ function stat(filename) {
@@ -196,7 +196,7 @@ function stat(filename) {
const result = statCache.get(filename);
if (result !== undefined) { return result; }
}

Просмотреть файл

@ -1,284 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Cheng Zhao <zcbenz@gmail.com>
Date: Mon, 4 Mar 2024 11:41:18 +0900
Subject: src: preload function for Environment
Backport https://github.com/nodejs/node/pull/51539
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
index 2fc9e2da8aa920acffc101b2c341a5d9b16fe90a..b4272f01e84d7fec263dcad444d92459743780a8 100644
--- a/lib/internal/process/pre_execution.js
+++ b/lib/internal/process/pre_execution.js
@@ -196,6 +196,9 @@ function setupUserModules(forceDefaultLoader = false) {
} = require('internal/modules/helpers');
assert(!hasStartedUserCJSExecution());
assert(!hasStartedUserESMExecution());
+ if (getEmbedderOptions().hasEmbedderPreload) {
+ runEmbedderPreload();
+ }
// Do not enable preload modules if custom loaders are disabled.
// For example, loader workers are responsible for doing this themselves.
// And preload modules are not supported in ShadowRealm as well.
@@ -713,6 +716,10 @@ function initializeFrozenIntrinsics() {
}
}
+function runEmbedderPreload() {
+ internalBinding('mksnapshot').runEmbedderPreload(process, require);
+}
+
function loadPreloadModules() {
// For user code, we preload modules if `-r` is passed
const preloadModules = getOptionValue('--require');
diff --git a/src/api/environment.cc b/src/api/environment.cc
index 7c2e4430299e0d78539d43070942ea3a585b559c..7741b9358a965231671bce004de581f1c6665c2d 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -549,25 +549,31 @@ NODE_EXTERN std::unique_ptr<InspectorParentHandle> GetInspectorParentHandle(
#endif
}
-MaybeLocal<Value> LoadEnvironment(
- Environment* env,
- StartExecutionCallback cb) {
+MaybeLocal<Value> LoadEnvironment(Environment* env,
+ StartExecutionCallback cb,
+ EmbedderPreloadCallback preload) {
env->InitializeLibuv();
env->InitializeDiagnostics();
+ if (preload) {
+ env->set_embedder_preload(std::move(preload));
+ }
return StartExecution(env, cb);
}
MaybeLocal<Value> LoadEnvironment(Environment* env,
- std::string_view main_script_source_utf8) {
+ std::string_view main_script_source_utf8,
+ EmbedderPreloadCallback preload) {
CHECK_NOT_NULL(main_script_source_utf8.data());
return LoadEnvironment(
- env, [&](const StartExecutionCallbackInfo& info) -> MaybeLocal<Value> {
+ env,
+ [&](const StartExecutionCallbackInfo& info) -> MaybeLocal<Value> {
Local<Value> main_script =
ToV8Value(env->context(), main_script_source_utf8).ToLocalChecked();
return info.run_cjs->Call(
env->context(), Null(env->isolate()), 1, &main_script);
- });
+ },
+ std::move(preload));
}
Environment* GetCurrentEnvironment(Local<Context> context) {
diff --git a/src/env-inl.h b/src/env-inl.h
index ac4295f495e240331a183b4a0a22d7437fc85271..63ce35ba68b48a55d8150395304bf86c2bf23aae 100644
--- a/src/env-inl.h
+++ b/src/env-inl.h
@@ -430,6 +430,14 @@ inline builtins::BuiltinLoader* Environment::builtin_loader() {
return &builtin_loader_;
}
+inline const EmbedderPreloadCallback& Environment::embedder_preload() const {
+ return embedder_preload_;
+}
+
+inline void Environment::set_embedder_preload(EmbedderPreloadCallback fn) {
+ embedder_preload_ = std::move(fn);
+}
+
inline double Environment::new_async_id() {
async_hooks()->async_id_fields()[AsyncHooks::kAsyncIdCounter] += 1;
return async_hooks()->async_id_fields()[AsyncHooks::kAsyncIdCounter];
diff --git a/src/env.h b/src/env.h
index f0a1d5ef2b45d4c27c5660177c9805acee19e5f2..910c69b6d1d17ef25201dbb39d3d074f4f3f011f 100644
--- a/src/env.h
+++ b/src/env.h
@@ -1003,6 +1003,9 @@ class Environment : public MemoryRetainer {
#endif // HAVE_INSPECTOR
+ inline const EmbedderPreloadCallback& embedder_preload() const;
+ inline void set_embedder_preload(EmbedderPreloadCallback fn);
+
inline void set_process_exit_handler(
std::function<void(Environment*, ExitCode)>&& handler);
@@ -1213,6 +1216,7 @@ class Environment : public MemoryRetainer {
std::unique_ptr<PrincipalRealm> principal_realm_ = nullptr;
builtins::BuiltinLoader builtin_loader_;
+ EmbedderPreloadCallback embedder_preload_;
// Used by allocate_managed_buffer() and release_managed_buffer() to keep
// track of the BackingStore for a given pointer.
diff --git a/src/node.h b/src/node.h
index 5ade64874ec08474f05db226cf19a043fa26592e..b3cc7a9f1866111c197b20068275c496fd4aace0 100644
--- a/src/node.h
+++ b/src/node.h
@@ -746,12 +746,33 @@ struct StartExecutionCallbackInfo {
using StartExecutionCallback =
std::function<v8::MaybeLocal<v8::Value>(const StartExecutionCallbackInfo&)>;
+using EmbedderPreloadCallback =
+ std::function<void(Environment* env,
+ v8::Local<v8::Value> process,
+ v8::Local<v8::Value> require)>;
+// Run initialization for the environment.
+//
+// The |preload| function, usually used by embedders to inject scripts,
+// will be run by Node.js before Node.js executes the entry point.
+// The function is guaranteed to run before the user land module loader running
+// any user code, so it is safe to assume that at this point, no user code has
+// been run yet.
+// The function will be executed with preload(process, require), and the passed
+// require function has access to internal Node.js modules. There is no
+// stability guarantee about the internals exposed to the internal require
+// function. Expect breakages when updating Node.js versions if the embedder
+// imports internal modules with the internal require function.
+// Worker threads created in the environment will also respect The |preload|
+// function, so make sure the function is thread-safe.
NODE_EXTERN v8::MaybeLocal<v8::Value> LoadEnvironment(
Environment* env,
- StartExecutionCallback cb);
+ StartExecutionCallback cb,
+ EmbedderPreloadCallback preload = nullptr);
NODE_EXTERN v8::MaybeLocal<v8::Value> LoadEnvironment(
- Environment* env, std::string_view main_script_source_utf8);
+ Environment* env,
+ std::string_view main_script_source_utf8,
+ EmbedderPreloadCallback preload = nullptr);
NODE_EXTERN void FreeEnvironment(Environment* env);
// Set a callback that is called when process.exit() is called from JS,
diff --git a/src/node_options.cc b/src/node_options.cc
index a02dcca456556a7cbb2a262edc5fa4a3b25297ed..92adb8323abac2c7ab956fe1adf95cfab62bef6a 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -1304,6 +1304,12 @@ void GetEmbedderOptions(const FunctionCallbackInfo<Value>& args) {
.IsNothing())
return;
+ if (ret->Set(context,
+ FIXED_ONE_BYTE_STRING(env->isolate(), "hasEmbedderPreload"),
+ Boolean::New(isolate, env->embedder_preload() != nullptr))
+ .IsNothing())
+ return;
+
args.GetReturnValue().Set(ret);
}
diff --git a/src/node_snapshotable.cc b/src/node_snapshotable.cc
index 0309aba6bdc24afe0d1fd24e7af6f472910363d7..55a65deeea6e74b77cb5b97da88e37779f336ce2 100644
--- a/src/node_snapshotable.cc
+++ b/src/node_snapshotable.cc
@@ -1417,6 +1417,17 @@ void SerializeSnapshotableObjects(Realm* realm,
});
}
+void RunEmbedderPreload(const FunctionCallbackInfo<Value>& args) {
+ Environment* env = Environment::GetCurrent(args);
+ CHECK(env->embedder_preload());
+ CHECK_EQ(args.Length(), 2);
+ Local<Value> process_obj = args[0];
+ Local<Value> require_fn = args[1];
+ CHECK(process_obj->IsObject());
+ CHECK(require_fn->IsFunction());
+ env->embedder_preload()(env, process_obj, require_fn);
+}
+
void CompileSerializeMain(const FunctionCallbackInfo<Value>& args) {
CHECK(args[0]->IsString());
Local<String> filename = args[0].As<String>();
@@ -1540,6 +1551,7 @@ void CreatePerContextProperties(Local<Object> target,
void CreatePerIsolateProperties(IsolateData* isolate_data,
Local<ObjectTemplate> target) {
Isolate* isolate = isolate_data->isolate();
+ SetMethod(isolate, target, "runEmbedderPreload", RunEmbedderPreload);
SetMethod(isolate, target, "compileSerializeMain", CompileSerializeMain);
SetMethod(isolate, target, "setSerializeCallback", SetSerializeCallback);
SetMethod(isolate, target, "setDeserializeCallback", SetDeserializeCallback);
@@ -1552,6 +1564,7 @@ void CreatePerIsolateProperties(IsolateData* isolate_data,
}
void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
+ registry->Register(RunEmbedderPreload);
registry->Register(CompileSerializeMain);
registry->Register(SetSerializeCallback);
registry->Register(SetDeserializeCallback);
diff --git a/src/node_worker.cc b/src/node_worker.cc
index 8b45c0265befaf68af07622d220ebdf96dc94ac4..196eb3bccaee87b52a46b693a061864ae6a5e3b9 100644
--- a/src/node_worker.cc
+++ b/src/node_worker.cc
@@ -62,6 +62,7 @@ Worker::Worker(Environment* env,
thread_id_(AllocateEnvironmentThreadId()),
name_(name),
env_vars_(env_vars),
+ embedder_preload_(env->embedder_preload()),
snapshot_data_(snapshot_data) {
Debug(this, "Creating new worker instance with thread id %llu",
thread_id_.id);
@@ -386,8 +387,12 @@ void Worker::Run() {
}
Debug(this, "Created message port for worker %llu", thread_id_.id);
- if (LoadEnvironment(env_.get(), StartExecutionCallback{}).IsEmpty())
+ if (LoadEnvironment(env_.get(),
+ StartExecutionCallback{},
+ std::move(embedder_preload_))
+ .IsEmpty()) {
return;
+ }
Debug(this, "Loaded environment for worker %llu", thread_id_.id);
}
diff --git a/src/node_worker.h b/src/node_worker.h
index 531e2b5287010f9206ab4fd7f4dd0f3dec9fe55c..07fd7b460654e169e8b6822474dc3cc70fcec4c0 100644
--- a/src/node_worker.h
+++ b/src/node_worker.h
@@ -114,6 +114,7 @@ class Worker : public AsyncWrap {
std::unique_ptr<MessagePortData> child_port_data_;
std::shared_ptr<KVStore> env_vars_;
+ EmbedderPreloadCallback embedder_preload_;
// A raw flag that is used by creator and worker threads to
// sync up on pre-mature termination of worker - while in the
diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc
index 9b8124081542876ce7245e4aede6810e9bf0e2eb..64e38c83006a004ebc3519a5e9f8b04263244514 100644
--- a/test/cctest/test_environment.cc
+++ b/test/cctest/test_environment.cc
@@ -778,3 +778,31 @@ TEST_F(EnvironmentTest, RequestInterruptAtExit) {
context->Exit();
}
+
+TEST_F(EnvironmentTest, EmbedderPreload) {
+ v8::HandleScope handle_scope(isolate_);
+ v8::Local<v8::Context> context = node::NewContext(isolate_);
+ v8::Context::Scope context_scope(context);
+
+ node::EmbedderPreloadCallback preload = [](node::Environment* env,
+ v8::Local<v8::Value> process,
+ v8::Local<v8::Value> require) {
+ CHECK(process->IsObject());
+ CHECK(require->IsFunction());
+ process.As<v8::Object>()
+ ->Set(env->context(),
+ v8::String::NewFromUtf8Literal(env->isolate(), "prop"),
+ v8::String::NewFromUtf8Literal(env->isolate(), "preload"))
+ .Check();
+ };
+
+ std::unique_ptr<node::Environment, decltype(&node::FreeEnvironment)> env(
+ node::CreateEnvironment(isolate_data_, context, {}, {}),
+ node::FreeEnvironment);
+
+ v8::Local<v8::Value> main_ret =
+ node::LoadEnvironment(env.get(), "return process.prop;", preload)
+ .ToLocalChecked();
+ node::Utf8Value main_ret_str(isolate_, main_ret);
+ EXPECT_EQ(std::string(*main_ret_str), "preload");
+}

Просмотреть файл

@ -7,7 +7,7 @@ This refactors several allocators to allocate within the V8 memory cage,
allowing them to be compatible with the V8_SANDBOXED_POINTERS feature.
diff --git a/src/api/environment.cc b/src/api/environment.cc
index ed730db22ed1c16041f4d1078f6798d4d2c55443..a9c7b009a74fab07afafa72e5f883bee88cf492a 100644
index 12414204361e7227f7f7736a07388ade3f093e00..f9d29f0065b1de63a62cfdce74a9705c22dd87d7 100644
--- a/src/api/environment.cc
+++ b/src/api/environment.cc
@@ -101,6 +101,14 @@ MaybeLocal<Value> PrepareStackTraceCallback(Local<Context> context,
@ -131,10 +131,10 @@ index d45325954d980724f80d49298bbe837197237a9b..ccea18080142bd9cba3765dbbec61c2a
return ret;
diff --git a/src/node_internals.h b/src/node_internals.h
index eeb0fac3fa1aa90cef6711efbafd915dd9c53d35..90b50f0c778e0b5d2c5df2e59f599402281d6046 100644
index 5f0adcf8aaba93f8fc2874b863acfc96e30cb2b7..6b4ec38bd092358a9433a1179dbe1e71f56aa387 100644
--- a/src/node_internals.h
+++ b/src/node_internals.h
@@ -114,7 +114,9 @@ v8::Maybe<bool> InitializePrimordials(v8::Local<v8::Context> context);
@@ -118,7 +118,9 @@ v8::Maybe<bool> InitializePrimordials(v8::Local<v8::Context> context);
class NodeArrayBufferAllocator : public ArrayBufferAllocator {
public:
@ -145,7 +145,7 @@ index eeb0fac3fa1aa90cef6711efbafd915dd9c53d35..90b50f0c778e0b5d2c5df2e59f599402
void* Allocate(size_t size) override; // Defined in src/node.cc
void* AllocateUninitialized(size_t size) override;
@@ -133,7 +135,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator {
@@ -137,7 +139,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator {
}
private:

Просмотреть файл

@ -7,7 +7,7 @@ Instead of disabling the tests, flag them as flaky so they still run
but don't cause CI failures on flakes.
diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status
index 012331287739c59ff4e28b8310733acecac57350..b4551a764e5162171a9f22c47d13398d2d039724 100644
index 54de053b4046b283fd4bb5b74531723dfa52dfce..762c15fa661314095a1352eeac07bef544883585 100644
--- a/test/parallel/parallel.status
+++ b/test/parallel/parallel.status
@@ -5,6 +5,16 @@ prefix parallel
@ -25,8 +25,8 @@ index 012331287739c59ff4e28b8310733acecac57350..b4551a764e5162171a9f22c47d13398d
+test-cluster-shared-handle-bind-privileged-port: PASS, FLAKY
+test-debugger-random-port-with-inspect-port: PASS, FLAKY
[$system==win32]
# https://github.com/nodejs/node/issues/51862
test-fs-read-stream-concurrent-reads: PASS, FLAKY
diff --git a/test/sequential/sequential.status b/test/sequential/sequential.status
index ccab879b6e5fcdcc0d3a4b790b97db94d92f1a59..11339325697ae98f6996101163679590451c0b81 100644
--- a/test/sequential/sequential.status

Просмотреть файл

@ -7,7 +7,7 @@ Subject: test: match wpt/streams/transferable/transform-stream-members.any.js
All four of this calls should fail - see third_party/blink/web_tests/external/wpt/streams/transferable/transform-stream-members.any-expected.txt
diff --git a/test/wpt/status/streams.json b/test/wpt/status/streams.json
index 3b6e0ce6429f9dddb0b1a6882ce9e3a5158300e5..7ec49a378bfc84728b473d5df69675fff1dfdfef 100644
index 8d6a4c6d2fe27b349ca8a4cbcdc51c3eec06ede9..1e7af48a149ba2c8bed01cd6584e59dc0bc6b676 100644
--- a/test/wpt/status/streams.json
+++ b/test/wpt/status/streams.json
@@ -50,7 +50,9 @@