From 38512efd25a159ddc64a54c22ef9eb6dd60064ec Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <84116207+electron-roller[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 15:09:33 -0400 Subject: [PATCH] chore: bump node to v20.17.0 (main) (#43428) * chore: bump node in DEPS to v20.17.0 * module: disallow CJS <-> ESM edges in a cycle from require(esm) https://github.com/nodejs/node/pull/52264 * src: expose LookupAndCompile with parameters https://github.com/nodejs/node/pull/53886 * src: fix -Wshadow warning https://github.com/nodejs/node/pull/53885 * lib: convert WeakMaps in cjs loader with symbol properties https://github.com/nodejs/node/pull/52095 * src: reduce unnecessary serialization of CLI options in C++ https://github.com/nodejs/node/pull/52451 * build: ensure v8_pointer_compression_sandbox is enabled on 64bit https://github.com/nodejs/node/pull/53884 * lib: improve error message when index not found on cjs https://github.com/nodejs/node/pull/53859 * src,lib: expose getCategoryEnabledBuffer to use on node.http https://github.com/nodejs/node/pull/53602 * deps: update c-ares to v1.32.2 https://github.com/nodejs/node/pull/53865 * chore: fixup patch indices * deps: update V8 to 12.2 https://github.com/nodejs/node/pull/51362 * stream: Expose DuplexPair API https://github.com/nodejs/node/pull/34111 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr --- DEPS | 2 +- patches/chromium/can_create_window.patch | 10 ++-- patches/node/.patches | 7 +-- patches/node/build_add_gn_build_files.patch | 21 ++++--- ...d_don_t_redefine_win32_lean_and_mean.patch | 36 +++++++++++ patches/node/build_enable_perfetto.patch | 6 +- ...compilation_fails_if_not_using_a_new.patch | 10 ++-- ...pression_sandbox_is_enabled_on_64bit.patch | 35 ----------- ...f_original-fs_and_custom_embedder_js.patch | 6 +- ...calls_to_recently_deprecated_v8_apis.patch | 8 +-- ...de_entrypoint_to_be_a_builtin_module.patch | 8 +-- ...e_expose_importmoduledynamically_and.patch | 18 +++--- ...ls_to_v8_functioncallbackinfo_holder.patch | 2 +- ..._remove_use_of_deprecated_kmaxlength.patch | 4 +- .../deprecate_vector_v8_local_in_v8.patch | 4 +- ...enable_crashpad_linux_node_processes.patch | 6 +- patches/node/fix_-wshadow_warning.patch | 45 -------------- ..._values_for_variables_in_common_gypi.patch | 2 +- ...ssert_module_in_the_renderer_process.patch | 36 ++++++----- patches/node/fix_building_with_unicode.patch | 33 ----------- .../fix_crypto_tests_to_run_with_bssl.patch | 4 +- ..._do_not_resolve_electron_entrypoints.patch | 18 +++--- ...ose_lookupandcompile_with_parameters.patch | 59 ------------------- ...n_electron_module_via_the_esm_loader.patch | 16 ++--- ...se_tracing_tracingcontroller_instead.patch | 8 +-- ...ingssl_and_openssl_incompatibilities.patch | 38 ++++++------ ...in_esm_loaders_to_apply_asar_patches.patch | 8 +-- ...g_c_calls_of_esm_legacy_main_resolve.patch | 40 ++++++++----- .../pass_all_globals_through_require.patch | 10 ++-- ...dder_overriding_of_internal_fs_calls.patch | 6 +- .../src_do_not_use_deprecated_v8_api.patch | 10 ++-- ..._on_wrapper-descriptor-based_cppheap.patch | 8 +-- ...rted_api_to_get_stalled_tla_messages.patch | 27 +++++++++ .../node/support_v8_sandboxed_pointers.patch | 46 +++++++++++++-- ...st_formally_mark_some_tests_as_flaky.patch | 2 +- ..._change_callback_needs_to_be_stdcall.patch | 34 ----------- 36 files changed, 270 insertions(+), 363 deletions(-) create mode 100644 patches/node/build_don_t_redefine_win32_lean_and_mean.patch delete mode 100644 patches/node/build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch delete mode 100644 patches/node/fix_-wshadow_warning.patch delete mode 100644 patches/node/fix_building_with_unicode.patch delete mode 100644 patches/node/fix_expose_lookupandcompile_with_parameters.patch create mode 100644 patches/node/src_use_supported_api_to_get_stalled_tla_messages.patch delete mode 100644 patches/node/windows_32bit_config_change_callback_needs_to_be_stdcall.patch diff --git a/DEPS b/DEPS index 166efcf65e998..9ac1c63f97641 100644 --- a/DEPS +++ b/DEPS @@ -4,7 +4,7 @@ vars = { 'chromium_version': '130.0.6672.0', 'node_version': - 'v20.16.0', + 'v20.17.0', 'nan_version': 'e14bdcd1f72d62bca1d541b66da43130384ec213', 'squirrel.mac_version': diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index ec488667e08cb..19b4f298d0cae 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -210,15 +210,15 @@ index c576ace24e81cc877aa2595d40e0a13a7af9f6a2..210fb97d44c19c29af424cc7b9cb3169 } // namespace blink diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc -index 96d7ba915e3d4248ad801237b0b43ff0b55be1a2..24cf1a2aa6f821c4d5597d98f3bf98a10bd30555 100644 +index 96d7ba915e3d4248ad801237b0b43ff0b55be1a2..8da4acbde65e933740a53de1dc45e7c779a688fb 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc -@@ -2245,6 +2245,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, - +@@ -2246,6 +2246,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate, WebWindowFeatures window_features = GetWindowFeaturesFromString(features, entered_window); -+ -+ window_features.raw_features = features; ++ window_features.raw_features = features; ++ if (window_features.is_partitioned_popin && !IsFeatureEnabled( + mojom::blink::PermissionsPolicyFeature::kPartitionedPopins, diff --git a/patches/node/.patches b/patches/node/.patches index 57f1d3e3d4180..8b7a7aca46fec 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -17,7 +17,6 @@ feat_add_uv_loop_interrupt_on_io_change_option_to_uv_loop_configure.patch support_v8_sandboxed_pointers.patch build_ensure_native_module_compilation_fails_if_not_using_a_new.patch fix_expose_the_built-in_electron_module_via_the_esm_loader.patch -fix_expose_lookupandcompile_with_parameters.patch enable_crashpad_linux_node_processes.patch fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch chore_expose_importmoduledynamically_and.patch @@ -25,7 +24,6 @@ test_formally_mark_some_tests_as_flaky.patch fix_adapt_debugger_tests_for_upstream_v8_changes.patch chore_remove_--no-harmony-atomics_related_code.patch fix_account_for_createexternalizablestring_v8_global.patch -fix_-wshadow_warning.patch fix_do_not_resolve_electron_entrypoints.patch ci_ensure_node_tests_set_electron_run_as_node.patch fix_assert_module_in_the_renderer_process.patch @@ -37,7 +35,6 @@ fix_capture_embedder_exceptions_before_entering_v8.patch spec_add_iterator_to_global_intrinsics.patch 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 deprecate_vector_v8_local_in_v8.patch fix_remove_deprecated_errno_constants.patch @@ -52,6 +49,6 @@ chore_remove_calls_to_v8_functioncallbackinfo_holder.patch src_do_not_use_soon-to-be-deprecated_v8_api.patch fix_add_property_query_interceptors.patch src_account_for_openssl_unexpected_version.patch -windows_32bit_config_change_callback_needs_to_be_stdcall.patch -fix_building_with_unicode.patch src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch +src_use_supported_api_to_get_stalled_tla_messages.patch +build_don_t_redefine_win32_lean_and_mean.patch diff --git a/patches/node/build_add_gn_build_files.patch b/patches/node/build_add_gn_build_files.patch index 219977a3c12cd..789b12418dec9 100644 --- a/patches/node/build_add_gn_build_files.patch +++ b/patches/node/build_add_gn_build_files.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..087e27424f3997575e4e089a57955d04b8802321 100644 +index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..d083aea4cb895d8425041879f1b22a6ee43a0b60 100644 --- a/deps/cares/BUILD.gn +++ b/deps/cares/BUILD.gn -@@ -1,14 +1,170 @@ +@@ -1,14 +1,172 @@ -############################################################################## -# # -# DO NOT EDIT THIS FILE! # @@ -566,7 +566,6 @@ index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..087e27424f3997575e4e089a57955d04 + "include/ares_dns.h", + "include/ares_dns_record.h", + "include/ares_nameser.h", -+ "include/ares_rules.h", + "include/ares_version.h", + "src/lib/ares__addrinfo2hostent.c", + "src/lib/ares__addrinfo_localhost.c", @@ -604,6 +603,8 @@ index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..087e27424f3997575e4e089a57955d04 + "src/lib/ares_data.h", + "src/lib/ares_destroy.c", + "src/lib/ares_dns_mapping.c", ++ "src/lib/ares_dns_multistring.c", ++ "src/lib/ares_dns_multistring.h", + "src/lib/ares_dns_name.c", + "src/lib/ares_dns_parse.c", + "src/lib/ares_dns_record.c", @@ -637,6 +638,7 @@ index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..087e27424f3997575e4e089a57955d04 + "src/lib/ares_library_init.c", + "src/lib/ares_ipv6.h", + "src/lib/ares_math.c", ++ "src/lib/ares_metrics.c", + "src/lib/ares_options.c", + "src/lib/ares_parse_a_reply.c", + "src/lib/ares_parse_aaaa_reply.c", @@ -673,7 +675,6 @@ index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..087e27424f3997575e4e089a57955d04 + "src/lib/ares_version.c", + "src/lib/inet_net_pton.c", + "src/lib/inet_ntop.c", -+ "src/lib/setup_once.h", + "src/tools/ares_getopt.c", + "src/tools/ares_getopt.h", + ] @@ -694,6 +695,7 @@ index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..087e27424f3997575e4e089a57955d04 + defines += [ "CARES_PULL_WS2TCPIP_H=1" ] + include_dirs += [ "config/win32" ] + sources += [ ++ "src/lib/ares_sysconfig_win.c", + "src/lib/config-win32.h", + "src/lib/windows_port.c", + ] @@ -1263,10 +1265,10 @@ index 0000000000000000000000000000000000000000..af9cbada10203b387fb9732b346583b1 +} diff --git a/filenames.json b/filenames.json new file mode 100644 -index 0000000000000000000000000000000000000000..679329d847fbfe303792cab5881287890c9961f4 +index 0000000000000000000000000000000000000000..646df853a2b985f14fd66cae6af854977c074706 --- /dev/null +++ b/filenames.json -@@ -0,0 +1,736 @@ +@@ -0,0 +1,737 @@ +// This file is automatically generated by generate_gn_filenames_json.py +// DO NOT EDIT +{ @@ -1636,6 +1638,7 @@ index 0000000000000000000000000000000000000000..679329d847fbfe303792cab588128789 + "lib/internal/streams/destroy.js", + "lib/internal/streams/duplex.js", + "lib/internal/streams/duplexify.js", ++ "lib/internal/streams/duplexpair.js", + "lib/internal/streams/end-of-stream.js", + "lib/internal/streams/from.js", + "lib/internal/streams/lazy_transform.js", @@ -2221,10 +2224,10 @@ index 909fd14345fcd988c381e640280f4b33f2e0c351..800431e6659f95f0495cb90b8fa2cccb + args = rebase_path(inputs + outputs, root_build_dir) } diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index bbb63df7899d4b9bf80e13eee78453352dd5c75b..804296db12f7864f72648f5f36834a924503e4a6 100644 +index 706ea4f5cb90525c8ea56f794320a733c45a193f..c7ae7759595bfc7fdc31dab174a7514ddd8345e7 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc -@@ -765,6 +765,7 @@ void BuiltinLoader::RegisterExternalReferences( +@@ -773,6 +773,7 @@ void BuiltinLoader::RegisterExternalReferences( registry->Register(GetNatives); RegisterExternalReferencesForInternalizedBuiltinCode(registry); @@ -2233,7 +2236,7 @@ index bbb63df7899d4b9bf80e13eee78453352dd5c75b..804296db12f7864f72648f5f36834a92 } // namespace builtins diff --git a/src/node_builtins.h b/src/node_builtins.h -index 75a7f3dd89e096d13ad7d70ed29d301cd56315b5..9a20a275fbe5df9f384b7b1d1d26806e7cd05384 100644 +index 1cb85b9058d06555382e565dc32192a9fa48ed9f..cec9be01abd107e8612f70daf19b4834e118ffcf 100644 --- a/src/node_builtins.h +++ b/src/node_builtins.h @@ -74,6 +74,8 @@ using BuiltinCodeCacheMap = diff --git a/patches/node/build_don_t_redefine_win32_lean_and_mean.patch b/patches/node/build_don_t_redefine_win32_lean_and_mean.patch new file mode 100644 index 0000000000000..4fd6a0c6128f3 --- /dev/null +++ b/patches/node/build_don_t_redefine_win32_lean_and_mean.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Fri, 23 Aug 2024 16:50:19 +0200 +Subject: build: don't redefine WIN32_LEAN_AND_MEAN + +https://github.com/nodejs/node/pull/53722 added a new define for WIN32_LEAN_AND_MEAN +without first checking to see if it was defined - other areas in c-ares do this so +we should here as well. Compilation errors occur otherwise: + +../../third_party/electron_node/deps/cares/include\ares_build.h(168,11): error: 'WIN32_LEAN_AND_MEAN' macro redefined [-Werror,-Wmacro-redefined] + 168 | # define WIN32_LEAN_AND_MEAN + | ^ +(25,9): note: previous definition is here + 25 | #define WIN32_LEAN_AND_MEAN 1 + | ^ +1 error generated. +[287 processes, 49437/51449 @ 48.5/s : 1018.562s] CC obj/third_party/electron_node/deps/cares/cares/ares__socket.obj +FAILED: obj/third_party/electron_node/deps/cares/cares/ares__socket.obj + +This should be upstreamed. + +diff --git a/deps/cares/include/ares_build.h b/deps/cares/include/ares_build.h +index 18a92606a817145302c73b5081b4c989799bc620..bafd26d9210d2347fec41f028e9e65088b83c48c 100644 +--- a/deps/cares/include/ares_build.h ++++ b/deps/cares/include/ares_build.h +@@ -165,7 +165,9 @@ + # define CARES_TYPEOF_ARES_SOCKLEN_T int + + #elif defined(_WIN32) +-# define WIN32_LEAN_AND_MEAN ++# ifndef WIN32_LEAN_AND_MEAN ++# define WIN32_LEAN_AND_MEAN ++# endif + # define CARES_TYPEOF_ARES_SOCKLEN_T int + # define CARES_HAVE_WINDOWS_H 1 + # define CARES_HAVE_SYS_TYPES_H 1 diff --git a/patches/node/build_enable_perfetto.patch b/patches/node/build_enable_perfetto.patch index d2a52425532d7..706d8785d5e2c 100644 --- a/patches/node/build_enable_perfetto.patch +++ b/patches/node/build_enable_perfetto.patch @@ -33,12 +33,12 @@ index 8d7204f6cb48f783adc4d1c1eb2de0c83b7fffe2..a154559a56bf383d3c26af523c9bb07b // Non-alphabetic chars. diff --git a/lib/internal/http.js b/lib/internal/http.js -index b20b3cd229efcd9701791309361b7d106f315900..6b2820c9dcce5e658b694f53e75d93707c4320d7 100644 +index c26c322aafc64ed9ca2a7c1fd703555a251db9de..f94bc5824d6c83fd1feca31c572dcfd3ac130bda 100644 --- a/lib/internal/http.js +++ b/lib/internal/http.js @@ -10,8 +10,8 @@ const { const { setUnrefTimeout } = require('internal/timers'); - const { trace, isTraceCategoryEnabled } = internalBinding('trace_events'); + const { getCategoryEnabledBuffer, trace } = internalBinding('trace_events'); const { - CHAR_LOWERCASE_B, - CHAR_LOWERCASE_E, @@ -47,7 +47,7 @@ index b20b3cd229efcd9701791309361b7d106f315900..6b2820c9dcce5e658b694f53e75d9370 } = require('internal/constants'); let utcCache; -@@ -44,11 +44,13 @@ function isTraceHTTPEnabled() { +@@ -46,11 +46,13 @@ function isTraceHTTPEnabled() { const traceEventCategory = 'node,node.http'; function traceBegin(...args) { diff --git a/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch b/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch index f2efc1703c80d..3a2bd9173388e 100644 --- a/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch +++ b/patches/node/build_ensure_native_module_compilation_fails_if_not_using_a_new.patch @@ -7,7 +7,7 @@ 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 9a27610992612b59eadcc8e481683cf1e6a5dbb6..1fad20645d059ad5f3efaa9279f582f99cb1006b 100644 +index 689e7fb2339253d0f2be3ccf33ecd76660ccf176..8736ad12eec294070a5160a64248044cd16347c9 100644 --- a/common.gypi +++ b/common.gypi @@ -87,6 +87,8 @@ @@ -19,7 +19,7 @@ index 9a27610992612b59eadcc8e481683cf1e6a5dbb6..1fad20645d059ad5f3efaa9279f582f9 ##### end V8 defaults ##### # When building native modules using 'npm install' with the system npm, -@@ -286,6 +288,7 @@ +@@ -287,6 +289,7 @@ # Defines these mostly for node-gyp to pickup. 'defines': [ '_GLIBCXX_USE_CXX11_ABI=1', @@ -27,7 +27,7 @@ index 9a27610992612b59eadcc8e481683cf1e6a5dbb6..1fad20645d059ad5f3efaa9279f582f9 ], # Forcibly disable -Werror. We support a wide range of compilers, it's -@@ -415,6 +418,11 @@ +@@ -416,6 +419,11 @@ }], ], }], @@ -40,7 +40,7 @@ index 9a27610992612b59eadcc8e481683cf1e6a5dbb6..1fad20645d059ad5f3efaa9279f582f9 # list in v8/BUILD.gn. ['v8_enable_v8_checks == 1', { diff --git a/configure.py b/configure.py -index f189ba2bf09fc248b3c1ce3c3535b939a4160ad2..2c24db93618f88f5f07e95a3edf63fb7942ac009 100755 +index 3084cc964cbe6d02f98d08cd6f847ea7f4a3d0db..5b6a3b62082985debf6ebc4bc09a7d056f58514a 100755 --- a/configure.py +++ b/configure.py @@ -1559,6 +1559,7 @@ def configure_library(lib, output, pkgname=None): @@ -52,7 +52,7 @@ index f189ba2bf09fc248b3c1ce3c3535b939a4160ad2..2c24db93618f88f5f07e95a3edf63fb7 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 c267ed1eeaa2d8b6ecd5a1563a4e9440bf0cca00..e55256996f2c85b0ae3854cbd1b83ca88a3e22cb 100644 +index 4f2eb9d0aab88b70c86339e750799080e980d7da..df3fb3372d6357b5d77b4f683e309b8483998128 100644 --- a/src/node.h +++ b/src/node.h @@ -22,6 +22,12 @@ diff --git a/patches/node/build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch b/patches/node/build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch deleted file mode 100644 index c63f986ab544a..0000000000000 --- a/patches/node/build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Wed, 17 Jan 2024 16:01:08 +0100 -Subject: build: ensure v8_pointer_compression_sandbox is enabled on 64bit - -The defines themselves were upstreamed in https://github.com/nodejs/node/pull/50820 -but the ability to configure the variables themselves were not. This adds that back -in. - -This should be upstreamed. - -diff --git a/common.gypi b/common.gypi -index 1fad20645d059ad5f3efaa9279f582f99cb1006b..4fbb33550e8a044b92997a42eb6603f151ba1043 100644 ---- a/common.gypi -+++ b/common.gypi -@@ -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, -+ 'v8_enable_sandbox': 0 - }], - ['target_arch in "ppc64 s390x"', { - 'v8_enable_backtrace': 1, -diff --git a/configure.py b/configure.py -index 2c24db93618f88f5f07e95a3edf63fb7942ac009..4e6dc7378e4435b90246eb072379cea1bfdad09c 100755 ---- a/configure.py -+++ b/configure.py -@@ -1573,6 +1573,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 -+ o['variables']['v8_enable_sandbox'] = 1 if options.enable_pointer_compression else 0 - o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0 - o['variables']['v8_enable_shared_ro_heap'] = 0 if options.enable_pointer_compression or options.disable_shared_ro_heap else 1 - o['variables']['v8_enable_extensible_ro_snapshot'] = 0 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 b5dbaa8aeddf0..6c5aa0275398e 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 @@ -34,7 +34,7 @@ index f5ecc15159f457cd0b8069c0427b7c758c916c4e..c9ce67391f321989b0af48159b4da3ab let kResistStopPropagation; diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index 804296db12f7864f72648f5f36834a924503e4a6..2cac503e92640a4683a4be6969f1ed40e42785a0 100644 +index c7ae7759595bfc7fdc31dab174a7514ddd8345e7..4bf80aa6cc6385dc376fd0a3538efc27fe5bd0a2 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -35,6 +35,7 @@ using v8::Value; @@ -46,10 +46,10 @@ index 804296db12f7864f72648f5f36834a924503e4a6..2cac503e92640a4683a4be6969f1ed40 AddExternalizedBuiltin( "internal/deps/cjs-module-lexer/lexer", diff --git a/src/node_builtins.h b/src/node_builtins.h -index 9a20a275fbe5df9f384b7b1d1d26806e7cd05384..a1a9fe7d592f0d57b70dcee8c865b99d71248bf2 100644 +index cec9be01abd107e8612f70daf19b4834e118ffcf..3d9c6b962423555257bad4ebaad9ebd821d00042 100644 --- a/src/node_builtins.h +++ b/src/node_builtins.h -@@ -132,6 +132,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader { +@@ -138,6 +138,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader { // Generated by tools/js2c.py as node_javascript.cc void LoadJavaScriptSource(); // Loads data into source_ diff --git a/patches/node/cherry-pick_src_remove_calls_to_recently_deprecated_v8_apis.patch b/patches/node/cherry-pick_src_remove_calls_to_recently_deprecated_v8_apis.patch index b93a926c4bc03..94a97386644d9 100644 --- a/patches/node/cherry-pick_src_remove_calls_to_recently_deprecated_v8_apis.patch +++ b/patches/node/cherry-pick_src_remove_calls_to_recently_deprecated_v8_apis.patch @@ -15,10 +15,10 @@ This patch is expected to be deleted once we catch up with a Node.js upgrade that includes the original Node.js commit above. diff --git a/src/module_wrap.cc b/src/module_wrap.cc -index 9ad67e0993da4c3e3f8a14681edbf941cf14e2e6..29ed378d32d452518dc929e60e6038ba4ca38a5c 100644 +index ff658ec88e5161cd66536ee6e95dba675b16eccc..9bbb8ab908d8d992abb43254860d51f57f56387b 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc -@@ -186,8 +186,7 @@ void ModuleWrap::New(const FunctionCallbackInfo& args) { +@@ -202,8 +202,7 @@ void ModuleWrap::New(const FunctionCallbackInfo& args) { } Local source_text = args[2].As(); @@ -28,7 +28,7 @@ index 9ad67e0993da4c3e3f8a14681edbf941cf14e2e6..29ed378d32d452518dc929e60e6038ba line_offset, column_offset, true, // is cross origin -@@ -394,7 +393,6 @@ void ModuleWrap::Evaluate(const FunctionCallbackInfo& args) { +@@ -464,7 +463,6 @@ void ModuleWrap::Evaluate(const FunctionCallbackInfo& args) { ShouldNotAbortOnUncaughtScope no_abort_scope(realm->env()); TryCatchScope try_catch(realm->env()); @@ -37,7 +37,7 @@ index 9ad67e0993da4c3e3f8a14681edbf941cf14e2e6..29ed378d32d452518dc929e60e6038ba bool timed_out = false; bool received_signal = false; diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index f9a090f5c3e04403602ba383032e7f3230669a92..3f82db324d406e342abee23ab0d7f7c9807ff652 100644 +index 4bf80aa6cc6385dc376fd0a3538efc27fe5bd0a2..3e37aa8b0c9696cceb3f3cfab9721f38c74a2fba 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -267,7 +267,7 @@ MaybeLocal BuiltinLoader::LookupAndCompileInternal( 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 09771c2c8c723..04776c7053843 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,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 155485dbab0d46bb225fa40e99f555d805659c4f..8183cffe9d7060571c08f696abb7c090e6df3be8 100644 +index 364469160af5e348f8890417de16a63c0d1dca67..75d5f58fe02fa8cfa7716ffaf761d567ab403a2c 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -1331,6 +1331,13 @@ Module.prototype._compile = function(content, filename) { +@@ -1441,6 +1441,13 @@ Module.prototype._compile = function(content, filename, loadAsESM = false) { 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 155485dbab0d46bb225fa40e99f555d805659c4f..8183cffe9d7060571c08f696abb7c090 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 8fad2fe617e4f8d2364b8c9d3cfb27c265f08b5b..710af646aaf97f88ac2ee003d8f83388ccf9a84f 100644 +index 59308ab817fb864a7b84ecf349c9e08d1c710342..8398657065b28a4451b8fe3996e63838a1645314 100644 --- a/lib/internal/process/pre_execution.js +++ b/lib/internal/process/pre_execution.js -@@ -244,12 +244,14 @@ function patchProcessObject(expandArgv1) { +@@ -245,12 +245,14 @@ function patchProcessObject(expandArgv1) { if (expandArgv1 && process.argv[1] && !StringPrototypeStartsWith(process.argv[1], '-')) { // Expand process.argv[1] into a full path. diff --git a/patches/node/chore_expose_importmoduledynamically_and.patch b/patches/node/chore_expose_importmoduledynamically_and.patch index 507fa27879392..18583f403a64a 100644 --- a/patches/node/chore_expose_importmoduledynamically_and.patch +++ b/patches/node/chore_expose_importmoduledynamically_and.patch @@ -11,10 +11,10 @@ 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 d7867864bba7141b7ba12b171d185a94ed25d01d..d93a248d8a96fe1dffa08b39cfe3ea7b368db54a 100644 +index 150816057129c147c13ce044474f341581679f34..dd8627653265e22f55e67ec4a47641b20fba6c9d 100644 --- a/lib/internal/modules/esm/utils.js +++ b/lib/internal/modules/esm/utils.js -@@ -24,7 +24,7 @@ const { +@@ -30,7 +30,7 @@ const { ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING, ERR_INVALID_ARG_VALUE, } = require('internal/errors').codes; @@ -23,7 +23,7 @@ index d7867864bba7141b7ba12b171d185a94ed25d01d..d93a248d8a96fe1dffa08b39cfe3ea7b const { loadPreloadModules, initializeFrozenIntrinsics, -@@ -236,12 +236,13 @@ let _forceDefaultLoader = false; +@@ -273,12 +273,13 @@ let _forceDefaultLoader = false; * @param {boolean} [forceDefaultLoader=false] - A boolean indicating disabling custom loaders. */ function initializeESM(forceDefaultLoader = false) { @@ -40,10 +40,10 @@ index d7867864bba7141b7ba12b171d185a94ed25d01d..d93a248d8a96fe1dffa08b39cfe3ea7b /** diff --git a/src/module_wrap.cc b/src/module_wrap.cc -index 501e4d7b7ea180588737fcbb2bf6ff79abfb9d9a..cce67100588bf6b47d26ee9168a123cb813b822e 100644 +index eea74bed4bb8a980f99a9a1404c9a2df203ca09c..e862b51293135995c527c32aa3c3579780d7831c 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc -@@ -561,7 +561,7 @@ MaybeLocal ModuleWrap::ResolveModuleCallback( +@@ -752,7 +752,7 @@ MaybeLocal ModuleWrap::ResolveModuleCallback( return module->module_.Get(isolate); } @@ -52,7 +52,7 @@ index 501e4d7b7ea180588737fcbb2bf6ff79abfb9d9a..cce67100588bf6b47d26ee9168a123cb Local context, Local host_defined_options, Local resource_name, -@@ -626,12 +626,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback( +@@ -817,12 +817,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback( Realm* realm = Realm::GetCurrent(args); HandleScope handle_scope(isolate); @@ -68,7 +68,7 @@ index 501e4d7b7ea180588737fcbb2bf6ff79abfb9d9a..cce67100588bf6b47d26ee9168a123cb } void ModuleWrap::HostInitializeImportMetaObjectCallback( -@@ -673,13 +674,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback( +@@ -864,13 +865,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback( Realm* realm = Realm::GetCurrent(args); Isolate* isolate = realm->isolate(); @@ -87,7 +87,7 @@ index 501e4d7b7ea180588737fcbb2bf6ff79abfb9d9a..cce67100588bf6b47d26ee9168a123cb MaybeLocal ModuleWrap::SyntheticModuleEvaluationStepsCallback( diff --git a/src/module_wrap.h b/src/module_wrap.h -index e17048357feca2419087621ed280de30882a90bc..63682be31ce00a3bf7b9be909cac4b7f9ec02a8e 100644 +index 45a338b38e01c824f69ea59ee286130c67e9eddf..99bb079df11696fc3ba5e6bcca7e7a42818fe3d1 100644 --- a/src/module_wrap.h +++ b/src/module_wrap.h @@ -7,6 +7,7 @@ @@ -123,7 +123,7 @@ index e17048357feca2419087621ed280de30882a90bc..63682be31ce00a3bf7b9be909cac4b7f private: ModuleWrap(Realm* realm, v8::Local object, -@@ -102,7 +112,6 @@ class ModuleWrap : public BaseObject { +@@ -110,7 +120,6 @@ class ModuleWrap : public BaseObject { v8::Local specifier, v8::Local import_attributes, v8::Local referrer); diff --git a/patches/node/chore_remove_calls_to_v8_functioncallbackinfo_holder.patch b/patches/node/chore_remove_calls_to_v8_functioncallbackinfo_holder.patch index 8a163772337e7..0c9f1f6672790 100644 --- a/patches/node/chore_remove_calls_to_v8_functioncallbackinfo_holder.patch +++ b/patches/node/chore_remove_calls_to_v8_functioncallbackinfo_holder.patch @@ -10,7 +10,7 @@ https://issues.chromium.org/issues/333672197 This patch can be removed once Node addresses this change. diff --git a/src/node_internals.h b/src/node_internals.h -index 6b4ec38bd092358a9433a1179dbe1e71f56aa387..0a9eaba5c71f711c58799d77a9de6072304deb9a 100644 +index 5dff80ee287256ba40bfa496df6db60a18fbb9d7..a9162b4e2ee48dbebec8dc52b6990369be15fe4a 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -67,7 +67,7 @@ template diff --git a/patches/node/chore_remove_use_of_deprecated_kmaxlength.patch b/patches/node/chore_remove_use_of_deprecated_kmaxlength.patch index bcf032e1566bf..786506d1b53e3 100644 --- a/patches/node/chore_remove_use_of_deprecated_kmaxlength.patch +++ b/patches/node/chore_remove_use_of_deprecated_kmaxlength.patch @@ -21,10 +21,10 @@ index 606a6f5caa3b11b6d2a9068ed2fd65800530a5eb..080dcce21da05ccea398d8a856deb397 typedef void (*FreeCallback)(char* data, void* hint); diff --git a/src/node_errors.h b/src/node_errors.h -index 30f66a7648bff4e9b5cd9e9ba516d9c854482263..9eb9a1a932e2f097827ab24b1f3abd2ce20a51af 100644 +index ad40141ca92c5a46ae2e4dfa96e4d6c239da8516..c462e5afcaa2328c4908fff462fc7c9fbfc1fd5f 100644 --- a/src/node_errors.h +++ b/src/node_errors.h -@@ -227,7 +227,7 @@ inline v8::Local ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) { +@@ -232,7 +232,7 @@ inline v8::Local ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) { char message[128]; snprintf(message, sizeof(message), "Cannot create a Buffer larger than 0x%zx bytes", diff --git a/patches/node/deprecate_vector_v8_local_in_v8.patch b/patches/node/deprecate_vector_v8_local_in_v8.patch index 294f8e530eb71..7462efb97f399 100644 --- a/patches/node/deprecate_vector_v8_local_in_v8.patch +++ b/patches/node/deprecate_vector_v8_local_in_v8.patch @@ -9,10 +9,10 @@ This patch can be removed when Electron upgrades to a version of Node.js that contains the above CL. diff --git a/src/module_wrap.cc b/src/module_wrap.cc -index cce67100588bf6b47d26ee9168a123cb813b822e..9ad67e0993da4c3e3f8a14681edbf941cf14e2e6 100644 +index e862b51293135995c527c32aa3c3579780d7831c..ff658ec88e5161cd66536ee6e95dba675b16eccc 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc -@@ -169,7 +169,9 @@ void ModuleWrap::New(const FunctionCallbackInfo& args) { +@@ -186,7 +186,9 @@ void ModuleWrap::New(const FunctionCallbackInfo& args) { export_names[i] = export_name_val.As(); } diff --git a/patches/node/enable_crashpad_linux_node_processes.patch b/patches/node/enable_crashpad_linux_node_processes.patch index c2cd8cb15eb81..931c0665073fa 100644 --- a/patches/node/enable_crashpad_linux_node_processes.patch +++ b/patches/node/enable_crashpad_linux_node_processes.patch @@ -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 c09fca512584ce2c674ae1d05136ff4cd8ea8471..d4edaa71a7bf6660bad209fbfbc43014bb4bf741 100644 +index 48870b35ad0f3411f2d509b12d92a9e0d20046f9..e7ef454d2d71207ae7b2788a437b82bf7732716e 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -61,6 +61,7 @@ let debug = require('internal/util/debuglog').debuglog( @@ -27,7 +27,7 @@ index c09fca512584ce2c674ae1d05136ff4cd8ea8471..d4edaa71a7bf6660bad209fbfbc43014 args = [...execArgv, modulePath, ...args]; if (typeof options.stdio === 'string') { -@@ -617,6 +617,22 @@ function normalizeSpawnArguments(file, args, options) { +@@ -618,6 +618,22 @@ function normalizeSpawnArguments(file, args, options) { 'options.windowsVerbatimArguments'); } @@ -50,7 +50,7 @@ index c09fca512584ce2c674ae1d05136ff4cd8ea8471..d4edaa71a7bf6660bad209fbfbc43014 if (options.shell) { validateArgumentNullCheck(options.shell, 'options.shell'); const command = ArrayPrototypeJoin([file, ...args], ' '); -@@ -650,7 +666,6 @@ function normalizeSpawnArguments(file, args, options) { +@@ -651,7 +667,6 @@ function normalizeSpawnArguments(file, args, options) { ArrayPrototypeUnshift(args, file); } diff --git a/patches/node/fix_-wshadow_warning.patch b/patches/node/fix_-wshadow_warning.patch deleted file mode 100644 index 20894b157fb3d..0000000000000 --- a/patches/node/fix_-wshadow_warning.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Charles Kerr -Date: Fri, 7 Jul 2023 11:28:19 -0500 -Subject: fix: -Wshadow warning - -In utils.h's `ERROR_AND_ABORT` macro, rename the static local variable -`args` to avoid -Wshadow warnings in code that calls `ERROR_AND_ABORT()` -or `CHECK()` from a function that already has an `args` variable. - -This patch could be removed after upstreaming to Node.js. - -Example warning: - -In file included from ../../third_party/electron_node/src/inspector/runtime_agent.cc:3: -In file included from ../../third_party/electron_node/src/env-inl.h:32: -../../third_party/electron_node/src/node_internals.h:72:3: error: declaration shadows a local variable [-Werror,-Wshadow] - 72 | CHECK(args[0]->IsObject()); - | ^ -../../third_party/electron_node/src/util.h:154:7: note: expanded from macro 'CHECK' - 154 | ERROR_AND_ABORT(expr); \ - | ^ -../../third_party/electron_node/src/util.h:132:38: note: expanded from macro 'ERROR_AND_ABORT' - 132 | static const node::AssertionInfo args = { \ - | ^ -../../third_party/electron_node/src/node_internals.h:67:67: note: previous declaration is here - 67 | void GetSockOrPeerName(const v8::FunctionCallbackInfo& args) { - | ^ -1 error generated. - -diff --git a/src/util.h b/src/util.h -index 3ae876e5484f0ebacfae6749cc336f42cd69bf14..8e9e8289de249119d6b8078abe32db6b885dfaab 100644 ---- a/src/util.h -+++ b/src/util.h -@@ -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. */ \ -- static const node::AssertionInfo args = { \ -+ static const node::AssertionInfo error_and_abort_args = { \ - __FILE__ ":" STRINGIFY(__LINE__), #expr, PRETTY_FUNCTION_NAME}; \ -- node::Assert(args); \ -+ node::Assert(error_and_abort_args); \ - /* `node::Assert` doesn't return. Add an [[noreturn]] abort() here to */ \ - /* make the compiler happy about no return value in the caller */ \ - /* function when calling ERROR_AND_ABORT. */ \ 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 21122c75609a4..e6052529e2035 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 0af8af37c6cf02d99456d30e4639bbddf8e6ace9..9a27610992612b59eadcc8e481683cf1e6a5dbb6 100644 +index 7c0b4a0851b295ee0c86f701c997b739a3cb7a7a..689e7fb2339253d0f2be3ccf33ecd76660ccf176 100644 --- a/common.gypi +++ b/common.gypi @@ -89,6 +89,23 @@ diff --git a/patches/node/fix_assert_module_in_the_renderer_process.patch b/patches/node/fix_assert_module_in_the_renderer_process.patch index 4b35b6f1d53dd..64ef1f6fd03e9 100644 --- a/patches/node/fix_assert_module_in_the_renderer_process.patch +++ b/patches/node/fix_assert_module_in_the_renderer_process.patch @@ -13,7 +13,7 @@ if the override has been disabled. This will be upstreamed. diff --git a/lib/assert.js b/lib/assert.js -index 9dfcf80a913942c93b206c6f871ac7807c7a7e81..4d25a22aedf7d7182bb709864e29b7e725336323 100644 +index eadc3844c20128bb9f9a269e5d599f8febf17421..e4615e55c0847d969e9c95295ddecfc640019c99 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -66,6 +66,7 @@ const { inspect } = require('internal/util/inspect'); @@ -44,10 +44,10 @@ 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 f9d29f0065b1de63a62cfdce74a9705c22dd87d7..3f44160f1bd40fc2d4658f10edf0d0b374732ca2 100644 +index fe41619f45913fe31a59771c8d1af6cde3b89f66..bb6c6d51846fed1d160ec9dcd5a5dd67b4fef911 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -277,6 +277,9 @@ void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s) { +@@ -244,6 +244,9 @@ void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s) { auto* prepare_stack_trace_cb = s.prepare_stack_trace_callback ? s.prepare_stack_trace_callback : PrepareStackTraceCallback; isolate->SetPrepareStackTraceCallback(prepare_stack_trace_cb); @@ -58,18 +58,24 @@ index f9d29f0065b1de63a62cfdce74a9705c22dd87d7..3f44160f1bd40fc2d4658f10edf0d0b3 } diff --git a/src/node_options.cc b/src/node_options.cc -index 28fbd93c5d4a6f379844e10e556920b7614910d8..53cf93719bea001db09697b56f197815549dc953 100644 +index 74955717117001393e8b55809b4e4a1424019dad..409c6e3918e3ef7c9d35f87e093cb965cb889dd7 100644 --- a/src/node_options.cc +++ b/src/node_options.cc -@@ -1321,6 +1321,11 @@ void GetEmbedderOptions(const FunctionCallbackInfo& args) { - Local context = env->context(); - Local ret = Object::New(isolate); +@@ -1393,14 +1393,16 @@ void GetEmbedderOptions(const FunctionCallbackInfo& args) { + } + Isolate* isolate = args.GetIsolate(); + +- constexpr size_t kOptionsSize = 4; ++ constexpr size_t kOptionsSize = 5; + std::array, kOptionsSize> names = { ++ FIXED_ONE_BYTE_STRING(env->isolate(), "hasPrepareStackTraceCallback"), + FIXED_ONE_BYTE_STRING(env->isolate(), "shouldNotRegisterESMLoader"), + FIXED_ONE_BYTE_STRING(env->isolate(), "noGlobalSearchPaths"), + FIXED_ONE_BYTE_STRING(env->isolate(), "noBrowserGlobals"), + FIXED_ONE_BYTE_STRING(env->isolate(), "hasEmbedderPreload")}; -+ if (ret->Set(context, -+ FIXED_ONE_BYTE_STRING(env->isolate(), "hasPrepareStackTraceCallback"), -+ Boolean::New(isolate, !env->prepare_stack_trace_callback().IsEmpty())) -+ .IsNothing()) return; -+ - if (ret->Set(context, - FIXED_ONE_BYTE_STRING(env->isolate(), "shouldNotRegisterESMLoader"), - Boolean::New(isolate, env->should_not_register_esm_loader())) + std::array, kOptionsSize> values = { ++ Boolean::New(isolate, env->prepare_stack_trace_callback().IsEmpty()), + Boolean::New(isolate, env->should_not_register_esm_loader()), + Boolean::New(isolate, env->no_global_search_paths()), + Boolean::New(isolate, env->no_browser_globals()), diff --git a/patches/node/fix_building_with_unicode.patch b/patches/node/fix_building_with_unicode.patch deleted file mode 100644 index b039f758bc339..0000000000000 --- a/patches/node/fix_building_with_unicode.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Keeley Hammond -Date: Thu, 25 Jul 2024 15:29:12 -0700 -Subject: fix: building with UNICODE - -Use the unicode version of 'RegOpenKeyEx' to avoid compilation error on string type. - -Backport of https://github.com/c-ares/c-ares/pull/802. - -diff --git a/deps/cares/src/lib/ares_event_configchg.c b/deps/cares/src/lib/ares_event_configchg.c -index c9b39f7b3358f37e61fb95e440695a9b590c2090..b33141ce3a30dd92509de8a4aff1a7fc76a5b915 100644 ---- a/deps/cares/src/lib/ares_event_configchg.c -+++ b/deps/cares/src/lib/ares_event_configchg.c -@@ -319,15 +319,15 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg, - /* Monitor HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\Interfaces - * and HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces - * for changes via RegNotifyChangeKeyValue() */ -- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, -- "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces", -+ if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, -+ L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces", - 0, KEY_NOTIFY, &c->regip4) != ERROR_SUCCESS) { - status = ARES_ESERVFAIL; - goto done; - } - -- if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, -- "SYSTEM\\CurrentControlSet\\Services\\Tcpip6\\Parameters\\Interfaces", -+ if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, -+ L"SYSTEM\\CurrentControlSet\\Services\\Tcpip6\\Parameters\\Interfaces", - 0, KEY_NOTIFY, &c->regip6) != ERROR_SUCCESS) { - status = ARES_ESERVFAIL; - goto done; 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 febe2a9fbc2d0..dfbcdda173155 100644 --- a/patches/node/fix_crypto_tests_to_run_with_bssl.patch +++ b/patches/node/fix_crypto_tests_to_run_with_bssl.patch @@ -381,7 +381,7 @@ index fcf1922bcdba733af6c22f142db4f7b099947757..9f72ae4e41a113e752f40795103c2af5 assert.throws(() => crypto.createDiffieHellman('abcdef', g), ex); assert.throws(() => crypto.createDiffieHellman('abcdef', 'hex', g), ex); diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js -index fb580e1b315445182538c56fc114742ce896bf4c..36014fe7cb411016d72a7f4ab118923d12e97898 100644 +index 8ae0a002fec0944737d2c6ae73fc8956e41beb50..5b37236a6c2f1ec1761d8143c8ea6a7e2a837a7a 100644 --- a/test/parallel/test-crypto-dh.js +++ b/test/parallel/test-crypto-dh.js @@ -55,18 +55,17 @@ const crypto = require('crypto'); @@ -411,7 +411,7 @@ index fb580e1b315445182538c56fc114742ce896bf4c..36014fe7cb411016d72a7f4ab118923d }; } -@@ -99,10 +98,16 @@ const crypto = require('crypto'); +@@ -100,10 +99,16 @@ const crypto = require('crypto'); // Through a fluke of history, g=0 defaults to DH_GENERATOR (2). { const g = 0; diff --git a/patches/node/fix_do_not_resolve_electron_entrypoints.patch b/patches/node/fix_do_not_resolve_electron_entrypoints.patch index ba3c8252444e8..e5177c8297d81 100644 --- a/patches/node/fix_do_not_resolve_electron_entrypoints.patch +++ b/patches/node/fix_do_not_resolve_electron_entrypoints.patch @@ -6,7 +6,7 @@ Subject: fix: do not resolve electron entrypoints This wastes fs cycles and can result in strange behavior if this path actually exists on disk diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js -index 449131b9af99744c08d62d73f8d124cef5c9cc71..3df06eff63106aece1009d88fd01df2abdf6d943 100644 +index 22248b753c14960122f1d6b9bfe6b89fdb8d2010..9d245a04fbcb98dcd1c61e60f7cfe528bd1c8af0 100644 --- a/lib/internal/modules/esm/load.js +++ b/lib/internal/modules/esm/load.js @@ -132,7 +132,7 @@ async function defaultLoad(url, context = kEmptyObject) { @@ -19,19 +19,19 @@ index 449131b9af99744c08d62d73f8d124cef5c9cc71..3df06eff63106aece1009d88fd01df2a context = { __proto__: context, source }; } diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index 5e79fc2c04ffb6006229920cc1ab61b537fed4c0..d62565bf4fe51be41d9ce6ef3ffc04ed34d17e1a 100644 +index f3dfc69cd2cdec50bc3b3f7cb2d63349812d87dd..b6f2d7194cb75ecc8c47869761c63184707ade40 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js -@@ -379,6 +379,9 @@ function cjsPreparseModuleExports(filename, source) { - if (cached) { - return { module, exportNames: cached.exportNames }; - } -+ if (filename === 'electron') { -+ return { module, exportNames: new SafeSet(['default', ...Object.keys(module.exports)]) }; -+ } +@@ -375,6 +375,9 @@ function cjsPreparseModuleExports(filename, source) { + if (module && module[kModuleExportNames] !== undefined) { + return { module, exportNames: module[kModuleExportNames] }; } ++ if (filename === 'electron') { ++ return { module, exportNames: new SafeSet(['default', ...Object.keys(module.exports)]) }; ++ } const loaded = Boolean(module); if (!loaded) { + module = new CJSModule(filename); diff --git a/lib/internal/modules/run_main.js b/lib/internal/modules/run_main.js index ca401044c0178c46db9b439b27c440a5d7924c84..dc1a682f0a3cf1ba1095c60bf6a6ca992d6043b3 100644 --- a/lib/internal/modules/run_main.js diff --git a/patches/node/fix_expose_lookupandcompile_with_parameters.patch b/patches/node/fix_expose_lookupandcompile_with_parameters.patch deleted file mode 100644 index 94befc32f20d8..0000000000000 --- a/patches/node/fix_expose_lookupandcompile_with_parameters.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Thu, 13 Oct 2022 17:10:01 +0200 -Subject: fix: expose LookupAndCompile with parameters - -Node.js removed custom parameters from the public version of LookupAndCompile, -which we use in Electron. This patch re-exposes a wrapper to allow custom -parameters. - -This should be upstreamed. - -diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index 2cac503e92640a4683a4be6969f1ed40e42785a0..f9a090f5c3e04403602ba383032e7f3230669a92 100644 ---- a/src/node_builtins.cc -+++ b/src/node_builtins.cc -@@ -491,6 +491,18 @@ MaybeLocal BuiltinLoader::CompileAndCall(Local context, - return fn->Call(context, undefined, argc, argv); - } - -+MaybeLocal BuiltinLoader::LookupAndCompile( -+ Local context, -+ const char* id, -+ std::vector>* parameters, -+ Realm* optional_realm) { -+ Isolate* isolate = context->GetIsolate(); -+ -+ MaybeLocal maybe = LookupAndCompileInternal( -+ context, id, parameters, optional_realm); -+ return maybe; -+} -+ - bool BuiltinLoader::CompileAllBuiltinsAndCopyCodeCache( - Local context, - const std::vector& eager_builtins, -diff --git a/src/node_builtins.h b/src/node_builtins.h -index a1a9fe7d592f0d57b70dcee8c865b99d71248bf2..3279aac04fd20080db258eafa2826c2dda614b90 100644 ---- a/src/node_builtins.h -+++ b/src/node_builtins.h -@@ -99,6 +99,12 @@ class NODE_EXTERN_PRIVATE BuiltinLoader { - const char* id, - Realm* optional_realm); - -+ v8::MaybeLocal LookupAndCompile( -+ v8::Local context, -+ const char* id, -+ std::vector>* parameters, -+ Realm* optional_realm); -+ - v8::MaybeLocal CompileAndCall(v8::Local context, - const char* id, - int argc, -@@ -109,6 +115,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader { - const char* id, - Realm* realm); - -+ - // Returns config.gypi as a JSON string - v8::Local GetConfigString(v8::Isolate* isolate); - bool Exists(const char* id); diff --git a/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch b/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch index cce05bd17584e..fc2f7ead31d21 100644 --- a/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch +++ b/patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch @@ -18,7 +18,7 @@ index 1931688e85d05ee2da4f88efb05d635cb43be233..afccc24392abff9eef2b9953fcffeb79 /** diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js -index 5239bc8ed883a54df206d73c5dc0b70942c4f3df..6a15fcae677b3bda58fc85f705862bbcd9feec9d 100644 +index 7b77af35a1dfebf6ad45ace521f1a55b5fa18293..ac24cf305bd5995ad13b37ee36f9e1fe3589c5d7 100644 --- a/lib/internal/modules/esm/load.js +++ b/lib/internal/modules/esm/load.js @@ -142,7 +142,7 @@ async function defaultLoad(url, context = kEmptyObject) { @@ -30,7 +30,7 @@ index 5239bc8ed883a54df206d73c5dc0b70942c4f3df..6a15fcae677b3bda58fc85f705862bbc // For backward compatibility reasons, we need to discard the source in // order for the CJS loader to re-fetch it. source = null; -@@ -224,6 +224,7 @@ function throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports) { +@@ -234,6 +234,7 @@ function throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports) { protocol !== 'file:' && protocol !== 'data:' && protocol !== 'node:' && @@ -38,7 +38,7 @@ index 5239bc8ed883a54df206d73c5dc0b70942c4f3df..6a15fcae677b3bda58fc85f705862bbc ( !experimentalNetworkImports || ( -@@ -232,7 +233,7 @@ function throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports) { +@@ -242,7 +243,7 @@ function throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports) { ) ) ) { @@ -73,10 +73,10 @@ index e73a8ad60a13925d6773c32cead8d04ec9d96ee7..52cdb7d5e14a18ed7b1b65e429729cf4 parsePackageName(specifier, base); diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index 6772bbffd989d2257593bde76c94449dbd9272a8..232cf43c500056896eb754c15334858038b0525c 100644 +index 8f4b6b25d8889686d00613fd9821b0aa822a946a..89ca269294ee1afa7f5aeb0ac6b8958f7a8b49d0 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js -@@ -283,7 +283,7 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) { +@@ -272,7 +272,7 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) { const { exportNames, module } = cjsPreparseModuleExports(filename, source); cjsCache.set(url, module); @@ -85,7 +85,7 @@ index 6772bbffd989d2257593bde76c94449dbd9272a8..232cf43c500056896eb754c153348580 [...exportNames] : ['default', ...exportNames]; if (isMain) { -@@ -305,8 +305,8 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) { +@@ -294,8 +294,8 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) { ({ exports } = module); } for (const exportName of exportNames) { @@ -96,7 +96,7 @@ index 6772bbffd989d2257593bde76c94449dbd9272a8..232cf43c500056896eb754c153348580 continue; } // We might trigger a getter -> dont fail. -@@ -331,6 +331,10 @@ translators.set('require-commonjs', (url, source, isMain) => { +@@ -329,6 +329,10 @@ translators.set('require-commonjs', (url, source, isMain) => { return createCJSModuleWrap(url, source); }); @@ -108,7 +108,7 @@ index 6772bbffd989d2257593bde76c94449dbd9272a8..232cf43c500056896eb754c153348580 // 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 34fb672ecb62b83cfb6a3a7484354165f4b02a85..679cb1302dfeb4a50d34219efccc73b518587066 100644 +index 4103775560644e4f1a78bf11da6cc07d5dc4cda2..474cf3b44d680c4c897553d5e98c3c43699e6592 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -1459,6 +1459,8 @@ function fileURLToPath(path, options = kEmptyObject) { 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 850b0b96eac3b..4eb5d30bea95b 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 @@ -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 cdc2f7aaa8efd8b5d9090455c92d81b2bef460b7..12414204361e7227f7f7736a07388ade3f093e00 100644 +index cb4095dee52c5a5d40815c20c33065fd03ce0804..60be2353cf0e77287dfda965c820cf36655a7ce5 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -591,6 +591,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) { +@@ -558,6 +558,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) { return env->platform(); } @@ -22,7 +22,7 @@ index cdc2f7aaa8efd8b5d9090455c92d81b2bef460b7..12414204361e7227f7f7736a07388ade int thread_pool_size, node::tracing::TracingController* tracing_controller) { diff --git a/src/node.h b/src/node.h -index 7047a667f7f1b2a09aa409b2933aad4b3a4af929..c267ed1eeaa2d8b6ecd5a1563a4e9440bf0cca00 100644 +index 6373adacb628459a4c9d7237da2587aee318e2d8..4f2eb9d0aab88b70c86339e750799080e980d7da 100644 --- a/src/node.h +++ b/src/node.h @@ -133,6 +133,7 @@ struct SnapshotData; @@ -33,7 +33,7 @@ index 7047a667f7f1b2a09aa409b2933aad4b3a4af929..c267ed1eeaa2d8b6ecd5a1563a4e9440 class TracingController; } -@@ -828,6 +829,8 @@ NODE_EXTERN void GetNodeReport(Environment* env, +@@ -832,6 +833,8 @@ NODE_EXTERN void GetNodeReport(Environment* env, 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 ccaaacd55feb4..267bdf2ea9d8d 100644 --- a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch +++ b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch @@ -38,10 +38,10 @@ index 67cd4f2adf15e7d8511f561c54163b1842e971af..88471fd6bc0b8a810bb55464cd2d1933 const EVP_MD* digest = nullptr; diff --git a/src/crypto/crypto_common.cc b/src/crypto/crypto_common.cc -index 962018583360a137639682d4aec8b0ebad2f3070..4f569daa0d5e9976f40f30b77425679798a0b8b8 100644 +index 85d48dfd2c15c453707bf6eb94e22f89b4f856b2..fe31a9a7f465a03d2de365cef392dfbb7c540156 100644 --- a/src/crypto/crypto_common.cc +++ b/src/crypto/crypto_common.cc -@@ -166,7 +166,7 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { +@@ -158,7 +158,7 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { const unsigned char* buf; size_t len; size_t rem; @@ -50,7 +50,7 @@ index 962018583360a137639682d4aec8b0ebad2f3070..4f569daa0d5e9976f40f30b774256797 if (!SSL_client_hello_get0_ext( ssl.get(), TLSEXT_TYPE_application_layer_protocol_negotiation, -@@ -179,13 +179,15 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { +@@ -171,13 +171,15 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { len = (buf[0] << 8) | buf[1]; if (len + 2 != rem) return nullptr; return reinterpret_cast(buf + 3); @@ -67,7 +67,7 @@ index 962018583360a137639682d4aec8b0ebad2f3070..4f569daa0d5e9976f40f30b774256797 if (!SSL_client_hello_get0_ext( ssl.get(), TLSEXT_TYPE_server_name, -@@ -207,6 +209,8 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) { +@@ -199,6 +201,8 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) { if (len + 2 > rem) return nullptr; return reinterpret_cast(buf + 5); @@ -76,7 +76,7 @@ index 962018583360a137639682d4aec8b0ebad2f3070..4f569daa0d5e9976f40f30b774256797 } const char* GetServerName(SSL* ssl) { -@@ -1044,14 +1048,14 @@ MaybeLocal GetClientHelloCiphers( +@@ -1036,14 +1040,14 @@ MaybeLocal GetClientHelloCiphers( Environment* env, const SSLPointer& ssl) { EscapableHandleScope scope(env->isolate()); @@ -95,7 +95,7 @@ index 962018583360a137639682d4aec8b0ebad2f3070..4f569daa0d5e9976f40f30b774256797 Local obj = Object::New(env->isolate()); if (!Set(env->context(), obj, -@@ -1104,8 +1108,11 @@ MaybeLocal GetEphemeralKey(Environment* env, const SSLPointer& ssl) { +@@ -1096,8 +1100,11 @@ MaybeLocal GetEphemeralKey(Environment* env, const SSLPointer& ssl) { EscapableHandleScope scope(env->isolate()); Local info = Object::New(env->isolate()); @@ -237,10 +237,10 @@ index 3fa4a415dc911a13afd90dfb31c1ed4ad0fd268f..fa48dffc31342c44a1c1207b9d4c3dc7 return EVPKeyCtxPointer(); diff --git a/src/crypto/crypto_keys.cc b/src/crypto/crypto_keys.cc -index a4979cf5586a7be6308a917eb020bedafa17f683..e4705482c6d45138deac84c59d8192bb2a284a76 100644 +index ce28ec8f37a5e483b11284bc866cb649ad7b61cf..eaaa151a770a23a498984cf03c0e9b999a4ad8e8 100644 --- a/src/crypto/crypto_keys.cc +++ b/src/crypto/crypto_keys.cc -@@ -1241,6 +1241,7 @@ void KeyObjectHandle::GetAsymmetricKeyType( +@@ -1239,6 +1239,7 @@ void KeyObjectHandle::GetAsymmetricKeyType( } bool KeyObjectHandle::CheckEcKeyData() const { @@ -248,7 +248,7 @@ index a4979cf5586a7be6308a917eb020bedafa17f683..e4705482c6d45138deac84c59d8192bb MarkPopErrorOnReturn mark_pop_error_on_return; const ManagedEVPPKey& key = data_->GetAsymmetricKey(); -@@ -1259,6 +1260,9 @@ bool KeyObjectHandle::CheckEcKeyData() const { +@@ -1257,6 +1258,9 @@ bool KeyObjectHandle::CheckEcKeyData() const { #else return EVP_PKEY_public_check(ctx.get()) == 1; #endif @@ -272,7 +272,7 @@ index 48154df7dc91ed7c0d65323199bc2f59dfc68135..6431e5c3062890975854780d15ecb843 THROW_ERR_CRYPTO_OPERATION_FAILED(env, "could not generate prime"); return Nothing(); diff --git a/src/crypto/crypto_rsa.cc b/src/crypto/crypto_rsa.cc -index f222ab9cf5ccbc5dd3399b18d7688efda6672c93..349abd4d06e7f624a071b994271dedc31dc9229a 100644 +index 23b2b8c56dec8ac600b8f14b78d9e80b7fa3ed3b..e7a8fe4181542252d9142ea9460cacc5b4acd00d 100644 --- a/src/crypto/crypto_rsa.cc +++ b/src/crypto/crypto_rsa.cc @@ -616,10 +616,11 @@ Maybe GetRsaKeyDetail( @@ -292,10 +292,10 @@ index f222ab9cf5ccbc5dd3399b18d7688efda6672c93..349abd4d06e7f624a071b994271dedc3 if (target diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc -index 5734d8fdc5505e1586f571c19b840bd56e9c9f1f..3034b114e081e2b32dd5b71653927a41af7d48df 100644 +index 990638ec3993bde40ad3dd40d373d816ebc66a6a..63d971e1fe6b861e29c12f04563701b01fdfb976 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc -@@ -517,24 +517,15 @@ Maybe Decorate(Environment* env, Local obj, +@@ -518,24 +518,15 @@ Maybe Decorate(Environment* env, V(BIO) \ V(PKCS7) \ V(X509V3) \ @@ -321,7 +321,7 @@ index 5734d8fdc5505e1586f571c19b840bd56e9c9f1f..3034b114e081e2b32dd5b71653927a41 V(USER) \ #define V(name) case ERR_LIB_##name: lib = #name "_"; break; -@@ -715,7 +706,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -716,7 +707,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { CHECK(args[0]->IsUint32()); Environment* env = Environment::GetCurrent(args); uint32_t len = args[0].As()->Value(); @@ -330,7 +330,7 @@ index 5734d8fdc5505e1586f571c19b840bd56e9c9f1f..3034b114e081e2b32dd5b71653927a41 if (data == nullptr) { // There's no memory available for the allocation. // Return nothing. -@@ -726,7 +717,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -727,7 +718,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { data, len, [](void* data, size_t len, void* deleter_data) { @@ -339,7 +339,7 @@ index 5734d8fdc5505e1586f571c19b840bd56e9c9f1f..3034b114e081e2b32dd5b71653927a41 }, data); Local buffer = ArrayBuffer::New(env->isolate(), store); -@@ -734,10 +725,12 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -735,10 +726,12 @@ void SecureBuffer(const FunctionCallbackInfo& args) { } void SecureHeapUsed(const FunctionCallbackInfo& args) { @@ -353,7 +353,7 @@ index 5734d8fdc5505e1586f571c19b840bd56e9c9f1f..3034b114e081e2b32dd5b71653927a41 } // namespace diff --git a/src/env.h b/src/env.h -index cd8db07919dc4d00675bbaae976e8fa1fcc16028..2310c89227f08cdcca6c4965cc163031af303626 100644 +index 1ca2d5ed40fa3c72256182fa4ca4b6a09190ca16..c6cc2c874b603f595a008a7d3bc229d6b9834f55 100644 --- a/src/env.h +++ b/src/env.h @@ -49,7 +49,7 @@ @@ -365,7 +365,7 @@ index cd8db07919dc4d00675bbaae976e8fa1fcc16028..2310c89227f08cdcca6c4965cc163031 #include #endif -@@ -1038,7 +1038,7 @@ class Environment : public MemoryRetainer { +@@ -1040,7 +1040,7 @@ class Environment : public MemoryRetainer { kExitInfoFieldCount }; @@ -388,7 +388,7 @@ index cf051585e779e2b03bd7b95fe5008b89cc7f8162..9de49c6828468fdf846dcd4ad445390f #if NODE_OPENSSL_HAS_QUIC #include diff --git a/src/node_options.cc b/src/node_options.cc -index 1ba0bfcd9b3096c4bffe518ad08973edb895e8c3..28fbd93c5d4a6f379844e10e556920b7614910d8 100644 +index e94e4dbc959cee1fcab68799edc84745dfc07ec8..74955717117001393e8b55809b4e4a1424019dad 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -6,7 +6,7 @@ @@ -401,7 +401,7 @@ index 1ba0bfcd9b3096c4bffe518ad08973edb895e8c3..28fbd93c5d4a6f379844e10e556920b7 #endif diff --git a/src/node_options.h b/src/node_options.h -index 1357e5b42869e8e3a30d2bf6db0faed565d99754..49c6d8b4162977a926e36bad7183a10502b2beaf 100644 +index c978c339cbbb388f0f49d26ded0e92bb52a7973a..d13c97e8a0e1ea0212fb34a0178b3a7c74ff43e6 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -11,7 +11,7 @@ diff --git a/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch b/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch index 72a54b2dbfb5d..787043e5cca47 100644 --- a/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch +++ b/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch @@ -6,7 +6,7 @@ Subject: fix: lazyload fs in esm loaders to apply asar patches Changes { foo } from fs to just "fs.foo" so that our patching of fs is applied to esm loaders diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js -index 6a15fcae677b3bda58fc85f705862bbcd9feec9d..449131b9af99744c08d62d73f8d124cef5c9cc71 100644 +index ac24cf305bd5995ad13b37ee36f9e1fe3589c5d7..22248b753c14960122f1d6b9bfe6b89fdb8d2010 100644 --- a/lib/internal/modules/esm/load.js +++ b/lib/internal/modules/esm/load.js @@ -10,7 +10,7 @@ const { kEmptyObject } = require('internal/util'); @@ -78,7 +78,7 @@ index 52cdb7d5e14a18ed7b1b65e429729cf47dce3f98..69f73f829706deddc4f328b78af9d584 // Check for !stat.isDirectory() if (stat !== 1) { diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index 232cf43c500056896eb754c15334858038b0525c..5e79fc2c04ffb6006229920cc1ab61b537fed4c0 100644 +index 89ca269294ee1afa7f5aeb0ac6b8958f7a8b49d0..f3dfc69cd2cdec50bc3b3f7cb2d63349812d87dd 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -36,7 +36,7 @@ const { @@ -90,7 +90,7 @@ index 232cf43c500056896eb754c15334858038b0525c..5e79fc2c04ffb6006229920cc1ab61b5 const { dirname, extname, isAbsolute } = require('path'); const { loadBuiltinModule, -@@ -358,7 +358,7 @@ translators.set('commonjs', async function commonjsStrategy(url, source, +@@ -356,7 +356,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 232cf43c500056896eb754c15334858038b0525c..5e79fc2c04ffb6006229920cc1ab61b5 } catch { // Continue regardless of error. } -@@ -427,7 +427,7 @@ function cjsPreparseModuleExports(filename, source) { +@@ -424,7 +424,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). diff --git a/patches/node/fix_revert_src_lb_reducing_c_calls_of_esm_legacy_main_resolve.patch b/patches/node/fix_revert_src_lb_reducing_c_calls_of_esm_legacy_main_resolve.patch index 748963f28b24d..dfeebbd3586e0 100644 --- a/patches/node/fix_revert_src_lb_reducing_c_calls_of_esm_legacy_main_resolve.patch +++ b/patches/node/fix_revert_src_lb_reducing_c_calls_of_esm_legacy_main_resolve.patch @@ -142,7 +142,7 @@ index 69f73f829706deddc4f328b78af9d58434af647d..1d53a2a47423150e822bb917b2725d3a const encodedSepRegEx = /%2F|%5C/i; diff --git a/src/node_file.cc b/src/node_file.cc -index b0aa53420c4efb45ccb129cd4db5579de9f3e401..3e3aa383f54f45ab6dd134be29a2dbcf35760163 100644 +index 80ff36f2463035ed32cb8b7b826bfe94c339dbe2..cca6c6775bc8dd35b897498c7dd65b2e3957ee40 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -19,14 +19,11 @@ @@ -160,7 +160,7 @@ index b0aa53420c4efb45ccb129cd4db5579de9f3e401..3e3aa383f54f45ab6dd134be29a2dbcf #include "node_process-inl.h" #include "node_stat_watcher.h" #include "node_url.h" -@@ -3116,134 +3113,6 @@ constexpr std::array legacy_main_extensions = { +@@ -3127,135 +3124,6 @@ constexpr std::array legacy_main_extensions = { } // namespace @@ -180,6 +180,8 @@ index b0aa53420c4efb45ccb129cd4db5579de9f3e401..3e3aa383f54f45ab6dd134be29a2dbcf - return; - } - +- std::string package_initial_file = ""; +- - ada::result file_path_url; - std::optional initial_file_path; - std::string file_path; @@ -202,6 +204,8 @@ index b0aa53420c4efb45ccb129cd4db5579de9f3e401..3e3aa383f54f45ab6dd134be29a2dbcf - - node::url::FromNamespacedPath(&initial_file_path.value()); - +- package_initial_file = *initial_file_path; +- - for (int i = 0; i < legacy_main_extensions_with_main_end; i++) { - file_path = *initial_file_path + std::string(legacy_main_extensions[i]); - @@ -257,13 +261,10 @@ index b0aa53420c4efb45ccb129cd4db5579de9f3e401..3e3aa383f54f45ab6dd134be29a2dbcf - } - } - -- std::optional module_path = -- node::url::FileURLToPath(env, *package_json_url); -- std::optional module_base; +- if (package_initial_file == "") +- package_initial_file = *initial_file_path + ".js"; - -- if (!module_path.has_value()) { -- return; -- } +- std::optional module_base; - - if (args.Length() >= 3 && args[2]->IsString()) { - Utf8Value utf8_base_path(isolate, args[2]); @@ -288,14 +289,14 @@ index b0aa53420c4efb45ccb129cd4db5579de9f3e401..3e3aa383f54f45ab6dd134be29a2dbcf - - THROW_ERR_MODULE_NOT_FOUND(isolate, - "Cannot find package '%s' imported from %s", -- *module_path, +- package_initial_file, - *module_base); -} - void BindingData::MemoryInfo(MemoryTracker* tracker) const { tracker->TrackField("stats_field_array", stats_field_array); tracker->TrackField("stats_field_bigint_array", stats_field_bigint_array); -@@ -3343,19 +3212,6 @@ InternalFieldInfoBase* BindingData::Serialize(int index) { +@@ -3355,19 +3223,6 @@ InternalFieldInfoBase* BindingData::Serialize(int index) { return info; } @@ -315,7 +316,7 @@ index b0aa53420c4efb45ccb129cd4db5579de9f3e401..3e3aa383f54f45ab6dd134be29a2dbcf static void CreatePerIsolateProperties(IsolateData* isolate_data, Local target) { Isolate* isolate = isolate_data->isolate(); -@@ -3410,7 +3266,6 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data, +@@ -3422,7 +3277,6 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data, SetMethod(isolate, target, "mkdtemp", Mkdtemp); StatWatcher::CreatePerIsolateProperties(isolate_data, target); @@ -323,7 +324,7 @@ index b0aa53420c4efb45ccb129cd4db5579de9f3e401..3e3aa383f54f45ab6dd134be29a2dbcf target->Set( FIXED_ONE_BYTE_STRING(isolate, "kFsStatsFieldsNumber"), -@@ -3483,7 +3338,6 @@ BindingData* FSReqBase::binding_data() { +@@ -3495,7 +3349,6 @@ BindingData* FSReqBase::binding_data() { void RegisterExternalReferences(ExternalReferenceRegistry* registry) { registry->Register(Access); StatWatcher::RegisterExternalReferences(registry); @@ -350,7 +351,7 @@ index 6f1b55284db0f4f8c70081b4834a074c717f3cc9..a969fff32bd156aa9393c1db9eec474e SET_SELF_SIZE(BindingData) SET_MEMORY_INFO_NAME(BindingData) diff --git a/test/es-module/test-cjs-legacyMainResolve.js b/test/es-module/test-cjs-legacyMainResolve.js -index 1dc7d8faafe6eb5cea7e43e9783041f2a994be0d..d86d501689b2b72f2b964d6e2a91c5d36b6b62f5 100644 +index 0bfeb567a22b1f9d9116b749d6cb3a8fda6bcc6a..17f137c595a9fef5f051fafc4682f206034c214c 100644 --- a/test/es-module/test-cjs-legacyMainResolve.js +++ b/test/es-module/test-cjs-legacyMainResolve.js @@ -82,7 +82,7 @@ describe('legacyMainResolve', () => { @@ -366,7 +367,7 @@ index 1dc7d8faafe6eb5cea7e43e9783041f2a994be0d..d86d501689b2b72f2b964d6e2a91c5d3 ); assert.throws( () => legacyMainResolve(packageJsonUrl, { main: null }, packageJsonUrl), -- { code: 'ERR_MODULE_NOT_FOUND' }, +- { message: /index\.js/, code: 'ERR_MODULE_NOT_FOUND' }, + { code: 'ERR_INTERNAL_ASSERTION' }, ); }); @@ -375,12 +376,21 @@ index 1dc7d8faafe6eb5cea7e43e9783041f2a994be0d..d86d501689b2b72f2b964d6e2a91c5d3 const packageJsonUrl = pathToFileURL('/c/file%20with%20percents/package.json'); assert.throws( () => legacyMainResolve(packageJsonUrl, { main: null }, packageJsonUrl), -- { code: 'ERR_MODULE_NOT_FOUND' }, +- { message: /index\.js/, code: 'ERR_MODULE_NOT_FOUND' }, + { code: 'ERR_INTERNAL_ASSERTION' }, ); }); @@ -150,7 +150,7 @@ describe('legacyMainResolve', () => { + ); + assert.throws( + () => legacyMainResolve(packageJsonUrl, { main: './index.node' }, packageJsonUrl), +- { message: /index\.node/, code: 'ERR_MODULE_NOT_FOUND' }, ++ { code: 'ERR_INTERNAL_ASSERTION' }, + ); + }); + +@@ -163,7 +163,7 @@ describe('legacyMainResolve', () => { ); assert.throws( () => legacyMainResolve(packageJsonUrl, { main: null }, undefined), diff --git a/patches/node/pass_all_globals_through_require.patch b/patches/node/pass_all_globals_through_require.patch index ff927e0e63eae..596b997812510 100644 --- a/patches/node/pass_all_globals_through_require.patch +++ b/patches/node/pass_all_globals_through_require.patch @@ -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 7bbd59e16330b59f6c71aa8e6ff59659e42f6cee..276ab42c22b796ee07ce66744187adca6a8b8da4 100644 +index c284b39b1ac13eaea8776b7b4f457c084dce5fb8..c794751ecd4448119ce33d661e694f83b3323f03 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -148,6 +148,13 @@ const { +@@ -185,6 +185,13 @@ const { CHAR_FORWARD_SLASH, } = require('internal/constants'); @@ -23,8 +23,8 @@ index 7bbd59e16330b59f6c71aa8e6ff59659e42f6cee..276ab42c22b796ee07ce66744187adca const { isProxy, } = require('internal/util/types'); -@@ -1353,10 +1360,12 @@ Module.prototype._compile = function(content, filename) { - setHasStartedUserCJSExecution(); +@@ -1464,10 +1471,12 @@ Module.prototype._compile = function(content, filename, loadAsESM = false) { + this[kIsExecuting] = true; if (inspectorWrapper) { result = inspectorWrapper(compiledWrapper, thisValue, exports, - require, module, filename, dirname); @@ -36,5 +36,5 @@ index 7bbd59e16330b59f6c71aa8e6ff59659e42f6cee..276ab42c22b796ee07ce66744187adca + [exports, require, module, filename, + dirname, process, localGlobal, localBuffer]); } + this[kIsExecuting] = false; if (requireDepth === 0) { statCache = null; } - return result; 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 0925cfcb3a070..f36422f981307 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 @@ -22,10 +22,10 @@ index 12262f40ce123440a9a0f974386cfbe8511f4459..f3c15b61d33bdae44de528e106fcc6f9 const binding = internalBinding('builtins'); diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index 276ab42c22b796ee07ce66744187adca6a8b8da4..155485dbab0d46bb225fa40e99f555d805659c4f 100644 +index c794751ecd4448119ce33d661e694f83b3323f03..364469160af5e348f8890417de16a63c0d1dca67 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -102,7 +102,7 @@ const { +@@ -138,7 +138,7 @@ const { const assert = require('internal/assert'); const fs = require('fs'); const path = require('path'); @@ -34,7 +34,7 @@ index 276ab42c22b796ee07ce66744187adca6a8b8da4..155485dbab0d46bb225fa40e99f555d8 const { safeGetenv } = internalBinding('credentials'); const { privateSymbols: { -@@ -196,7 +196,7 @@ function stat(filename) { +@@ -233,7 +233,7 @@ function stat(filename) { const result = statCache.get(filename); if (result !== undefined) { return result; } } diff --git a/patches/node/src_do_not_use_deprecated_v8_api.patch b/patches/node/src_do_not_use_deprecated_v8_api.patch index d6c0c6e46e9e7..eb0549b2e5d21 100644 --- a/patches/node/src_do_not_use_deprecated_v8_api.patch +++ b/patches/node/src_do_not_use_deprecated_v8_api.patch @@ -60,7 +60,7 @@ index 5968694e8393d8434fb2ffee411dfac4c93aff29..5c16d0d1b32e2d056f4fcfa0e0178129 const v8::PropertyCallbackInfo& info); diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index 3f82db324d406e342abee23ab0d7f7c9807ff652..91ee97c0d1308e650730b9977facb924ab361bf5 100644 +index 3e37aa8b0c9696cceb3f3cfab9721f38c74a2fba..78f20de6b127961e9de7b5caaeca702ed7a36e01 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -11,7 +11,6 @@ namespace node { @@ -71,7 +71,7 @@ index 3f82db324d406e342abee23ab0d7f7c9807ff652..91ee97c0d1308e650730b9977facb924 using v8::EscapableHandleScope; using v8::Function; using v8::FunctionCallbackInfo; -@@ -724,7 +723,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data, +@@ -720,7 +719,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data, nullptr, Local(), None, @@ -79,7 +79,7 @@ index 3f82db324d406e342abee23ab0d7f7c9807ff652..91ee97c0d1308e650730b9977facb924 SideEffectType::kHasNoSideEffect); target->SetNativeDataProperty(FIXED_ONE_BYTE_STRING(isolate, "builtinIds"), -@@ -732,7 +730,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data, +@@ -728,7 +726,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data, nullptr, Local(), None, @@ -87,7 +87,7 @@ index 3f82db324d406e342abee23ab0d7f7c9807ff652..91ee97c0d1308e650730b9977facb924 SideEffectType::kHasNoSideEffect); target->SetNativeDataProperty( -@@ -741,7 +738,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data, +@@ -737,7 +734,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data, nullptr, Local(), None, @@ -95,7 +95,7 @@ index 3f82db324d406e342abee23ab0d7f7c9807ff652..91ee97c0d1308e650730b9977facb924 SideEffectType::kHasNoSideEffect); target->SetNativeDataProperty(FIXED_ONE_BYTE_STRING(isolate, "natives"), -@@ -749,7 +745,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data, +@@ -745,7 +741,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data, nullptr, Local(), None, diff --git a/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch b/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch index f582cf54991cc..1640e89608dd0 100644 --- a/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch +++ b/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch @@ -16,7 +16,7 @@ patch: (cherry picked from commit 30329d06235a9f9733b1d4da479b403462d1b326) diff --git a/src/env-inl.h b/src/env-inl.h -index 63ce35ba68b48a55d8150395304bf86c2bf23aae..c6fc53d1666ae51e69257c9bbcaf4cbff36cbad3 100644 +index 18b1461e50e456728cbc5e26259d06e7602a8d11..c5973e430debcf354afb9c9288c9ba8cf8f538ee 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -62,31 +62,6 @@ inline uv_loop_t* IsolateData::event_loop() const { @@ -146,7 +146,7 @@ index ea0ae4e08ec7dd98721bc89d2fe80fa47eaddfec..0f9846baeef6fd490cdc43893e29ea2d void IsolateData::MemoryInfo(MemoryTracker* tracker) const { diff --git a/src/env.h b/src/env.h -index 2310c89227f08cdcca6c4965cc163031af303626..d00dcc4e6661999d97943ce0398f568fc5e1e44f 100644 +index c6cc2c874b603f595a008a7d3bc229d6b9834f55..f378e810e8b48dd07ec25c7eae7923767ef25270 100644 --- a/src/env.h +++ b/src/env.h @@ -164,10 +164,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer { @@ -161,10 +161,10 @@ index 2310c89227f08cdcca6c4965cc163031af303626..d00dcc4e6661999d97943ce0398f568f inline MultiIsolatePlatform* platform() const; inline const SnapshotData* snapshot_data() const; diff --git a/src/node.h b/src/node.h -index e55256996f2c85b0ae3854cbd1b83ca88a3e22cb..5aa647a095ed965a3f7e755947be4948c75651d6 100644 +index df3fb3372d6357b5d77b4f683e309b8483998128..01e8a4f2ed905bf5bbb803419012a014c204b460 100644 --- a/src/node.h +++ b/src/node.h -@@ -1557,24 +1557,14 @@ void RegisterSignalHandler(int signal, +@@ -1561,24 +1561,14 @@ void RegisterSignalHandler(int signal, bool reset_handler = false); #endif // _WIN32 diff --git a/patches/node/src_use_supported_api_to_get_stalled_tla_messages.patch b/patches/node/src_use_supported_api_to_get_stalled_tla_messages.patch new file mode 100644 index 0000000000000..c4c302dc66fa3 --- /dev/null +++ b/patches/node/src_use_supported_api_to_get_stalled_tla_messages.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= +Date: Mon, 11 Mar 2024 09:27:11 +0000 +Subject: src: use supported API to get stalled TLA messages + +Refs: https://github.com/v8/v8/commit/23e3b6f650162ed2b332e55aa802adb8f41b50f2 + +diff --git a/src/module_wrap.cc b/src/module_wrap.cc +index 9bbb8ab908d8d992abb43254860d51f57f56387b..92edfc6fc6401edd3685a0137eac25d9e37566f6 100644 +--- a/src/module_wrap.cc ++++ b/src/module_wrap.cc +@@ -587,11 +587,10 @@ void ModuleWrap::EvaluateSync(const FunctionCallbackInfo& args) { + + if (module->IsGraphAsync()) { + CHECK(env->options()->print_required_tla); +- auto stalled = module->GetStalledTopLevelAwaitMessage(isolate); +- if (stalled.size() != 0) { +- for (auto pair : stalled) { +- Local message = std::get<1>(pair); +- ++ auto stalled_messages = ++ std::get<1>(module->GetStalledTopLevelAwaitMessages(isolate)); ++ if (stalled_messages.size() != 0) { ++ for (auto& message : stalled_messages) { + std::string reason = "Error: unexpected top-level await at "; + std::string info = + FormatErrorMessage(isolate, context, "", message, true); diff --git a/patches/node/support_v8_sandboxed_pointers.patch b/patches/node/support_v8_sandboxed_pointers.patch index a6449d4aacc6f..ff22a22a83251 100644 --- a/patches/node/support_v8_sandboxed_pointers.patch +++ b/patches/node/support_v8_sandboxed_pointers.patch @@ -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 12414204361e7227f7f7736a07388ade3f093e00..f9d29f0065b1de63a62cfdce74a9705c22dd87d7 100644 +index 60be2353cf0e77287dfda965c820cf36655a7ce5..fe41619f45913fe31a59771c8d1af6cde3b89f66 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -101,6 +101,14 @@ MaybeLocal PrepareStackTraceCallback(Local context, @@ -26,7 +26,7 @@ index 12414204361e7227f7f7736a07388ade3f093e00..f9d29f0065b1de63a62cfdce74a9705c void* ret; if (zero_fill_field_ || per_process::cli_options->zero_fill_all_buffers) diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc -index 3034b114e081e2b32dd5b71653927a41af7d48df..49b0175c219d75dd3a038687f353b2428fbdf62b 100644 +index 63d971e1fe6b861e29c12f04563701b01fdfb976..f39652a6f5196531cd78ce74e91076b1b9e970ca 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc @@ -348,10 +348,35 @@ ByteSource& ByteSource::operator=(ByteSource&& other) noexcept { @@ -79,7 +79,7 @@ index 3034b114e081e2b32dd5b71653927a41af7d48df..49b0175c219d75dd3a038687f353b242 return ArrayBuffer::New(env->isolate(), std::move(store)); } -@@ -702,6 +728,16 @@ namespace { +@@ -703,6 +729,16 @@ namespace { // in which case this has the same semantics as // using OPENSSL_malloc. However, if the secure heap is // initialized, SecureBuffer will automatically use it. @@ -96,7 +96,7 @@ index 3034b114e081e2b32dd5b71653927a41af7d48df..49b0175c219d75dd3a038687f353b242 void SecureBuffer(const FunctionCallbackInfo& args) { CHECK(args[0]->IsUint32()); Environment* env = Environment::GetCurrent(args); -@@ -723,6 +759,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -724,6 +760,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { Local buffer = ArrayBuffer::New(env->isolate(), store); args.GetReturnValue().Set(Uint8Array::New(buffer, 0, len)); } @@ -131,7 +131,7 @@ index d45325954d980724f80d49298bbe837197237a9b..ccea18080142bd9cba3765dbbec61c2a return ret; diff --git a/src/node_internals.h b/src/node_internals.h -index 5f0adcf8aaba93f8fc2874b863acfc96e30cb2b7..6b4ec38bd092358a9433a1179dbe1e71f56aa387 100644 +index e04fadd7f83e52fe965d8c73916a56f60425ba3d..5dff80ee287256ba40bfa496df6db60a18fbb9d7 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -118,7 +118,9 @@ v8::Maybe InitializePrimordials(v8::Local context); @@ -145,7 +145,7 @@ index 5f0adcf8aaba93f8fc2874b863acfc96e30cb2b7..6b4ec38bd092358a9433a1179dbe1e71 void* Allocate(size_t size) override; // Defined in src/node.cc void* AllocateUninitialized(size_t size) override; -@@ -137,7 +139,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator { +@@ -136,7 +138,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator { } private: @@ -237,3 +237,37 @@ index 6698a1df81cb4e0947c86fb30c2d77fca8e2d9d1..dad297652b347819805b09fbfd869f1d if (!buf.IsEmpty()) { args.GetReturnValue().Set(buf.ToLocalChecked()); +diff --git a/src/node_trace_events.cc b/src/node_trace_events.cc +index c4960ee1427e3b29b873135a815a7a09bedcfb73..2c6d8cdeb37f7dce9f29b8f3b260036ae23e6fb5 100644 +--- a/src/node_trace_events.cc ++++ b/src/node_trace_events.cc +@@ -132,12 +132,28 @@ static void GetCategoryEnabledBuffer(const FunctionCallbackInfo& args) { + const uint8_t* enabled_pointer = + TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_name.out()); + uint8_t* enabled_pointer_cast = const_cast(enabled_pointer); ++ uint8_t size = sizeof(*enabled_pointer_cast); + ++#if defined(V8_ENABLE_SANDBOX) ++ std::unique_ptr allocator(ArrayBuffer::Allocator::NewDefaultAllocator()); ++ void* v8_data = allocator->Allocate(size); ++ CHECK(v8_data); ++ memcpy(v8_data, enabled_pointer_cast, size); ++ std::unique_ptr bs = ArrayBuffer::NewBackingStore( ++ v8_data, ++ size, ++ [](void* data, size_t length, void*) { ++ std::unique_ptr allocator(ArrayBuffer::Allocator::NewDefaultAllocator()); ++ allocator->Free(data, length); ++ }, nullptr); ++#else + std::unique_ptr bs = ArrayBuffer::NewBackingStore( + enabled_pointer_cast, +- sizeof(*enabled_pointer_cast), ++ size, + [](void*, size_t, void*) {}, + nullptr); ++#endif ++ + auto ab = ArrayBuffer::New(isolate, std::move(bs)); + v8::Local u8 = v8::Uint8Array::New(ab, 0, 1); + diff --git a/patches/node/test_formally_mark_some_tests_as_flaky.patch b/patches/node/test_formally_mark_some_tests_as_flaky.patch index ec350f845e1cf..ec63de31410b7 100644 --- a/patches/node/test_formally_mark_some_tests_as_flaky.patch +++ b/patches/node/test_formally_mark_some_tests_as_flaky.patch @@ -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 c2b988f9b2f76940c1c6b05af13898ba2062ba72..d45260cee87349cc8642d814dd11b904bdcf3762 100644 +index 28f25e4be7e3104894e53a22e50f5474e0b7bc76..2525b094e1eb936d311a0b57fc9579df360883d6 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -5,6 +5,16 @@ prefix parallel diff --git a/patches/node/windows_32bit_config_change_callback_needs_to_be_stdcall.patch b/patches/node/windows_32bit_config_change_callback_needs_to_be_stdcall.patch deleted file mode 100644 index 7d0cd34dc3525..0000000000000 --- a/patches/node/windows_32bit_config_change_callback_needs_to_be_stdcall.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Keeley Hammond -Date: Thu, 25 Jul 2024 15:26:37 -0700 -Subject: windows 32bit: config change callback needs to be stdcall - -Patch of upstream fix: https://github.com/c-ares/c-ares/commit/8f265c9d5109e5665136396d347c0a93ea78999e - -diff --git a/deps/cares/src/lib/ares_event_configchg.c b/deps/cares/src/lib/ares_event_configchg.c -index b7c5ad8c75b6218cf36283fb6d0f8cd702224b87..c9b39f7b3358f37e61fb95e440695a9b590c2090 100644 ---- a/deps/cares/src/lib/ares_event_configchg.c -+++ b/deps/cares/src/lib/ares_event_configchg.c -@@ -239,9 +239,10 @@ void ares_event_configchg_destroy(ares_event_configchg_t *configchg) - - - # ifndef __WATCOMC__ --static void ares_event_configchg_ip_cb(PVOID CallerContext, -- PMIB_IPINTERFACE_ROW Row, -- MIB_NOTIFICATION_TYPE NotificationType) -+static void NETIOAPI_API_ -+ ares_event_configchg_ip_cb(PVOID CallerContext, -+ PMIB_IPINTERFACE_ROW Row, -+ MIB_NOTIFICATION_TYPE NotificationType) - { - ares_event_configchg_t *configchg = CallerContext; - (void)Row; -@@ -308,7 +309,7 @@ ares_status_t ares_event_configchg_init(ares_event_configchg_t **configchg, - * that didn't get triggered either. - */ - if (NotifyIpInterfaceChange( -- AF_UNSPEC, (PIPINTERFACE_CHANGE_CALLBACK)ares_event_configchg_ip_cb, -+ AF_UNSPEC, ares_event_configchg_ip_cb, - *configchg, FALSE, &c->ifchg_hnd) != NO_ERROR) { - status = ARES_ESERVFAIL; - goto done;