diff --git a/DEPS b/DEPS index 790da2014c4deb..c8b39d0e1ec0e7 100644 --- a/DEPS +++ b/DEPS @@ -17,7 +17,7 @@ vars = { 'chromium_version': '100.0.4894.0', 'node_version': - 'v16.13.2', + 'v16.14.2', 'nan_version': # The following commit hash of NAN is v2.14.2 with *only* changes to the # test suite. This should be updated to a specific tag when one becomes diff --git a/patches/node/.patches b/patches/node/.patches index 2c7f73453169f2..7b2b6aae5d061b 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -4,7 +4,6 @@ feat_initialize_asar_support.patch expose_get_builtin_module_function.patch build_add_gn_build_files.patch fix_add_default_values_for_variables_in_common_gypi.patch -feat_add_flags_for_low-level_hooks_and_exceptions.patch fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch pass_all_globals_through_require.patch build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch @@ -19,11 +18,9 @@ fix_allow_preventing_initializeinspector_in_env.patch src_allow_embedders_to_provide_a_custom_pageallocator_to.patch fix_crypto_tests_to_run_with_bssl.patch fix_account_for_debugger_agent_race_condition.patch -add_should_read_node_options_from_env_option_to_disable_node_options.patch repl_fix_crash_when_sharedarraybuffer_disabled.patch fix_readbarrier_undefined_symbol_error_on_woa_arm64.patch chore_fix_-wimplicit-fallthrough.patch -test_add_fixture_trim_option.patch fix_crash_caused_by_gethostnamew_on_windows_7.patch fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch fix_don_t_create_console_window_when_creating_process.patch diff --git a/patches/node/add_should_read_node_options_from_env_option_to_disable_node_options.patch b/patches/node/add_should_read_node_options_from_env_option_to_disable_node_options.patch deleted file mode 100644 index 8f7b86fbef1fbb..00000000000000 --- a/patches/node/add_should_read_node_options_from_env_option_to_disable_node_options.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samuel Attard -Date: Wed, 21 Jul 2021 13:40:59 -0700 -Subject: add should_read_node_options_from_env option to disable NODE_OPTIONS - parsing at runtime - -We can remove the NODE_OPTIONS environment variable but it in theory could be injected / re-inserted at runtime and be used for workers. In order to ensure the fuse is respected we need a hard runtime toggle for NODE_OPTION support. - -diff --git a/src/env.cc b/src/env.cc -index 2cb2dccdf32ba4ad58972bb1d2b185996104b5ee..0abd61d6ddd1fb55afde40b38cf7c9400a8c3d41 100644 ---- a/src/env.cc -+++ b/src/env.cc -@@ -329,6 +329,9 @@ std::string GetExecPath(const std::vector& argv) { - return exec_path; - } - -+/* static */ -+bool Environment::should_read_node_options_from_env_ = true; -+ - Environment::Environment(IsolateData* isolate_data, - Isolate* isolate, - const std::vector& args, -diff --git a/src/env.h b/src/env.h -index e0deca497feb111622b257b952c9ed9161c7d001..ab8334bf0e3405fee4d21a4b541bd1164d92ca89 100644 ---- a/src/env.h -+++ b/src/env.h -@@ -1145,6 +1145,8 @@ class Environment : public MemoryRetainer { - inline double trigger_async_id(); - inline double get_default_trigger_async_id(); - -+ static bool should_read_node_options_from_env_; -+ - // List of id's that have been destroyed and need the destroy() cb called. - inline std::vector* destroy_async_id_list(); - -diff --git a/src/node.cc b/src/node.cc -index 207a95d202b4e422a39f837241f1655f7111b1e3..14b9002dbd918b59b05d8b12c5441080695ed9f0 100644 ---- a/src/node.cc -+++ b/src/node.cc -@@ -875,7 +875,7 @@ int InitializeNodeWithArgs(std::vector* argv, - #if !defined(NODE_WITHOUT_NODE_OPTIONS) - std::string node_options; - -- if (credentials::SafeGetenv("NODE_OPTIONS", &node_options)) { -+ if (Environment::should_read_node_options_from_env_ && credentials::SafeGetenv("NODE_OPTIONS", &node_options)) { - std::vector env_argv = - ParseNodeOptionsEnvVar(node_options, errors); - -diff --git a/src/node_worker.cc b/src/node_worker.cc -index 16b7be36f284311f38583fa1df28a2945560b524..62a7dae080fad7e18863968dee22dbe4b461ab82 100644 ---- a/src/node_worker.cc -+++ b/src/node_worker.cc -@@ -467,6 +467,7 @@ void Worker::New(const FunctionCallbackInfo& args) { - }); - - #ifndef NODE_WITHOUT_NODE_OPTIONS -+ if (Environment::should_read_node_options_from_env_) { - MaybeLocal maybe_node_opts = - env_vars->Get(isolate, OneByteString(isolate, "NODE_OPTIONS")); - Local node_opts; -@@ -497,6 +498,7 @@ void Worker::New(const FunctionCallbackInfo& args) { - return; - } - } -+ } - #endif - } - diff --git a/patches/node/be_compatible_with_cppgc.patch b/patches/node/be_compatible_with_cppgc.patch index 3bbc3ce0bde168..c907fff1e20a4f 100644 --- a/patches/node/be_compatible_with_cppgc.patch +++ b/patches/node/be_compatible_with_cppgc.patch @@ -83,7 +83,7 @@ index bb1e8d4b46bce3bf08f730ac5d43f7113d17ae39..6da0669943fc6465ffc47a1c8c3dadfe } diff --git a/src/base_object.h b/src/base_object.h -index d46a0f216009c63f45c440fc352b54d1ac4a08d8..81913c0d7762bf499ee19aaa3b63b986ca370bb4 100644 +index 1c63da92fd80c042d5ea729bdd70049cae51a141..3b8127e884187b21cebeabb39b60bd3010b62217 100644 --- a/src/base_object.h +++ b/src/base_object.h @@ -40,7 +40,7 @@ class TransferData; diff --git a/patches/node/build_add_gn_build_files.patch b/patches/node/build_add_gn_build_files.patch index 3d78f40a426246..d18f8e519d5a40 100644 --- a/patches/node/build_add_gn_build_files.patch +++ b/patches/node/build_add_gn_build_files.patch @@ -964,10 +964,10 @@ index 0000000000000000000000000000000000000000..2c9d2826c85bdd033f1df1d6188df636 +} diff --git a/filenames.json b/filenames.json new file mode 100644 -index 0000000000000000000000000000000000000000..ac32bd83b683b048ffde3314f4caebbc41054754 +index 0000000000000000000000000000000000000000..d2d196a59037ed32800ab6981c6a7424afb63ca5 --- /dev/null +++ b/filenames.json -@@ -0,0 +1,604 @@ +@@ -0,0 +1,612 @@ +// This file is automatically generated by generate_gn_filenames_json.py +// DO NOT EDIT +{ @@ -1191,6 +1191,7 @@ index 0000000000000000000000000000000000000000..ac32bd83b683b048ffde3314f4caebbc + "lib/internal/blob.js", + "lib/internal/socket_list.js", + "lib/internal/socketaddress.js", ++ "lib/internal/promise_hooks.js", + "lib/internal/stream_base_commons.js", + "lib/internal/url.js", + "lib/internal/async_hooks.js", @@ -1229,6 +1230,7 @@ index 0000000000000000000000000000000000000000..ac32bd83b683b048ffde3314f4caebbc + "lib/internal/webstreams/queuingstrategies.js", + "lib/internal/webstreams/encoding.js", + "lib/internal/webstreams/transformstream.js", ++ "lib/internal/webstreams/adapters.js", + "lib/internal/webstreams/transfer.js", + "lib/internal/bootstrap/loaders.js", + "lib/internal/bootstrap/pre_execution.js", @@ -1252,6 +1254,7 @@ index 0000000000000000000000000000000000000000..ac32bd83b683b048ffde3314f4caebbc + "lib/internal/streams/destroy.js", + "lib/internal/streams/legacy.js", + "lib/internal/streams/passthrough.js", ++ "lib/internal/streams/operators.js", + "lib/internal/streams/readable.js", + "lib/internal/streams/from.js", + "lib/internal/streams/writable.js", @@ -1263,6 +1266,7 @@ index 0000000000000000000000000000000000000000..ac32bd83b683b048ffde3314f4caebbc + "lib/internal/streams/lazy_transform.js", + "lib/internal/streams/duplex.js", + "lib/internal/streams/pipeline.js", ++ "lib/internal/readline/interface.js", + "lib/internal/readline/utils.js", + "lib/internal/readline/emitKeypressEvents.js", + "lib/internal/readline/callbacks.js", @@ -1300,11 +1304,14 @@ index 0000000000000000000000000000000000000000..ac32bd83b683b048ffde3314f4caebbc + "lib/internal/modules/run_main.js", + "lib/internal/modules/package_json_reader.js", + "lib/internal/modules/esm/module_job.js", ++ "lib/internal/modules/esm/assert.js", + "lib/internal/modules/esm/get_source.js", + "lib/internal/modules/esm/translators.js", + "lib/internal/modules/esm/resolve.js", + "lib/internal/modules/esm/create_dynamic_module.js", + "lib/internal/modules/esm/load.js", ++ "lib/internal/modules/esm/handle_process_exit.js", ++ "lib/internal/modules/esm/initialize_import_meta.js", + "lib/internal/modules/esm/module_map.js", + "lib/internal/modules/esm/get_format.js", + "lib/internal/modules/esm/loader.js", @@ -1565,6 +1572,7 @@ index 0000000000000000000000000000000000000000..ac32bd83b683b048ffde3314f4caebbc + "src/tracing/trace_event_common.h", + "src/tracing/traced_value.h", + "src/timer_wrap.h", ++ "src/timer_wrap-inl.h", + "src/tty_wrap.h", + "src/udp_wrap.h", + "src/util.h", @@ -1778,7 +1786,7 @@ index 0000000000000000000000000000000000000000..d1d6b51e8c0c5bc6a5d09e217eb30483 + args = rebase_path(inputs + outputs, root_build_dir) +} diff --git a/src/node_version.h b/src/node_version.h -index 31e75367f8263f575f37243475acb58bb5c40d04..8f102792fe66847dad0ba7176299cf09686cd182 100644 +index 41081f82714169f3bf388c3a8c2d9aa78e21a3f4..48c0d2655789a0528dfea0a60f756aacb48a6f60 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -89,7 +89,10 @@ @@ -1905,10 +1913,10 @@ index 0000000000000000000000000000000000000000..3088ae4bdf814ae255c9805ebd393b2e + + out_file.writelines(new_contents) diff --git a/tools/install.py b/tools/install.py -index 41cc1cbc60a9480cc08df3aa0ebe582c2becc3a2..dd13ad149f1b4cb807ca7aff62e1b15718116855 100755 +index 8a050dfa7c8b771ceb30fd2b74dc47f3de96834c..ad3bee1660de26d3502c6247f23b091171a6416c 100755 --- a/tools/install.py +++ b/tools/install.py -@@ -170,17 +170,72 @@ def files(action): +@@ -172,17 +172,72 @@ def files(action): def headers(action): def wanted_v8_headers(files_arg, dest): v8_headers = [ @@ -1991,7 +1999,7 @@ index 41cc1cbc60a9480cc08df3aa0ebe582c2becc3a2..dd13ad149f1b4cb807ca7aff62e1b157 files_arg = [name for name in files_arg if name in v8_headers] action(files_arg, dest) -@@ -201,7 +256,7 @@ def headers(action): +@@ -209,7 +264,7 @@ def headers(action): if sys.platform.startswith('aix'): action(['out/Release/node.exp'], 'include/node/') diff --git a/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch b/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch index 711d8326bb029b..519b9bf1489838 100644 --- a/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch +++ b/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch @@ -35,7 +35,7 @@ index b45af42d12ff7df8a9e125e87f51af3456811c23..c84ff7feb07aebf656ada7e37d812d9d async function* watch(filename, options = {}) { const path = toNamespacedPath(getValidatedPath(filename)); diff --git a/src/node_native_module.cc b/src/node_native_module.cc -index 006a30903184d76d6c11849784e6c6b38fd39807..edde37f281c10a1cb69db642149cc300744499cb 100644 +index 5d20e1d6a86416c0de9f01a22b992aad889078d3..c836540c7d9328ae4646097ecc18023c1d8add8f 100644 --- a/src/node_native_module.cc +++ b/src/node_native_module.cc @@ -20,6 +20,7 @@ NativeModuleLoader NativeModuleLoader::instance_; diff --git a/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch b/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch index a5087a9679b6ca..b921424c37b371 100644 --- a/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch +++ b/patches/node/chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch @@ -8,31 +8,33 @@ they use themselves as the entry point. We should try to upstream some form of this. diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js -index 4d4996e9868c35ac3e0babbf08c38d90a6857abc..419ffd9d5deb84eb94381259d3084411f6c3341b 100644 +index 3c5e6fe40070f52d8b3f4e9757485845c1d6dbed..2af6b11c97ecdca3c40792ab35c69b07b9db76a0 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js -@@ -104,10 +104,12 @@ function patchProcessObject(expandArgv1) { +@@ -95,11 +95,13 @@ function patchProcessObject(expandArgv1) { if (expandArgv1 && process.argv[1] && !StringPrototypeStartsWith(process.argv[1], '-')) { // Expand process.argv[1] into a full path. - const path = require('path'); - try { - process.argv[1] = path.resolve(process.argv[1]); -- } catch {} +- } catch { +- // Continue regardless of error. + if (!process.argv[1] || !process.argv[1].startsWith('electron/js2c')) { + const path = require('path'); + try { + process.argv[1] = path.resolve(process.argv[1]); -+ } catch {} -+ } ++ } catch { ++ // Continue regardless of error. ++ } + } } - // TODO(joyeecheung): most of these should be deprecated and removed, diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index 05a62bb3c3852536001912cb0b69fe5578ace125..37f395e9f2b7ab9ce99b0f8f4217253fcbd9175b 100644 +index caca939942cb721a3efde7005b0a987a19237a8b..2d30a56a87ff8657cddb3d9e6af5bd9f81deffdb 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -1075,6 +1075,13 @@ Module.prototype._compile = function(content, filename) { +@@ -1077,6 +1077,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. diff --git a/patches/node/chore_read_nobrowserglobals_from_global_not_process.patch b/patches/node/chore_read_nobrowserglobals_from_global_not_process.patch index 046a66f06ab2fb..a666b1d9744f7e 100644 --- a/patches/node/chore_read_nobrowserglobals_from_global_not_process.patch +++ b/patches/node/chore_read_nobrowserglobals_from_global_not_process.patch @@ -7,10 +7,10 @@ This is used so that we can modify the flag at runtime where config can only be set at compile time. diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js -index ef06d0563fa7452348754418867a56c9b8c6f4e1..a313402f93937cf2f1f93eb74422d9609e291d76 100644 +index 085dd7e09d31fb1800b3596cc068637e1956ba52..9e0f811b2a37f45a9d8162dff7c9d5c935b856d6 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js -@@ -193,7 +193,7 @@ const { +@@ -209,7 +209,7 @@ const { queueMicrotask } = require('internal/process/task_queues'); diff --git a/patches/node/darwin_bump_minimum_supported_version_to_10_15_3406.patch b/patches/node/darwin_bump_minimum_supported_version_to_10_15_3406.patch index 43023e3d022541..555ee607137d1e 100644 --- a/patches/node/darwin_bump_minimum_supported_version_to_10_15_3406.patch +++ b/patches/node/darwin_bump_minimum_supported_version_to_10_15_3406.patch @@ -11,7 +11,7 @@ Refs: https://github.com/libuv/libuv/pull/482 Refs: https://github.com/libuv/libuv/pull/3405 diff --git a/deps/uv/SUPPORTED_PLATFORMS.md b/deps/uv/SUPPORTED_PLATFORMS.md -index 30e0ea617a6fcaa5b4b7c7c5b117652e61f367d3..dc57dfb12dc7ddf8d29308ac44f46084a933d5ca 100644 +index 87e23823ad6424526fdbc2457e535875124b31cb..79509db5b17bb9e7fe245d8a0fd7fa25f8665426 100644 --- a/deps/uv/SUPPORTED_PLATFORMS.md +++ b/deps/uv/SUPPORTED_PLATFORMS.md @@ -3,7 +3,7 @@ diff --git a/patches/node/darwin_remove_eprototype_error_workaround_3405.patch b/patches/node/darwin_remove_eprototype_error_workaround_3405.patch index 60dc8b799e4b77..45d8d4936d74e4 100644 --- a/patches/node/darwin_remove_eprototype_error_workaround_3405.patch +++ b/patches/node/darwin_remove_eprototype_error_workaround_3405.patch @@ -18,7 +18,7 @@ I'm opting to simply remove the workaround and have the error bubble up. Refs: https://github.com/libuv/libuv/pull/482 diff --git a/deps/uv/src/unix/stream.c b/deps/uv/src/unix/stream.c -index bc64fe8f44b26d9f4c0d4d0d282b65cdf11a531b..1af448e7691392c3f7794eed1905d9132394e207 100644 +index 5858258d2868c3352e0e9e3313045aa29ff4a873..c5cd6ddc0b627eeb047e0cb08677f65b4601b89b 100644 --- a/deps/uv/src/unix/stream.c +++ b/deps/uv/src/unix/stream.c @@ -58,20 +58,6 @@ struct uv__stream_select_s { diff --git a/patches/node/darwin_translate_eprototype_to_econnreset_3413.patch b/patches/node/darwin_translate_eprototype_to_econnreset_3413.patch index 903921bce934bf..c6199bc4c13884 100644 --- a/patches/node/darwin_translate_eprototype_to_econnreset_3413.patch +++ b/patches/node/darwin_translate_eprototype_to_econnreset_3413.patch @@ -18,7 +18,7 @@ Refs: https://github.com/libuv/libuv/pull/482 Refs: https://github.com/libuv/libuv/pull/3405 diff --git a/deps/uv/src/unix/stream.c b/deps/uv/src/unix/stream.c -index 1af448e7691392c3f7794eed1905d9132394e207..9d22debf2bf5bd5912ade152e55a85ad652e3819 100644 +index c5cd6ddc0b627eeb047e0cb08677f65b4601b89b..b5b05a6a4a737f50b780b7c15717b4f465496fa8 100644 --- a/deps/uv/src/unix/stream.c +++ b/deps/uv/src/unix/stream.c @@ -865,6 +865,20 @@ static int uv__try_write(uv_stream_t* stream, diff --git a/patches/node/enable_31_bit_smis_on_64bit_arch_and_ptr_compression.patch b/patches/node/enable_31_bit_smis_on_64bit_arch_and_ptr_compression.patch index 3beda4a974e9fb..6b9b4d53271bab 100644 --- a/patches/node/enable_31_bit_smis_on_64bit_arch_and_ptr_compression.patch +++ b/patches/node/enable_31_bit_smis_on_64bit_arch_and_ptr_compression.patch @@ -8,7 +8,7 @@ node modules will have different (wrong) ideas about how v8 structs are laid out in memory on 64-bit machines, and will summarily fail to work. diff --git a/common.gypi b/common.gypi -index 4b6a965f65b9ad711507e4dd7ade4d54d52277cc..9e4064b263819756f17fb712a54bd6f828c5be35 100644 +index b86c3f3bbeddfa57c223ff066451fd3e1ce1315d..59e6a857060a35ca52cff2b44bc412a3f5e8eece 100644 --- a/common.gypi +++ b/common.gypi @@ -64,7 +64,7 @@ diff --git a/patches/node/feat_add_flags_for_low-level_hooks_and_exceptions.patch b/patches/node/feat_add_flags_for_low-level_hooks_and_exceptions.patch deleted file mode 100644 index bfe9ef5ec6ade6..00000000000000 --- a/patches/node/feat_add_flags_for_low-level_hooks_and_exceptions.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Thu, 13 Sep 2018 08:42:22 -0700 -Subject: feat: add flags for low-level hooks and exceptions - -This commit adds two new exposed methods to `node.cc`, `InitGeneric` and -`LoadEnvironmentGeneric` that allow for control of which mode Node -should run, which i have called `standalone_mode` and -`upstream_node_mode`. Default behavior of `Init` and `LoadEnvironment` -remain the same. - -We have 3 modes when running Node in Electron: -1. In the main process, we want to have a full Node environment, but -with signal handlers and other low level things disabled -2. In renderer process, we want Node to reuse the web page's context -3. In `ELECTRON_RUN_AS_NODE`, we want Node to run as it runs officially -by default - -For modes 1 and 3, we have Node create a new V8 context with a Node -Environment on it. However, for mode 2, since the V8 context is created -by blink for web frames and web workers we make Node create the Node -Environment on the V8 context of blink, so no new V8 context is created. - -As a result, a renderer process may have multiple Node Environments in it. - -diff --git a/src/node.cc b/src/node.cc -index e942c108a15a3c50d92c08b344f6691050c7859d..207a95d202b4e422a39f837241f1655f7111b1e3 100644 ---- a/src/node.cc -+++ b/src/node.cc -@@ -139,6 +139,8 @@ using v8::Undefined; - using v8::V8; - using v8::Value; - -+bool g_upstream_node_mode = true; -+ - namespace per_process { - - // node_revert.h -@@ -853,7 +855,9 @@ int InitializeNodeWithArgs(std::vector* argv, - binding::RegisterBuiltinModules(); - - // Make inherited handles noninheritable. -- uv_disable_stdio_inheritance(); -+ if (g_upstream_node_mode) { -+ uv_disable_stdio_inheritance(); -+ } - - // Cache the original command line to be - // used in diagnostic reports. -@@ -887,7 +891,8 @@ int InitializeNodeWithArgs(std::vector* argv, - if (exit_code != 0) return exit_code; - } - #endif -- -+ if (g_upstream_node_mode) { -+ // NOTE(jeremy): indentation is intentionally wrong here, to ease rebasing. - const int exit_code = ProcessGlobalArgs(argv, - exec_argv, - errors, -@@ -930,7 +935,7 @@ int InitializeNodeWithArgs(std::vector* argv, - return 9; - } - per_process::metadata.versions.InitializeIntlVersions(); -- -+ } // g_upstream_node_mode - # ifndef __POSIX__ - std::string tz; - if (credentials::SafeGetenv("TZ", &tz) && !tz.empty()) { -diff --git a/src/node.h b/src/node.h -index 1f9afa558d0c8b7950a0f5862017e09a08118ec1..45de72bd94cf669ac2badf89d23164cb7022a5b3 100644 ---- a/src/node.h -+++ b/src/node.h -@@ -213,6 +213,8 @@ namespace node { - - class IsolateData; - class Environment; -+// Whether node should open some low level hooks. -+NODE_EXTERN extern bool g_upstream_node_mode; - - // TODO(addaleax): Officially deprecate this and replace it with something - // better suited for a public embedder API. diff --git a/patches/node/feat_add_uv_loop_watcher_queue_code.patch b/patches/node/feat_add_uv_loop_watcher_queue_code.patch index 610da58034be2c..49468ed2ae2fe2 100644 --- a/patches/node/feat_add_uv_loop_watcher_queue_code.patch +++ b/patches/node/feat_add_uv_loop_watcher_queue_code.patch @@ -6,10 +6,10 @@ Subject: feat: add uv_loop watcher_queue code Electron's Node Integration works by listening to Node's backend file descriptor in a separate thread; when an event is ready the backend file descriptor will trigger a new event for it, and the main thread will then iterate the libuv loop. For certain operations (ex. adding a timeout task) the backend file descriptor isn't informed, & as a result the main thread doesn't know it needs to iterate the libuv loop so the timeout task will never execute until something else trigger a new event. This commit should be removed when https://github.com/libuv/libuv/pull/1921 is merged diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h -index 77503bde9f28e4769ae3832fb2117e632e9c9268..49930027bdad013d8fcbc375c534d67cc5201bc7 100644 +index 606083c87de5790d7e66fc34aeaae9a58acb8ef4..ca9568c58b1ccd554318f5deb27d2b4e80f08a28 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h -@@ -1802,6 +1802,8 @@ union uv_any_req { +@@ -1805,6 +1805,8 @@ union uv_any_req { struct uv_loop_s { /* User data - use this for whatever. */ void* data; diff --git a/patches/node/feat_initialize_asar_support.patch b/patches/node/feat_initialize_asar_support.patch index b32de0a339035c..350139338d2338 100644 --- a/patches/node/feat_initialize_asar_support.patch +++ b/patches/node/feat_initialize_asar_support.patch @@ -6,7 +6,7 @@ Subject: feat: initialize asar support This patch initializes asar support in Node.js. diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js -index f2a10641906e317270e7f27f4ee3ee1956802113..4d4996e9868c35ac3e0babbf08c38d90a6857abc 100644 +index f21ba048b4863863e6c7b740f410775776a7649a..3c5e6fe40070f52d8b3f4e9757485845c1d6dbed 100644 --- a/lib/internal/bootstrap/pre_execution.js +++ b/lib/internal/bootstrap/pre_execution.js @@ -76,6 +76,7 @@ function prepareMainThreadExecution(expandArgv1 = false) { @@ -17,7 +17,7 @@ index f2a10641906e317270e7f27f4ee3ee1956802113..4d4996e9868c35ac3e0babbf08c38d90 } function patchProcessObject(expandArgv1) { -@@ -484,6 +485,10 @@ function loadPreloadModules() { +@@ -477,6 +478,10 @@ function loadPreloadModules() { } } diff --git a/patches/node/fix_account_for_debugger_agent_race_condition.patch b/patches/node/fix_account_for_debugger_agent_race_condition.patch index e2c4b5401c958b..f4f70161ba85a8 100644 --- a/patches/node/fix_account_for_debugger_agent_race_condition.patch +++ b/patches/node/fix_account_for_debugger_agent_race_condition.patch @@ -10,7 +10,7 @@ errors. This is remedied by adding a small timeout to the test. We'll either upstream this or figure out a better solution. diff --git a/test/parallel/test-debugger-address.js b/test/parallel/test-debugger-address.js -index 95dd1c6e3f82835d5ccaf65544d654b71efaa392..ed8dccf91247068455dd593bb3e8c02bddc89ae5 100644 +index bffc28ac916e8d241465f1e2649ab8aa4a15a0c7..079e668a3d1c505fa0a540fb1df87b32e603db48 100644 --- a/test/parallel/test-debugger-address.js +++ b/test/parallel/test-debugger-address.js @@ -59,6 +59,7 @@ function launchTarget(...args) { @@ -22,7 +22,7 @@ index 95dd1c6e3f82835d5ccaf65544d654b71efaa392..ed8dccf91247068455dd593bb3e8c02b .then(() => cli.waitFor(/break/)) .then(() => cli.waitForPrompt()) diff --git a/test/sequential/test-debugger-pid.js b/test/sequential/test-debugger-pid.js -index 402c1f86dd4ed99b413eca5fce8a2db47797b11a..74ef0a1618ccf1f6671bbe2a03548eee6cd0b88c 100644 +index 0056113ecaecd3a176ee9539b7fda0132ef59963..3228d0ecc220b5c8c8034fea0dce20f8c38ac68c 100644 --- a/test/sequential/test-debugger-pid.js +++ b/test/sequential/test-debugger-pid.js @@ -41,6 +41,7 @@ function launchTarget(...args) { diff --git a/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch b/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch index fc9a9c0e2182d6..32787013571529 100644 --- a/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch +++ b/patches/node/fix_add_default_values_for_variables_in_common_gypi.patch @@ -7,7 +7,7 @@ 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 b8d61f0d32709f3476dd2fd870d3959ab8f16a60..4b6a965f65b9ad711507e4dd7ade4d54d52277cc 100644 +index be30169cf58d9759320f1763ede7e0ce89be3aa2..b86c3f3bbeddfa57c223ff066451fd3e1ce1315d 100644 --- a/common.gypi +++ b/common.gypi @@ -81,6 +81,23 @@ diff --git a/patches/node/fix_add_v8_enable_reverse_jsargs_defines_in_common_gypi.patch b/patches/node/fix_add_v8_enable_reverse_jsargs_defines_in_common_gypi.patch index 7b1e9bff157a11..cc2b2f0f7cbb48 100644 --- a/patches/node/fix_add_v8_enable_reverse_jsargs_defines_in_common_gypi.patch +++ b/patches/node/fix_add_v8_enable_reverse_jsargs_defines_in_common_gypi.patch @@ -6,7 +6,7 @@ Subject: fix: add v8_enable_reverse_jsargs defines in common.gypi This can be removed once node upgrades V8 and inevitably has to do this exact same thing. Also hi node people if you are looking at this. diff --git a/common.gypi b/common.gypi -index 9e4064b263819756f17fb712a54bd6f828c5be35..2e59efb38d95231fcbcbb5a7859a6cfad3cf232c 100644 +index 59e6a857060a35ca52cff2b44bc412a3f5e8eece..7741f97758282d1c601eecf263cb4ce1510be284 100644 --- a/common.gypi +++ b/common.gypi @@ -65,6 +65,7 @@ @@ -25,7 +25,7 @@ index 9e4064b263819756f17fb712a54bd6f828c5be35..2e59efb38d95231fcbcbb5a7859a6cfa ##### end V8 defaults ##### # When building native modules using 'npm install' with the system npm, -@@ -390,6 +392,9 @@ +@@ -398,6 +400,9 @@ ['v8_enable_pointer_compression == 1 or v8_enable_31bit_smis_on_64bit_arch == 1', { 'defines': ['V8_31BIT_SMIS_ON_64BIT_ARCH'], }], diff --git a/patches/node/fix_allow_preventing_initializeinspector_in_env.patch b/patches/node/fix_allow_preventing_initializeinspector_in_env.patch index e018f2af594421..8cfa46d3819e0c 100644 --- a/patches/node/fix_allow_preventing_initializeinspector_in_env.patch +++ b/patches/node/fix_allow_preventing_initializeinspector_in_env.patch @@ -36,10 +36,10 @@ index 523d252e08974a10f9a53fb46d3345669cec3380..5bf19a0dda42849159d954181058897c #endif diff --git a/src/env-inl.h b/src/env-inl.h -index 1e85bc07a4cc29f3b380da3c0e217a85309eb3a5..845e00208af4b12960ed8b3f3926323af7685185 100644 +index e679780900abc9f6b6d1d6baa52576df278be8c7..2da8174fe9e4209f4705af0a1cf8bca5928f088c 100644 --- a/src/env-inl.h +++ b/src/env-inl.h -@@ -892,6 +892,10 @@ inline bool Environment::no_global_search_paths() const { +@@ -882,6 +882,10 @@ inline bool Environment::no_global_search_paths() const { !options_->global_search_paths; } @@ -51,10 +51,10 @@ index 1e85bc07a4cc29f3b380da3c0e217a85309eb3a5..845e00208af4b12960ed8b3f3926323a return emit_filehandle_warning_; } diff --git a/src/env.h b/src/env.h -index 0c3715151488f425a723618252e1277b78fafe5f..e0deca497feb111622b257b952c9ed9161c7d001 100644 +index 7aa5822abf11f1858d1ef8551cfc7a8c3d931f1e..2554c530f2ca7078ed0cca03968b31f56027231b 100644 --- a/src/env.h +++ b/src/env.h -@@ -1204,6 +1204,7 @@ class Environment : public MemoryRetainer { +@@ -1215,6 +1215,7 @@ class Environment : public MemoryRetainer { inline bool tracks_unmanaged_fds() const; inline bool hide_console_windows() const; inline bool no_global_search_paths() const; @@ -63,10 +63,10 @@ index 0c3715151488f425a723618252e1277b78fafe5f..e0deca497feb111622b257b952c9ed91 inline worker::Worker* worker_context() const; Environment* worker_parent_env() const; diff --git a/src/node.h b/src/node.h -index 364f789fbcbec8e3234961294698d8e69b04a310..85b5ac6a5a5cb5e4388a92a1d07c9afe17140a8c 100644 +index 70518ba49b3bcbfaf2e46ba8ddc3f04236bc27b8..7ca7502e086190c87ae6a61dca2192253894e906 100644 --- a/src/node.h +++ b/src/node.h -@@ -420,7 +420,11 @@ enum Flags : uint64_t { +@@ -439,7 +439,11 @@ enum Flags : uint64_t { // $HOME/.node_modules and $NODE_PATH. This is used by standalone apps that // do not expect to have their behaviors changed because of globally // installed modules. diff --git a/patches/node/fix_crash_caused_by_gethostnamew_on_windows_7.patch b/patches/node/fix_crash_caused_by_gethostnamew_on_windows_7.patch index eb24c26a805cb8..5ebadbf25bec8d 100644 --- a/patches/node/fix_crash_caused_by_gethostnamew_on_windows_7.patch +++ b/patches/node/fix_crash_caused_by_gethostnamew_on_windows_7.patch @@ -6,7 +6,7 @@ Subject: fix: crash caused by GetHostNameW on Windows 7 Backported from https://github.com/libuv/libuv/pull/3285. diff --git a/deps/uv/src/win/util.c b/deps/uv/src/win/util.c -index 88602c7ee8623f16f87398cf3ffd1f71555fc1a0..5ffde08e1aed041c4da679156ed10f7e54bfc386 100644 +index 33e874ac442f88b58d2b68c8ec9764f6f664552e..2d4cc0aaa02e61bf359e80eca27527efb49fd85e 100644 --- a/deps/uv/src/win/util.c +++ b/deps/uv/src/win/util.c @@ -37,6 +37,7 @@ @@ -166,69 +166,3 @@ index 88602c7ee8623f16f87398cf3ffd1f71555fc1a0..5ffde08e1aed041c4da679156ed10f7e int uv_os_gethostname(char* buffer, size_t* size) { WCHAR buf[UV_MAXHOSTNAMESIZE]; size_t len; -@@ -1674,7 +1803,9 @@ int uv_os_gethostname(char* buffer, size_t* size) { - - uv__once_init(); /* Initialize winsock */ - -- if (GetHostNameW(buf, UV_MAXHOSTNAMESIZE) != 0) -+ sGetHostNameW gethostnamew = -+ pGetHostNameW == NULL ? uv__gethostnamew_nt60 : pGetHostNameW; -+ if (gethostnamew(buf, UV_MAXHOSTNAMESIZE) != 0) - return uv_translate_sys_error(WSAGetLastError()); - - convert_result = uv__convert_utf16_to_utf8(buf, -1, &utf8_str); -diff --git a/deps/uv/src/win/winapi.c b/deps/uv/src/win/winapi.c -index bb86ec8ceac8ba3fccd02b292aca7ddfab38e187..9d6effb10ddd1801f7411ee71a70575b7072ab7d 100644 ---- a/deps/uv/src/win/winapi.c -+++ b/deps/uv/src/win/winapi.c -@@ -45,12 +45,15 @@ sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotification; - /* User32.dll function pointer */ - sSetWinEventHook pSetWinEventHook; - -+/* ws2_32.dll function pointer */ -+sGetHostNameW pGetHostNameW; - - void uv_winapi_init(void) { - HMODULE ntdll_module; - HMODULE powrprof_module; - HMODULE user32_module; - HMODULE kernel32_module; -+ HMODULE ws2_32_module;; - - ntdll_module = GetModuleHandleA("ntdll.dll"); - if (ntdll_module == NULL) { -@@ -134,4 +137,10 @@ void uv_winapi_init(void) { - pSetWinEventHook = (sSetWinEventHook) - GetProcAddress(user32_module, "SetWinEventHook"); - } -+ -+ ws2_32_module = LoadLibraryA("ws2_32.dll"); -+ if (ws2_32_module != NULL) { -+ pGetHostNameW = (sGetHostNameW) -+ GetProcAddress(ws2_32_module, "GetHostNameW"); -+ } - } -diff --git a/deps/uv/src/win/winapi.h b/deps/uv/src/win/winapi.h -index 0b66b5634bca88cec65b1bf0c0193986f5ddd542..5951717ab9e21db274f956c44410cc03c1617eaf 100644 ---- a/deps/uv/src/win/winapi.h -+++ b/deps/uv/src/win/winapi.h -@@ -4739,6 +4739,11 @@ typedef struct _TCP_INITIAL_RTO_PARAMETERS { - # define SIO_TCP_INITIAL_RTO _WSAIOW(IOC_VENDOR,17) - #endif - -+/* From winsock2.h */ -+typedef int (WSAAPI *sGetHostNameW) -+ (PWSTR name, -+ int namelen); -+ - /* Ntdll function pointers */ - extern sRtlGetVersion pRtlGetVersion; - extern sRtlNtStatusToDosError pRtlNtStatusToDosError; -@@ -4759,4 +4764,7 @@ extern sPowerRegisterSuspendResumeNotification pPowerRegisterSuspendResumeNotifi - /* User32.dll function pointer */ - extern sSetWinEventHook pSetWinEventHook; - -+/* ws2_32.dll function pointer */ -+extern sGetHostNameW pGetHostNameW; -+ - #endif /* UV_WIN_WINAPI_H_ */ diff --git a/patches/node/fix_crypto_tests_to_run_with_bssl.patch b/patches/node/fix_crypto_tests_to_run_with_bssl.patch index 7774100703837a..20e89d87ef6bec 100644 --- a/patches/node/fix_crypto_tests_to_run_with_bssl.patch +++ b/patches/node/fix_crypto_tests_to_run_with_bssl.patch @@ -590,7 +590,7 @@ index 9afcb38616dafd6da1ab7b5843d68f4f796ca9a6..00d3381056a5a40c549f06d74c130149 } +*/ diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js -index 6893f0c0e6d49a8e171ec9f156f74656dab9fd06..4c8ccd10e0dcd64669cccca1e8c2e5279d683595 100644 +index b2c14b1efcd68bd20e9c946106f1ab5fb58627c5..eef0bfe638b641c68fdadd95226a74df044921cb 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js @@ -29,6 +29,7 @@ const keySize = 2048; @@ -673,20 +673,19 @@ index 008ab129f0e019c659eecf5a76b7eb412c947fe3..6688f5d916f50e1e4fcfff1619c8634a cipher.end('Papaya!'); // Should not cause an unhandled exception. diff --git a/test/parallel/test-crypto-x509.js b/test/parallel/test-crypto-x509.js -index c85a79b4854369e35fbe89833e9df9a12065671e..8f13ac60362854d12264f26b74533bd55efd6605 100644 +index d1782359277dc52d7a60830a6dd958544d610e6b..4c781f062bc505b860b821773070551f4cd80067 100644 --- a/test/parallel/test-crypto-x509.js +++ b/test/parallel/test-crypto-x509.js -@@ -104,7 +104,8 @@ const der = Buffer.from( - '84:AC:5B:08:9A:20:89:B6:8F:D6' +@@ -110,7 +110,7 @@ const der = Buffer.from( + 'A3:06:C5:CE:43:C1:7F:2D:7E:5F:44:A5:EE:A3:CB:97:05:A3:E3:68' ); assert.strictEqual(x509.keyUsage, undefined); - assert.strictEqual(x509.serialNumber, 'ECC9B856270DA9A8'); -+ + assert.match(x509.serialNumber, /ECC9B856270DA9A8/i); assert.deepStrictEqual(x509.raw, der); -@@ -190,6 +191,12 @@ const der = Buffer.from( +@@ -196,6 +196,12 @@ const der = Buffer.from( }); mc.port2.postMessage(x509); @@ -699,7 +698,7 @@ index c85a79b4854369e35fbe89833e9df9a12065671e..8f13ac60362854d12264f26b74533bd5 // Verify that legacy encoding works const legacyObjectCheck = { subject: 'C=US\n' + -@@ -213,11 +220,7 @@ const der = Buffer.from( +@@ -219,11 +225,7 @@ const der = Buffer.from( 'CA Issuers - URI:http://ca.nodejs.org/ca.cert' : 'OCSP - URI:http://ocsp.nodejs.org/\n' + 'CA Issuers - URI:http://ca.nodejs.org/ca.cert\n', @@ -712,16 +711,16 @@ index c85a79b4854369e35fbe89833e9df9a12065671e..8f13ac60362854d12264f26b74533bd5 bits: 1024, exponent: '0x10001', valid_from: 'Nov 16 18:42:21 2018 GMT', -@@ -226,7 +229,7 @@ const der = Buffer.from( - fingerprint256: - 'B0:BE:46:49:B8:29:63:E0:6F:63:C8:8A:57:9C:3F:9B:72:' + - 'C6:F5:89:E3:0D:84:AC:5B:08:9A:20:89:B6:8F:D6', +@@ -237,7 +239,7 @@ const der = Buffer.from( + 'D0:39:97:54:B6:D0:B4:46:5B:DE:13:5B:68:86:B6:F2:A8:' + + '95:22:D5:6E:8B:35:DA:89:29:CA:A3:06:C5:CE:43:C1:7F:' + + '2D:7E:5F:44:A5:EE:A3:CB:97:05:A3:E3:68', - serialNumber: 'ECC9B856270DA9A8' + serialNumberPattern: /ECC9B856270DA9A8/i }; const legacyObject = x509.toLegacyObject(); -@@ -235,7 +238,7 @@ const der = Buffer.from( +@@ -246,7 +248,7 @@ const der = Buffer.from( assert.strictEqual(legacyObject.subject, legacyObjectCheck.subject); assert.strictEqual(legacyObject.issuer, legacyObjectCheck.issuer); assert.strictEqual(legacyObject.infoAccess, legacyObjectCheck.infoAccess); @@ -730,7 +729,7 @@ index c85a79b4854369e35fbe89833e9df9a12065671e..8f13ac60362854d12264f26b74533bd5 assert.strictEqual(legacyObject.bits, legacyObjectCheck.bits); assert.strictEqual(legacyObject.exponent, legacyObjectCheck.exponent); assert.strictEqual(legacyObject.valid_from, legacyObjectCheck.valid_from); -@@ -244,7 +247,5 @@ const der = Buffer.from( +@@ -255,7 +257,5 @@ const der = Buffer.from( assert.strictEqual( legacyObject.fingerprint256, legacyObjectCheck.fingerprint256); diff --git a/patches/node/fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch b/patches/node/fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch index 8c641431ad5cc4..97e7fb79cfe5a9 100644 --- a/patches/node/fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch +++ b/patches/node/fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch @@ -22,7 +22,7 @@ index 0fb750c5abbe00740f2095ec397c823e26666199..523d252e08974a10f9a53fb46d334566 int thread_pool_size, node::tracing::TracingController* tracing_controller) { diff --git a/src/node.h b/src/node.h -index 45de72bd94cf669ac2badf89d23164cb7022a5b3..364f789fbcbec8e3234961294698d8e69b04a310 100644 +index 5b1404ff8e290a505a1143b582494e9a3319a183..70518ba49b3bcbfaf2e46ba8ddc3f04236bc27b8 100644 --- a/src/node.h +++ b/src/node.h @@ -118,6 +118,7 @@ namespace node { @@ -33,7 +33,7 @@ index 45de72bd94cf669ac2badf89d23164cb7022a5b3..364f789fbcbec8e3234961294698d8e6 class TracingController; } -@@ -499,6 +500,8 @@ NODE_EXTERN v8::MaybeLocal PrepareStackTraceCallback( +@@ -518,6 +519,8 @@ NODE_EXTERN v8::MaybeLocal PrepareStackTraceCallback( NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(Environment* env); NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env); diff --git a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch index a91c0a3cdd9490..f7b4c08817e126 100644 --- a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch +++ b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch @@ -17,7 +17,7 @@ Upstreams: - https://github.com/nodejs/node/pull/39136 diff --git a/src/crypto/crypto_common.cc b/src/crypto/crypto_common.cc -index fe828bafa6422cc1f1717afddbd4b199055e9c43..74c56954e5e2d8efc3d8495860addc0138f39f3a 100644 +index f830da2cfba18ae2f7ad02fa862122780c956c80..51b26af969d5c84c741563297fda45426038d199 100644 --- a/src/crypto/crypto_common.cc +++ b/src/crypto/crypto_common.cc @@ -176,7 +176,7 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { @@ -66,7 +66,7 @@ index fe828bafa6422cc1f1717afddbd4b199055e9c43..74c56954e5e2d8efc3d8495860addc01 } const char* X509ErrorCode(long err) { // NOLINT(runtime/int) -@@ -1117,14 +1124,14 @@ MaybeLocal GetClientHelloCiphers( +@@ -1126,14 +1133,14 @@ MaybeLocal GetClientHelloCiphers( Environment* env, const SSLPointer& ssl) { EscapableHandleScope scope(env->isolate()); @@ -86,10 +86,10 @@ index fe828bafa6422cc1f1717afddbd4b199055e9c43..74c56954e5e2d8efc3d8495860addc01 if (!Set(env->context(), obj, diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc -index 7e99759654e8b9272c48e0e6c0637f4327dc1615..612ed87ce396e285719a9efc8c346adb6d29b366 100644 +index b6ef5e5b1e004e663fbfd2578b82644cb53051e0..1d48ea6d022304b1e6a4f703fea790437edcc876 100644 --- a/src/crypto/crypto_dh.cc +++ b/src/crypto/crypto_dh.cc -@@ -144,13 +144,11 @@ void DiffieHellman::MemoryInfo(MemoryTracker* tracker) const { +@@ -143,13 +143,11 @@ void DiffieHellman::MemoryInfo(MemoryTracker* tracker) const { bool DiffieHellman::Init(const char* p, int p_len, int g) { dh_.reset(DH_new()); if (p_len <= 0) { @@ -105,7 +105,7 @@ index 7e99759654e8b9272c48e0e6c0637f4327dc1615..612ed87ce396e285719a9efc8c346adb return false; } BIGNUM* bn_p = -@@ -168,21 +166,18 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) { +@@ -167,21 +165,18 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) { bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) { dh_.reset(DH_new()); if (p_len <= 0) { @@ -130,7 +130,7 @@ index 7e99759654e8b9272c48e0e6c0637f4327dc1615..612ed87ce396e285719a9efc8c346adb return false; } BIGNUM* bn_p = -@@ -502,16 +497,20 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { +@@ -501,16 +496,20 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { if (!BN_set_word(bn_g.get(), params->params.generator) || !DH_set0_pqg(dh.get(), prime, nullptr, bn_g.get())) return EVPKeyCtxPointer(); @@ -152,7 +152,7 @@ index 7e99759654e8b9272c48e0e6c0637f4327dc1615..612ed87ce396e285719a9efc8c346adb if (!param_ctx || EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 || EVP_PKEY_CTX_set_dh_paramgen_prime_len( -@@ -523,8 +522,10 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { +@@ -522,8 +521,10 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { EVP_PKEY_paramgen(param_ctx.get(), &raw_params) <= 0) { return EVPKeyCtxPointer(); } @@ -244,10 +244,10 @@ index ae4550e9fde8120c35409e495d5b763a95546509..188a7efe76df2a1aa2eb2746f4d74836 if (target diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc -index fec0a493c985f1fb716dd6222e438b430947f2a1..1a7d26ad134b094d02023c99934b8ac7a4bb18d7 100644 +index e1ef170a9f17634d218492a2ce888c3a4365e097..8dffad89c80e0906780d1b26ba9a65ba1e76ce0a 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc -@@ -503,24 +503,14 @@ Maybe Decorate(Environment* env, Local obj, +@@ -508,24 +508,14 @@ Maybe Decorate(Environment* env, Local obj, V(BIO) \ V(PKCS7) \ V(X509V3) \ @@ -272,7 +272,7 @@ index fec0a493c985f1fb716dd6222e438b430947f2a1..1a7d26ad134b094d02023c99934b8ac7 V(USER) \ #define V(name) case ERR_LIB_##name: lib = #name "_"; break; -@@ -680,7 +670,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -684,7 +674,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { CHECK(args[0]->IsUint32()); Environment* env = Environment::GetCurrent(args); uint32_t len = args[0].As()->Value(); @@ -281,7 +281,7 @@ index fec0a493c985f1fb716dd6222e438b430947f2a1..1a7d26ad134b094d02023c99934b8ac7 if (data == nullptr) { // There's no memory available for the allocation. // Return nothing. -@@ -692,7 +682,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -696,7 +686,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { data, len, [](void* data, size_t len, void* deleter_data) { @@ -290,7 +290,7 @@ index fec0a493c985f1fb716dd6222e438b430947f2a1..1a7d26ad134b094d02023c99934b8ac7 }, data); Local buffer = ArrayBuffer::New(env->isolate(), store); -@@ -700,10 +690,12 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -704,10 +694,12 @@ void SecureBuffer(const FunctionCallbackInfo& args) { } void SecureHeapUsed(const FunctionCallbackInfo& args) { @@ -304,7 +304,7 @@ index fec0a493c985f1fb716dd6222e438b430947f2a1..1a7d26ad134b094d02023c99934b8ac7 } // namespace diff --git a/src/crypto/crypto_util.h b/src/crypto/crypto_util.h -index 463a19f516d23fdb56eb83025f4a3f2b3f4a426b..86e66e29ee644f86cb8ac20f37061fc03dc3099b 100644 +index 5060fc3f2fbd67d8b33975f2512cbd7cf7fedf1a..4f86810f8366b490ca2293cd1a811e69a199f708 100644 --- a/src/crypto/crypto_util.h +++ b/src/crypto/crypto_util.h @@ -16,7 +16,9 @@ diff --git a/patches/node/fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch b/patches/node/fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch index 1613f28863fd0a..bb7df671a39574 100644 --- a/patches/node/fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch +++ b/patches/node/fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch @@ -6,10 +6,10 @@ Subject: fix: suppress clang -Wdeprecated-declarations in libuv Should be upstreamed. diff --git a/deps/uv/src/win/util.c b/deps/uv/src/win/util.c -index 5ffde08e1aed041c4da679156ed10f7e54bfc386..69aff95f68519acc8fc399c4358702b146f802ca 100644 +index 2d4cc0aaa02e61bf359e80eca27527efb49fd85e..aaa16052e2a9c7d1dca82763c41c0890371f1471 100644 --- a/deps/uv/src/win/util.c +++ b/deps/uv/src/win/util.c -@@ -1949,10 +1949,17 @@ int uv_os_uname(uv_utsname_t* buffer) { +@@ -1950,10 +1950,17 @@ int uv_os_uname(uv_utsname_t* buffer) { #ifdef _MSC_VER #pragma warning(suppress : 4996) #endif diff --git a/patches/node/pass_all_globals_through_require.patch b/patches/node/pass_all_globals_through_require.patch index e0ef037d54b9e7..ee776addc06a72 100644 --- a/patches/node/pass_all_globals_through_require.patch +++ b/patches/node/pass_all_globals_through_require.patch @@ -6,7 +6,7 @@ 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 b8eff0440624a41d89a39c46303fa51d581bf4bf..67eb7717f13379312721fc4da2e760bc08d8ed3a 100644 +index cfe2982bf22c245d3249a743e341c9948d98c18b..2c188ae0b5cb86493a7fd701c343b36370369f20 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -127,6 +127,13 @@ const { @@ -23,7 +23,7 @@ index b8eff0440624a41d89a39c46303fa51d581bf4bf..67eb7717f13379312721fc4da2e760bc const { isProxy } = require('internal/util/types'); -@@ -1096,10 +1103,12 @@ Module.prototype._compile = function(content, filename) { +@@ -1098,10 +1105,12 @@ Module.prototype._compile = function(content, filename) { if (requireDepth === 0) statCache = new SafeMap(); if (inspectorWrapper) { result = inspectorWrapper(compiledWrapper, thisValue, exports, diff --git a/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch b/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch index 1eccad9b31b622..ff492a0b6b9b01 100644 --- a/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch +++ b/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch @@ -7,10 +7,10 @@ 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 58f7396990dddb7dd4cf3d23fcdcc1d48f52623e..ef06d0563fa7452348754418867a56c9b8c6f4e1 100644 +index 1393cc20f45db69c9e133e25ac9428fcb6d81100..085dd7e09d31fb1800b3596cc068637e1956ba52 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js -@@ -62,6 +62,10 @@ setupBuffer(); +@@ -66,6 +66,10 @@ setupBuffer(); process.domain = null; process._exiting = false; @@ -22,7 +22,7 @@ index 58f7396990dddb7dd4cf3d23fcdcc1d48f52623e..ef06d0563fa7452348754418867a56c9 const nativeModule = internalBinding('native_module'); diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index 67eb7717f13379312721fc4da2e760bc08d8ed3a..05a62bb3c3852536001912cb0b69fe5578ace125 100644 +index 2c188ae0b5cb86493a7fd701c343b36370369f20..caca939942cb721a3efde7005b0a987a19237a8b 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -86,7 +86,7 @@ const fs = require('fs'); diff --git a/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch b/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch index 686eb257df5090..67c1845b31c135 100644 --- a/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch +++ b/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch @@ -7,10 +7,10 @@ Subject: refactor: alter child_process.fork to use execute script with When forking a child script, we setup a special environment to make the Electron binary run like the upstream node. On Mac, we use the helper app as node binary. diff --git a/lib/child_process.js b/lib/child_process.js -index 62c552d567eaad07ffe65ea5cb24be101b57ebdd..73c11500d7e4a540f26cc7ee3b692a2f4b158b19 100644 +index a7ef8ba1e4af1aaabf88ea424b0a101397f7eb16..9cd99a7440ee4d2273fe94a0d51b4bf4051f612d 100644 --- a/lib/child_process.js +++ b/lib/child_process.js -@@ -161,6 +161,15 @@ function fork(modulePath /* , args, options */) { +@@ -160,6 +160,15 @@ function fork(modulePath, args = [], options) { throw new ERR_CHILD_PROCESS_IPC_REQUIRED('options.stdio'); } diff --git a/patches/node/repl_fix_crash_when_sharedarraybuffer_disabled.patch b/patches/node/repl_fix_crash_when_sharedarraybuffer_disabled.patch index fe3a805081ff79..510461bd8a1be7 100644 --- a/patches/node/repl_fix_crash_when_sharedarraybuffer_disabled.patch +++ b/patches/node/repl_fix_crash_when_sharedarraybuffer_disabled.patch @@ -25,7 +25,7 @@ index a771b1813731edf4f0dd60f3505799e389f1d876..b9461677e2d7d1df192e752496e62cca bench.start(); for (let i = 0; i < n; i++) diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js -index 71a07a63a3636ab211746004ebab24a0058b08fc..e3ce67987ee3185a93750ebad72beab304c71e3a 100644 +index 65827ecd593ffb050484152fc6d31411fd3e4dcc..2e5d6b01d86e34549c1c7a3d3128350cad2b0c47 100644 --- a/lib/internal/main/worker_thread.js +++ b/lib/internal/main/worker_thread.js @@ -9,7 +9,7 @@ const { diff --git a/patches/node/src_allow_embedders_to_provide_a_custom_pageallocator_to.patch b/patches/node/src_allow_embedders_to_provide_a_custom_pageallocator_to.patch index 455cc74afe3e69..08195a21f54d58 100644 --- a/patches/node/src_allow_embedders_to_provide_a_custom_pageallocator_to.patch +++ b/patches/node/src_allow_embedders_to_provide_a_custom_pageallocator_to.patch @@ -40,10 +40,10 @@ index 5bf19a0dda42849159d954181058897c45d280fd..03078ff3869fcd17101f1cdaf77f725d MaybeLocal GetPerContextExports(Local context) { diff --git a/src/node.h b/src/node.h -index 85b5ac6a5a5cb5e4388a92a1d07c9afe17140a8c..4201c0d0460b032721ef42a26d79c38a9ee20c24 100644 +index 7ca7502e086190c87ae6a61dca2192253894e906..b2b766f242e02593631be087fceaf63f71d74284 100644 --- a/src/node.h +++ b/src/node.h -@@ -313,7 +313,8 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform { +@@ -332,7 +332,8 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform { static std::unique_ptr Create( int thread_pool_size, @@ -53,7 +53,7 @@ index 85b5ac6a5a5cb5e4388a92a1d07c9afe17140a8c..4201c0d0460b032721ef42a26d79c38a }; enum IsolateSettingsFlags { -@@ -509,7 +510,8 @@ NODE_EXTERN node::tracing::Agent* CreateAgent(); +@@ -528,7 +529,8 @@ NODE_EXTERN node::tracing::Agent* CreateAgent(); NODE_DEPRECATED("Use MultiIsolatePlatform::Create() instead", NODE_EXTERN MultiIsolatePlatform* CreatePlatform( int thread_pool_size, diff --git a/patches/node/test_add_fixture_trim_option.patch b/patches/node/test_add_fixture_trim_option.patch deleted file mode 100644 index 8a20a9354c0892..00000000000000 --- a/patches/node/test_add_fixture_trim_option.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Mon, 8 Nov 2021 15:52:17 +0100 -Subject: test: add fixture trim option - -Fixes a spec failure originating with a strict requirement in BoringSSL -that base64 strings be evenly divisible by 4 in their implementation of -`NETSCAPE_SPKI_b64_decode`. - -Fixes that issue by trimming the newlines out of the file. - -Upstreamed at https://github.com/nodejs/node/pull/40757. - -diff --git a/test/common/fixtures.js b/test/common/fixtures.js -index e5e1d887df525e493989a4aa8df6952a0e5b6c47..2da8aeb6a694e4b45d76bc3908284783d83f6755 100644 ---- a/test/common/fixtures.js -+++ b/test/common/fixtures.js -@@ -15,8 +15,13 @@ function readFixtureSync(args, enc) { - return fs.readFileSync(fixturesPath(args), enc); - } - --function readFixtureKey(name, enc) { -- return fs.readFileSync(fixturesPath('keys', name), enc); -+function readFixtureKey(name, enc, trim) { -+ let result = fs.readFileSync(fixturesPath('keys', name), enc); -+ if (trim) { -+ result = Buffer.from(result.toString().trim(), 'utf8'); -+ } -+ -+ return result; - } - - function readFixtureKeys(enc, ...names) { -diff --git a/test/parallel/test-crypto-certificate.js b/test/parallel/test-crypto-certificate.js -index 4a5f1f149fe6c739f7f1d2ee17df6e61a942d621..a21fbff81c840da29034cb07ae2bd711cfe78b0a 100644 ---- a/test/parallel/test-crypto-certificate.js -+++ b/test/parallel/test-crypto-certificate.js -@@ -30,9 +30,9 @@ const { Certificate } = crypto; - const fixtures = require('../common/fixtures'); - - // Test Certificates --const spkacValid = fixtures.readKey('rsa_spkac.spkac'); -+const spkacValid = fixtures.readKey('rsa_spkac.spkac', null, true); - const spkacChallenge = 'this-is-a-challenge'; --const spkacFail = fixtures.readKey('rsa_spkac_invalid.spkac'); -+const spkacFail = fixtures.readKey('rsa_spkac_invalid.spkac', null, true); - const spkacPublicPem = fixtures.readKey('rsa_public.pem'); - - function copyArrayBuffer(buf) { diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc index aad85fb2c9c685..1af890a2a0b3b2 100644 --- a/shell/common/node_bindings.cc +++ b/shell/common/node_bindings.cc @@ -365,7 +365,6 @@ bool NodeBindings::IsInitialized() { void NodeBindings::Initialize() { TRACE_EVENT0("electron", "NodeBindings::Initialize"); // Open node's error reporting system for browser process. - node::g_upstream_node_mode = false; #if BUILDFLAG(IS_LINUX) // Get real command line in renderer process forked by zygote. @@ -381,14 +380,17 @@ void NodeBindings::Initialize() { auto env = base::Environment::Create(); SetNodeOptions(env.get()); - node::Environment::should_read_node_options_from_env_ = - fuses::IsNodeOptionsEnabled(); std::vector argv = {"electron"}; std::vector exec_argv; std::vector errors; + uint64_t process_flags = node::ProcessFlags::kEnableStdioInheritance; + if (!fuses::IsNodeOptionsEnabled()) + process_flags |= node::ProcessFlags::kDisableNodeOptionsEnv; - int exit_code = node::InitializeNodeWithArgs(&argv, &exec_argv, &errors); + int exit_code = node::InitializeNodeWithArgs( + &argv, &exec_argv, &errors, + static_cast(process_flags)); for (const std::string& error : errors) fprintf(stderr, "%s: %s\n", argv[0].c_str(), error.c_str());