diff --git a/DEPS b/DEPS index 0d7145f8c1cb..e628068fb3d1 100644 --- a/DEPS +++ b/DEPS @@ -4,7 +4,7 @@ vars = { 'chromium_version': '125.0.6412.0', 'node_version': - 'v20.11.1', + 'v20.12.2', 'nan_version': 'e14bdcd1f72d62bca1d541b66da43130384ec213', 'squirrel.mac_version': diff --git a/lib/node/init.ts b/lib/node/init.ts index 451251e3b390..e55293386107 100644 --- a/lib/node/init.ts +++ b/lib/node/init.ts @@ -2,6 +2,11 @@ import { wrapFsWithAsar } from './asar-fs-wrapper'; wrapFsWithAsar(require('fs')); +// See ElectronRendererClient::DidCreateScriptContext. +if ((globalThis as any).blinkFetch) { + globalThis.fetch = (globalThis as any).blinkFetch; +} + // Hook child_process.fork. import cp = require('child_process'); // eslint-disable-line import/first const originalFork = cp.fork; diff --git a/patches/node/.patches b/patches/node/.patches index 02377318a92d..17b0aa74e97d 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -35,17 +35,13 @@ win_process_avoid_assert_after_spawning_store_app_4152.patch chore_remove_use_of_deprecated_kmaxlength.patch feat_optionally_prevent_calling_v8_enablewebassemblytraphandler.patch build_only_create_cppgc_heap_on_non-32_bit_platforms.patch -fix_-wshadow_error_in_uvwasi_c.patch src_update_default_v8_platform_to_override_functions_with_location.patch fix_capture_embedder_exceptions_before_entering_v8.patch spec_add_iterator_to_global_intrinsics.patch -build_do_not_rely_on_gn_helpers_in_gn_build.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 src_preload_function_for_environment.patch deprecate_vector_v8_local_in_v8.patch -fs_fix_wtf-8_decoding_issue.patch fix_remove_deprecated_errno_constants.patch -chore_add_v8-sandbox_h.patch diff --git a/patches/node/build_add_gn_build_files.patch b/patches/node/build_add_gn_build_files.patch index 59a813f35469..8a76de7e10b3 100644 --- a/patches/node/build_add_gn_build_files.patch +++ b/patches/node/build_add_gn_build_files.patch @@ -11,10 +11,10 @@ really in 20/21. We have to wait until 22 is released to be able to build with upstream GN files. diff --git a/BUILD.gn b/BUILD.gn -index 1ed186b597eece7c34cb69c8e1e20870555a040d..541e7d2b8ee05677b64a3ea39c1422560fd5df75 100644 +index 1ed186b597eece7c34cb69c8e1e20870555a040d..7d201bb6b822f0401c3be2bc52d65bc71463748b 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -1,14 +1,404 @@ +@@ -1,14 +1,406 @@ -############################################################################## -# # -# DO NOT EDIT THIS FILE! # @@ -258,9 +258,11 @@ index 1ed186b597eece7c34cb69c8e1e20870555a040d..541e7d2b8ee05677b64a3ea39c142256 + defines = [] + sources = [ + "tools/js2c.cc", -+ "tools/executable_wrapper.h" ++ "tools/executable_wrapper.h", ++ "src/embedded_data.cc", ++ "src/embedded_data.h", + ] -+ include_dirs = [ "tools" ] ++ include_dirs = [ "tools", "src" ] + deps = [ + "deps/simdutf($electron_js2c_toolchain)", + "deps/uv($electron_js2c_toolchain)", @@ -457,88 +459,88 @@ index e92ac3a3beac143dced2efb05304ed8ba832b067..1ce69e9deba1a9b191e8d95f4c82e0ec + public_configs = [ ":ada_config" ] } diff --git a/deps/base64/unofficial.gni b/deps/base64/unofficial.gni -index 269c62d976d6adea6d020568094e23e9b0a9dc7c..14ffff0b4badb7ad71f2b6df43ad2eb300fc55ed 100644 +index 0e69d7383762f6b81c5b57698aa9d121d5a9c401..35bbeb37acc7ccb14b4b8a644ec3d4c76ca5c61c 100644 --- a/deps/base64/unofficial.gni +++ b/deps/base64/unofficial.gni -@@ -18,6 +18,10 @@ template("base64_gn_build") { +@@ -12,6 +12,10 @@ template("base64_gn_build") { } } + # FIXME(zcbenz): ASM on win/x86 compiles perfectly in upstream Node, figure + # out why it does not work in Electron's build configs. -+ support_x86_asm = target_cpu == "x64" || (target_cpu == "x86" && !is_win) ++ support_x86_asm = current_cpu == "x64" || (current_cpu == "x86" && !is_win) + config("base64_internal_config") { include_dirs = [ "base64/lib" ] if (is_component_build) { -@@ -25,7 +29,7 @@ template("base64_gn_build") { +@@ -19,7 +23,7 @@ template("base64_gn_build") { } else { defines = [] } -- if (target_cpu == "x86" || target_cpu == "x64") { +- if (current_cpu == "x86" || current_cpu == "x64") { + if (support_x86_asm) { defines += [ "HAVE_SSSE3=1", "HAVE_SSE41=1", -@@ -75,7 +79,7 @@ template("base64_gn_build") { +@@ -69,7 +73,7 @@ template("base64_gn_build") { source_set("base64_ssse3") { configs += [ ":base64_internal_config" ] sources = [ "base64/lib/arch/ssse3/codec.c" ] -- if (target_cpu == "x86" || target_cpu == "x64") { +- if (current_cpu == "x86" || current_cpu == "x64") { + if (support_x86_asm) { if (is_clang || !is_win) { cflags_c = [ "-mssse3" ] } -@@ -85,7 +89,7 @@ template("base64_gn_build") { +@@ -79,7 +83,7 @@ template("base64_gn_build") { source_set("base64_sse41") { configs += [ ":base64_internal_config" ] sources = [ "base64/lib/arch/sse41/codec.c" ] -- if (target_cpu == "x86" || target_cpu == "x64") { +- if (current_cpu == "x86" || current_cpu == "x64") { + if (support_x86_asm) { if (is_clang || !is_win) { cflags_c = [ "-msse4.1" ] } -@@ -95,7 +99,7 @@ template("base64_gn_build") { +@@ -89,7 +93,7 @@ template("base64_gn_build") { source_set("base64_sse42") { configs += [ ":base64_internal_config" ] sources = [ "base64/lib/arch/sse42/codec.c" ] -- if (target_cpu == "x86" || target_cpu == "x64") { +- if (current_cpu == "x86" || current_cpu == "x64") { + if (support_x86_asm) { if (is_clang || !is_win) { cflags_c = [ "-msse4.2" ] } -@@ -105,7 +109,7 @@ template("base64_gn_build") { +@@ -99,7 +103,7 @@ template("base64_gn_build") { source_set("base64_avx") { configs += [ ":base64_internal_config" ] sources = [ "base64/lib/arch/avx/codec.c" ] -- if (target_cpu == "x86" || target_cpu == "x64") { +- if (current_cpu == "x86" || current_cpu == "x64") { + if (support_x86_asm) { if (is_clang || !is_win) { cflags_c = [ "-mavx" ] } else if (is_win) { -@@ -117,7 +121,7 @@ template("base64_gn_build") { +@@ -111,7 +115,7 @@ template("base64_gn_build") { source_set("base64_avx2") { configs += [ ":base64_internal_config" ] sources = [ "base64/lib/arch/avx2/codec.c" ] -- if (target_cpu == "x86" || target_cpu == "x64") { +- if (current_cpu == "x86" || current_cpu == "x64") { + if (support_x86_asm) { if (is_clang || !is_win) { cflags_c = [ "-mavx2" ] } else if (is_win) { -@@ -129,7 +133,7 @@ template("base64_gn_build") { +@@ -123,7 +127,7 @@ template("base64_gn_build") { source_set("base64_avx512") { configs += [ ":base64_internal_config" ] sources = [ "base64/lib/arch/avx512/codec.c" ] -- if (target_cpu == "x86" || target_cpu == "x64") { +- if (current_cpu == "x86" || current_cpu == "x64") { + if (support_x86_asm) { if (is_clang || !is_win) { cflags_c = [ "-mavx512vl", diff --git a/deps/cares/BUILD.gn b/deps/cares/BUILD.gn -index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..fb1b3138cdb674205afa0ffe078270585843eca3 100644 +index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..1717143998ae15e65e9af12650b796226508a137 100644 --- a/deps/cares/BUILD.gn +++ b/deps/cares/BUILD.gn -@@ -1,14 +1,143 @@ +@@ -1,14 +1,165 @@ -############################################################################## -# # -# DO NOT EDIT THIS FILE! # @@ -562,36 +564,59 @@ index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..fb1b3138cdb674205afa0ffe07827058 + sources = [ + "include/ares.h", + "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", -+ "src/lib/ares_android.c", + "src/lib/ares__buf.c", + "src/lib/ares__buf.h", + "src/lib/ares__close_sockets.c", ++ "src/lib/ares__hosts_file.c", + "src/lib/ares__htable.c", + "src/lib/ares__htable.h", + "src/lib/ares__htable_asvp.c", + "src/lib/ares__htable_asvp.h", -+ "src/lib/ares__htable_stvp.c", -+ "src/lib/ares__htable_stvp.h", ++ "src/lib/ares__htable_strvp.c", ++ "src/lib/ares__htable_strvp.h", ++ "src/lib/ares__htable_szvp.c", ++ "src/lib/ares__htable_szvp.h", ++ "src/lib/ares__iface_ips.c", ++ "src/lib/ares__iface_ips.h", + "src/lib/ares__llist.c", + "src/lib/ares__llist.h", -+ "src/lib/ares__get_hostent.c", + "src/lib/ares__parse_into_addrinfo.c", + "src/lib/ares__read_line.c", -+ "src/lib/ares__readaddrinfo.c", + "src/lib/ares__slist.c", + "src/lib/ares__slist.h", ++ "src/lib/ares__socket.c", + "src/lib/ares__sortaddrinfo.c", ++ "src/lib/ares__threads.c", ++ "src/lib/ares__threads.h", + "src/lib/ares__timeval.c", ++ "src/lib/ares_android.c", ++ "src/lib/ares_android.h", + "src/lib/ares_cancel.c", + "src/lib/ares_create_query.c", + "src/lib/ares_data.c", + "src/lib/ares_data.h", + "src/lib/ares_destroy.c", ++ "src/lib/ares_dns_mapping.c", ++ "src/lib/ares_dns_name.c", ++ "src/lib/ares_dns_parse.c", ++ "src/lib/ares_dns_record.c", ++ "src/lib/ares_dns_private.h", ++ "src/lib/ares_dns_write.c", ++ "src/lib/ares_event.h", ++ "src/lib/ares_event_win32.h", ++ "src/lib/ares_event_epoll.c", ++ "src/lib/ares_event_kqueue.c", ++ "src/lib/ares_event_poll.c", ++ "src/lib/ares_event_select.c", ++ "src/lib/ares_event_thread.c", ++ "src/lib/ares_event_wake_pipe.c", ++ "src/lib/ares_event_win32.c", + "src/lib/ares_expand_name.c", + "src/lib/ares_expand_string.c", + "src/lib/ares_fds.c", @@ -599,6 +624,7 @@ index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..fb1b3138cdb674205afa0ffe07827058 + "src/lib/ares_free_string.c", + "src/lib/ares_freeaddrinfo.c", + "src/lib/ares_getaddrinfo.c", ++ "src/lib/ares_getenv.c", + "src/lib/ares_getenv.h", + "src/lib/ares_gethostbyaddr.c", + "src/lib/ares_gethostbyname.c", @@ -606,16 +632,13 @@ index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..fb1b3138cdb674205afa0ffe07827058 + "src/lib/ares_getsock.c", + "src/lib/ares_inet_net_pton.h", + "src/lib/ares_init.c", -+ "src/lib/ares_ipv6.h", + "src/lib/ares_library_init.c", -+ "src/lib/ares_library_init.h", ++ "src/lib/ares_ipv6.h", ++ "src/lib/ares_math.c", + "src/lib/ares_mkquery.c", -+ "src/lib/ares_nameser.h", -+ "src/lib/ares_nowarn.c", -+ "src/lib/ares_nowarn.h", + "src/lib/ares_options.c", -+ "src/lib/ares_parse_aaaa_reply.c", + "src/lib/ares_parse_a_reply.c", ++ "src/lib/ares_parse_aaaa_reply.c", + "src/lib/ares_parse_caa_reply.c", + "src/lib/ares_parse_mx_reply.c", + "src/lib/ares_parse_naptr_reply.c", @@ -625,9 +648,11 @@ index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..fb1b3138cdb674205afa0ffe07827058 + "src/lib/ares_parse_srv_reply.c", + "src/lib/ares_parse_txt_reply.c", + "src/lib/ares_parse_uri_reply.c", ++ "src/lib/ares_platform.c", + "src/lib/ares_platform.h", + "src/lib/ares_private.h", + "src/lib/ares_process.c", ++ "src/lib/ares_qcache.c", + "src/lib/ares_query.c", + "src/lib/ares_rand.c", + "src/lib/ares_search.c", @@ -635,14 +660,16 @@ index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..fb1b3138cdb674205afa0ffe07827058 + "src/lib/ares_setup.h", + "src/lib/ares_strcasecmp.c", + "src/lib/ares_strcasecmp.h", -+ "src/lib/ares_strdup.c", -+ "src/lib/ares_strdup.h", ++ "src/lib/ares_str.c", ++ "src/lib/ares_str.h", + "src/lib/ares_strerror.c", + "src/lib/ares_strsplit.c", ++ "src/lib/ares_strsplit.h", ++ "src/lib/ares_sysconfig.c", ++ "src/lib/ares_sysconfig_files.c", + "src/lib/ares_timeout.c", ++ "src/lib/ares_update_servers.c", + "src/lib/ares_version.c", -+ "src/lib/bitncmp.c", -+ "src/lib/bitncmp.h", + "src/lib/inet_net_pton.c", + "src/lib/inet_ntop.c", + "src/lib/setup_once.h", @@ -666,9 +693,6 @@ index ac19ac73ed1e24c61cb679f3851685b79cfc8b39..fb1b3138cdb674205afa0ffe07827058 + defines += [ "CARES_PULL_WS2TCPIP_H=1" ] + include_dirs += [ "config/win32" ] + sources += [ -+ "src/lib/ares_getenv.c", -+ "src/lib/ares_iphlpapi.h", -+ "src/lib/ares_platform.c", + "src/lib/config-win32.h", + "src/lib/windows_port.c", + ] @@ -838,7 +862,7 @@ index 64a2a4799d5530276f46aa1faa63ece063390ada..fb000f8ee7647c375bc190d1729d67bb + ] } diff --git a/deps/nghttp2/BUILD.gn b/deps/nghttp2/BUILD.gn -index 274352b0e2449f8db49d9a49c6b92a69f97e8363..7d2ca477db2415f43ababa270d8aefa3124b2765 100644 +index 274352b0e2449f8db49d9a49c6b92a69f97e8363..f04c7ca24af6cdbe8d739bcd55172110963888e9 100644 --- a/deps/nghttp2/BUILD.gn +++ b/deps/nghttp2/BUILD.gn @@ -1,14 +1,51 @@ @@ -888,7 +912,7 @@ index 274352b0e2449f8db49d9a49c6b92a69f97e8363..7d2ca477db2415f43ababa270d8aefa3 + "lib/nghttp2_http.c", + "lib/nghttp2_map.c", + "lib/nghttp2_mem.c", -+ "lib/nghttp2_npn.c", ++ "lib/nghttp2_alpn.c", + "lib/nghttp2_option.c", + "lib/nghttp2_outbound_item.c", + "lib/nghttp2_pq.c", @@ -901,7 +925,7 @@ index 274352b0e2449f8db49d9a49c6b92a69f97e8363..7d2ca477db2415f43ababa270d8aefa3 + "lib/nghttp2_submit.c", + "lib/nghttp2_time.c", + "lib/nghttp2_version.c", -+ "lib/sfparse.c" ++ "lib/sfparse.c", + ] } diff --git a/deps/simdjson/BUILD.gn b/deps/simdjson/BUILD.gn @@ -1234,10 +1258,10 @@ index 0000000000000000000000000000000000000000..af9cbada10203b387fb9732b346583b1 +} diff --git a/filenames.json b/filenames.json new file mode 100644 -index 0000000000000000000000000000000000000000..4404338bb5d576b341cae3bf79c84334fb05654f +index 0000000000000000000000000000000000000000..12f844c771c19c8d27dcfb9210dcf7bc77b2e994 --- /dev/null +++ b/filenames.json -@@ -0,0 +1,733 @@ +@@ -0,0 +1,739 @@ +// This file is automatically generated by generate_gn_filenames_json.py +// DO NOT EDIT +{ @@ -1308,6 +1332,7 @@ index 0000000000000000000000000000000000000000..4404338bb5d576b341cae3bf79c84334 + "//v8/include/v8-promise.h", + "//v8/include/v8-proxy.h", + "//v8/include/v8-regexp.h", ++ "//v8/include/v8-sandbox.h", + "//v8/include/v8-script.h", + "//v8/include/v8-snapshot.h", + "//v8/include/v8-source-location.h", @@ -1692,6 +1717,7 @@ index 0000000000000000000000000000000000000000..4404338bb5d576b341cae3bf79c84334 + "lib/readline.js", + "lib/readline/promises.js", + "lib/repl.js", ++ "lib/sea.js", + "lib/stream.js", + "lib/stream/consumers.js", + "lib/stream/promises.js", @@ -1748,6 +1774,7 @@ index 0000000000000000000000000000000000000000..4404338bb5d576b341cae3bf79c84334 + "src/connection_wrap.cc", + "src/dataqueue/queue.cc", + "src/debug_utils.cc", ++ "src/embedded_data.cc", + "src/encoding_binding.cc", + "src/env.cc", + "src/fs_event_wrap.cc", @@ -1817,6 +1844,7 @@ index 0000000000000000000000000000000000000000..4404338bb5d576b341cae3bf79c84334 + "src/node_watchdog.cc", + "src/node_worker.cc", + "src/node_zlib.cc", ++ "src/path.cc", + "src/permission/child_process_permission.cc", + "src/permission/fs_permission.cc", + "src/permission/inspector_permission.cc", @@ -1865,6 +1893,7 @@ index 0000000000000000000000000000000000000000..4404338bb5d576b341cae3bf79c84334 + "src/dataqueue/queue.h", + "src/debug_utils.h", + "src/debug_utils-inl.h", ++ "src/embeded_data.h", + "src/encoding_binding.h", + "src/env_properties.h", + "src/env.h", @@ -1936,6 +1965,7 @@ index 0000000000000000000000000000000000000000..4404338bb5d576b341cae3bf79c84334 + "src/node_wasi.h", + "src/node_watchdog.h", + "src/node_worker.h", ++ "src/path.h", + "src/permission/child_process_permission.h", + "src/permission/fs_permission.h", + "src/permission/inspector_permission.h", @@ -1972,10 +2002,10 @@ index 0000000000000000000000000000000000000000..4404338bb5d576b341cae3bf79c84334 + ] +} diff --git a/src/inspector/BUILD.gn b/src/inspector/BUILD.gn -index 909fd14345fcd988c381e640280f4b33f2e0c351..cb0e4558436ab7a109cadf439d49413b0f569a5a 100644 +index 909fd14345fcd988c381e640280f4b33f2e0c351..800431e6659f95f0495cb90b8fa2cccbc9f34661 100644 --- a/src/inspector/BUILD.gn +++ b/src/inspector/BUILD.gn -@@ -1,14 +1,203 @@ +@@ -1,14 +1,202 @@ -############################################################################## -# # -# DO NOT EDIT THIS FILE! # @@ -2068,7 +2098,6 @@ index 909fd14345fcd988c381e640280f4b33f2e0c351..cb0e4558436ab7a109cadf439d49413b + "$inspector_protocol_dir/lib/base_string_adapter_cc.template", + "$inspector_protocol_dir/lib/base_string_adapter_h.template", + "$inspector_protocol_dir/lib/Allocator_h.template", -+ "$inspector_protocol_dir/lib/Array_h.template", + "$inspector_protocol_dir/lib/DispatcherBase_cpp.template", + "$inspector_protocol_dir/lib/DispatcherBase_h.template", + "$inspector_protocol_dir/lib/ErrorSupport_cpp.template", @@ -2190,10 +2219,10 @@ index 909fd14345fcd988c381e640280f4b33f2e0c351..cb0e4558436ab7a109cadf439d49413b + args = rebase_path(inputs + outputs, root_build_dir) } diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index bafd8d4b8581f0aee6cb1f30b810c8dfc46c2ce9..453d874efff767a95ef25fad7005ac11717f0c67 100644 +index bbb63df7899d4b9bf80e13eee78453352dd5c75b..804296db12f7864f72648f5f36834a924503e4a6 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc -@@ -739,6 +739,7 @@ void BuiltinLoader::RegisterExternalReferences( +@@ -765,6 +765,7 @@ void BuiltinLoader::RegisterExternalReferences( registry->Register(GetNatives); RegisterExternalReferencesForInternalizedBuiltinCode(registry); @@ -2202,7 +2231,7 @@ index bafd8d4b8581f0aee6cb1f30b810c8dfc46c2ce9..453d874efff767a95ef25fad7005ac11 } // namespace builtins diff --git a/src/node_builtins.h b/src/node_builtins.h -index 9f2fbc1e53937448aa27c1f5fe110eabc7edc0df..ea77c7598153bb8a9ba20c89a4ece2c1580b9a25 100644 +index 75a7f3dd89e096d13ad7d70ed29d301cd56315b5..9a20a275fbe5df9f384b7b1d1d26806e7cd05384 100644 --- a/src/node_builtins.h +++ b/src/node_builtins.h @@ -74,6 +74,8 @@ using BuiltinCodeCacheMap = @@ -2336,229 +2365,33 @@ index 0000000000000000000000000000000000000000..a6cdf33f2c0bcca4d7b4eacaa407f1ac + transformed_f.write(transformed_contents) + diff --git a/tools/install.py b/tools/install.py -index 11616e1bcac5308020eb68fdb811bfb86cb14dd5..74b01f8352021f1105c080dbbf8bb29121a13501 100755 +index 17b0947aaca4cd63ce6b57ffc4835eae7f74e76e..c6fa8a931f6a1357592a8447b1abbfe0c894aefd 100755 --- a/tools/install.py +++ b/tools/install.py -@@ -199,105 +199,108 @@ def headers(action): - v8_headers = [ - # The internal cppgc headers are depended on by the public - # ones, so they need to be included as well. -- 'deps/v8/include/cppgc/internal/api-constants.h', -- 'deps/v8/include/cppgc/internal/atomic-entry-flag.h', -- 'deps/v8/include/cppgc/internal/base-page-handle.h', -- 'deps/v8/include/cppgc/internal/caged-heap-local-data.h', -- 'deps/v8/include/cppgc/internal/caged-heap.h', -- 'deps/v8/include/cppgc/internal/compiler-specific.h', -- 'deps/v8/include/cppgc/internal/finalizer-trait.h', -- 'deps/v8/include/cppgc/internal/gc-info.h', -- 'deps/v8/include/cppgc/internal/logging.h', -- 'deps/v8/include/cppgc/internal/member-storage.h', -- 'deps/v8/include/cppgc/internal/name-trait.h', -- 'deps/v8/include/cppgc/internal/persistent-node.h', -- 'deps/v8/include/cppgc/internal/pointer-policies.h', -- 'deps/v8/include/cppgc/internal/write-barrier.h', -+ '../../v8/include/cppgc/internal/api-constants.h', -+ '../../v8/include/cppgc/internal/atomic-entry-flag.h', -+ '../../v8/include/cppgc/internal/base-page-handle.h', -+ '../../v8/include/cppgc/internal/caged-heap-local-data.h', -+ '../../v8/include/cppgc/internal/caged-heap.h', -+ '../../v8/include/cppgc/internal/compiler-specific.h', -+ '../../v8/include/cppgc/internal/finalizer-trait.h', -+ '../../v8/include/cppgc/internal/gc-info.h', -+ '../../v8/include/cppgc/internal/logging.h', -+ '../../v8/include/cppgc/internal/member-storage.h', -+ '../../v8/include/cppgc/internal/name-trait.h', -+ '../../v8/include/cppgc/internal/persistent-node.h', -+ '../../v8/include/cppgc/internal/pointer-policies.h', -+ '../../v8/include/cppgc/internal/write-barrier.h', - # cppgc headers -- 'deps/v8/include/cppgc/allocation.h', -- 'deps/v8/include/cppgc/common.h', -- 'deps/v8/include/cppgc/cross-thread-persistent.h', -- 'deps/v8/include/cppgc/custom-space.h', -- 'deps/v8/include/cppgc/default-platform.h', -- 'deps/v8/include/cppgc/ephemeron-pair.h', -- 'deps/v8/include/cppgc/explicit-management.h', -- 'deps/v8/include/cppgc/garbage-collected.h', -- 'deps/v8/include/cppgc/heap-consistency.h', -- 'deps/v8/include/cppgc/heap-handle.h', -- 'deps/v8/include/cppgc/heap-state.h', -- 'deps/v8/include/cppgc/heap-statistics.h', -- 'deps/v8/include/cppgc/heap.h', -- 'deps/v8/include/cppgc/liveness-broker.h', -- 'deps/v8/include/cppgc/macros.h', -- 'deps/v8/include/cppgc/member.h', -- 'deps/v8/include/cppgc/name-provider.h', -- 'deps/v8/include/cppgc/object-size-trait.h', -- 'deps/v8/include/cppgc/persistent.h', -- 'deps/v8/include/cppgc/platform.h', -- 'deps/v8/include/cppgc/prefinalizer.h', -- 'deps/v8/include/cppgc/process-heap-statistics.h', -- 'deps/v8/include/cppgc/sentinel-pointer.h', -- 'deps/v8/include/cppgc/source-location.h', -- 'deps/v8/include/cppgc/testing.h', -- 'deps/v8/include/cppgc/trace-trait.h', -- 'deps/v8/include/cppgc/type-traits.h', -- 'deps/v8/include/cppgc/visitor.h', -+ '../../v8/include/cppgc/allocation.h', -+ '../../v8/include/cppgc/common.h', -+ '../../v8/include/cppgc/cross-thread-persistent.h', -+ '../../v8/include/cppgc/custom-space.h', -+ '../../v8/include/cppgc/default-platform.h', -+ '../../v8/include/cppgc/ephemeron-pair.h', -+ '../../v8/include/cppgc/explicit-management.h', -+ '../../v8/include/cppgc/garbage-collected.h', -+ '../../v8/include/cppgc/heap-consistency.h', -+ '../../v8/include/cppgc/heap-handle.h', -+ '../../v8/include/cppgc/heap-state.h', -+ '../../v8/include/cppgc/heap-statistics.h', -+ '../../v8/include/cppgc/heap.h', -+ '../../v8/include/cppgc/liveness-broker.h', -+ '../../v8/include/cppgc/macros.h', -+ '../../v8/include/cppgc/member.h', -+ '../../v8/include/cppgc/name-provider.h', -+ '../../v8/include/cppgc/object-size-trait.h', -+ '../../v8/include/cppgc/persistent.h', -+ '../../v8/include/cppgc/platform.h', -+ '../../v8/include/cppgc/prefinalizer.h', -+ '../../v8/include/cppgc/process-heap-statistics.h', -+ '../../v8/include/cppgc/sentinel-pointer.h', -+ '../../v8/include/cppgc/source-location.h', -+ '../../v8/include/cppgc/testing.h', -+ '../../v8/include/cppgc/trace-trait.h', -+ '../../v8/include/cppgc/type-traits.h', -+ '../../v8/include/cppgc/visitor.h', - # libplatform headers -- 'deps/v8/include/libplatform/libplatform-export.h', -- 'deps/v8/include/libplatform/libplatform.h', -- 'deps/v8/include/libplatform/v8-tracing.h', -+ '../../v8/include/libplatform/libplatform-export.h', -+ '../../v8/include/libplatform/libplatform.h', -+ '../../v8/include/libplatform/v8-tracing.h', - # v8 headers -- 'deps/v8/include/v8-array-buffer.h', -- 'deps/v8/include/v8-callbacks.h', -- 'deps/v8/include/v8-container.h', -- 'deps/v8/include/v8-context.h', -- 'deps/v8/include/v8-cppgc.h', -- 'deps/v8/include/v8-data.h', -- 'deps/v8/include/v8-date.h', -- 'deps/v8/include/v8-debug.h', -- 'deps/v8/include/v8-embedder-heap.h', -- 'deps/v8/include/v8-embedder-state-scope.h', -- 'deps/v8/include/v8-exception.h', -- 'deps/v8/include/v8-extension.h', -- 'deps/v8/include/v8-external.h', -- 'deps/v8/include/v8-forward.h', -- 'deps/v8/include/v8-function-callback.h', -- 'deps/v8/include/v8-function.h', -- 'deps/v8/include/v8-initialization.h', -- 'deps/v8/include/v8-internal.h', -- 'deps/v8/include/v8-isolate.h', -- 'deps/v8/include/v8-json.h', -- 'deps/v8/include/v8-local-handle.h', -- 'deps/v8/include/v8-locker.h', -- 'deps/v8/include/v8-maybe.h', -- 'deps/v8/include/v8-memory-span.h', -- 'deps/v8/include/v8-message.h', -- 'deps/v8/include/v8-microtask-queue.h', -- 'deps/v8/include/v8-microtask.h', -- 'deps/v8/include/v8-object.h', -- 'deps/v8/include/v8-persistent-handle.h', -- 'deps/v8/include/v8-platform.h', -- 'deps/v8/include/v8-primitive-object.h', -- 'deps/v8/include/v8-primitive.h', -- 'deps/v8/include/v8-profiler.h', -- 'deps/v8/include/v8-promise.h', -- 'deps/v8/include/v8-proxy.h', -- 'deps/v8/include/v8-regexp.h', -- 'deps/v8/include/v8-script.h', -- 'deps/v8/include/v8-snapshot.h', -- 'deps/v8/include/v8-statistics.h', -- 'deps/v8/include/v8-template.h', -- 'deps/v8/include/v8-traced-handle.h', -- 'deps/v8/include/v8-typed-array.h', -- 'deps/v8/include/v8-unwinder.h', -- 'deps/v8/include/v8-value-serializer.h', -- 'deps/v8/include/v8-value.h', -- 'deps/v8/include/v8-version.h', -- 'deps/v8/include/v8-wasm.h', -- 'deps/v8/include/v8-weak-callback-info.h', -- 'deps/v8/include/v8.h', -- 'deps/v8/include/v8config.h', -+ '../../v8/include/v8-array-buffer.h', -+ '../../v8/include/v8-callbacks.h', -+ '../../v8/include/v8-container.h', -+ '../../v8/include/v8-context.h', -+ '../../v8/include/v8-cppgc.h', -+ '../../v8/include/v8-data.h', -+ '../../v8/include/v8-date.h', -+ '../../v8/include/v8-debug.h', -+ '../../v8/include/v8-embedder-heap.h', -+ '../../v8/include/v8-embedder-state-scope.h', -+ '../../v8/include/v8-exception.h', -+ '../../v8/include/v8-extension.h', -+ '../../v8/include/v8-external.h', -+ '../../v8/include/v8-forward.h', -+ '../../v8/include/v8-function-callback.h', -+ '../../v8/include/v8-function.h', -+ '../../v8/include/v8-handle-base.h', -+ '../../v8/include/v8-initialization.h', -+ '../../v8/include/v8-internal.h', -+ '../../v8/include/v8-isolate.h', -+ '../../v8/include/v8-json.h', -+ '../../v8/include/v8-local-handle.h', -+ '../../v8/include/v8-locker.h', -+ '../../v8/include/v8-maybe.h', -+ '../../v8/include/v8-memory-span.h', -+ '../../v8/include/v8-message.h', -+ '../../v8/include/v8-microtask-queue.h', -+ '../../v8/include/v8-microtask.h', -+ '../../v8/include/v8-object.h', -+ '../../v8/include/v8-persistent-handle.h', -+ '../../v8/include/v8-platform.h', -+ '../../v8/include/v8-primitive-object.h', -+ '../../v8/include/v8-primitive.h', -+ '../../v8/include/v8-profiler.h', -+ '../../v8/include/v8-promise.h', -+ '../../v8/include/v8-proxy.h', -+ '../../v8/include/v8-regexp.h', -+ '../../v8/include/v8-script.h', -+ '../../v8/include/v8-snapshot.h', -+ '../../v8/include/v8-source-location.h', -+ '../../v8/include/v8-statistics.h', -+ '../../v8/include/v8-template.h', -+ '../../v8/include/v8-traced-handle.h', -+ '../../v8/include/v8-typed-array.h', -+ '../../v8/include/v8-unwinder.h', -+ '../../v8/include/v8-value-serializer.h', -+ '../../v8/include/v8-value.h', -+ '../../v8/include/v8-version.h', -+ '../../v8/include/v8-wasm.h', -+ '../../v8/include/v8-weak-callback-info.h', -+ '../../v8/include/v8.h', -+ '../../v8/include/v8config.h', - ] -+ v8_headers = [h.replace('deps/', '../../') for h in v8_headers] - files_arg = [name for name in files_arg if name in v8_headers] - action(files_arg, dest) - -@@ -324,7 +327,7 @@ def headers(action): - if sys.platform.startswith('aix') or sys.platform == "os400": - action(['out/Release/node.exp'], 'include/node/') - -- subdir_files('deps/v8/include', 'include/node/', wanted_v8_headers) -+ subdir_files('../../v8/include', 'include/node/', wanted_v8_headers) - - if 'false' == variables.get('node_shared_libuv'): - subdir_files('deps/uv/include', 'include/node/', action) +@@ -284,6 +284,7 @@ def headers(options, action): + 'include/v8-promise.h', + 'include/v8-proxy.h', + 'include/v8-regexp.h', ++ "include/v8-sandbox.h", + 'include/v8-script.h', + 'include/v8-snapshot.h', + 'include/v8-statistics.h', +@@ -390,7 +391,7 @@ def parse_options(args): + parser.add_argument('--build-dir', help='the location of built binaries', + default='out/Release') + parser.add_argument('--v8-dir', help='the location of V8', +- default='deps/v8') ++ default='../../v8') + parser.add_argument('--config-gypi-path', help='the location of config.gypi', + default='config.gypi') + parser.add_argument('--is-win', help='build for Windows target', diff --git a/tools/js2c.cc b/tools/js2c.cc old mode 100644 new mode 100755 -index 904fb6fa44d4f56fb67476e937edcbb797d78fe7..129cd4b2c12b58464fbab8355afa0c26721d1413 +index 0fa9c5954d24a555a1e7c50fdb4b43c17cb1452d..9a77af51630aec5437a09aae1d7296e2e1238809 --- a/tools/js2c.cc +++ b/tools/js2c.cc -@@ -29,6 +29,7 @@ namespace js2c { +@@ -30,6 +30,7 @@ namespace js2c { int Main(int argc, char* argv[]); static bool is_verbose = false; @@ -2566,7 +2399,7 @@ index 904fb6fa44d4f56fb67476e937edcbb797d78fe7..129cd4b2c12b58464fbab8355afa0c26 void Debug(const char* format, ...) { va_list arguments; -@@ -195,6 +196,7 @@ const char* kTemplate = R"( +@@ -196,6 +197,7 @@ const char* kTemplate = R"( #include "node_builtins.h" #include "node_external_reference.h" #include "node_internals.h" @@ -2574,7 +2407,7 @@ index 904fb6fa44d4f56fb67476e937edcbb797d78fe7..129cd4b2c12b58464fbab8355afa0c26 namespace node { -@@ -210,7 +212,11 @@ const ThreadsafeCopyOnWrite global_source_map { +@@ -211,7 +213,11 @@ const ThreadsafeCopyOnWrite global_source_map { } // anonymous namespace void BuiltinLoader::LoadJavaScriptSource() { @@ -2587,7 +2420,7 @@ index 904fb6fa44d4f56fb67476e937edcbb797d78fe7..129cd4b2c12b58464fbab8355afa0c26 } void RegisterExternalReferencesForInternalizedBuiltinCode( -@@ -227,6 +233,45 @@ UnionBytes BuiltinLoader::GetConfig() { +@@ -228,6 +234,45 @@ UnionBytes BuiltinLoader::GetConfig() { } // namespace node )"; @@ -2633,7 +2466,7 @@ index 904fb6fa44d4f56fb67476e937edcbb797d78fe7..129cd4b2c12b58464fbab8355afa0c26 Fragment Format(const Fragments& definitions, const Fragments& initializers, const Fragments& registrations) { -@@ -236,13 +281,12 @@ Fragment Format(const Fragments& definitions, +@@ -237,13 +282,12 @@ Fragment Format(const Fragments& definitions, size_t init_size = init_buf.size(); std::vector reg_buf = Join(registrations, "\n"); size_t reg_size = reg_buf.size(); @@ -2650,7 +2483,7 @@ index 904fb6fa44d4f56fb67476e937edcbb797d78fe7..129cd4b2c12b58464fbab8355afa0c26 static_cast(def_buf.size()), def_buf.data(), static_cast(init_buf.size()), -@@ -711,12 +755,15 @@ int JS2C(const FileList& js_files, +@@ -834,12 +878,15 @@ int JS2C(const FileList& js_files, } } @@ -2666,7 +2499,7 @@ index 904fb6fa44d4f56fb67476e937edcbb797d78fe7..129cd4b2c12b58464fbab8355afa0c26 Fragment out = Format(definitions, initializers, registrations); return WriteIfChanged(out, dest); } -@@ -742,6 +789,8 @@ int Main(int argc, char* argv[]) { +@@ -865,6 +912,8 @@ int Main(int argc, char* argv[]) { std::string arg(argv[i]); if (arg == "--verbose") { is_verbose = true; @@ -2675,7 +2508,7 @@ index 904fb6fa44d4f56fb67476e937edcbb797d78fe7..129cd4b2c12b58464fbab8355afa0c26 } else if (arg == "--root") { if (i == argc - 1) { fprintf(stderr, "--root must be followed by a path\n"); -@@ -790,6 +839,14 @@ int Main(int argc, char* argv[]) { +@@ -913,6 +962,14 @@ int Main(int argc, char* argv[]) { } } @@ -2690,7 +2523,7 @@ index 904fb6fa44d4f56fb67476e937edcbb797d78fe7..129cd4b2c12b58464fbab8355afa0c26 // Should have exactly 3 types: `.js`, `.mjs` and `.gypi`. assert(file_map.size() == 3); auto gypi_it = file_map.find(".gypi"); -@@ -809,6 +866,7 @@ int Main(int argc, char* argv[]) { +@@ -932,6 +989,7 @@ int Main(int argc, char* argv[]) { std::sort(mjs_it->second.begin(), mjs_it->second.end()); return JS2C(js_it->second, mjs_it->second, gypi_it->second[0], output); @@ -2698,7 +2531,7 @@ index 904fb6fa44d4f56fb67476e937edcbb797d78fe7..129cd4b2c12b58464fbab8355afa0c26 } } // namespace js2c } // namespace node -@@ -817,4 +875,4 @@ NODE_MAIN(int argc, node::argv_type raw_argv[]) { +@@ -940,4 +998,4 @@ NODE_MAIN(int argc, node::argv_type raw_argv[]) { char** argv; node::FixupMain(argc, raw_argv, &argv); return node::js2c::Main(argc, argv); diff --git a/patches/node/build_do_not_rely_on_gn_helpers_in_gn_build.patch b/patches/node/build_do_not_rely_on_gn_helpers_in_gn_build.patch deleted file mode 100644 index eab5cc22c352..000000000000 --- a/patches/node/build_do_not_rely_on_gn_helpers_in_gn_build.patch +++ /dev/null @@ -1,171 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Cheng Zhao -Date: Fri, 12 Jan 2024 08:46:57 +0900 -Subject: build: do not rely on gn_helpers in GN build - -Backport https://github.com/nodejs/node/pull/51439 - -diff --git a/deps/ngtcp2/unofficial.gni b/deps/ngtcp2/unofficial.gni -index a304cf4aded42d27a1656be36f2d9e1e2b1818c9..838f5d2402cfd6265f913fa1afa57c1c14ed6eca 100644 ---- a/deps/ngtcp2/unofficial.gni -+++ b/deps/ngtcp2/unofficial.gni -@@ -7,7 +7,7 @@ - # building official binaries. - # Please edit the gyp files if you are making changes to build system. - --import("//node/node.gni") -+import("../../node.gni") - - # The actual configurations are put inside a template in unofficial.gni to - # prevent accidental edits from contributors. -diff --git a/tools/gypi_to_gn.py b/tools/gypi_to_gn.py -index 47182d8017bfc2e4c156d43a868eaa3df15ed3e2..8a094bd7cf844f880d20a9015e76eefe350af592 100755 ---- a/tools/gypi_to_gn.py -+++ b/tools/gypi_to_gn.py -@@ -77,29 +77,119 @@ the input will be replaced with "bar": - from __future__ import absolute_import - from __future__ import print_function - from optparse import OptionParser --import os - import sys - - --# Look for standalone GN distribution. --def FindGNPath(): -- for i in os.environ['PATH'].split(os.pathsep): -- if i.rstrip(os.sep).endswith('gn'): -- return i -- return None -+# This function is copied from build/gn_helpers.py in Chromium. -+def ToGNString(value, pretty=False): -+ """Returns a stringified GN equivalent of a Python value. - -+ Args: -+ value: The Python value to convert. -+ pretty: Whether to pretty print. If true, then non-empty lists are rendered -+ recursively with one item per line, with indents. Otherwise lists are -+ rendered without new line. -+ Returns: -+ The stringified GN equivalent to |value|. - --try: -- # May already be in the import path. -- import gn_helpers --except ImportError: -- # Add src/build to import path. -- src_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), -- os.pardir, os.pardir)) -- sys.path.append(os.path.join(src_dir, 'build')) -- if FindGNPath(): -- sys.path.append(os.path.join(FindGNPath(), 'build')) -- import gn_helpers -+ Raises: -+ ValueError: |value| cannot be printed to GN. -+ """ -+ -+ # Emits all output tokens without intervening whitespaces. -+ def GenerateTokens(v, level): -+ if isinstance(v, str): -+ yield '"' + ''.join(TranslateToGnChars(v)) + '"' -+ -+ elif isinstance(v, bool): -+ yield 'true' if v else 'false' -+ -+ elif isinstance(v, int): -+ yield str(v) -+ -+ elif isinstance(v, list): -+ yield '[' -+ for i, item in enumerate(v): -+ if i > 0: -+ yield ',' -+ for tok in GenerateTokens(item, level + 1): -+ yield tok -+ yield ']' -+ -+ elif isinstance(v, dict): -+ if level > 0: -+ yield '{' -+ for key in sorted(v): -+ if not isinstance(key, str): -+ raise ValueError('Dictionary key is not a string.') -+ if not key or key[0].isdigit() or not key.replace('_', '').isalnum(): -+ raise ValueError('Dictionary key is not a valid GN identifier.') -+ yield key # No quotations. -+ yield '=' -+ for tok in GenerateTokens(v[key], level + 1): -+ yield tok -+ if level > 0: -+ yield '}' -+ -+ else: # Not supporting float: Add only when needed. -+ raise ValueError('Unsupported type when printing to GN.') -+ -+ can_start = lambda tok: tok and tok not in ',}]=' -+ can_end = lambda tok: tok and tok not in ',{[=' -+ -+ # Adds whitespaces, trying to keep everything (except dicts) in 1 line. -+ def PlainGlue(gen): -+ prev_tok = None -+ for i, tok in enumerate(gen): -+ if i > 0: -+ if can_end(prev_tok) and can_start(tok): -+ yield '\n' # New dict item. -+ elif prev_tok == '[' and tok == ']': -+ yield ' ' # Special case for []. -+ elif tok != ',': -+ yield ' ' -+ yield tok -+ prev_tok = tok -+ -+ # Adds whitespaces so non-empty lists can span multiple lines, with indent. -+ def PrettyGlue(gen): -+ prev_tok = None -+ level = 0 -+ for i, tok in enumerate(gen): -+ if i > 0: -+ if can_end(prev_tok) and can_start(tok): -+ yield '\n' + ' ' * level # New dict item. -+ elif tok == '=' or prev_tok in '=': -+ yield ' ' # Separator before and after '=', on same line. -+ if tok in ']}': -+ level -= 1 -+ # Exclude '[]' and '{}' cases. -+ if int(prev_tok == '[') + int(tok == ']') == 1 or \ -+ int(prev_tok == '{') + int(tok == '}') == 1: -+ yield '\n' + ' ' * level -+ yield tok -+ if tok in '[{': -+ level += 1 -+ if tok == ',': -+ yield '\n' + ' ' * level -+ prev_tok = tok -+ -+ token_gen = GenerateTokens(value, 0) -+ ret = ''.join((PrettyGlue if pretty else PlainGlue)(token_gen)) -+ # Add terminating '\n' for dict |value| or multi-line output. -+ if isinstance(value, dict) or '\n' in ret: -+ return ret + '\n' -+ return ret -+ -+ -+def TranslateToGnChars(s): -+ for code in s.encode('utf-8'): -+ if code in (34, 36, 92): # For '"', '$', or '\\'. -+ yield '\\' + chr(code) -+ elif 32 <= code < 127: -+ yield chr(code) -+ else: -+ yield '$0x%02X' % code - - - def LoadPythonDictionary(path): -@@ -209,7 +299,7 @@ def main(): - else: - gn_dict[gn_key] = data[key] - -- print(gn_helpers.ToGNString(DeduplicateLists(gn_dict))) -+ print(ToGNString(DeduplicateLists(gn_dict))) - - if __name__ == '__main__': - try: 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 67165398699c..39b94e29a90f 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 f52d4f805406c513904151be90e433948764b3ad..7b790060b03cceec62bfe4c1f12d396b9cf52e8c 100644 +index 292cd621dd6d2a6bfcbf959c5910563446492fd9..722b4c3d376ce6eaa683397b693f9bad8f2aa584 100644 --- a/common.gypi +++ b/common.gypi @@ -86,6 +86,8 @@ @@ -40,10 +40,10 @@ index f52d4f805406c513904151be90e433948764b3ad..7b790060b03cceec62bfe4c1f12d396b # list in v8/BUILD.gn. ['v8_enable_v8_checks == 1', { diff --git a/configure.py b/configure.py -index 84b016cd853080656d4dcf982e64855fcfa72a55..f0cccff0eed2ef11275d2f7ec2358276f6e10458 100755 +index 00c8513d6820ec862bffb06063e9b1ae27d6043d..8169c674d672b7206b3765bcbf68cde04ba2d915 100755 --- a/configure.py +++ b/configure.py -@@ -1489,6 +1489,7 @@ def configure_library(lib, output, pkgname=None): +@@ -1496,6 +1496,7 @@ def configure_library(lib, output, pkgname=None): def configure_v8(o): @@ -52,7 +52,7 @@ index 84b016cd853080656d4dcf982e64855fcfa72a55..f0cccff0eed2ef11275d2f7ec2358276 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 868366f6d3e35d0fe543c89efd7d5e313a831a96..a512d2228e0afcfff765c3fe845e1f22073047d0 100644 +index 13e29b98d0c91badee41b53c37b4763f73e02e87..16c3ad349e942b83764c7772178baa5057cd64f3 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 index 7afbbf98e97d..7c610a3e4e29 100644 --- 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 @@ -10,7 +10,7 @@ in. This should be upstreamed. diff --git a/common.gypi b/common.gypi -index 7b790060b03cceec62bfe4c1f12d396b9cf52e8c..ef8c7a0477aa9c92439846699e739eae4340b88c 100644 +index 722b4c3d376ce6eaa683397b693f9bad8f2aa584..b003ddf5763a0f5c3289a7ff39d71f3d828b73db 100644 --- a/common.gypi +++ b/common.gypi @@ -133,6 +133,7 @@ @@ -22,10 +22,10 @@ index 7b790060b03cceec62bfe4c1f12d396b9cf52e8c..ef8c7a0477aa9c92439846699e739eae ['target_arch in "ppc64 s390x"', { 'v8_enable_backtrace': 1, diff --git a/configure.py b/configure.py -index f0cccff0eed2ef11275d2f7ec2358276f6e10458..87b647ab363219add8201966a64b539215bdee03 100755 +index 8169c674d672b7206b3765bcbf68cde04ba2d915..ac5990cf48703ae2e10ad86915aacdad25206f0e 100755 --- a/configure.py +++ b/configure.py -@@ -1503,6 +1503,7 @@ def configure_v8(o): +@@ -1510,6 +1510,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 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 562d0088845a..b5dbaa8aeddf 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 @@ -10,7 +10,7 @@ JS errors and ensures embedder JS is loaded via LoadEmbedderJavaScriptSource. That method is generated by our modifications to js2c.cc in the BUILD.gn patch diff --git a/lib/internal/fs/watchers.js b/lib/internal/fs/watchers.js -index 99212fa713bf3f767d4604906e41d9b279447239..4e32a274a63c8244ce3168d0c5cc56203cfe5473 100644 +index f5ecc15159f457cd0b8069c0427b7c758c916c4e..c9ce67391f321989b0af48159b4da3ab8ffc3e65 100644 --- a/lib/internal/fs/watchers.js +++ b/lib/internal/fs/watchers.js @@ -292,12 +292,13 @@ function emitCloseNT(self) { @@ -34,7 +34,7 @@ index 99212fa713bf3f767d4604906e41d9b279447239..4e32a274a63c8244ce3168d0c5cc5620 let kResistStopPropagation; diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index 453d874efff767a95ef25fad7005ac11717f0c67..bcef04f980d1b1f010c5349ecbfca8080f39b308 100644 +index 804296db12f7864f72648f5f36834a924503e4a6..2cac503e92640a4683a4be6969f1ed40e42785a0 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -35,6 +35,7 @@ using v8::Value; @@ -46,14 +46,14 @@ index 453d874efff767a95ef25fad7005ac11717f0c67..bcef04f980d1b1f010c5349ecbfca808 AddExternalizedBuiltin( "internal/deps/cjs-module-lexer/lexer", diff --git a/src/node_builtins.h b/src/node_builtins.h -index ea77c7598153bb8a9ba20c89a4ece2c1580b9a25..11d10f52b7c492bfae4bc58b39c20a693762a72d 100644 +index 9a20a275fbe5df9f384b7b1d1d26806e7cd05384..a1a9fe7d592f0d57b70dcee8c865b99d71248bf2 100644 --- a/src/node_builtins.h +++ b/src/node_builtins.h -@@ -126,6 +126,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader { +@@ -132,6 +132,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader { // Generated by tools/js2c.py as node_javascript.cc void LoadJavaScriptSource(); // Loads data into source_ + void LoadEmbedderJavaScriptSource(); // Loads embedder data into source_ UnionBytes GetConfig(); // Return data for config.gypi - std::vector GetBuiltinIds() const; + struct BuiltinCategories { diff --git a/patches/node/build_only_create_cppgc_heap_on_non-32_bit_platforms.patch b/patches/node/build_only_create_cppgc_heap_on_non-32_bit_platforms.patch index b52639ab81e1..f624996a4c81 100644 --- a/patches/node/build_only_create_cppgc_heap_on_non-32_bit_platforms.patch +++ b/patches/node/build_only_create_cppgc_heap_on_non-32_bit_platforms.patch @@ -18,7 +18,7 @@ See https://gist.github.com/codebytere/275ec8923253fd6559b3d36115f7b31b for more This should be fixed and re-enabled on all platforms. diff --git a/BUILD.gn b/BUILD.gn -index 541e7d2b8ee05677b64a3ea39c1422560fd5df75..8d63fea3304b36654992fe718ceeb3931ef86d39 100644 +index 7d201bb6b822f0401c3be2bc52d65bc71463748b..38f4b5afb9e667f0958008847224fa7a6cfe64a0 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -181,6 +181,10 @@ config("node_internal_config") { @@ -33,10 +33,10 @@ index 541e7d2b8ee05677b64a3ea39c1422560fd5df75..8d63fea3304b36654992fe718ceeb393 node_platform = "win32" } else if (target_os == "mac") { diff --git a/src/env.cc b/src/env.cc -index a429d5526d0af66eef94132b196e42994e3f6448..ba575a04340b91709fb6c8710ab160a4ca1f8b77 100644 +index 9f83720fefc77342dd45cdf1eebfac613262ad63..309b39fb2b1116824c0c1c2ae86d8e1113e31c3d 100644 --- a/src/env.cc +++ b/src/env.cc -@@ -546,7 +546,8 @@ IsolateData::IsolateData(Isolate* isolate, +@@ -557,7 +557,8 @@ IsolateData::IsolateData(Isolate* isolate, // for embedder ID, V8 could accidentally enable cppgc on them. So // safe guard against this. DCHECK_NE(descriptor.wrappable_type_index, BaseObject::kSlot); @@ -46,7 +46,7 @@ index a429d5526d0af66eef94132b196e42994e3f6448..ba575a04340b91709fb6c8710ab160a4 cpp_heap_ = CppHeap::Create( platform, CppHeapCreateParams{ -@@ -554,6 +555,7 @@ IsolateData::IsolateData(Isolate* isolate, +@@ -565,6 +566,7 @@ IsolateData::IsolateData(Isolate* isolate, WrapperDescriptor( BaseObject::kEmbedderType, BaseObject::kSlot, cppgc_id)}); isolate->AttachCppHeap(cpp_heap_.get()); diff --git a/patches/node/chore_add_v8-sandbox_h.patch b/patches/node/chore_add_v8-sandbox_h.patch deleted file mode 100644 index 9dc94af68c9d..000000000000 --- a/patches/node/chore_add_v8-sandbox_h.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Charles Kerr -Date: Tue, 9 Apr 2024 19:42:44 -0500 -Subject: chore: add v8-sandbox.h - -Add v8-sandbox.h to the list of v8 headers. - -This patch can be removed after upstream Node is updated to a version -of v8 that includes this file. - -diff --git a/deps/v8/BUILD.bazel b/deps/v8/BUILD.bazel -index 81a9286d2670de2caef1f151def05d865d3c8ccf..6922952d0df0a6300759389d65af9f12d7ef42ae 100644 ---- a/deps/v8/BUILD.bazel -+++ b/deps/v8/BUILD.bazel -@@ -549,6 +549,7 @@ filegroup( - "include/v8-promise.h", - "include/v8-proxy.h", - "include/v8-regexp.h", -+ "include/v8-sandbox.h", - "include/v8-script.h", - "include/v8-snapshot.h", - "include/v8-statistics.h", -diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn -index 68d92c3477bc2c324859a4167e2be129d8a209a7..94f3c30568f54e37f42696deb910049f719f49e9 100644 ---- a/deps/v8/BUILD.gn -+++ b/deps/v8/BUILD.gn -@@ -2726,6 +2726,7 @@ v8_header_set("v8_headers") { - "include/v8-promise.h", - "include/v8-proxy.h", - "include/v8-regexp.h", -+ "include/v8-sandbox.h", - "include/v8-script.h", - "include/v8-snapshot.h", - "include/v8-statistics.h", -diff --git a/filenames.json b/filenames.json -index 4404338bb5d576b341cae3bf79c84334fb05654f..ec7d82e49ed96314499e4304101f557fcfecc617 100644 ---- a/filenames.json -+++ b/filenames.json -@@ -68,6 +68,7 @@ - "//v8/include/v8-promise.h", - "//v8/include/v8-proxy.h", - "//v8/include/v8-regexp.h", -+ "//v8/include/v8-sandbox.h", - "//v8/include/v8-script.h", - "//v8/include/v8-snapshot.h", - "//v8/include/v8-source-location.h", -diff --git a/tools/install.py b/tools/install.py -index 74b01f8352021f1105c080dbbf8bb29121a13501..633119cc6b1152ec3a4b676756b554aa4667d298 100755 ---- a/tools/install.py -+++ b/tools/install.py -@@ -284,6 +284,7 @@ def headers(action): - '../../v8/include/v8-promise.h', - '../../v8/include/v8-proxy.h', - '../../v8/include/v8-regexp.h', -+ '../../v8/include/v8-sandbox.h', - '../../v8/include/v8-script.h', - '../../v8/include/v8-snapshot.h', - '../../v8/include/v8-source-location.h', 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 4d17a2946cb5..fbba61d7f315 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 dbbb454c3fc8a7774c1d190713e88862fda50f22..7a326e925a5769b8ea8e512e30fa655768beae3f 100644 +index 46140285cf6b73c154a067c5f0f0931add5e9275..fb4e675c9dca33b99dbbf347adf6a6938ff91a7a 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -1350,6 +1350,13 @@ Module.prototype._compile = function(content, filename) { +@@ -1342,6 +1342,13 @@ Module.prototype._compile = function(content, filename) { if (getOptionValue('--inspect-brk') && process._eval == null) { if (!resolvedArgv) { // We enter the repl if we're not given a filename argument. @@ -26,10 +26,10 @@ index dbbb454c3fc8a7774c1d190713e88862fda50f22..7a326e925a5769b8ea8e512e30fa6557 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 cffffc28d3d703aab4beca6a150549f370281615..eb66f0e37b517a03be20e0829863e7572042c7ed 100644 +index 9d80d2a55c72d2035480ddfb5d54c14ef52844ea..2fc9e2da8aa920acffc101b2c341a5d9b16fe90a 100644 --- a/lib/internal/process/pre_execution.js +++ b/lib/internal/process/pre_execution.js -@@ -233,12 +233,14 @@ function patchProcessObject(expandArgv1) { +@@ -241,12 +241,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 2599c58985f9..5103dd7e1d05 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 003ae7eb987f03611444f02695bc8582e0ac6a67..bbf1df480bc6ec90ee3ac29312dc89ff8bf94ab3 100644 +index 39e87338dc5a799a8a30bd2399b8ec5d6b554fad..7b1939fa25379b333f2be07f4ff483f53d8a2ac6 100644 --- a/lib/internal/modules/esm/utils.js +++ b/lib/internal/modules/esm/utils.js -@@ -23,7 +23,7 @@ const { +@@ -24,7 +24,7 @@ const { ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING, ERR_INVALID_ARG_VALUE, } = require('internal/errors').codes; @@ -23,7 +23,7 @@ index 003ae7eb987f03611444f02695bc8582e0ac6a67..bbf1df480bc6ec90ee3ac29312dc89ff const { loadPreloadModules, initializeFrozenIntrinsics, -@@ -221,12 +221,13 @@ let _forceDefaultLoader = false; +@@ -239,12 +239,13 @@ let _forceDefaultLoader = false; * @param {boolean} [forceDefaultLoader=false] - A boolean indicating disabling custom loaders. */ function initializeESM(forceDefaultLoader = false) { @@ -40,10 +40,10 @@ index 003ae7eb987f03611444f02695bc8582e0ac6a67..bbf1df480bc6ec90ee3ac29312dc89ff /** diff --git a/src/module_wrap.cc b/src/module_wrap.cc -index 895ff3a5948add3513700ecc2f32fce4c2fbe4eb..3182a5e4aad2ba0be2b6769edb696b815ce39a61 100644 +index 501e4d7b7ea180588737fcbb2bf6ff79abfb9d9a..cce67100588bf6b47d26ee9168a123cb813b822e 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc -@@ -554,7 +554,7 @@ MaybeLocal ModuleWrap::ResolveModuleCallback( +@@ -561,7 +561,7 @@ MaybeLocal ModuleWrap::ResolveModuleCallback( return module->module_.Get(isolate); } @@ -52,7 +52,7 @@ index 895ff3a5948add3513700ecc2f32fce4c2fbe4eb..3182a5e4aad2ba0be2b6769edb696b81 Local context, Local host_defined_options, Local resource_name, -@@ -618,12 +618,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback( +@@ -626,12 +626,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback( Realm* realm = Realm::GetCurrent(args); HandleScope handle_scope(isolate); @@ -68,7 +68,7 @@ index 895ff3a5948add3513700ecc2f32fce4c2fbe4eb..3182a5e4aad2ba0be2b6769edb696b81 } void ModuleWrap::HostInitializeImportMetaObjectCallback( -@@ -665,13 +666,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback( +@@ -673,13 +674,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback( Realm* realm = Realm::GetCurrent(args); Isolate* isolate = realm->isolate(); diff --git a/patches/node/chore_remove_--no-harmony-atomics_related_code.patch b/patches/node/chore_remove_--no-harmony-atomics_related_code.patch index e0a00e1ae423..2bebe42415df 100644 --- a/patches/node/chore_remove_--no-harmony-atomics_related_code.patch +++ b/patches/node/chore_remove_--no-harmony-atomics_related_code.patch @@ -9,7 +9,7 @@ This patch can be removed when Node.js upgrades to a version of V8 containing the above CL. diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml -index fbaf641789e8dc2b1ba991ad7ee755271e756ee1..53bc3ce5e144f5988a9164c41e6bbc6cc44582d2 100644 +index 834e2a1d814d7a215284554b95e38100f54f6471..dbd563061b01bc8796f95e004e07dd0097b8499b 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -33,10 +33,6 @@ rules: diff --git a/patches/node/chore_remove_use_of_deprecated_kmaxlength.patch b/patches/node/chore_remove_use_of_deprecated_kmaxlength.patch index 580cad4b463f..bcf032e1566b 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 8591faab8eaf6f0e6c745e2a6e9f60a468c3efcc..32efaf5148bd6620210c58a95ef3c53bc57a4ea1 100644 +index 30f66a7648bff4e9b5cd9e9ba516d9c854482263..9eb9a1a932e2f097827ab24b1f3abd2ce20a51af 100644 --- a/src/node_errors.h +++ b/src/node_errors.h -@@ -222,7 +222,7 @@ inline v8::Local ERR_BUFFER_TOO_LARGE(v8::Isolate* isolate) { +@@ -227,7 +227,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/ci_ensure_node_tests_set_electron_run_as_node.patch b/patches/node/ci_ensure_node_tests_set_electron_run_as_node.patch index a55a002be208..bcc55a210ffd 100644 --- a/patches/node/ci_ensure_node_tests_set_electron_run_as_node.patch +++ b/patches/node/ci_ensure_node_tests_set_electron_run_as_node.patch @@ -20,20 +20,18 @@ index 88f40281e069b77ac071ac872c4491f749b64e21..0fa102da111fa370406ca74069316fa7 await assertSnapshot(transform(`${stdout}${stderr}`), filename); } diff --git a/test/fixtures/test-runner/output/arbitrary-output-colored.js b/test/fixtures/test-runner/output/arbitrary-output-colored.js -index b09eeeb9971cf6dfbdccc700757487fe2236e5a8..dd8296e63133eec6babac9b35e77da301a44b86f 100644 +index af23e674cb361ed81dafa22670d5633559cd1144..1dd59990cb7cdba8aecf4f499ee6b92e7cd41b30 100644 --- a/test/fixtures/test-runner/output/arbitrary-output-colored.js +++ b/test/fixtures/test-runner/output/arbitrary-output-colored.js -@@ -6,6 +6,6 @@ const fixtures = require('../../../common/fixtures'); - +@@ -7,6 +7,6 @@ const fixtures = require('../../../common/fixtures'); (async function run() { const test = fixtures.path('test-runner/output/arbitrary-output-colored-1.js'); -- await once(spawn(process.execPath, ['--test', test], { stdio: 'inherit', env: { FORCE_COLOR: 1 } }), 'exit'); -- await once(spawn(process.execPath, ['--test', '--test-reporter', 'tap', test], { stdio: 'inherit', env: { FORCE_COLOR: 1 } }), 'exit'); --})().then(common.mustCall()); -+ await once(spawn(process.execPath, ['--test', test], { stdio: 'inherit', env: { ELECTRON_RUN_AS_NODE: 1, FORCE_COLOR: 1 } }), 'exit'); -+ await once(spawn(process.execPath, ['--test', '--test-reporter', 'tap', test], { stdio: 'inherit', env: { ELECTRON_RUN_AS_NODE: 1, FORCE_COLOR: 1 } }), 'exit'); -+})().then(common.mustCall()); -\ No newline at end of file + const reset = fixtures.path('test-runner/output/reset-color-depth.js'); +- await once(spawn(process.execPath, ['-r', reset, '--test', test], { stdio: 'inherit' }), 'exit'); +- await once(spawn(process.execPath, ['-r', reset, '--test', '--test-reporter', 'tap', test], { stdio: 'inherit' }), 'exit'); ++ await once(spawn(process.execPath, ['-r', reset, '--test', test], { stdio: 'inherit', env: { ELECTRON_RUN_AS_NODE: 1 }}), 'exit'); ++ await once(spawn(process.execPath, ['-r', reset, '--test', '--test-reporter', 'tap', test], { stdio: 'inherit', env: { ELECTRON_RUN_AS_NODE: 1 } }), 'exit'); + })().then(common.mustCall()); diff --git a/test/parallel/test-node-output-console.mjs b/test/parallel/test-node-output-console.mjs index 5a1b9feb6c8bedb50b89f5c4f3c5983455bb042d..efca7811dc0b6a590c5ee023c71801703a642882 100644 --- a/test/parallel/test-node-output-console.mjs diff --git a/patches/node/deprecate_vector_v8_local_in_v8.patch b/patches/node/deprecate_vector_v8_local_in_v8.patch index 7a382b84a1ff..294f8e530eb7 100644 --- a/patches/node/deprecate_vector_v8_local_in_v8.patch +++ b/patches/node/deprecate_vector_v8_local_in_v8.patch @@ -9,7 +9,7 @@ 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 3182a5e4aad2ba0be2b6769edb696b815ce39a61..e73f129d5f9ca3ea872fd5934d9d31a952a4a3fe 100644 +index cce67100588bf6b47d26ee9168a123cb813b822e..9ad67e0993da4c3e3f8a14681edbf941cf14e2e6 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -169,7 +169,9 @@ void ModuleWrap::New(const FunctionCallbackInfo& args) { diff --git a/patches/node/feat_add_knostartdebugsignalhandler_to_environment_to_prevent.patch b/patches/node/feat_add_knostartdebugsignalhandler_to_environment_to_prevent.patch index b2a13e66b162..4596c395c39e 100644 --- a/patches/node/feat_add_knostartdebugsignalhandler_to_environment_to_prevent.patch +++ b/patches/node/feat_add_knostartdebugsignalhandler_to_environment_to_prevent.patch @@ -7,10 +7,10 @@ Subject: feat: add kNoStartDebugSignalHandler to Environment to prevent This patch should be upstreamed, it allows embedders to prevent the call to StartDebugSignalHandler which handles SIGUSR1 and starts the inspector agent. Apps that have --inspect disabled also don't want SIGUSR1 to have this affect. diff --git a/src/env-inl.h b/src/env-inl.h -index d5124e73e7c4c6b631ccfedf407e02bc444b428f..564de2990c09a54693686666f9ad66398ff76ab5 100644 +index 022f1507ce6a72d0ef140409efba476c7ef7825a..ac4295f495e240331a183b4a0a22d7437fc85271 100644 --- a/src/env-inl.h +++ b/src/env-inl.h -@@ -677,6 +677,10 @@ inline bool Environment::no_global_search_paths() const { +@@ -669,6 +669,10 @@ inline bool Environment::no_global_search_paths() const { !options_->global_search_paths; } @@ -22,10 +22,10 @@ index d5124e73e7c4c6b631ccfedf407e02bc444b428f..564de2990c09a54693686666f9ad6639 // configure --no-browser-globals #ifdef NODE_NO_BROWSER_GLOBALS diff --git a/src/env.h b/src/env.h -index 1047f1d794da2a3a035df5eaab1c809a7fca3d23..448075e354c760a2dbd1dd763f40b7a645730250 100644 +index bb84f5ab43cb5be42019921e5dc2fc010d7b9018..f0a1d5ef2b45d4c27c5660177c9805acee19e5f2 100644 --- a/src/env.h +++ b/src/env.h -@@ -787,6 +787,7 @@ class Environment : public MemoryRetainer { +@@ -801,6 +801,7 @@ class Environment : public MemoryRetainer { inline bool tracks_unmanaged_fds() const; inline bool hide_console_windows() const; inline bool no_global_search_paths() const; @@ -34,10 +34,10 @@ index 1047f1d794da2a3a035df5eaab1c809a7fca3d23..448075e354c760a2dbd1dd763f40b7a6 inline uint64_t thread_id() const; inline worker::Worker* worker_context() const; diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc -index de372400fd9cedb0a724ce434c8944760dd2d078..58eb4befb94a68aa8f27c11665e9d7b32fe472be 100644 +index 63c8ae14abb3dee3c4a628d1042c2e9e25688806..4e1eb17dd174e18a814fce6b170d75d161937ace 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc -@@ -707,8 +707,10 @@ bool Agent::Start(const std::string& path, +@@ -717,8 +717,10 @@ bool Agent::Start(const std::string& path, StartIoThreadAsyncCallback)); uv_unref(reinterpret_cast(&start_io_thread_async)); start_io_thread_async.data = this; @@ -51,10 +51,10 @@ index de372400fd9cedb0a724ce434c8944760dd2d078..58eb4befb94a68aa8f27c11665e9d7b3 parent_env_->AddCleanupHook([](void* data) { Environment* env = static_cast(data); diff --git a/src/node.h b/src/node.h -index 74a097279d3e5dc3ee6c5e609fd35cf44e5002f5..868366f6d3e35d0fe543c89efd7d5e313a831a96 100644 +index dbe6aa42075524f66a8f76bb945255f5195359cd..13e29b98d0c91badee41b53c37b4763f73e02e87 100644 --- a/src/node.h +++ b/src/node.h -@@ -656,7 +656,11 @@ enum Flags : uint64_t { +@@ -657,7 +657,11 @@ enum Flags : uint64_t { // This control is needed by embedders who may not want to initialize the V8 // inspector in situations where one has already been created, // e.g. Blink's in Chromium. diff --git a/patches/node/feat_optionally_prevent_calling_v8_enablewebassemblytraphandler.patch b/patches/node/feat_optionally_prevent_calling_v8_enablewebassemblytraphandler.patch index 456f87f58628..da012c2cafb2 100644 --- a/patches/node/feat_optionally_prevent_calling_v8_enablewebassemblytraphandler.patch +++ b/patches/node/feat_optionally_prevent_calling_v8_enablewebassemblytraphandler.patch @@ -10,10 +10,10 @@ already been called. This should be upstreamed. diff --git a/src/node.cc b/src/node.cc -index 1d77a8b31cb0bfbeeeac594b6e1ac7dd303c902d..dadddf33527beebfcde12214da4084badbd27af1 100644 +index 012dd487e8db232d068bce358ad44b14e78d0fe9..a1062226bebd18ec84302ebdc4c4dbac352f51ae 100644 --- a/src/node.cc +++ b/src/node.cc -@@ -605,6 +605,7 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) { +@@ -650,6 +650,7 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) { #endif } #endif // defined(_WIN32) @@ -22,10 +22,10 @@ index 1d77a8b31cb0bfbeeeac594b6e1ac7dd303c902d..dadddf33527beebfcde12214da4084ba #endif // NODE_USE_V8_WASM_TRAP_HANDLER } diff --git a/src/node.h b/src/node.h -index a512d2228e0afcfff765c3fe845e1f22073047d0..36da93a7b41ea450a5f288ec17b61adae46ae178 100644 +index 16c3ad349e942b83764c7772178baa5057cd64f3..5ade64874ec08474f05db226cf19a043fa26592e 100644 --- a/src/node.h +++ b/src/node.h -@@ -274,6 +274,10 @@ enum Flags : uint32_t { +@@ -275,6 +275,10 @@ enum Flags : uint32_t { kNoInitializeCppgc = 1 << 13, // Initialize the process for predictable snapshot generation. kGeneratePredictableSnapshot = 1 << 14, diff --git a/patches/node/fix_-wshadow_error_in_uvwasi_c.patch b/patches/node/fix_-wshadow_error_in_uvwasi_c.patch deleted file mode 100644 index 4df6805d1b68..000000000000 --- a/patches/node/fix_-wshadow_error_in_uvwasi_c.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Fri, 8 Dec 2023 18:05:28 +0100 -Subject: fix: -Wshadow error in uvwasi.c - -Refs https://github.com/nodejs/node/pull/49908 - -Fixes a -Wshadow error in uvwasi.c. This should be upstreamed. - -diff --git a/deps/uvwasi/src/uvwasi.c b/deps/uvwasi/src/uvwasi.c -index e904b9f9293864db02f660dc3c9737f0e3684355..3e9cce85cae109ffc09f6b86ab5e896620b862d8 100644 ---- a/deps/uvwasi/src/uvwasi.c -+++ b/deps/uvwasi/src/uvwasi.c -@@ -2794,13 +2794,13 @@ uvwasi_errno_t uvwasi_sock_accept(uvwasi_t* uvwasi, - goto close_sock_and_error_exit; - } - -- int r = uv_accept((uv_stream_t*) wrap->sock, (uv_stream_t*) uv_connect_sock); -- if (r == UV_EAGAIN) { -+ int rr = uv_accept((uv_stream_t*) wrap->sock, (uv_stream_t*) uv_connect_sock); -+ if (rr == UV_EAGAIN) { - // still no connection or error so run the loop again - continue; - } - -- if (r != 0) { -+ if (rr != 0) { - // An error occurred accepting the connection. Break out of the loop and - // report an error. - err = uvwasi__translate_uv_error(r); diff --git a/patches/node/fix_-wshadow_warning.patch b/patches/node/fix_-wshadow_warning.patch index 9ecff7c7c0cf..aefc77d6ea30 100644 --- a/patches/node/fix_-wshadow_warning.patch +++ b/patches/node/fix_-wshadow_warning.patch @@ -28,19 +28,18 @@ In file included from ../../third_party/electron_node/src/env-inl.h:32: 1 error generated. diff --git a/src/util.h b/src/util.h -index 28873dbe4024df70a43fdc01ebd70c09acd118b0..f270efded6930f9fda56c7e277e0e3b4de6c91f4 100644 +index e5f508b5090b2a0a95dc280e010ddcc731ad0dd2..d1d78c5b2f0409c7a399444875079eb5c487a3e7 100644 --- a/src/util.h +++ b/src/util.h -@@ -131,10 +131,10 @@ 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); \ - } while (0) - - #ifdef __GNUC__ +@@ -145,9 +145,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 9508d73606f9..a47180ebedd7 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 db09a8a33df06663b05d65828b51cfd35eb6fa79..f52d4f805406c513904151be90e433948764b3ad 100644 +index efcd8da848150de3201ac5105470e908127015c3..292cd621dd6d2a6bfcbf959c5910563446492fd9 100644 --- a/common.gypi +++ b/common.gypi @@ -88,6 +88,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 d365b295a81e..2abdebf294d1 100644 --- a/patches/node/fix_assert_module_in_the_renderer_process.patch +++ b/patches/node/fix_assert_module_in_the_renderer_process.patch @@ -44,7 +44,7 @@ index 9dfcf80a913942c93b206c6f871ac7807c7a7e81..4d25a22aedf7d7182bb709864e29b7e7 let filename = call.getFileName(); const line = call.getLineNumber() - 1; diff --git a/src/api/environment.cc b/src/api/environment.cc -index 11f8b8dea7bf4119c2d99ee451e3f1bc7bde8902..9045de3b17c93c4864a1bb1024b08f7d1ffa83be 100644 +index a9c7b009a74fab07afafa72e5f883bee88cf492a..7c2e4430299e0d78539d43070942ea3a585b559c 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -277,6 +277,9 @@ void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s) { @@ -58,10 +58,10 @@ index 11f8b8dea7bf4119c2d99ee451e3f1bc7bde8902..9045de3b17c93c4864a1bb1024b08f7d } diff --git a/src/node_options.cc b/src/node_options.cc -index a3d25cdd52f18e319ae3ac81437c8a0206b18690..48ce3f3b68a94fc35e5ce93a385ddbebb03741b9 100644 +index e46c71ee467ce1390f0e14794f3514196856b424..a02dcca456556a7cbb2a262edc5fa4a3b25297ed 100644 --- a/src/node_options.cc +++ b/src/node_options.cc -@@ -1269,6 +1269,11 @@ void GetEmbedderOptions(const FunctionCallbackInfo& args) { +@@ -1283,6 +1283,11 @@ void GetEmbedderOptions(const FunctionCallbackInfo& args) { Local context = env->context(); Local ret = Object::New(isolate); diff --git a/patches/node/fix_capture_embedder_exceptions_before_entering_v8.patch b/patches/node/fix_capture_embedder_exceptions_before_entering_v8.patch index 54f5009e9051..9443080a9f6b 100644 --- a/patches/node/fix_capture_embedder_exceptions_before_entering_v8.patch +++ b/patches/node/fix_capture_embedder_exceptions_before_entering_v8.patch @@ -24,10 +24,10 @@ index 69e2a389f9e1480a1a4ba37f5df5356b42f7d52d..0c29b00298b44b97f88a63aa5b89f1c2 wrap->object()->Has(env->context(), env->handle_onclose_symbol()) .FromMaybe(false)) { diff --git a/src/node_contextify.cc b/src/node_contextify.cc -index a68f6bb686768e2c5eaa4148741891926156883d..0239c64f80f4fb1870b452ed44e6ac36bfa0e3d2 100644 +index e9d50ac402b01208eb06504afcdfaf8d1e982bcd..c728c11145bdc7bfce59c3c20fa43508ea4482fb 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc -@@ -472,6 +472,7 @@ bool ContextifyContext::IsStillInitializing(const ContextifyContext* ctx) { +@@ -459,6 +459,7 @@ bool ContextifyContext::IsStillInitializing(const ContextifyContext* ctx) { void ContextifyContext::PropertyGetterCallback( Local property, const PropertyCallbackInfo& args) { @@ -35,7 +35,7 @@ index a68f6bb686768e2c5eaa4148741891926156883d..0239c64f80f4fb1870b452ed44e6ac36 ContextifyContext* ctx = ContextifyContext::Get(args); // Still initializing -@@ -479,6 +480,8 @@ void ContextifyContext::PropertyGetterCallback( +@@ -466,6 +467,8 @@ void ContextifyContext::PropertyGetterCallback( Local context = ctx->context(); Local sandbox = ctx->sandbox(); @@ -44,7 +44,7 @@ index a68f6bb686768e2c5eaa4148741891926156883d..0239c64f80f4fb1870b452ed44e6ac36 MaybeLocal maybe_rv = sandbox->GetRealNamedProperty(context, property); if (maybe_rv.IsEmpty()) { -@@ -488,6 +491,11 @@ void ContextifyContext::PropertyGetterCallback( +@@ -475,6 +478,11 @@ void ContextifyContext::PropertyGetterCallback( Local rv; if (maybe_rv.ToLocal(&rv)) { @@ -57,7 +57,7 @@ index a68f6bb686768e2c5eaa4148741891926156883d..0239c64f80f4fb1870b452ed44e6ac36 rv = ctx->global_proxy(); diff --git a/src/node_messaging.cc b/src/node_messaging.cc -index 6c9a23e669b29d1fdbc4e371d903e77060fd1b74..7c9f6b004295433be6a4ce84621f2005a0b67e14 100644 +index e7d2bfbafef13f04a73dcbefe7d6e90b37b904d1..31b870c5f003b62b848c00d6032ed98eb829778d 100644 --- a/src/node_messaging.cc +++ b/src/node_messaging.cc @@ -907,7 +907,7 @@ Maybe MessagePort::PostMessage(Environment* env, diff --git a/patches/node/fix_do_not_resolve_electron_entrypoints.patch b/patches/node/fix_do_not_resolve_electron_entrypoints.patch index c4c46aa0e535..9a44e6fbe6be 100644 --- a/patches/node/fix_do_not_resolve_electron_entrypoints.patch +++ b/patches/node/fix_do_not_resolve_electron_entrypoints.patch @@ -19,10 +19,10 @@ index 449131b9af99744c08d62d73f8d124cef5c9cc71..3df06eff63106aece1009d88fd01df2a context = { __proto__: context, source }; } diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index cea066d1073a31573e134d584f1991e7a06b1036..2b2d8e00e7ecf2e8266218d8dc5e65f0f7c8a49f 100644 +index 4831f3678cde9b4edad04922932c8239a7908a04..e364c76e2eccafdd795544cb224e43f3df456fbb 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js -@@ -387,6 +387,9 @@ function cjsPreparseModuleExports(filename, source) { +@@ -397,6 +397,9 @@ function cjsPreparseModuleExports(filename, source) { if (cached) { return { module, exportNames: cached.exportNames }; } diff --git a/patches/node/fix_expose_lookupandcompile_with_parameters.patch b/patches/node/fix_expose_lookupandcompile_with_parameters.patch index b5236345d65d..94befc32f20d 100644 --- a/patches/node/fix_expose_lookupandcompile_with_parameters.patch +++ b/patches/node/fix_expose_lookupandcompile_with_parameters.patch @@ -10,10 +10,10 @@ parameters. This should be upstreamed. diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index bcef04f980d1b1f010c5349ecbfca8080f39b308..6861c28eb6deea72e844b04048d88ca726385c7f 100644 +index 2cac503e92640a4683a4be6969f1ed40e42785a0..f9a090f5c3e04403602ba383032e7f3230669a92 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc -@@ -482,6 +482,18 @@ MaybeLocal BuiltinLoader::CompileAndCall(Local context, +@@ -491,6 +491,18 @@ MaybeLocal BuiltinLoader::CompileAndCall(Local context, return fn->Call(context, undefined, argc, argv); } @@ -29,11 +29,11 @@ index bcef04f980d1b1f010c5349ecbfca8080f39b308..6861c28eb6deea72e844b04048d88ca7 + return maybe; +} + - bool BuiltinLoader::CompileAllBuiltins(Local context) { - std::vector ids = GetBuiltinIds(); - bool all_succeeded = true; + bool BuiltinLoader::CompileAllBuiltinsAndCopyCodeCache( + Local context, + const std::vector& eager_builtins, diff --git a/src/node_builtins.h b/src/node_builtins.h -index 11d10f52b7c492bfae4bc58b39c20a693762a72d..b995e15fcd795f310126a38ec652efcd9fd36945 100644 +index a1a9fe7d592f0d57b70dcee8c865b99d71248bf2..3279aac04fd20080db258eafa2826c2dda614b90 100644 --- a/src/node_builtins.h +++ b/src/node_builtins.h @@ -99,6 +99,12 @@ class NODE_EXTERN_PRIVATE BuiltinLoader { 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 41d7e9e8ccf2..68cbafecf4de 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 @@ -48,10 +48,10 @@ index 5239bc8ed883a54df206d73c5dc0b70942c4f3df..6a15fcae677b3bda58fc85f705862bbc ArrayPrototypePush(schemes, 'https', 'http'); } diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js -index 06a34c11254a2fedd2ea59c4057bfb30c31082a6..66ecfbcdd4fb2c9986e2d4619a381337839979fe 100644 +index b56ad6cc833f00f58bf3925e9fd82a8f5b7b9bd7..8c9e8bfb4e828d044b236a11c0890cb4f0161050 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js -@@ -740,6 +740,8 @@ function packageImportsResolve(name, base, conditions) { +@@ -741,6 +741,8 @@ function packageImportsResolve(name, base, conditions) { throw importNotDefined(name, packageJSONUrl, base); } @@ -60,7 +60,7 @@ index 06a34c11254a2fedd2ea59c4057bfb30c31082a6..66ecfbcdd4fb2c9986e2d4619a381337 /** * Returns the package type for a given URL. * @param {URL} url - The URL to get the package type for. -@@ -800,6 +802,11 @@ function packageResolve(specifier, base, conditions) { +@@ -801,6 +803,11 @@ function packageResolve(specifier, base, conditions) { return new URL('node:' + specifier); } @@ -73,10 +73,10 @@ index 06a34c11254a2fedd2ea59c4057bfb30c31082a6..66ecfbcdd4fb2c9986e2d4619a381337 parsePackageName(specifier, base); diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index 9976b819f266c682631f41522af114b660d7c20c..e5fea28126b1b810cd3e1e5a13c0fdc97b6b71f5 100644 +index ca547699d00ed125fd3b9d383d67b9606f89d199..11d64bfd66259a5c5cf089de713af35ec9cde2aa 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js -@@ -291,7 +291,7 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) { +@@ -301,7 +301,7 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) { const { exportNames, module } = cjsPreparseModuleExports(filename, source); cjsCache.set(url, module); @@ -85,7 +85,7 @@ index 9976b819f266c682631f41522af114b660d7c20c..e5fea28126b1b810cd3e1e5a13c0fdc9 [...exportNames] : ['default', ...exportNames]; if (isMain) { -@@ -313,8 +313,8 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) { +@@ -323,8 +323,8 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) { ({ exports } = module); } for (const exportName of exportNames) { @@ -96,7 +96,7 @@ index 9976b819f266c682631f41522af114b660d7c20c..e5fea28126b1b810cd3e1e5a13c0fdc9 continue; } // We might trigger a getter -> dont fail. -@@ -339,6 +339,10 @@ translators.set('require-commonjs', (url, source, isMain) => { +@@ -349,6 +349,10 @@ translators.set('require-commonjs', (url, source, isMain) => { return createCJSModuleWrap(url, source); }); @@ -108,10 +108,10 @@ index 9976b819f266c682631f41522af114b660d7c20c..e5fea28126b1b810cd3e1e5a13c0fdc9 // 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 a58f96aee7cc424ce18fe647afff8724f8a179a0..ae618cdeac1dfa1fd0ddcceb9edc83e06c59fc4b 100644 +index 428c2f1bec4a8e149b8058406d1393a6690ff31a..979455cb44f5edba6d178a6c36a330d707a2395e 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js -@@ -1389,6 +1389,8 @@ function fileURLToPath(path) { +@@ -1457,6 +1457,8 @@ function fileURLToPath(path) { path = new URL(path); else if (!isURL(path)) throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path); 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 f61b808d5f50..318e1f744545 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 a37a1b01fffb2acc1473e8b32349c86eead4f375..33edf44239a7ec13ebee2f926b1e7f9b8d0b83fe 100644 +index 29826aa2d79586f0ccef65e2735237ffa06b53c1..ed730db22ed1c16041f4d1078f6798d4d2c55443 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -590,6 +590,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) { +@@ -583,6 +583,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) { return env->platform(); } @@ -22,10 +22,10 @@ index a37a1b01fffb2acc1473e8b32349c86eead4f375..33edf44239a7ec13ebee2f926b1e7f9b int thread_pool_size, node::tracing::TracingController* tracing_controller) { diff --git a/src/node.h b/src/node.h -index f2740116a4710be31d8c8d3a03f9ea3925301b31..74a097279d3e5dc3ee6c5e609fd35cf44e5002f5 100644 +index bf3382f4c952ca161a5b31c6d76bc11ff6f2cfa5..dbe6aa42075524f66a8f76bb945255f5195359cd 100644 --- a/src/node.h +++ b/src/node.h -@@ -132,6 +132,7 @@ struct SnapshotData; +@@ -133,6 +133,7 @@ struct SnapshotData; namespace tracing { @@ -33,7 +33,7 @@ index f2740116a4710be31d8c8d3a03f9ea3925301b31..74a097279d3e5dc3ee6c5e609fd35cf4 class TracingController; } -@@ -774,6 +775,8 @@ NODE_EXTERN void GetNodeReport(Environment* env, +@@ -802,6 +803,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 759d19414edb..11a6989ab39e 100644 --- a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch +++ b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch @@ -147,10 +147,10 @@ index 6e5bbe07d0c337b36f3157c2e6404fdc91849fd1..7ec682833213de9054a8c30751436d12 DHPointer dh; { diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc -index 408d6be2a9cfdbcb52af285204c07c40bf74a5a9..9c3244a14bc286d60805bac5719df6595d802768 100644 +index b4447102a8478639a5aa774e583834d79808603f..678be07feb394530b944c1b356265416f2d50742 100644 --- a/src/crypto/crypto_dh.cc +++ b/src/crypto/crypto_dh.cc -@@ -153,13 +153,11 @@ bool DiffieHellman::Init(BignumPointer&& bn_p, int g) { +@@ -154,13 +154,11 @@ bool DiffieHellman::Init(BignumPointer&& bn_p, int g) { bool DiffieHellman::Init(const char* p, int p_len, int g) { dh_.reset(DH_new()); if (p_len <= 0) { @@ -165,8 +165,8 @@ index 408d6be2a9cfdbcb52af285204c07c40bf74a5a9..9c3244a14bc286d60805bac5719df659 + OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR); return false; } - BIGNUM* bn_p = -@@ -177,21 +175,18 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) { + BignumPointer bn_p( +@@ -176,20 +174,17 @@ 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) { @@ -181,17 +181,16 @@ index 408d6be2a9cfdbcb52af285204c07c40bf74a5a9..9c3244a14bc286d60805bac5719df659 + OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR); return false; } - BIGNUM* bn_g = - BN_bin2bn(reinterpret_cast(g), g_len, nullptr); - if (BN_is_zero(bn_g) || BN_is_one(bn_g)) { - BN_free(bn_g); + BignumPointer bn_g( + BN_bin2bn(reinterpret_cast(g), g_len, nullptr)); + if (BN_is_zero(bn_g.get()) || BN_is_one(bn_g.get())) { - ERR_put_error(ERR_LIB_DH, DH_F_DH_BUILTIN_GENPARAMS, - DH_R_BAD_GENERATOR, __FILE__, __LINE__); + OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR); return false; } - BIGNUM* bn_p = -@@ -218,8 +213,10 @@ typedef BignumPointer (*StandardizedGroupInstantiator)(); + BignumPointer bn_p( +@@ -219,8 +214,10 @@ typedef BignumPointer (*StandardizedGroupInstantiator)(); inline StandardizedGroupInstantiator FindDiffieHellmanGroup(const char* name) { #define V(n, p) \ if (StringEqualNoCase(name, n)) return InstantiateStandardizedGroup

@@ -202,7 +201,7 @@ index 408d6be2a9cfdbcb52af285204c07c40bf74a5a9..9c3244a14bc286d60805bac5719df659 V("modp5", BN_get_rfc3526_prime_1536); V("modp14", BN_get_rfc3526_prime_2048); V("modp15", BN_get_rfc3526_prime_3072); -@@ -558,15 +555,20 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { +@@ -559,15 +556,20 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { return EVPKeyCtxPointer(); } @@ -223,7 +222,7 @@ index 408d6be2a9cfdbcb52af285204c07c40bf74a5a9..9c3244a14bc286d60805bac5719df659 if (!param_ctx || EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 || EVP_PKEY_CTX_set_dh_paramgen_prime_len( -@@ -580,6 +582,9 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { +@@ -581,6 +583,9 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { } key_params = EVPKeyPointer(raw_params); @@ -373,11 +372,33 @@ index 5734d8fdc5505e1586f571c19b840bd56e9c9f1f..3034b114e081e2b32dd5b71653927a41 } } // namespace +diff --git a/src/env.h b/src/env.h +index 994b9573822fd3eb0588e87edaa0e505aa5102fb..bb84f5ab43cb5be42019921e5dc2fc010d7b9018 100644 +--- a/src/env.h ++++ b/src/env.h +@@ -49,7 +49,7 @@ + #include "uv.h" + #include "v8.h" + +-#if HAVE_OPENSSL ++#if HAVE_OPENSSL && OPENSSL_VERSION_MAJOR >= 3 + #include + #endif + +@@ -1032,7 +1032,7 @@ class Environment : public MemoryRetainer { + kExitInfoFieldCount + }; + +-#if HAVE_OPENSSL ++#if HAVE_OPENSSL// && !defined(OPENSSL_IS_BORINGSSL) + #if OPENSSL_VERSION_MAJOR >= 3 + // We declare another alias here to avoid having to include crypto_util.h + using EVPMDPointer = DeleteFnPtr; diff --git a/src/node.cc b/src/node.cc -index 524f80ee69ee5248e045a2b61faf5610c9ba4285..1d77a8b31cb0bfbeeeac594b6e1ac7dd303c902d 100644 +index 10e04ed8a28bd010e4887ad5b9af3886f7b32a53..012dd487e8db232d068bce358ad44b14e78d0fe9 100644 --- a/src/node.cc +++ b/src/node.cc -@@ -1027,7 +1027,8 @@ InitializeOncePerProcessInternal(const std::vector& args, +@@ -1079,7 +1079,8 @@ InitializeOncePerProcessInternal(const std::vector& args, } if (!(flags & ProcessInitializationFlags::kNoInitOpenSSL)) { @@ -387,7 +408,7 @@ index 524f80ee69ee5248e045a2b61faf5610c9ba4285..1d77a8b31cb0bfbeeeac594b6e1ac7dd auto GetOpenSSLErrorString = []() -> std::string { std::string ret; ERR_print_errors_cb( -@@ -1127,13 +1128,13 @@ InitializeOncePerProcessInternal(const std::vector& args, +@@ -1179,13 +1180,13 @@ InitializeOncePerProcessInternal(const std::vector& args, CHECK(crypto::CSPRNG(buffer, length).is_ok()); return true; }); @@ -404,12 +425,12 @@ index 524f80ee69ee5248e045a2b61faf5610c9ba4285..1d77a8b31cb0bfbeeeac594b6e1ac7dd if (!(flags & ProcessInitializationFlags::kNoInitializeNodeV8Platform)) { diff --git a/src/node_metadata.cc b/src/node_metadata.cc -index b88cfb98e75aca426224e19376b3ff4c23b92e53..b66f4e2b5cbd8f36af42f82a8921207302360e39 100644 +index 844c5ac2c2b948b3be35cb3e447717a510a463a6..72a75ee0bf391ea508441f49413f85c5b735b259 100644 --- a/src/node_metadata.cc +++ b/src/node_metadata.cc -@@ -16,7 +16,7 @@ - #include "v8.h" - #include "zlib_version.h" +@@ -21,7 +21,7 @@ + #include + #endif // NODE_BUNDLED_ZLIB -#if HAVE_OPENSSL +#if HAVE_OPENSSL && !defined(OPENSSL_IS_BORINGSSL) @@ -430,7 +451,7 @@ index cf051585e779e2b03bd7b95fe5008b89cc7f8162..9de49c6828468fdf846dcd4ad445390f #if NODE_OPENSSL_HAS_QUIC #include diff --git a/src/node_options.cc b/src/node_options.cc -index 5da6918af8c125259a89ce95bbbbc4fc475c4c69..a3d25cdd52f18e319ae3ac81437c8a0206b18690 100644 +index fa09d4503980e144a0b3b6f15e858fcad6c6f5b2..e46c71ee467ce1390f0e14794f3514196856b424 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -6,7 +6,7 @@ @@ -443,7 +464,7 @@ index 5da6918af8c125259a89ce95bbbbc4fc475c4c69..a3d25cdd52f18e319ae3ac81437c8a02 #endif diff --git a/src/node_options.h b/src/node_options.h -index 312fae8f759c5828d0770ceee845dc4754871436..207468a2177d36894c64cb37aac946af02c82549 100644 +index 293642d79fa168e12a5875e98f9b9e39cca533be..440bb9ebdf72b9883a1f6a997f23e0344d26ae5f 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 b2c21b6e80b4..a625f3a6133a 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 @@ -38,7 +38,7 @@ index 6a15fcae677b3bda58fc85f705862bbcd9feec9d..449131b9af99744c08d62d73f8d124ce const match = RegExpPrototypeExec(DATA_URL_PATTERN, url.pathname); if (!match) { diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js -index 66ecfbcdd4fb2c9986e2d4619a381337839979fe..06d23dac1d0f591893643ed2c32711eb2b5c0675 100644 +index 8c9e8bfb4e828d044b236a11c0890cb4f0161050..30f6abd5d2d3fb7aceaa6191ebd99642e34d9ee4 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -24,7 +24,7 @@ const { @@ -50,7 +50,7 @@ index 66ecfbcdd4fb2c9986e2d4619a381337839979fe..06d23dac1d0f591893643ed2c32711eb const { getOptionValue } = require('internal/options'); // Do not eagerly grab .manifest, it may be in TDZ const policy = getOptionValue('--experimental-policy') ? -@@ -250,7 +250,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) { +@@ -251,7 +251,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) { throw err; } @@ -59,7 +59,7 @@ index 66ecfbcdd4fb2c9986e2d4619a381337839979fe..06d23dac1d0f591893643ed2c32711eb StringPrototypeSlice(path, -1) : path)); // Check for stats.isDirectory() -@@ -266,7 +266,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) { +@@ -267,7 +267,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) { } if (!preserveSymlinks) { @@ -68,7 +68,7 @@ index 66ecfbcdd4fb2c9986e2d4619a381337839979fe..06d23dac1d0f591893643ed2c32711eb [internalFS.realpathCacheKey]: realpathCache, }); const { search, hash } = resolved; -@@ -825,7 +825,7 @@ function packageResolve(specifier, base, conditions) { +@@ -826,7 +826,7 @@ function packageResolve(specifier, base, conditions) { let packageJSONPath = fileURLToPath(packageJSONUrl); let lastPath; do { @@ -78,10 +78,10 @@ index 66ecfbcdd4fb2c9986e2d4619a381337839979fe..06d23dac1d0f591893643ed2c32711eb // Check for !stat.isDirectory() if (stat !== 1) { diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index e5fea28126b1b810cd3e1e5a13c0fdc97b6b71f5..cea066d1073a31573e134d584f1991e7a06b1036 100644 +index 11d64bfd66259a5c5cf089de713af35ec9cde2aa..4831f3678cde9b4edad04922932c8239a7908a04 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js -@@ -33,7 +33,7 @@ function lazyTypes() { +@@ -32,7 +32,7 @@ function lazyTypes() { const { containsModuleSyntax } = internalBinding('contextify'); const { BuiltinModule } = require('internal/bootstrap/realm'); const assert = require('internal/assert'); @@ -90,7 +90,7 @@ index e5fea28126b1b810cd3e1e5a13c0fdc97b6b71f5..cea066d1073a31573e134d584f1991e7 const { dirname, extname, isAbsolute } = require('path'); const { loadBuiltinModule, -@@ -366,7 +366,7 @@ translators.set('commonjs', async function commonjsStrategy(url, source, +@@ -376,7 +376,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 e5fea28126b1b810cd3e1e5a13c0fdc97b6b71f5..cea066d1073a31573e134d584f1991e7 } catch { // Continue regardless of error. } -@@ -435,7 +435,7 @@ function cjsPreparseModuleExports(filename, source) { +@@ -445,7 +445,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_remove_deprecated_errno_constants.patch b/patches/node/fix_remove_deprecated_errno_constants.patch index 7984ff6ecee0..472d54ad9600 100644 --- a/patches/node/fix_remove_deprecated_errno_constants.patch +++ b/patches/node/fix_remove_deprecated_errno_constants.patch @@ -86,10 +86,10 @@ index 149c7c107322919dfeea1dfe89dc223f78b0e979..e4e8dac6b8b5924a7eae83935031e091 NODE_DEFINE_CONSTANT(target, ETIMEDOUT); #endif diff --git a/src/node_errors.cc b/src/node_errors.cc -index 9c4ebbe4502698f023c053a5299aa0c2981a423d..f275d0c2012041540b4fd83df535e4d9fb41edc5 100644 +index 7ef6ea7f07998f25385c3dee2feb5a68923c4726..56eba10cf791cce2de760f8ed2b34e040676fc8b 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc -@@ -833,10 +833,6 @@ const char* errno_string(int errorno) { +@@ -842,10 +842,6 @@ const char* errno_string(int errorno) { ERRNO_CASE(ENOBUFS); #endif @@ -100,7 +100,7 @@ index 9c4ebbe4502698f023c053a5299aa0c2981a423d..f275d0c2012041540b4fd83df535e4d9 #ifdef ENODEV ERRNO_CASE(ENODEV); #endif -@@ -875,14 +871,6 @@ const char* errno_string(int errorno) { +@@ -884,14 +880,6 @@ const char* errno_string(int errorno) { ERRNO_CASE(ENOSPC); #endif @@ -115,7 +115,7 @@ index 9c4ebbe4502698f023c053a5299aa0c2981a423d..f275d0c2012041540b4fd83df535e4d9 #ifdef ENOSYS ERRNO_CASE(ENOSYS); #endif -@@ -965,10 +953,6 @@ const char* errno_string(int errorno) { +@@ -974,10 +962,6 @@ const char* errno_string(int errorno) { ERRNO_CASE(ESTALE); #endif 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 ef4ff1250ea1..8f28089f2b98 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 @@ -15,7 +15,7 @@ to recognize asar files. This reverts commit 9cf2e1f55b8446a7cde23699d00a3be73aa0c8f1. diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js -index 06d23dac1d0f591893643ed2c32711eb2b5c0675..585437ce6a5382cd8657e02e4f3bcefc92206d7b 100644 +index 30f6abd5d2d3fb7aceaa6191ebd99642e34d9ee4..cd5f59a5c27afd74f68c920a6ab5b8bc7992458c 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -36,10 +36,9 @@ const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); @@ -24,13 +24,13 @@ index 06d23dac1d0f591893643ed2c32711eb2b5c0675..585437ce6a5382cd8657e02e4f3bcefc const inputTypeFlag = getOptionValue('--input-type'); -const { URL, pathToFileURL, fileURLToPath, isURL } = require('internal/url'); +const { URL, pathToFileURL, fileURLToPath, isURL, toPathIfFileURL } = require('internal/url'); - const { getCWDURL } = require('internal/util'); + const { getCWDURL, setOwnProperty } = require('internal/util'); const { canParse: URLCanParse } = internalBinding('url'); -const { legacyMainResolve: FSLegacyMainResolve } = internalBinding('fs'); const { ERR_INPUT_TYPE_NOT_ALLOWED, ERR_INVALID_ARG_TYPE, -@@ -58,7 +57,7 @@ const { Module: CJSModule } = require('internal/modules/cjs/loader'); +@@ -59,7 +58,7 @@ const { Module: CJSModule } = require('internal/modules/cjs/loader'); const { getPackageScopeConfig } = require('internal/modules/esm/package_config'); const { getConditionsSet } = require('internal/modules/esm/utils'); const packageJsonReader = require('internal/modules/package_json_reader'); @@ -39,7 +39,7 @@ index 06d23dac1d0f591893643ed2c32711eb2b5c0675..585437ce6a5382cd8657e02e4f3bcefc /** * @typedef {import('internal/modules/esm/package_config.js').PackageConfig} PackageConfig -@@ -161,34 +160,13 @@ function emitLegacyIndexDeprecation(url, packageJSONUrl, base, main) { +@@ -162,34 +161,13 @@ function emitLegacyIndexDeprecation(url, packageJSONUrl, base, main) { const realpathCache = new SafeMap(); @@ -81,7 +81,7 @@ index 06d23dac1d0f591893643ed2c32711eb2b5c0675..585437ce6a5382cd8657e02e4f3bcefc /** * Legacy CommonJS main resolution: -@@ -203,22 +181,44 @@ const legacyMainResolveExtensionsIndexes = { +@@ -204,22 +182,44 @@ const legacyMainResolveExtensionsIndexes = { * @returns {URL} */ function legacyMainResolve(packageJSONUrl, packageConfig, base) { @@ -142,7 +142,7 @@ index 06d23dac1d0f591893643ed2c32711eb2b5c0675..585437ce6a5382cd8657e02e4f3bcefc const encodedSepRegEx = /%2F|%5C/i; diff --git a/src/node_file.cc b/src/node_file.cc -index f3d8c35d4963d84aef1cb2e15627a959215b8ab2..5b42f671f7a8f1814e086cd9855fff7edaa87851 100644 +index 1a14b30e00778b6bdb8b75a380e92b7140b18595..9e4be8909311634c49ffac7cc6d32ecf5cf25108 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -19,14 +19,11 @@ @@ -160,7 +160,7 @@ index f3d8c35d4963d84aef1cb2e15627a959215b8ab2..5b42f671f7a8f1814e086cd9855fff7e #include "node_process-inl.h" #include "node_stat_watcher.h" #include "node_url.h" -@@ -2971,134 +2968,6 @@ constexpr std::array legacy_main_extensions = { +@@ -2979,134 +2976,6 @@ constexpr std::array legacy_main_extensions = { } // namespace @@ -295,7 +295,7 @@ index f3d8c35d4963d84aef1cb2e15627a959215b8ab2..5b42f671f7a8f1814e086cd9855fff7e void BindingData::MemoryInfo(MemoryTracker* tracker) const { tracker->TrackField("stats_field_array", stats_field_array); tracker->TrackField("stats_field_bigint_array", stats_field_bigint_array); -@@ -3198,19 +3067,6 @@ InternalFieldInfoBase* BindingData::Serialize(int index) { +@@ -3206,19 +3075,6 @@ InternalFieldInfoBase* BindingData::Serialize(int index) { return info; } @@ -315,7 +315,7 @@ index f3d8c35d4963d84aef1cb2e15627a959215b8ab2..5b42f671f7a8f1814e086cd9855fff7e static void CreatePerIsolateProperties(IsolateData* isolate_data, Local target) { Isolate* isolate = isolate_data->isolate(); -@@ -3265,7 +3121,6 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data, +@@ -3273,7 +3129,6 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data, SetMethod(isolate, target, "mkdtemp", Mkdtemp); StatWatcher::CreatePerIsolateProperties(isolate_data, target); @@ -323,7 +323,7 @@ index f3d8c35d4963d84aef1cb2e15627a959215b8ab2..5b42f671f7a8f1814e086cd9855fff7e target->Set( FIXED_ONE_BYTE_STRING(isolate, "kFsStatsFieldsNumber"), -@@ -3338,7 +3193,6 @@ BindingData* FSReqBase::binding_data() { +@@ -3346,7 +3201,6 @@ BindingData* FSReqBase::binding_data() { void RegisterExternalReferences(ExternalReferenceRegistry* registry) { registry->Register(Access); StatWatcher::RegisterExternalReferences(registry); diff --git a/patches/node/fix_serdes_test.patch b/patches/node/fix_serdes_test.patch index a49ad55630c3..ac1699e76a83 100644 --- a/patches/node/fix_serdes_test.patch +++ b/patches/node/fix_serdes_test.patch @@ -6,10 +6,10 @@ Subject: fix serdes test The V8 wire format version changed. diff --git a/test/parallel/test-v8-serdes.js b/test/parallel/test-v8-serdes.js -index 1b6638ac1a90bdcec618b6c7b2a51c21fe6b548e..5ce5668925f0defb685d77063212f42eb524b3ad 100644 +index 296e076a9f760d94293fe4310d6f3a081e3e59f4..be6deaf463977cc65e9f135008c3ce2b2919e22f 100644 --- a/test/parallel/test-v8-serdes.js +++ b/test/parallel/test-v8-serdes.js -@@ -164,11 +164,11 @@ const hostObject = new (internalBinding('js_stream').JSStream)(); +@@ -163,11 +163,11 @@ const hostObject = new (internalBinding('js_stream').JSStream)(); { // Test that an old serialized value can still be deserialized. @@ -23,7 +23,7 @@ index 1b6638ac1a90bdcec618b6c7b2a51c21fe6b548e..5ce5668925f0defb685d77063212f42e const value = des.readValue(); assert.strictEqual(value, value.foo); -@@ -203,7 +203,7 @@ const hostObject = new (internalBinding('js_stream').JSStream)(); +@@ -202,7 +202,7 @@ const hostObject = new (internalBinding('js_stream').JSStream)(); { // Unaligned Uint16Array read, with padding in the underlying array buffer. let buf = Buffer.alloc(32 + 9); diff --git a/patches/node/fs_fix_wtf-8_decoding_issue.patch b/patches/node/fs_fix_wtf-8_decoding_issue.patch deleted file mode 100644 index 6f433693d087..000000000000 --- a/patches/node/fs_fix_wtf-8_decoding_issue.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Richard Lau -Date: Fri, 1 Mar 2024 19:15:40 +0000 -Subject: fs: fix WTF-8 decoding issue - -Cherry-pick of libuv/libuv@d09441c - -Refs: https://github.com/libuv/libuv/pull/2970 -Fixes: https://github.com/nodejs/node/issues/48673 - -We forgot to mask off the high bits from the first byte, so we ended up -always failing the subsequent range check. - -diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c -index fc209c54f470edaa031009979061cff071cbf66d..4fc13b04bdae5bd9e2627027a10c534c2d9675dc 100644 ---- a/deps/uv/src/win/fs.c -+++ b/deps/uv/src/win/fs.c -@@ -176,9 +176,11 @@ static int32_t fs__decode_wtf8_char(const char** input) { - if ((b4 & 0xC0) != 0x80) - return -1; /* invalid: not a continuation byte */ - code_point = (code_point << 6) | (b4 & 0x3F); -- if (b1 <= 0xF4) -+ if (b1 <= 0xF4) { -+ code_point &= 0x1FFFFF; - if (code_point <= 0x10FFFF) - return code_point; /* four-byte character */ -+ } - - /* code point too large */ - return -1; diff --git a/patches/node/pass_all_globals_through_require.patch b/patches/node/pass_all_globals_through_require.patch index 0145ce648c36..3b41b9d0890c 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 b077ee386bb40ea32208fc6655de88a3449b7eb2..d4b70bab5e89300bfe6305263d556c986380e2e0 100644 +index 2c48ff9512c225eb40cd34b844663e063b3695a9..e384e3e6c4e584132bb6a9831a554502f289133a 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -146,6 +146,13 @@ const { @@ -23,8 +23,8 @@ index b077ee386bb40ea32208fc6655de88a3449b7eb2..d4b70bab5e89300bfe6305263d556c98 const { isProxy, } = require('internal/util/types'); -@@ -1371,10 +1378,12 @@ Module.prototype._compile = function(content, filename) { - if (requireDepth === 0) { statCache = new SafeMap(); } +@@ -1364,10 +1371,12 @@ Module.prototype._compile = function(content, filename) { + setHasStartedUserCJSExecution(); if (inspectorWrapper) { result = inspectorWrapper(compiledWrapper, thisValue, exports, - require, module, filename, dirname); @@ -36,5 +36,5 @@ index b077ee386bb40ea32208fc6655de88a3449b7eb2..d4b70bab5e89300bfe6305263d556c98 + [exports, require, module, filename, + dirname, process, localGlobal, localBuffer]); } - hasLoadedAnyUserCJSModule = true; 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 6584bc3d7a71..320d5394e537 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,7 +7,7 @@ We use this to allow node's 'fs' module to read from ASAR files as if they were a real filesystem. diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js -index 7a773d5208e250abd8b0efb6dde66c45060bbee4..45e38ca0a122e3b1c5d8d59865f9610c19bdbd54 100644 +index 8812c3b35184b2f58f3d1e1a1b4f14b7120325cc..932f5035d7f4e11113420dc095014682778a79a6 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -134,6 +134,10 @@ process.domain = null; @@ -22,10 +22,10 @@ index 7a773d5208e250abd8b0efb6dde66c45060bbee4..45e38ca0a122e3b1c5d8d59865f9610c const binding = internalBinding('builtins'); diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index d4b70bab5e89300bfe6305263d556c986380e2e0..dbbb454c3fc8a7774c1d190713e88862fda50f22 100644 +index e384e3e6c4e584132bb6a9831a554502f289133a..46140285cf6b73c154a067c5f0f0931add5e9275 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -95,7 +95,7 @@ const { containsModuleSyntax } = internalBinding('contextify'); +@@ -100,7 +100,7 @@ const { containsModuleSyntax } = internalBinding('contextify'); const assert = require('internal/assert'); const fs = require('fs'); const path = require('path'); @@ -34,7 +34,7 @@ index d4b70bab5e89300bfe6305263d556c986380e2e0..dbbb454c3fc8a7774c1d190713e88862 const { safeGetenv } = internalBinding('credentials'); const { privateSymbols: { -@@ -195,7 +195,7 @@ function stat(filename) { +@@ -194,7 +194,7 @@ function stat(filename) { const result = statCache.get(filename); if (result !== undefined) { return result; } } diff --git a/patches/node/src_preload_function_for_environment.patch b/patches/node/src_preload_function_for_environment.patch index 783812be759d..f5c1a4665fb0 100644 --- a/patches/node/src_preload_function_for_environment.patch +++ b/patches/node/src_preload_function_for_environment.patch @@ -6,20 +6,20 @@ Subject: src: preload function for Environment Backport https://github.com/nodejs/node/pull/51539 diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js -index eb66f0e37b517a03be20e0829863e7572042c7ed..4d5646b6067a1409df5915cc744bdc38d0191bd9 100644 +index 2fc9e2da8aa920acffc101b2c341a5d9b16fe90a..b4272f01e84d7fec263dcad444d92459743780a8 100644 --- a/lib/internal/process/pre_execution.js +++ b/lib/internal/process/pre_execution.js -@@ -186,6 +186,9 @@ function setupUserModules(forceDefaultLoader = false) { - initializeESMLoader(forceDefaultLoader); - const CJSLoader = require('internal/modules/cjs/loader'); - assert(!CJSLoader.hasLoadedAnyUserCJSModule); +@@ -196,6 +196,9 @@ function setupUserModules(forceDefaultLoader = false) { + } = require('internal/modules/helpers'); + assert(!hasStartedUserCJSExecution()); + assert(!hasStartedUserESMExecution()); + if (getEmbedderOptions().hasEmbedderPreload) { + runEmbedderPreload(); + } // Do not enable preload modules if custom loaders are disabled. // For example, loader workers are responsible for doing this themselves. // And preload modules are not supported in ShadowRealm as well. -@@ -745,6 +748,10 @@ function initializeFrozenIntrinsics() { +@@ -713,6 +716,10 @@ function initializeFrozenIntrinsics() { } } @@ -31,10 +31,10 @@ index eb66f0e37b517a03be20e0829863e7572042c7ed..4d5646b6067a1409df5915cc744bdc38 // For user code, we preload modules if `-r` is passed const preloadModules = getOptionValue('--require'); diff --git a/src/api/environment.cc b/src/api/environment.cc -index 9045de3b17c93c4864a1bb1024b08f7d1ffa83be..e8669ba2a1ede090fea1869c476cac19a2aebbc6 100644 +index 7c2e4430299e0d78539d43070942ea3a585b559c..7741b9358a965231671bce004de581f1c6665c2d 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -556,25 +556,31 @@ NODE_EXTERN std::unique_ptr GetInspectorParentHandle( +@@ -549,25 +549,31 @@ NODE_EXTERN std::unique_ptr GetInspectorParentHandle( #endif } @@ -73,11 +73,11 @@ index 9045de3b17c93c4864a1bb1024b08f7d1ffa83be..e8669ba2a1ede090fea1869c476cac19 Environment* GetCurrentEnvironment(Local context) { diff --git a/src/env-inl.h b/src/env-inl.h -index 564de2990c09a54693686666f9ad66398ff76ab5..cc448abbc650b5abb7f555872fd8c15bc09fd643 100644 +index ac4295f495e240331a183b4a0a22d7437fc85271..63ce35ba68b48a55d8150395304bf86c2bf23aae 100644 --- a/src/env-inl.h +++ b/src/env-inl.h -@@ -438,6 +438,14 @@ inline void Environment::set_embedder_entry_point(StartExecutionCallback&& fn) { - embedder_entry_point_ = std::move(fn); +@@ -430,6 +430,14 @@ inline builtins::BuiltinLoader* Environment::builtin_loader() { + return &builtin_loader_; } +inline const EmbedderPreloadCallback& Environment::embedder_preload() const { @@ -92,31 +92,32 @@ index 564de2990c09a54693686666f9ad66398ff76ab5..cc448abbc650b5abb7f555872fd8c15b async_hooks()->async_id_fields()[AsyncHooks::kAsyncIdCounter] += 1; return async_hooks()->async_id_fields()[AsyncHooks::kAsyncIdCounter]; diff --git a/src/env.h b/src/env.h -index 448075e354c760a2dbd1dd763f40b7a645730250..d6956873b1b7bdf49ed0217587729aaa974ae89f 100644 +index f0a1d5ef2b45d4c27c5660177c9805acee19e5f2..910c69b6d1d17ef25201dbb39d3d074f4f3f011f 100644 --- a/src/env.h +++ b/src/env.h -@@ -985,6 +985,8 @@ class Environment : public MemoryRetainer { +@@ -1003,6 +1003,9 @@ class Environment : public MemoryRetainer { + + #endif // HAVE_INSPECTOR - inline const StartExecutionCallback& embedder_entry_point() const; - inline void set_embedder_entry_point(StartExecutionCallback&& fn); + inline const EmbedderPreloadCallback& embedder_preload() const; + inline void set_embedder_preload(EmbedderPreloadCallback fn); - ++ inline void set_process_exit_handler( std::function&& handler); -@@ -1186,6 +1188,7 @@ class Environment : public MemoryRetainer { + +@@ -1213,6 +1216,7 @@ class Environment : public MemoryRetainer { + std::unique_ptr principal_realm_ = nullptr; builtins::BuiltinLoader builtin_loader_; - StartExecutionCallback embedder_entry_point_; + EmbedderPreloadCallback embedder_preload_; // Used by allocate_managed_buffer() and release_managed_buffer() to keep // track of the BackingStore for a given pointer. diff --git a/src/node.h b/src/node.h -index 36da93a7b41ea450a5f288ec17b61adae46ae178..c65c96342d7d02ddb37565477f67a93ef55a78ba 100644 +index 5ade64874ec08474f05db226cf19a043fa26592e..b3cc7a9f1866111c197b20068275c496fd4aace0 100644 --- a/src/node.h +++ b/src/node.h -@@ -718,12 +718,33 @@ struct StartExecutionCallbackInfo { +@@ -746,12 +746,33 @@ struct StartExecutionCallbackInfo { using StartExecutionCallback = std::function(const StartExecutionCallbackInfo&)>; @@ -153,10 +154,10 @@ index 36da93a7b41ea450a5f288ec17b61adae46ae178..c65c96342d7d02ddb37565477f67a93e // Set a callback that is called when process.exit() is called from JS, diff --git a/src/node_options.cc b/src/node_options.cc -index 48ce3f3b68a94fc35e5ce93a385ddbebb03741b9..39d34e18e483882a71145110962109711a1566e2 100644 +index a02dcca456556a7cbb2a262edc5fa4a3b25297ed..92adb8323abac2c7ab956fe1adf95cfab62bef6a 100644 --- a/src/node_options.cc +++ b/src/node_options.cc -@@ -1290,6 +1290,12 @@ void GetEmbedderOptions(const FunctionCallbackInfo& args) { +@@ -1304,6 +1304,12 @@ void GetEmbedderOptions(const FunctionCallbackInfo& args) { .IsNothing()) return; @@ -170,11 +171,11 @@ index 48ce3f3b68a94fc35e5ce93a385ddbebb03741b9..39d34e18e483882a7114511096210971 } diff --git a/src/node_snapshotable.cc b/src/node_snapshotable.cc -index 562a47ddcc9c8e61590b7b09d84dc08ab4b3653d..431cbe1c2cb77669ceb10602a7b3ef1c2f7e8718 100644 +index 0309aba6bdc24afe0d1fd24e7af6f472910363d7..55a65deeea6e74b77cb5b97da88e37779f336ce2 100644 --- a/src/node_snapshotable.cc +++ b/src/node_snapshotable.cc -@@ -1369,6 +1369,17 @@ static void RunEmbedderEntryPoint(const FunctionCallbackInfo& args) { - } +@@ -1417,6 +1417,17 @@ void SerializeSnapshotableObjects(Realm* realm, + }); } +void RunEmbedderPreload(const FunctionCallbackInfo& args) { @@ -191,27 +192,27 @@ index 562a47ddcc9c8e61590b7b09d84dc08ab4b3653d..431cbe1c2cb77669ceb10602a7b3ef1c void CompileSerializeMain(const FunctionCallbackInfo& args) { CHECK(args[0]->IsString()); Local filename = args[0].As(); -@@ -1493,6 +1504,7 @@ void CreatePerIsolateProperties(IsolateData* isolate_data, +@@ -1540,6 +1551,7 @@ void CreatePerContextProperties(Local target, + void CreatePerIsolateProperties(IsolateData* isolate_data, Local target) { Isolate* isolate = isolate_data->isolate(); - SetMethod(isolate, target, "runEmbedderEntryPoint", RunEmbedderEntryPoint); + SetMethod(isolate, target, "runEmbedderPreload", RunEmbedderPreload); SetMethod(isolate, target, "compileSerializeMain", CompileSerializeMain); SetMethod(isolate, target, "setSerializeCallback", SetSerializeCallback); SetMethod(isolate, target, "setDeserializeCallback", SetDeserializeCallback); -@@ -1506,6 +1518,7 @@ void CreatePerIsolateProperties(IsolateData* isolate_data, +@@ -1552,6 +1564,7 @@ void CreatePerIsolateProperties(IsolateData* isolate_data, + } void RegisterExternalReferences(ExternalReferenceRegistry* registry) { - registry->Register(RunEmbedderEntryPoint); + registry->Register(RunEmbedderPreload); registry->Register(CompileSerializeMain); registry->Register(SetSerializeCallback); registry->Register(SetDeserializeCallback); diff --git a/src/node_worker.cc b/src/node_worker.cc -index 900674bbe4c90e9aeb2013c06c9979864b06dcd5..52d7473b05ccb49e5fc915224b6d2972a14191da 100644 +index 8b45c0265befaf68af07622d220ebdf96dc94ac4..196eb3bccaee87b52a46b693a061864ae6a5e3b9 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc -@@ -63,6 +63,7 @@ Worker::Worker(Environment* env, +@@ -62,6 +62,7 @@ Worker::Worker(Environment* env, thread_id_(AllocateEnvironmentThreadId()), name_(name), env_vars_(env_vars), @@ -219,7 +220,7 @@ index 900674bbe4c90e9aeb2013c06c9979864b06dcd5..52d7473b05ccb49e5fc915224b6d2972 snapshot_data_(snapshot_data) { Debug(this, "Creating new worker instance with thread id %llu", thread_id_.id); -@@ -381,8 +382,12 @@ void Worker::Run() { +@@ -386,8 +387,12 @@ void Worker::Run() { } Debug(this, "Created message port for worker %llu", thread_id_.id); @@ -246,10 +247,10 @@ index 531e2b5287010f9206ab4fd7f4dd0f3dec9fe55c..07fd7b460654e169e8b6822474dc3cc7 // A raw flag that is used by creator and worker threads to // sync up on pre-mature termination of worker - while in the diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc -index 2e747c7be58922897abd0424b797f3f12a89ada1..fcffaca89cf5aa24be6e539bfb4d9d6df690a709 100644 +index 9b8124081542876ce7245e4aede6810e9bf0e2eb..64e38c83006a004ebc3519a5e9f8b04263244514 100644 --- a/test/cctest/test_environment.cc +++ b/test/cctest/test_environment.cc -@@ -773,3 +773,31 @@ TEST_F(EnvironmentTest, RequestInterruptAtExit) { +@@ -778,3 +778,31 @@ TEST_F(EnvironmentTest, RequestInterruptAtExit) { context->Exit(); } diff --git a/patches/node/src_update_default_v8_platform_to_override_functions_with_location.patch b/patches/node/src_update_default_v8_platform_to_override_functions_with_location.patch index 2b73dd2b1627..8d576cc65756 100644 --- a/patches/node/src_update_default_v8_platform_to_override_functions_with_location.patch +++ b/patches/node/src_update_default_v8_platform_to_override_functions_with_location.patch @@ -9,10 +9,10 @@ Xref: https://chromium-review.googlesource.com/c/v8/v8/+/4336198 Backported from https://github.com/nodejs/node-v8/commit/f66b996030e94a7e4874820a53475338e1df4fe3 diff --git a/src/node_platform.cc b/src/node_platform.cc -index 927fdddb8d9a1a75263890623d05ea1df2bfee14..291e386ccae0d2f33125c221b09f4259575184ac 100644 +index 97cf6cb840bab5016e485b0dd90b3e4e1d8686c9..00ca9757bc4d0cdeb03a3f32be3ef19077cb7969 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc -@@ -496,17 +496,22 @@ bool PerIsolatePlatformData::FlushForegroundTasksInternal() { +@@ -501,17 +501,22 @@ bool PerIsolatePlatformData::FlushForegroundTasksInternal() { return did_work; } @@ -39,7 +39,7 @@ index 927fdddb8d9a1a75263890623d05ea1df2bfee14..291e386ccae0d2f33125c221b09f4259 IsolatePlatformDelegate* NodePlatform::ForIsolate(Isolate* isolate) { Mutex::ScopedLock lock(per_isolate_mutex_); auto data = per_isolate_[isolate]; -@@ -528,8 +533,10 @@ bool NodePlatform::FlushForegroundTasks(Isolate* isolate) { +@@ -533,8 +538,10 @@ bool NodePlatform::FlushForegroundTasks(Isolate* isolate) { return per_isolate->FlushForegroundTasksInternal(); } diff --git a/patches/node/support_v8_sandboxed_pointers.patch b/patches/node/support_v8_sandboxed_pointers.patch index c8ccc9901374..caf08b705e10 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 33edf44239a7ec13ebee2f926b1e7f9b8d0b83fe..11f8b8dea7bf4119c2d99ee451e3f1bc7bde8902 100644 +index ed730db22ed1c16041f4d1078f6798d4d2c55443..a9c7b009a74fab07afafa72e5f883bee88cf492a 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -101,6 +101,14 @@ MaybeLocal PrepareStackTraceCallback(Local context, @@ -105,7 +105,7 @@ index 3034b114e081e2b32dd5b71653927a41af7d48df..49b0175c219d75dd3a038687f353b242 void SecureHeapUsed(const FunctionCallbackInfo& args) { #ifndef OPENSSL_IS_BORINGSSL diff --git a/src/crypto/crypto_util.h b/src/crypto/crypto_util.h -index 1ce5f35a70a7c855796cc96d4201cc996907cf8f..be700c953d55b35bd2fee7fd872efd9ed2600c63 100644 +index 0ae2946e5e5884d6d095c039a3b4dc537e0f29a2..8c06e81de3ae93d82bf7eaf1bada77164a130695 100644 --- a/src/crypto/crypto_util.h +++ b/src/crypto/crypto_util.h @@ -280,7 +280,7 @@ class ByteSource { @@ -131,10 +131,10 @@ index d45325954d980724f80d49298bbe837197237a9b..ccea18080142bd9cba3765dbbec61c2a return ret; diff --git a/src/node_internals.h b/src/node_internals.h -index 9a96e042fc5cda18beb13b89965a6267fba3e0a6..bd210db0b6ad12075e8ced8b321da38752b3d050 100644 +index eeb0fac3fa1aa90cef6711efbafd915dd9c53d35..90b50f0c778e0b5d2c5df2e59f599402281d6046 100644 --- a/src/node_internals.h +++ b/src/node_internals.h -@@ -112,7 +112,9 @@ v8::Maybe InitializePrimordials(v8::Local context); +@@ -114,7 +114,9 @@ v8::Maybe InitializePrimordials(v8::Local context); class NodeArrayBufferAllocator : public ArrayBufferAllocator { public: @@ -145,7 +145,7 @@ index 9a96e042fc5cda18beb13b89965a6267fba3e0a6..bd210db0b6ad12075e8ced8b321da387 void* Allocate(size_t size) override; // Defined in src/node.cc void* AllocateUninitialized(size_t size) override; -@@ -131,7 +133,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator { +@@ -133,7 +135,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator { } private: 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 deaf847d3f20..29938d31ded4 100644 --- a/patches/node/test_formally_mark_some_tests_as_flaky.patch +++ b/patches/node/test_formally_mark_some_tests_as_flaky.patch @@ -7,13 +7,16 @@ 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 4c29730e78a07f5fa247900ae1bfbc9cb3bfdd0a..d19fb4a1f0e6a1efaff05e8faf638cff7e0c2255 100644 +index 012331287739c59ff4e28b8310733acecac57350..b4551a764e5162171a9f22c47d13398d2d039724 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status -@@ -8,6 +8,13 @@ prefix parallel - # https://github.com/nodejs/node/pull/50327 - # Currently there's no reliable way to test it. - test-diagnostics-channel-memory-leak: SKIP +@@ -5,6 +5,16 @@ prefix parallel + # sample-test : PASS,FLAKY + + [true] # This section applies to all platforms ++# https://github.com/nodejs/node/pull/50327 ++# Currently there's no reliable way to test it. ++test-diagnostics-channel-memory-leak: SKIP +test-inspector-multisession-ws: PASS, FLAKY +test-heapsnapshot-near-heap-limit-by-api-in-worker: PASS, FLAKY +test-heapsnapshot-near-heap-limit-worker: PASS, FLAKY @@ -23,9 +26,9 @@ index 4c29730e78a07f5fa247900ae1bfbc9cb3bfdd0a..d19fb4a1f0e6a1efaff05e8faf638cff +test-debugger-random-port-with-inspect-port: PASS, FLAKY [$system==win32] - # https://github.com/nodejs/node/issues/41206 + diff --git a/test/sequential/sequential.status b/test/sequential/sequential.status -index a5e2d38ff31aa8b90f3b99783b16cec086b4f30e..b8afe3d88b5af4756663f45fad81105e9b7f0e7e 100644 +index ccab879b6e5fcdcc0d3a4b790b97db94d92f1a59..11339325697ae98f6996101163679590451c0b81 100644 --- a/test/sequential/sequential.status +++ b/test/sequential/sequential.status @@ -7,6 +7,18 @@ prefix sequential diff --git a/script/node-disabled-tests.json b/script/node-disabled-tests.json index b05bff18e066..2d255f1b2350 100644 --- a/script/node-disabled-tests.json +++ b/script/node-disabled-tests.json @@ -17,10 +17,11 @@ "parallel/test-crypto-keygen", "parallel/test-crypto-keygen-deprecation", "parallel/test-crypto-rsa-dsa-revert", - "parallel/test-crypto-rsa-dsa.js", + "parallel/test-crypto-rsa-dsa", "parallel/test-crypto-padding-aes256", "parallel/test-crypto-secure-heap", "parallel/test-dgram-send-cb-quelches-error", + "parallel/test-domain-error-types", "parallel/test-fs-utimes-y2K38", "parallel/test-http2-clean-output", "parallel/test-http2-https-fallback", @@ -45,6 +46,7 @@ "parallel/test-snapshot-cjs-main", "parallel/test-snapshot-cwd", "parallel/test-snapshot-console", + "parallel/test-snapshot-config.", "parallel/test-snapshot-dns-lookup-localhost", "parallel/test-snapshot-dns-lookup-localhost-promise", "parallel/test-snapshot-dns-resolve-localhost", diff --git a/shell/browser/javascript_environment.cc b/shell/browser/javascript_environment.cc index 6efd69abc33b..f91ac8a38984 100644 --- a/shell/browser/javascript_environment.cc +++ b/shell/browser/javascript_environment.cc @@ -120,7 +120,6 @@ JavascriptEnvironment::JavascriptEnvironment(uv_loop_t* event_loop, JavascriptEnvironment::~JavascriptEnvironment() { DCHECK_NE(platform_, nullptr); - platform_->DrainTasks(isolate_); { v8::HandleScope scope(isolate_); diff --git a/shell/renderer/electron_renderer_client.cc b/shell/renderer/electron_renderer_client.cc index 1e8dc4a6b03c..228ce6839ceb 100644 --- a/shell/renderer/electron_renderer_client.cc +++ b/shell/renderer/electron_renderer_client.cc @@ -110,6 +110,21 @@ void ElectronRendererClient::DidCreateScriptContext( base::BindRepeating(&ElectronRendererClient::UndeferLoad, base::Unretained(this), render_frame)); + v8::Local global = renderer_context->Global(); + v8::MaybeLocal fetch = + global->Get(renderer_context, gin::StringToV8(env->isolate(), "fetch")); + + // We need to use the Blink implementation of fetch in the renderer process + // Node.js deletes the global fetch function when their fetch implementation + // is disabled, so we need to save and re-add it after the Node.js environment + // is loaded. See corresponding change in node/init.ts. + if (!fetch.IsEmpty()) { + global + ->Set(renderer_context, gin::StringToV8(env->isolate(), "blinkFetch"), + fetch.ToLocalChecked()) + .Check(); + } + // If we have disabled the site instance overrides we should prevent loading // any non-context aware native module. env->options()->force_context_aware = true; diff --git a/shell/renderer/web_worker_observer.cc b/shell/renderer/web_worker_observer.cc index 6adb042bb7e1..0faf53b1c583 100644 --- a/shell/renderer/web_worker_observer.cc +++ b/shell/renderer/web_worker_observer.cc @@ -66,12 +66,26 @@ void WebWorkerObserver::WorkerScriptReadyForEvaluation( std::shared_ptr env = node_bindings_->CreateEnvironment(worker_context, nullptr); + v8::Local global = worker_context->Global(); + v8::Local fetch_string = gin::StringToV8(env->isolate(), "fetch"); + v8::MaybeLocal fetch = global->Get(worker_context, fetch_string); + // Add Electron extended APIs. electron_bindings_->BindTo(env->isolate(), env->process_object()); // Load everything. node_bindings_->LoadEnvironment(env.get()); + // We need to use the Blink implementation of fetch in WebWorker process + // Node.js deletes the global fetch function when their fetch implementation + // is disabled, so we need to save and re-add it after the Node.js environment + // is loaded. + if (!fetch.IsEmpty()) { + worker_context->Global() + ->Set(worker_context, fetch_string, fetch.ToLocalChecked()) + .Check(); + } + // Make uv loop being wrapped by window context. node_bindings_->set_uv_env(env.get());