From 946ab5f1d76a30c7e2db0504a66eb4bf0ed5c323 Mon Sep 17 00:00:00 2001 From: Keeley Hammond Date: Wed, 13 Nov 2024 06:34:30 -0800 Subject: [PATCH] build: reland bump Node.js to v22.9.0 (#44597) Co-authored-by: Shelley Vohr --- .../pipeline-segment-electron-test.yml | 2 +- BUILD.gn | 10 +- DEPS | 2 +- docs/tutorial/multithreading.md | 2 +- lib/node/asar-fs-wrapper.ts | 21 + npm/package.json | 2 +- package.json | 2 +- patches/chromium/.patches | 1 + ...ld_allow_electron_to_use_exec_script.patch | 23 +- .../chromium/build_disable_thin_lto_mac.patch | 25 + patches/config.json | 3 +- patches/node/.patches | 20 +- patches/node/build_add_gn_build_files.patch | 1807 +++-------------- .../build_compile_with_c_20_support.patch | 25 +- patches/node/build_enable_perfetto.patch | 108 +- ...compilation_fails_if_not_using_a_new.patch | 16 +- ...f_original-fs_and_custom_embedder_js.patch | 4 +- ...e_clang_as_default_compiler_on_macos.patch | 2 +- ...calls_to_recently_deprecated_v8_apis.patch | 182 -- ...t_to_context_aware_module_prevention.patch | 4 +- ...de_entrypoint_to_be_a_builtin_module.patch | 8 +- ...deprecation_ftbfs_in_simdjson_header.patch | 60 + ...e_expose_importmoduledynamically_and.patch | 30 +- ...ve_--no-harmony-atomics_related_code.patch | 52 - ..._remove_use_of_deprecated_kmaxlength.patch | 35 - ..._node_tests_set_electron_run_as_node.patch | 76 - .../node/cli_remove_deprecated_v8_flag.patch | 10 +- .../deprecate_vector_v8_local_in_v8.patch | 25 - ...enable_crashpad_linux_node_processes.patch | 8 +- ...m_drop_support_for_import_assertions.patch | 53 - .../expose_get_builtin_module_function.patch | 8 +- ...o_change_option_to_uv_loop_configure.patch | 28 +- ...xtra-semi_errors_in_nghttp2_helper_h.patch | 60 + ...createexternalizablestring_v8_global.patch | 23 - ...bugger_tests_for_upstream_v8_changes.patch | 82 - ..._values_for_variables_in_common_gypi.patch | 2 +- .../fix_add_property_query_interceptors.patch | 574 ------ ..._and_trusted_lo_space_to_the_v8_heap.patch | 23 - ...ssert_module_in_the_renderer_process.patch | 6 +- ...bedder_exceptions_before_entering_v8.patch | 63 +- .../fix_crypto_tests_to_run_with_bssl.patch | 445 +--- ..._do_not_resolve_electron_entrypoints.patch | 16 +- ...n_electron_module_via_the_esm_loader.patch | 56 +- ...se_tracing_tracingcontroller_instead.patch | 6 +- ...ingssl_and_openssl_incompatibilities.patch | 404 +++- ...in_esm_loaders_to_apply_asar_patches.patch | 54 +- ...ix_remove_deprecated_errno_constants.patch | 10 +- ...rmony-import-assertions_from_node_cc.patch | 25 + ...g_c_calls_of_esm_legacy_main_resolve.patch | 71 +- ...g_-wdeprecated-declarations_in_libuv.patch | 4 +- .../pass_all_globals_through_require.patch | 6 +- ...dder_overriding_of_internal_fs_calls.patch | 46 +- ...ec_add_iterator_to_global_intrinsics.patch | 19 - .../src_do_not_use_deprecated_v8_api.patch | 118 -- ..._on_wrapper-descriptor-based_cppheap.patch | 20 +- ...ted_fields_of_fastapicallbackoptions.patch | 44 + ..._to_override_functions_with_location.patch | 87 - ...new_v8_api_to_define_stream_accessor.patch | 153 -- ...rted_api_to_get_stalled_tla_messages.patch | 27 - .../node/support_v8_sandboxed_pointers.patch | 99 +- ...st_formally_mark_some_tests_as_flaky.patch | 2 +- ..._test-node-output-v8-warning_generic.patch | 6 +- ...able_transform-stream-members_any_js.patch | 23 - ...est_update_v8-stats_test_for_v8_12_6.patch | 4 +- ..._fix_race_detecting_esrch_in_uv_kill.patch | 70 + ...assert_after_spawning_store_app_4152.patch | 85 - patches/sqlite/.patches | 1 + ...orts_to_avoid_conflicts_with_node_js.patch | 31 + script/node-disabled-tests.json | 4 + shell/app/node_main.cc | 2 +- .../file_system_access_permission_context.cc | 6 +- shell/common/node_bindings.cc | 2 +- spec/api-utility-process-spec.ts | 3 +- .../native-addon/external-ab/binding.cc | 1 - spec/lib/events-helpers.ts | 1 + yarn.lock | 24 +- 76 files changed, 1465 insertions(+), 3997 deletions(-) create mode 100644 patches/chromium/build_disable_thin_lto_mac.patch delete mode 100644 patches/node/cherry-pick_src_remove_calls_to_recently_deprecated_v8_apis.patch create mode 100644 patches/node/chore_disable_deprecation_ftbfs_in_simdjson_header.patch delete mode 100644 patches/node/chore_remove_--no-harmony-atomics_related_code.patch delete mode 100644 patches/node/chore_remove_use_of_deprecated_kmaxlength.patch delete mode 100644 patches/node/deprecate_vector_v8_local_in_v8.patch delete mode 100644 patches/node/esm_drop_support_for_import_assertions.patch create mode 100644 patches/node/fix_-wextra-semi_errors_in_nghttp2_helper_h.patch delete mode 100644 patches/node/fix_account_for_createexternalizablestring_v8_global.patch delete mode 100644 patches/node/fix_adapt_debugger_tests_for_upstream_v8_changes.patch delete mode 100644 patches/node/fix_add_property_query_interceptors.patch delete mode 100644 patches/node/fix_add_trusted_space_and_trusted_lo_space_to_the_v8_heap.patch create mode 100644 patches/node/fix_remove_harmony-import-assertions_from_node_cc.patch delete mode 100644 patches/node/spec_add_iterator_to_global_intrinsics.patch delete mode 100644 patches/node/src_do_not_use_deprecated_v8_api.patch delete mode 100644 patches/node/src_update_default_v8_platform_to_override_functions_with_location.patch delete mode 100644 patches/node/src_use_new_v8_api_to_define_stream_accessor.patch delete mode 100644 patches/node/src_use_supported_api_to_get_stalled_tla_messages.patch delete mode 100644 patches/node/test_match_wpt_streams_transferable_transform-stream-members_any_js.patch create mode 100644 patches/node/win_almost_fix_race_detecting_esrch_in_uv_kill.patch delete mode 100644 patches/node/win_process_avoid_assert_after_spawning_store_app_4152.patch create mode 100644 patches/sqlite/.patches create mode 100644 patches/sqlite/fix_rename_sqlite_win32_exports_to_avoid_conflicts_with_node_js.patch diff --git a/.github/workflows/pipeline-segment-electron-test.yml b/.github/workflows/pipeline-segment-electron-test.yml index ab850c0e77..5e91be33db 100644 --- a/.github/workflows/pipeline-segment-electron-test.yml +++ b/.github/workflows/pipeline-segment-electron-test.yml @@ -176,7 +176,7 @@ jobs: if [ "${{ inputs.is-asan }}" == "true" ]; then cd .. ASAN_SYMBOLIZE="$PWD/tools/valgrind/asan/asan_symbolize.py --executable-path=$PWD/out/Default/electron" - export ASAN_OPTIONS="symbolize=0 handle_abort=1" + export ASAN_OPTIONS="symbolize=0 handle_abort=1 detect_container_overflow=0" export G_SLICE=always-malloc export NSS_DISABLE_ARENA_FREE_LIST=1 export NSS_DISABLE_UNLOAD=1 diff --git a/BUILD.gn b/BUILD.gn index 91dd30d516..aacd4bde19 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -9,7 +9,7 @@ import("//pdf/features.gni") import("//ppapi/buildflags/buildflags.gni") import("//printing/buildflags/buildflags.gni") import("//testing/test.gni") -import("//third_party/electron_node/electron_node.gni") +import("//third_party/electron_node/node.gni") import("//third_party/ffmpeg/ffmpeg_options.gni") import("//tools/generate_library_loader/generate_library_loader.gni") import("//tools/grit/grit_rule.gni") @@ -408,7 +408,7 @@ action("electron_generate_node_defines") { source_set("electron_lib") { configs += [ "//v8:external_startup_data", - "//third_party/electron_node:node_internals", + "//third_party/electron_node:node_external_config", ] public_configs = [ @@ -483,7 +483,7 @@ source_set("electron_lib") { "//third_party/blink/public:blink_devtools_inspector_resources", "//third_party/blink/public/platform/media", "//third_party/boringssl", - "//third_party/electron_node:node_lib", + "//third_party/electron_node:libnode", "//third_party/inspector_protocol:crdtp", "//third_party/leveldatabase", "//third_party/libyuv", @@ -868,7 +868,7 @@ if (is_mac) { ":electron_framework_resources", ":electron_swiftshader_library", ":electron_xibs", - "//third_party/electron_node:node_lib", + "//third_party/electron_node:libnode", ] if (!is_mas_build) { deps += [ ":electron_crashpad_helper" ] @@ -1192,7 +1192,7 @@ if (is_mac) { "//components/crash/core/app", "//content:sandbox_helper_win", "//electron/buildflags", - "//third_party/electron_node:node_lib", + "//third_party/electron_node:libnode", "//ui/strings", ] diff --git a/DEPS b/DEPS index 6d6df98335..4f89464122 100644 --- a/DEPS +++ b/DEPS @@ -4,7 +4,7 @@ vars = { 'chromium_version': '132.0.6824.0', 'node_version': - 'v20.18.0', + 'v22.9.0', 'nan_version': 'e14bdcd1f72d62bca1d541b66da43130384ec213', 'squirrel.mac_version': diff --git a/docs/tutorial/multithreading.md b/docs/tutorial/multithreading.md index eb2bcc9e47..ab70b88a50 100644 --- a/docs/tutorial/multithreading.md +++ b/docs/tutorial/multithreading.md @@ -42,7 +42,7 @@ safe. The only way to load a native module safely for now, is to make sure the app loads no native modules after the Web Workers get started. -```js @ts-expect-error=[1] +```js process.dlopen = () => { throw new Error('Load native module is not safe') } diff --git a/lib/node/asar-fs-wrapper.ts b/lib/node/asar-fs-wrapper.ts index aebd5b3021..a46b97290f 100644 --- a/lib/node/asar-fs-wrapper.ts +++ b/lib/node/asar-fs-wrapper.ts @@ -841,6 +841,27 @@ export const wrapFsWithAsar = (fs: Record) => { return files; }; + const modBinding = internalBinding('modules'); + const { readPackageJSON } = modBinding; + internalBinding('modules').readPackageJSON = ( + jsonPath: string, + isESM: boolean, + base: undefined | string, + specifier: undefined | string + ) => { + const pathInfo = splitPath(jsonPath); + if (!pathInfo.isAsar) return readPackageJSON(jsonPath, isESM, base, specifier); + const { asarPath, filePath } = pathInfo; + + const archive = getOrCreateArchive(asarPath); + if (!archive) return undefined; + + const realPath = archive.copyFileOut(filePath); + if (!realPath) return undefined; + + return readPackageJSON(realPath, isESM, base, specifier); + }; + const binding = internalBinding('fs'); const { internalModuleReadJSON, kUsePromises } = binding; internalBinding('fs').internalModuleReadJSON = (pathArgument: string) => { diff --git a/npm/package.json b/npm/package.json index 69015766c5..96fd3c3ad0 100644 --- a/npm/package.json +++ b/npm/package.json @@ -9,7 +9,7 @@ }, "dependencies": { "@electron/get": "^2.0.0", - "@types/node": "^20.9.0", + "@types/node": "^22.7.7", "extract-zip": "^2.0.1" }, "engines": { diff --git a/package.json b/package.json index 6b1f040c78..12b3f777d2 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "@octokit/rest": "^20.0.2", "@primer/octicons": "^10.0.0", "@types/minimist": "^1.2.5", - "@types/node": "^20.9.0", + "@types/node": "^22.7.7", "@types/semver": "^7.5.8", "@types/stream-json": "^1.7.7", "@types/temp": "^0.9.4", diff --git a/patches/chromium/.patches b/patches/chromium/.patches index b76c37f09b..00ad9360aa 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -133,3 +133,4 @@ osr_shared_texture_remove_keyed_mutex_on_win_dxgi.patch feat_allow_usage_of_sccontentsharingpicker_on_supported_platforms.patch chore_partial_revert_of.patch fix_software_compositing_infinite_loop.patch +build_disable_thin_lto_mac.patch diff --git a/patches/chromium/build_allow_electron_to_use_exec_script.patch b/patches/chromium/build_allow_electron_to_use_exec_script.patch index c8b4c3a439..ef798e6bf1 100644 --- a/patches/chromium/build_allow_electron_to_use_exec_script.patch +++ b/patches/chromium/build_allow_electron_to_use_exec_script.patch @@ -6,15 +6,34 @@ Subject: build: allow electron to use exec_script This is similar to the //build usecase so we're OK adding ourselves here diff --git a/.gn b/.gn -index 44a11ec90ec9b67cf22b6d529c6843e6b6af12bc..783dd77dcdf92ec32cc6594b739eab9738f3e3ba 100644 +index 44a11ec90ec9b67cf22b6d529c6843e6b6af12bc..3e880eed02ca57db10d734d6a7566e0a977433a5 100644 --- a/.gn +++ b/.gn -@@ -172,4 +172,8 @@ exec_script_whitelist = +@@ -172,4 +172,27 @@ exec_script_whitelist = "//tools/grit/grit_rule.gni", "//tools/gritsettings/BUILD.gn", + + "//electron/BUILD.gn", ++ "//third_party/electron_node/deps/ada/unofficial.gni", + "//third_party/electron_node/deps/base64/BUILD.gn", + "//third_party/electron_node/deps/base64/unofficial.gni", ++ "//third_party/electron_node/node.gni", ++ "//third_party/electron_node/unofficial.gni", ++ "//third_party/electron_node/deps/brotli/unofficial.gni", ++ "//third_party/electron_node/deps/cares/unofficial.gni", ++ "//third_party/electron_node/deps/googletest/unofficial.gni", ++ "//third_party/electron_node/deps/histogram/unofficial.gni", ++ "//third_party/electron_node/deps/llhttp/unofficial.gni", ++ "//third_party/electron_node/deps/nbytes/unofficial.gni", ++ "//third_party/electron_node/deps/ncrypto/unofficial.gni", ++ "//third_party/electron_node/deps/nghttp2/unofficial.gni", ++ "//third_party/electron_node/deps/ngtcp2/unofficial.gni", ++ "//third_party/electron_node/deps/openssl/unofficial.gni", ++ "//third_party/electron_node/deps/simdutf/unofficial.gni", ++ "//third_party/electron_node/deps/simdjson/unofficial.gni", ++ "//third_party/electron_node/deps/sqlite/unofficial.gni", ++ "//third_party/electron_node/deps/uv/unofficial.gni", ++ "//third_party/electron_node/deps/uvwasi/unofficial.gni", ++ "//third_party/electron_node/src/inspector/unofficial.gni", ] diff --git a/patches/chromium/build_disable_thin_lto_mac.patch b/patches/chromium/build_disable_thin_lto_mac.patch new file mode 100644 index 0000000000..2d1a1a7e9e --- /dev/null +++ b/patches/chromium/build_disable_thin_lto_mac.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: VerteDinde +Date: Tue, 12 Nov 2024 21:16:15 -0800 +Subject: build: disable thin_lto on mac + +This patch disables thin lto on mac only. After Node 22 was merged into +main, release builds began failing due to missing symbols, which seem to +be being stripped out by thin lto. + +This patch can (and should) be removed when we can prevent those symbols +from being stripped in the release build. + +diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni +index ac5ce5e5d80facc0bbafe51ced9aba53a8fb0c04..6c457c4e63c4024490b47aaf29dfbbab83bf6f5e 100644 +--- a/build/config/compiler/compiler.gni ++++ b/build/config/compiler/compiler.gni +@@ -86,7 +86,7 @@ declare_args() { + # have the same LLVM revisions as us, making bitcode useless to them. + use_thin_lto = + is_cfi || (is_clang && is_official_build && chrome_pgo_phase != 1 && +- (is_linux || is_win || is_mac || ++ (is_linux || is_win || + (is_ios && use_lld && !is_cronet_build) || + (is_android && target_os != "chromeos") || + (is_chromeos && is_chromeos_device))) diff --git a/patches/config.json b/patches/config.json index 8cf28d8d2b..8d297c0fd3 100644 --- a/patches/config.json +++ b/patches/config.json @@ -11,5 +11,6 @@ { "patch_dir": "src/electron/patches/Mantle", "repo": "src/third_party/squirrel.mac/vendor/Mantle" }, { "patch_dir": "src/electron/patches/ReactiveObjC", "repo": "src/third_party/squirrel.mac/vendor/ReactiveObjC" }, { "patch_dir": "src/electron/patches/webrtc", "repo": "src/third_party/webrtc" }, - { "patch_dir": "src/electron/patches/reclient-configs", "repo": "src/third_party/engflow-reclient-configs" } + { "patch_dir": "src/electron/patches/reclient-configs", "repo": "src/third_party/engflow-reclient-configs" }, + { "patch_dir": "src/electron/patches/sqlite", "repo": "src/third_party/sqlite/src" } ] diff --git a/patches/node/.patches b/patches/node/.patches index abdfda54fa..d8853df516 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -21,37 +21,25 @@ enable_crashpad_linux_node_processes.patch fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch chore_expose_importmoduledynamically_and.patch test_formally_mark_some_tests_as_flaky.patch -fix_adapt_debugger_tests_for_upstream_v8_changes.patch -chore_remove_--no-harmony-atomics_related_code.patch -fix_account_for_createexternalizablestring_v8_global.patch fix_do_not_resolve_electron_entrypoints.patch ci_ensure_node_tests_set_electron_run_as_node.patch fix_assert_module_in_the_renderer_process.patch -fix_add_trusted_space_and_trusted_lo_space_to_the_v8_heap.patch -win_process_avoid_assert_after_spawning_store_app_4152.patch -chore_remove_use_of_deprecated_kmaxlength.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 test_make_test-node-output-v8-warning_generic.patch -test_match_wpt_streams_transferable_transform-stream-members_any_js.patch fix_revert_src_lb_reducing_c_calls_of_esm_legacy_main_resolve.patch -deprecate_vector_v8_local_in_v8.patch fix_remove_deprecated_errno_constants.patch build_enable_perfetto.patch fix_add_source_location_for_v8_task_runner.patch -cherry-pick_src_remove_calls_to_recently_deprecated_v8_apis.patch -src_do_not_use_deprecated_v8_api.patch -src_use_new_v8_api_to_define_stream_accessor.patch src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch test_update_v8-stats_test_for_v8_12_6.patch src_do_not_use_soon-to-be-deprecated_v8_api.patch -fix_add_property_query_interceptors.patch src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch -src_use_supported_api_to_get_stalled_tla_messages.patch build_don_t_redefine_win32_lean_and_mean.patch build_compile_with_c_20_support.patch add_v8_taskpirority_to_foreground_task_runner_signature.patch cli_remove_deprecated_v8_flag.patch build_restore_clang_as_default_compiler_on_macos.patch -esm_drop_support_for_import_assertions.patch +fix_-wextra-semi_errors_in_nghttp2_helper_h.patch +fix_remove_harmony-import-assertions_from_node_cc.patch +win_almost_fix_race_detecting_esrch_in_uv_kill.patch +chore_disable_deprecation_ftbfs_in_simdjson_header.patch diff --git a/patches/node/build_add_gn_build_files.patch b/patches/node/build_add_gn_build_files.patch index 1cb0332f0c..1fc6f58658 100644 --- a/patches/node/build_add_gn_build_files.patch +++ b/patches/node/build_add_gn_build_files.patch @@ -10,1268 +10,58 @@ however those files were cherry-picked from main branch and do not 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..e36168f0a051ca2fa2fc024aadcf5375b860105e 100644 ---- a/BUILD.gn -+++ b/BUILD.gn -@@ -1,14 +1,406 @@ --############################################################################## --# # --# DO NOT EDIT THIS FILE! # --# # --############################################################################## -+import("//v8/gni/v8.gni") -+import("//electron/js2c_toolchain.gni") -+import("electron_node.gni") +diff --git a/deps/ncrypto/ncrypto.h b/deps/ncrypto/ncrypto.h +index 60bfce3ea8999e8e145aaf8cd14f0fdf21ed9c54..661c996889d0a89c1c38658a0933fcf5e3cdc1b9 100644 +--- a/deps/ncrypto/ncrypto.h ++++ b/deps/ncrypto/ncrypto.h +@@ -400,17 +400,21 @@ public: + UNABLE_TO_CHECK_GENERATOR = DH_UNABLE_TO_CHECK_GENERATOR, + NOT_SUITABLE_GENERATOR = DH_NOT_SUITABLE_GENERATOR, + Q_NOT_PRIME = DH_CHECK_Q_NOT_PRIME, ++#ifndef OPENSSL_IS_BORINGSSL + INVALID_Q = DH_CHECK_INVALID_Q_VALUE, + INVALID_J = DH_CHECK_INVALID_J_VALUE, ++#endif + CHECK_FAILED = 512, + }; + CheckResult check(); --# This file is used by GN for building, which is NOT the build system used for --# building official binaries. --# Please modify the gyp files if you are making changes to build system. -+declare_args() { -+ # Enable the V8 inspector protocol for use with node. -+ node_enable_inspector = true - --import("unofficial.gni") -+ # Build node with SSL support. -+ # The variable is called "openssl" for parity with node's GYP build. -+ node_use_openssl = true - --node_gn_build("node") { -+ # Use the specified path to system CA (PEM format) in addition to -+ # the BoringSSL supplied CA store or compiled-in Mozilla CA copy. -+ node_openssl_system_ca_path = "" -+ -+ # Initialize v8 platform during node.js startup. -+ # NB. this must be turned off in Electron, because Electron initializes the -+ # v8 platform itself. -+ node_use_v8_platform = false -+ -+ # Build with DTrace support. -+ node_use_dtrace = false -+ -+ # Build with ETW support. -+ node_use_etw = false -+ -+ # Build JavaScript in lib/ with DCHECK macros. -+ node_debug_lib = false -+ -+ # Custom build tag. -+ node_tag = "" -+ -+ # V8 options to pass, see `node --v8-options` for examples -+ node_v8_options = "" -+ -+ # Provide a custom URL prefix for the `process.release` properties -+ # `sourceUrl` and `headersUrl`. When compiling a release build, this will -+ # default to https://nodejs.org/download/release/') -+ node_release_urlbase = "" -+ -+ # Allows downstream packagers (eg. Linux distributions) to build Electron against system shared libraries. -+ use_system_cares = false -+ use_system_nghttp2 = false -+ use_system_llhttp = false -+ use_system_histogram = false -+} -+ -+if (is_linux) { -+ import("//build/config/linux/pkg_config.gni") -+ if (use_system_cares) { -+ pkg_config("cares") { -+ packages = [ "libcares" ] -+ } -+ } -+ if (use_system_nghttp2) { -+ pkg_config("nghttp2") { -+ packages = [ "libnghttp2" ] -+ } -+ } -+} -+ -+assert(!node_use_dtrace, "node_use_dtrace not supported in GN") -+assert(!node_use_etw, "node_use_etw not supported in GN") -+ -+assert(!node_enable_inspector || node_use_openssl, -+ "node_enable_inspector requires node_use_openssl") -+ -+config("node_internals") { -+ defines = [ "NODE_WANT_INTERNALS=1" ] -+} -+ -+node_files = read_file("filenames.json", "json") -+library_files = node_files.library_files -+fs_files = node_files.fs_files -+original_fs_files = [] -+foreach(file, fs_files) { -+ original_fs_files += [string_replace(string_replace(string_replace(file, "internal/fs/", "internal/original-fs/"), "lib/fs.js", "lib/original-fs.js"), "lib/fs/", "lib/original-fs/")] -+} -+ -+copy("node_js2c_inputs") { -+ sources = library_files -+ outputs = [ -+ "$target_gen_dir/js2c_inputs/{{source_target_relative}}", -+ ] -+} -+ -+action("node_js2c_original_fs") { -+ script = "//electron/script/node/generate_original_fs.py" -+ inputs = fs_files -+ outputs = [] -+ foreach(file, fs_files + original_fs_files) { -+ outputs += ["$target_gen_dir/js2c_inputs/$file"] -+ } -+ -+ args = [rebase_path("$target_gen_dir/js2c_inputs")] + fs_files -+} -+ -+action("node_js2c_exec") { -+ deps = [ -+ "//electron:generate_config_gypi", -+ ":node_js2c_original_fs", -+ ":node_js2c_inputs", -+ ":node_js2c($electron_js2c_toolchain)" -+ ] -+ config_gypi = [ "$root_gen_dir/config.gypi" ] -+ inputs = library_files + get_target_outputs(":node_js2c_original_fs") + config_gypi -+ outputs = [ -+ "$target_gen_dir/node_javascript.cc", -+ ] -+ -+ script = "//electron/build/run-in-dir.py" -+ out_dir = get_label_info(":anything($electron_js2c_toolchain)", "root_out_dir") -+ args = [ rebase_path("$target_gen_dir/js2c_inputs"), rebase_path("$out_dir/node_js2c") ] + -+ rebase_path(outputs) + library_files + fs_files + original_fs_files + rebase_path(config_gypi) -+} -+ -+config("node_features") { -+ defines = [] -+ if (node_enable_inspector) { -+ defines += [ "HAVE_INSPECTOR=1" ] -+ } else { -+ defines += [ "HAVE_INSPECTOR=0" ] -+ } -+ if (node_use_openssl) { -+ defines += [ "HAVE_OPENSSL=1" ] -+ } else { -+ defines += [ "HAVE_OPENSSL=0" ] -+ } -+ if (v8_enable_i18n_support) { -+ defines += [ "NODE_HAVE_I18N_SUPPORT=1" ] -+ } else { -+ defines += [ "NODE_HAVE_I18N_SUPPORT=0" ] -+ } -+ if (node_use_v8_platform) { -+ defines += [ "NODE_USE_V8_PLATFORM=1" ] -+ } else { -+ defines += [ "NODE_USE_V8_PLATFORM=0" ] -+ } -+} -+ -+config("node_lib_config") { -+ include_dirs = [ "src" ] -+ -+ cflags = [ -+ "-Wno-shadow", -+ # FIXME(deepak1556): include paths should be corrected, -+ # refer https://docs.google.com/presentation/d/1oxNHaVjA9Gn_rTzX6HIpJHP7nXRua_0URXxxJ3oYRq0/edit#slide=id.g71ecd450e_2_702 -+ "-Wno-microsoft-include", -+ ] -+ -+ configs = [ ":node_features" ] -+ -+ if (is_debug) { -+ defines = [ "DEBUG" ] -+ } -+} -+ -+config("node_internal_config") { -+ visibility = [ -+ ":*", -+ "src/inspector:*", -+ ] -+ defines = [ -+ "NODE_WANT_INTERNALS=1", -+ "NODE_IMPLEMENTATION", -+ ] -+ if (node_module_version != "") { -+ defines += [ "NODE_EMBEDDER_MODULE_VERSION=" + node_module_version ] -+ } -+ if (is_component_build) { -+ defines += [ -+ "NODE_SHARED_MODE", + enum class CheckPublicKeyResult { + NONE, ++ #ifndef OPENSSL_IS_BORINGSSL + TOO_SMALL = DH_R_CHECK_PUBKEY_TOO_SMALL, + TOO_LARGE = DH_R_CHECK_PUBKEY_TOO_LARGE, + INVALID = DH_R_CHECK_PUBKEY_INVALID, ++ #endif + CHECK_FAILED = 512, + }; + // Check to see if the given public key is suitable for this DH instance. +diff --git a/deps/sqlite/unofficial.gni b/deps/sqlite/unofficial.gni +index ebb3ffcd6d42b4c16b6865a91ccf4428cffe864b..00225afa1fb4205f1e02d9f185aeb97d642b3fd9 100644 +--- a/deps/sqlite/unofficial.gni ++++ b/deps/sqlite/unofficial.gni +@@ -18,8 +18,14 @@ template("sqlite_gn_build") { + forward_variables_from(invoker, "*") + public_configs = [ ":sqlite_config" ] + sources = gypi_values.sqlite_sources ++ cflags_c = [ ++ "-Wno-implicit-fallthrough", ++ "-Wno-unreachable-code-break", ++ "-Wno-unreachable-code-return", ++ "-Wno-unreachable-code", + ] -+ } -+ -+ if (target_cpu == "x86") { -+ node_arch = "ia32" -+ } else { -+ node_arch = target_cpu -+ } -+ defines += [ "NODE_ARCH=\"$node_arch\"" ] -+ -+ if (target_os == "win") { -+ node_platform = "win32" -+ } else if (target_os == "mac") { -+ node_platform = "darwin" -+ } else { -+ node_platform = target_os -+ } -+ defines += [ "NODE_PLATFORM=\"$node_platform\"" ] -+ -+ if (is_win) { -+ defines += [ -+ "NOMINMAX", -+ "_UNICODE=1", -+ ] -+ } else { -+ defines += [ "__POSIX__" ] -+ } -+ -+ if (node_tag != "") { -+ defines += [ "NODE_TAG=\"$node_tag\"" ] -+ } -+ if (node_v8_options != "") { -+ defines += [ "NODE_V8_OPTIONS=\"$node_v8_options\"" ] -+ } -+ if (node_release_urlbase != "") { -+ defines += [ "NODE_RELEASE_URLBASE=\"$node_release_urlbase\"" ] -+ } -+ -+ if (node_use_openssl) { -+ defines += [ -+ "NODE_OPENSSL_SYSTEM_CERT_PATH=\"$node_openssl_system_ca_path\"", -+ "EVP_CTRL_CCM_SET_TAG=EVP_CTRL_GCM_SET_TAG", -+ ] -+ } -+} -+ -+executable("overlapped-checker") { -+ sources = [] -+ if (is_win) { -+ sources += [ "test/overlapped-checker/main_win.c" ] -+ } else { -+ sources += [ "test/overlapped-checker/main_unix.c" ] -+ } -+} -+ -+if (current_toolchain == electron_js2c_toolchain) { -+ executable("node_js2c") { -+ defines = [] -+ sources = [ -+ "tools/js2c.cc", -+ "tools/executable_wrapper.h", -+ "src/embedded_data.cc", -+ "src/embedded_data.h", -+ ] -+ include_dirs = [ "tools", "src" ] -+ deps = [ -+ "deps/simdutf($electron_js2c_toolchain)", -+ "deps/uv($electron_js2c_toolchain)", -+ "//v8" -+ ] -+ -+ if (!is_win) { -+ defines += [ "NODE_JS2C_USE_STRING_LITERALS" ] -+ } -+ if (is_debug) { -+ cflags_cc = [ "-g", "-O0" ] -+ defines += [ "DEBUG" ] -+ } -+ } -+} -+ -+component("node_lib") { -+ deps = [ -+ ":node_js2c_exec", -+ "deps/googletest:gtest", -+ "deps/ada", -+ "deps/base64", -+ "deps/simdutf", -+ "deps/uvwasi", -+ "//third_party/zlib", -+ "//third_party/brotli:dec", -+ "//third_party/brotli:enc", -+ "//v8:v8_libplatform", -+ ] -+ if (use_system_cares) { -+ configs += [ ":cares" ] -+ } else { -+ deps += [ "deps/cares" ] -+ } -+ if (use_system_nghttp2) { -+ configs += [ ":nghttp2" ] -+ } else { -+ deps += [ "deps/nghttp2" ] -+ } -+ public_deps = [ -+ "deps/uv", -+ "//electron:electron_js2c", -+ "//v8", -+ ] -+ configs += [ ":node_internal_config" ] -+ public_configs = [ ":node_lib_config" ] -+ include_dirs = [ -+ "src", -+ "deps/postject" -+ ] -+ libs = [] -+ if (use_system_llhttp) { -+ libs += [ "llhttp" ] -+ } else { -+ deps += [ "deps/llhttp" ] -+ } -+ if (use_system_histogram) { -+ libs += [ "hdr_histogram" ] -+ include_dirs += [ "/usr/include/hdr" ] -+ } else { -+ deps += [ "deps/histogram" ] -+ } -+ frameworks = [] -+ cflags_cc = [ -+ "-Wno-deprecated-declarations", -+ "-Wno-implicit-fallthrough", -+ "-Wno-return-type", -+ "-Wno-sometimes-uninitialized", -+ "-Wno-string-plus-int", -+ "-Wno-unused-function", -+ "-Wno-unused-label", -+ "-Wno-unused-private-field", -+ "-Wno-unused-variable", -+ ] -+ -+ if (v8_enable_i18n_support) { -+ deps += [ "//third_party/icu" ] -+ } -+ -+ sources = node_files.node_sources -+ sources += [ -+ "$root_gen_dir/electron_natives.cc", -+ "$target_gen_dir/node_javascript.cc", -+ "src/node_snapshot_stub.cc", -+ ] -+ -+ if (is_win) { -+ libs += [ "psapi.lib" ] -+ } -+ if (is_mac) { -+ frameworks += [ "CoreFoundation.framework" ] -+ } -+ -+ if (node_enable_inspector) { -+ sources += [ -+ "src/inspector_agent.cc", -+ "src/inspector_agent.h", -+ "src/inspector_io.cc", -+ "src/inspector_io.h", -+ "src/inspector_js_api.cc", -+ "src/inspector_profiler.cc", -+ "src/inspector_socket.cc", -+ "src/inspector_socket.h", -+ "src/inspector_socket_server.cc", -+ "src/inspector_socket_server.h", -+ ] -+ deps += [ "src/inspector" ] -+ } -+ -+ if (node_use_openssl) { -+ deps += [ "//third_party/boringssl" ] -+ sources += [ -+ "src/crypto/crypto_aes.cc", -+ "src/crypto/crypto_aes.h", -+ "src/crypto/crypto_bio.cc", -+ "src/crypto/crypto_bio.h", -+ "src/crypto/crypto_cipher.cc", -+ "src/crypto/crypto_cipher.h", -+ "src/crypto/crypto_clienthello-inl.h", -+ "src/crypto/crypto_clienthello.cc", -+ "src/crypto/crypto_clienthello.h", -+ "src/crypto/crypto_common.cc", -+ "src/crypto/crypto_common.h", -+ "src/crypto/crypto_context.cc", -+ "src/crypto/crypto_context.h", -+ "src/crypto/crypto_dh.cc", -+ "src/crypto/crypto_dh.h", -+ "src/crypto/crypto_dsa.cc", -+ "src/crypto/crypto_dsa.h", -+ "src/crypto/crypto_ec.cc", -+ "src/crypto/crypto_ec.h", -+ "src/crypto/crypto_groups.h", -+ "src/crypto/crypto_hash.cc", -+ "src/crypto/crypto_hash.h", -+ "src/crypto/crypto_hkdf.cc", -+ "src/crypto/crypto_hkdf.h", -+ "src/crypto/crypto_hmac.cc", -+ "src/crypto/crypto_hmac.h", -+ "src/crypto/crypto_keygen.cc", -+ "src/crypto/crypto_keygen.h", -+ "src/crypto/crypto_keys.cc", -+ "src/crypto/crypto_keys.h", -+ "src/crypto/crypto_pbkdf2.cc", -+ "src/crypto/crypto_pbkdf2.h", -+ "src/crypto/crypto_random.cc", -+ "src/crypto/crypto_random.h", -+ "src/crypto/crypto_rsa.cc", -+ "src/crypto/crypto_rsa.h", -+ "src/crypto/crypto_scrypt.cc", -+ "src/crypto/crypto_scrypt.h", -+ "src/crypto/crypto_sig.cc", -+ "src/crypto/crypto_sig.h", -+ "src/crypto/crypto_spkac.cc", -+ "src/crypto/crypto_spkac.h", -+ "src/crypto/crypto_timing.cc", -+ "src/crypto/crypto_timing.h", -+ "src/crypto/crypto_tls.cc", -+ "src/crypto/crypto_tls.h", -+ "src/crypto/crypto_util.cc", -+ "src/crypto/crypto_util.h", -+ "src/crypto/crypto_x509.cc", -+ "src/crypto/crypto_x509.h", -+ "src/node_crypto.cc", -+ "src/node_crypto.h", -+ ] -+ cflags_cc += [ "-Wno-sign-compare" ] -+ } - } -diff --git a/deps/ada/BUILD.gn b/deps/ada/BUILD.gn -index e92ac3a3beac143dced2efb05304ed8ba832b067..1ce69e9deba1a9b191e8d95f4c82e0ec1f7b50ca 100644 ---- a/deps/ada/BUILD.gn -+++ b/deps/ada/BUILD.gn -@@ -1,14 +1,12 @@ --############################################################################## --# # --# DO NOT EDIT THIS FILE! # --# # --############################################################################## -+import("//v8/gni/v8.gni") - --# This file is used by GN for building, which is NOT the build system used for --# building official binaries. --# Please modify the gyp files if you are making changes to build system. -+config("ada_config") { -+ include_dirs = [ "." ] -+} - --import("unofficial.gni") -+static_library("ada") { -+ include_dirs = [ "." ] -+ sources = [ "ada.cpp" ] - --ada_gn_build("ada") { -+ public_configs = [ ":ada_config" ] - } -diff --git a/deps/base64/unofficial.gni b/deps/base64/unofficial.gni -index 0e69d7383762f6b81c5b57698aa9d121d5a9c401..35bbeb37acc7ccb14b4b8a644ec3d4c76ca5c61c 100644 ---- a/deps/base64/unofficial.gni -+++ b/deps/base64/unofficial.gni -@@ -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 = current_cpu == "x64" || (current_cpu == "x86" && !is_win) -+ - config("base64_internal_config") { - include_dirs = [ "base64/lib" ] - if (is_component_build) { -@@ -19,7 +23,7 @@ template("base64_gn_build") { - } else { - defines = [] - } -- if (current_cpu == "x86" || current_cpu == "x64") { -+ if (support_x86_asm) { - defines += [ - "HAVE_SSSE3=1", - "HAVE_SSE41=1", -@@ -69,7 +73,7 @@ template("base64_gn_build") { - source_set("base64_ssse3") { - configs += [ ":base64_internal_config" ] - sources = [ "base64/lib/arch/ssse3/codec.c" ] -- if (current_cpu == "x86" || current_cpu == "x64") { -+ if (support_x86_asm) { - if (is_clang || !is_win) { - cflags_c = [ "-mssse3" ] - } -@@ -79,7 +83,7 @@ template("base64_gn_build") { - source_set("base64_sse41") { - configs += [ ":base64_internal_config" ] - sources = [ "base64/lib/arch/sse41/codec.c" ] -- if (current_cpu == "x86" || current_cpu == "x64") { -+ if (support_x86_asm) { - if (is_clang || !is_win) { - cflags_c = [ "-msse4.1" ] - } -@@ -89,7 +93,7 @@ template("base64_gn_build") { - source_set("base64_sse42") { - configs += [ ":base64_internal_config" ] - sources = [ "base64/lib/arch/sse42/codec.c" ] -- if (current_cpu == "x86" || current_cpu == "x64") { -+ if (support_x86_asm) { - if (is_clang || !is_win) { - cflags_c = [ "-msse4.2" ] - } -@@ -99,7 +103,7 @@ template("base64_gn_build") { - source_set("base64_avx") { - configs += [ ":base64_internal_config" ] - sources = [ "base64/lib/arch/avx/codec.c" ] -- if (current_cpu == "x86" || current_cpu == "x64") { -+ if (support_x86_asm) { - if (is_clang || !is_win) { - cflags_c = [ "-mavx" ] - } else if (is_win) { -@@ -111,7 +115,7 @@ template("base64_gn_build") { - source_set("base64_avx2") { - configs += [ ":base64_internal_config" ] - sources = [ "base64/lib/arch/avx2/codec.c" ] -- if (current_cpu == "x86" || current_cpu == "x64") { -+ if (support_x86_asm) { - if (is_clang || !is_win) { - cflags_c = [ "-mavx2" ] - } else if (is_win) { -@@ -123,7 +127,7 @@ template("base64_gn_build") { - source_set("base64_avx512") { - configs += [ ":base64_internal_config" ] - sources = [ "base64/lib/arch/avx512/codec.c" ] -- 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..7f4885631a85a25692e8969991951be02e5d73f1 100644 ---- a/deps/cares/BUILD.gn -+++ b/deps/cares/BUILD.gn -@@ -1,14 +1,175 @@ --############################################################################## --# # --# DO NOT EDIT THIS FILE! # --# # --############################################################################## -+config("cares_config") { -+ include_dirs = [ "include", "src/lib" ] -+} -+static_library("cares") { -+ defines = [ "CARES_STATICLIB" ] -+ include_dirs = [ "include" ] -+ public_configs = [ ":cares_config" ] -+ -+ libs = [] -+ cflags_c = [ -+ "-Wno-logical-not-parentheses", -+ "-Wno-implicit-fallthrough", -+ "-Wno-sign-compare", -+ ] -+ -+ sources = [ -+ "include/ares.h", -+ "include/ares_dns.h", -+ "include/ares_dns_record.h", -+ "include/ares_nameser.h", -+ "include/ares_version.h", -+ "src/lib/ares__addrinfo2hostent.c", -+ "src/lib/ares__addrinfo_localhost.c", -+ "src/lib/ares__close_sockets.c", -+ "src/lib/ares__hosts_file.c", -+ "src/lib/ares__parse_into_addrinfo.c", -+ "src/lib/ares__socket.c", -+ "src/lib/ares__sortaddrinfo.c", -+ "src/lib/ares_android.c", -+ "src/lib/ares_android.h", -+ "src/lib/ares_cancel.c", -+ "src/lib/ares_cookie.c", -+ "src/lib/ares_data.c", -+ "src/lib/ares_data.h", -+ "src/lib/ares_destroy.c", -+ "src/lib/ares_free_hostent.c", -+ "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", -+ "src/lib/ares_getnameinfo.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_metrics.c", -+ "src/lib/ares_options.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_search.c", -+ "src/lib/ares_send.c", -+ "src/lib/ares_setup.h", -+ "src/lib/ares_strerror.c", -+ "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/dsa/ares__array.c", -+ "src/lib/dsa/ares__array.h", -+ "src/lib/dsa/ares__htable.c", -+ "src/lib/dsa/ares__htable.h", -+ "src/lib/dsa/ares__htable_asvp.c", -+ "src/lib/dsa/ares__htable_asvp.h", -+ "src/lib/dsa/ares__htable_strvp.c", -+ "src/lib/dsa/ares__htable_strvp.h", -+ "src/lib/dsa/ares__htable_szvp.c", -+ "src/lib/dsa/ares__htable_szvp.h", -+ "src/lib/dsa/ares__htable_vpvp.c", -+ "src/lib/dsa/ares__htable_vpvp.h", -+ "src/lib/dsa/ares__llist.c", -+ "src/lib/dsa/ares__llist.h", -+ "src/lib/dsa/ares__slist.c", -+ "src/lib/dsa/ares__slist.h", -+ "src/lib/event/ares_event.h", -+ "src/lib/event/ares_event_configchg.c", -+ "src/lib/event/ares_event_epoll.c", -+ "src/lib/event/ares_event_kqueue.c", -+ "src/lib/event/ares_event_poll.c", -+ "src/lib/event/ares_event_select.c", -+ "src/lib/event/ares_event_thread.c", -+ "src/lib/event/ares_event_wake_pipe.c", -+ "src/lib/event/ares_event_win32.c", -+ "src/lib/event/ares_event_win32.h", -+ "src/lib/inet_net_pton.c", -+ "src/lib/inet_ntop.c", -+ "src/lib/legacy/ares_create_query.c", -+ "src/lib/legacy/ares_expand_name.c", -+ "src/lib/legacy/ares_expand_string.c", -+ "src/lib/legacy/ares_fds.c", -+ "src/lib/legacy/ares_getsock.c", -+ "src/lib/legacy/ares_parse_a_reply.c", -+ "src/lib/legacy/ares_parse_aaaa_reply.c", -+ "src/lib/legacy/ares_parse_caa_reply.c", -+ "src/lib/legacy/ares_parse_mx_reply.c", -+ "src/lib/legacy/ares_parse_naptr_reply.c", -+ "src/lib/legacy/ares_parse_ns_reply.c", -+ "src/lib/legacy/ares_parse_ptr_reply.c", -+ "src/lib/legacy/ares_parse_soa_reply.c", -+ "src/lib/legacy/ares_parse_srv_reply.c", -+ "src/lib/legacy/ares_parse_txt_reply.c", -+ "src/lib/legacy/ares_parse_uri_reply.c", -+ "src/lib/record/ares_dns_mapping.c", -+ "src/lib/record/ares_dns_multistring.c", -+ "src/lib/record/ares_dns_multistring.h", -+ "src/lib/record/ares_dns_name.c", -+ "src/lib/record/ares_dns_parse.c", -+ "src/lib/record/ares_dns_private.h", -+ "src/lib/record/ares_dns_record.c", -+ "src/lib/record/ares_dns_write.c", -+ "src/lib/str/ares__buf.c", -+ "src/lib/str/ares__buf.h", -+ "src/lib/str/ares_str.c", -+ "src/lib/str/ares_str.h", -+ "src/lib/str/ares_strcasecmp.c", -+ "src/lib/str/ares_strcasecmp.h", -+ "src/lib/str/ares_strsplit.c", -+ "src/lib/str/ares_strsplit.h", -+ "src/lib/util/ares__iface_ips.c", -+ "src/lib/util/ares__iface_ips.h", -+ "src/lib/util/ares__threads.c", -+ "src/lib/util/ares__threads.h", -+ "src/lib/util/ares__timeval.c", -+ "src/lib/util/ares_math.c", -+ "src/lib/util/ares_rand.c", -+ "src/tools/ares_getopt.c", -+ "src/tools/ares_getopt.h", -+ ] -+ -+ if (!is_win) { -+ defines += [ -+ "_DARWIN_USE_64_BIT_INODE=1", -+ "_LARGEFILE_SOURCE", -+ "_FILE_OFFSET_BITS=64", -+ "_GNU_SOURCE", -+ ] -+ } - --# This file is used by GN for building, which is NOT the build system used for --# building official binaries. --# Please modify the gyp files if you are making changes to build system. -+ if (is_win) { -+ defines += [ "CARES_PULL_WS2TCPIP_H=1" ] -+ include_dirs += [ "config/win32" ] -+ sources += [ -+ "src/lib/ares_sysconfig_win.c", -+ "src/lib/config-win32.h", -+ "src/lib/windows_port.c", -+ ] -+ libs += [ -+ "ws2_32.lib", -+ "iphlpapi.lib", -+ ] -+ } else { -+ defines += [ "HAVE_CONFIG_H" ] -+ } - --import("unofficial.gni") -+ if (is_linux) { -+ include_dirs += [ "config/linux" ] -+ sources += [ "config/linux/ares_config.h" ] -+ } - --cares_gn_build("cares") { -+ if (is_mac) { -+ include_dirs += [ "config/darwin" ] -+ sources += [ -+ "config/darwin/ares_config.h", -+ "src/lib/ares_sysconfig_mac.c", -+ "src/lib/thirdparty/apple/dnsinfo.h", -+ ] -+ } - } -diff --git a/deps/googletest/BUILD.gn b/deps/googletest/BUILD.gn -index de13f3f653b5d53610f4611001c10dce332293c2..0daf8c006cef89e76d7eccec3e924bd2718021c9 100644 ---- a/deps/googletest/BUILD.gn -+++ b/deps/googletest/BUILD.gn -@@ -1,14 +1,64 @@ --############################################################################## --# # --# DO NOT EDIT THIS FILE! # --# # --############################################################################## -+config("gtest_config") { -+ include_dirs = [ "include" ] -+ defines = [ "UNIT_TEST" ] -+} -+ -+static_library("gtest") { -+ include_dirs = [ -+ "include", -+ "." # src -+ ] -+ -+ public_configs = [ ":gtest_config" ] - --# This file is used by GN for building, which is NOT the build system used for --# building official binaries. --# Please modify the gyp files if you are making changes to build system. -+ cflags_cc = [ -+ "-Wno-c++98-compat-extra-semi", -+ "-Wno-unused-const-variable", -+ "-Wno-unreachable-code-return", -+ ] - --import("unofficial.gni") -+ defines = [ -+ "GTEST_HAS_POSIX_RE=0", -+ "GTEST_LANG_CXX11=1", -+ ] -+ -+ sources = [ -+ "include/gtest/gtest_pred_impl.h", -+ "include/gtest/gtest_prod.h", -+ "include/gtest/gtest-death-test.h", -+ "include/gtest/gtest-matchers.h", -+ "include/gtest/gtest-message.h", -+ "include/gtest/gtest-param-test.h", -+ "include/gtest/gtest-printers.h", -+ "include/gtest/gtest-spi.h", -+ "include/gtest/gtest-test-part.h", -+ "include/gtest/gtest-typed-test.h", -+ "include/gtest/gtest.h", -+ "include/gtest/internal/gtest-death-test-internal.h", -+ "include/gtest/internal/gtest-filepath.h", -+ "include/gtest/internal/gtest-internal.h", -+ "include/gtest/internal/gtest-param-util.h", -+ "include/gtest/internal/gtest-port-arch.h", -+ "include/gtest/internal/gtest-port.h", -+ "include/gtest/internal/gtest-string.h", -+ "include/gtest/internal/gtest-type-util.h", -+ "include/gtest/internal/custom/gtest-port.h", -+ "include/gtest/internal/custom/gtest-printers.h", -+ "include/gtest/internal/custom/gtest.h", -+ "src/gtest-all.cc", -+ "src/gtest-death-test.cc", -+ "src/gtest-filepath.cc", -+ "src/gtest-internal-inl.h", -+ "src/gtest-matchers.cc", -+ "src/gtest-port.cc", -+ "src/gtest-printers.cc", -+ "src/gtest-test-part.cc", -+ "src/gtest-typed-test.cc", -+ "src/gtest.cc", -+ ] -+} - --googletest_gn_build("googletest") { -+static_library("gtest_main") { -+ deps = [ ":gtest" ] -+ sources = [ "src/gtest_main.cc" ] - } -diff --git a/deps/histogram/BUILD.gn b/deps/histogram/BUILD.gn -index e2f3ee37137a6b7d45cbe79f8b9ba7f693ffc4d3..85467b372f01cf602af45fa2f0d599acabfc2310 100644 ---- a/deps/histogram/BUILD.gn -+++ b/deps/histogram/BUILD.gn -@@ -1,14 +1,19 @@ --############################################################################## --# # --# DO NOT EDIT THIS FILE! # --# # --############################################################################## -+config("histogram_config") { -+ include_dirs = [ "include" ] - --# This file is used by GN for building, which is NOT the build system used for --# building official binaries. --# Please modify the gyp files if you are making changes to build system. -+ cflags = [ -+ "-Wno-implicit-function-declaration", -+ "-Wno-incompatible-pointer-types", -+ "-Wno-unused-function", -+ "-Wno-atomic-alignment", -+ ] -+} - --import("unofficial.gni") -+static_library("histogram") { -+ public_configs = [ ":histogram_config" ] - --histogram_gn_build("histogram") { -+ sources = [ -+ "src/hdr_histogram.c", -+ "src/hdr_histogram.h", -+ ] - } -diff --git a/deps/llhttp/BUILD.gn b/deps/llhttp/BUILD.gn -index 64a2a4799d5530276f46aa1faa63ece063390ada..fb000f8ee7647c375bc190d1729d67bb7770d109 100644 ---- a/deps/llhttp/BUILD.gn -+++ b/deps/llhttp/BUILD.gn -@@ -1,14 +1,15 @@ --############################################################################## --# # --# DO NOT EDIT THIS FILE! # --# # --############################################################################## -- --# This file is used by GN for building, which is NOT the build system used for --# building official binaries. --# Please modify the gyp files if you are making changes to build system. -- --import("unofficial.gni") -+config("llhttp_config") { -+ include_dirs = [ "include" ] -+ cflags = [ "-Wno-unreachable-code" ] -+} - --llhttp_gn_build("llhttp") { -+static_library("llhttp") { -+ include_dirs = [ "include" ] -+ public_configs = [ ":llhttp_config" ] -+ cflags_c = [ "-Wno-implicit-fallthrough" ] -+ sources = [ -+ "src/api.c", -+ "src/http.c", -+ "src/llhttp.c", -+ ] - } -diff --git a/deps/nghttp2/BUILD.gn b/deps/nghttp2/BUILD.gn -index 274352b0e2449f8db49d9a49c6b92a69f97e8363..f04c7ca24af6cdbe8d739bcd55172110963888e9 100644 ---- a/deps/nghttp2/BUILD.gn -+++ b/deps/nghttp2/BUILD.gn -@@ -1,14 +1,51 @@ --############################################################################## --# # --# DO NOT EDIT THIS FILE! # --# # --############################################################################## -- --# This file is used by GN for building, which is NOT the build system used for --# building official binaries. --# Please modify the gyp files if you are making changes to build system. -+config("nghttp2_config") { -+ defines = [ "NGHTTP2_STATICLIB" ] -+ include_dirs = [ "lib/includes" ] -+} -+static_library("nghttp2") { -+ public_configs = [ ":nghttp2_config" ] -+ defines = [ -+ "_U_", -+ "BUILDING_NGHTTP2", -+ "NGHTTP2_STATICLIB", -+ "HAVE_CONFIG_H", -+ ] -+ include_dirs = [ "lib/includes" ] - --import("unofficial.gni") -+ cflags_c = [ -+ "-Wno-implicit-function-declaration", -+ "-Wno-implicit-fallthrough", -+ "-Wno-string-plus-int", -+ "-Wno-unreachable-code-return", -+ "-Wno-unused-but-set-variable", -+ ] - --nghttp2_gn_build("nghttp2") { -+ sources = [ -+ "lib/nghttp2_buf.c", -+ "lib/nghttp2_callbacks.c", -+ "lib/nghttp2_debug.c", -+ "lib/nghttp2_extpri.c", -+ "lib/nghttp2_frame.c", -+ "lib/nghttp2_hd.c", -+ "lib/nghttp2_hd_huffman.c", -+ "lib/nghttp2_hd_huffman_data.c", -+ "lib/nghttp2_helper.c", -+ "lib/nghttp2_http.c", -+ "lib/nghttp2_map.c", -+ "lib/nghttp2_mem.c", -+ "lib/nghttp2_alpn.c", -+ "lib/nghttp2_option.c", -+ "lib/nghttp2_outbound_item.c", -+ "lib/nghttp2_pq.c", -+ "lib/nghttp2_priority_spec.c", -+ "lib/nghttp2_queue.c", -+ "lib/nghttp2_ratelim.c", -+ "lib/nghttp2_rcbuf.c", -+ "lib/nghttp2_session.c", -+ "lib/nghttp2_stream.c", -+ "lib/nghttp2_submit.c", -+ "lib/nghttp2_time.c", -+ "lib/nghttp2_version.c", -+ "lib/sfparse.c", -+ ] - } -diff --git a/deps/simdjson/BUILD.gn b/deps/simdjson/BUILD.gn -index d0580ccf354d2000fb0075fd3bb4579f93477927..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 ---- a/deps/simdjson/BUILD.gn -+++ b/deps/simdjson/BUILD.gn -@@ -1,14 +0,0 @@ --############################################################################## --# # --# DO NOT EDIT THIS FILE! # --# # --############################################################################## -- --# This file is used by GN for building, which is NOT the build system used for --# building official binaries. --# Please modify the gyp files if you are making changes to build system. -- --import("unofficial.gni") -- --simdjson_gn_build("simdjson") { --} -diff --git a/deps/simdutf/BUILD.gn b/deps/simdutf/BUILD.gn -index 119d49456911e99944294bd00b3f182a8f0e35b5..ce38c3633a228306622a7237067393d25332c59c 100644 ---- a/deps/simdutf/BUILD.gn -+++ b/deps/simdutf/BUILD.gn -@@ -1,14 +1,21 @@ --############################################################################## --# # --# DO NOT EDIT THIS FILE! # --# # --############################################################################## -+config("simdutf_config") { -+ include_dirs = [ "." ] -+} - --# This file is used by GN for building, which is NOT the build system used for --# building official binaries. --# Please modify the gyp files if you are making changes to build system. -+static_library("simdutf") { -+ include_dirs = [ "." ] -+ sources = [ -+ "simdutf.cpp", -+ ] - --import("unofficial.gni") -+ public_configs = [ ":simdutf_config" ] - --simdutf_gn_build("simdutf") { -+ cflags_cc = [ -+ "-Wno-ambiguous-reversed-operator", -+ "-Wno-c++98-compat-extra-semi", -+ "-Wno-unreachable-code", -+ "-Wno-unreachable-code-break", -+ "-Wno-unused-const-variable", -+ "-Wno-unused-function", -+ ] - } -diff --git a/deps/uv/BUILD.gn b/deps/uv/BUILD.gn -index 8e6ac27048b5965e20f35c7a63e469beb6fa5970..7518168141db7958550c7f5dc1ed17ccdbbe4a60 100644 ---- a/deps/uv/BUILD.gn -+++ b/deps/uv/BUILD.gn -@@ -1,14 +1,194 @@ --############################################################################## --# # --# DO NOT EDIT THIS FILE! # --# # --############################################################################## -+config("libuv_config") { -+ include_dirs = [ "include" ] - --# This file is used by GN for building, which is NOT the build system used for --# building official binaries. --# Please modify the gyp files if you are making changes to build system. -+ defines = [] - --import("unofficial.gni") -+ if (is_linux) { -+ defines += [ "_POSIX_C_SOURCE=200112" ] -+ } -+ if (!is_win) { -+ defines += [ -+ "_LARGEFILE_SOURCE", -+ "_FILE_OFFSET_BITS=64", -+ ] -+ } -+ if (is_mac) { -+ defines += [ "_DARWIN_USE_64_BIT_INODE=1" ] -+ } -+} -+ -+static_library("uv") { -+ include_dirs = [ -+ "include", -+ "src", -+ ] -+ -+ public_configs = [ ":libuv_config" ] -+ -+ ldflags = [] -+ -+ defines = [] -+ -+ # This only has an effect on Windows, where it will cause libuv's symbols to be exported in node.lib -+ defines += [ "BUILDING_UV_SHARED=1" ] -+ -+ cflags_c = [ -+ "-Wno-incompatible-pointer-types", -+ "-Wno-bitwise-op-parentheses", -+ "-Wno-implicit-fallthrough", -+ "-Wno-implicit-function-declaration", -+ "-Wno-missing-braces", -+ "-Wno-sign-compare", -+ "-Wno-sometimes-uninitialized", -+ "-Wno-string-conversion", -+ "-Wno-switch", -+ "-Wno-unused-function", -+ "-Wno-unused-result", -+ "-Wno-unused-variable", -+ "-Wno-unreachable-code", -+ "-Wno-unreachable-code-return", -+ "-Wno-unused-but-set-variable", -+ "-Wno-shadow", -+ ] -+ -+ libs = [] -+ -+ sources = [ -+ "include/uv.h", -+ "include/uv/tree.h", -+ "include/uv/errno.h", -+ "include/uv/threadpool.h", -+ "include/uv/version.h", -+ "src/fs-poll.c", -+ "src/heap-inl.h", -+ "src/idna.c", -+ "src/idna.h", -+ "src/inet.c", -+ "src/queue.h", -+ "src/random.c", -+ "src/strscpy.c", -+ "src/strscpy.h", -+ "src/strtok.c", -+ "src/strtok.h", -+ "src/thread-common.c", -+ "src/threadpool.c", -+ "src/timer.c", -+ "src/uv-data-getter-setters.c", -+ "src/uv-common.c", -+ "src/uv-common.h", -+ "src/version.c", -+ ] -+ -+ if (is_win) { -+ defines += [ "_GNU_SOURCE" ] -+ sources += [ -+ "include/uv/win.h", -+ "src/win/async.c", -+ "src/win/atomicops-inl.h", -+ "src/win/core.c", -+ "src/win/detect-wakeup.c", -+ "src/win/dl.c", -+ "src/win/error.c", -+ "src/win/fs.c", -+ "src/win/fs-event.c", -+ "src/win/getaddrinfo.c", -+ "src/win/getnameinfo.c", -+ "src/win/handle.c", -+ "src/win/handle-inl.h", -+ "src/win/internal.h", -+ "src/win/loop-watcher.c", -+ "src/win/pipe.c", -+ "src/win/thread.c", -+ "src/win/poll.c", -+ "src/win/process.c", -+ "src/win/process-stdio.c", -+ "src/win/req-inl.h", -+ "src/win/signal.c", -+ "src/win/snprintf.c", -+ "src/win/stream.c", -+ "src/win/stream-inl.h", -+ "src/win/tcp.c", -+ "src/win/tty.c", -+ "src/win/udp.c", -+ "src/win/util.c", -+ "src/win/winapi.c", -+ "src/win/winapi.h", -+ "src/win/winsock.c", -+ "src/win/winsock.h", -+ ] - --uv_gn_build("uv") { -+ libs += [ -+ "advapi32.lib", -+ "iphlpapi.lib", -+ "psapi.lib", -+ "shell32.lib", -+ "user32.lib", -+ "userenv.lib", -+ "ws2_32.lib", -+ ] -+ } else { -+ sources += [ -+ "include/uv/unix.h", -+ "include/uv/linux.h", -+ "include/uv/sunos.h", -+ "include/uv/darwin.h", -+ "include/uv/bsd.h", -+ "include/uv/aix.h", -+ "src/unix/async.c", -+ "src/unix/core.c", -+ "src/unix/dl.c", -+ "src/unix/fs.c", -+ "src/unix/getaddrinfo.c", -+ "src/unix/getnameinfo.c", -+ "src/unix/internal.h", -+ "src/unix/loop.c", -+ "src/unix/loop-watcher.c", -+ "src/unix/pipe.c", -+ "src/unix/poll.c", -+ "src/unix/process.c", -+ "src/unix/random-devurandom.c", -+ "src/unix/signal.c", -+ "src/unix/stream.c", -+ "src/unix/tcp.c", -+ "src/unix/thread.c", -+ "src/unix/tty.c", -+ "src/unix/udp.c", -+ ] -+ libs += [ "m" ] -+ ldflags += [ "-pthread" ] -+ } -+ if (is_mac || is_linux) { -+ sources += [ "src/unix/proctitle.c" ] -+ } -+ if (is_mac) { -+ sources += [ -+ "src/unix/darwin-proctitle.c", -+ "src/unix/darwin.c", -+ "src/unix/fsevents.c", -+ "src/unix/random-getentropy.c", -+ ] -+ defines += [ -+ "_DARWIN_USE_64_BIT_INODE=1", -+ "_DARWIN_UNLIMITED_SELECT=1", -+ ] -+ } -+ if (is_linux) { -+ defines += [ "_GNU_SOURCE" ] -+ sources += [ -+ "src/unix/linux.c", -+ "src/unix/procfs-exepath.c", -+ "src/unix/random-getrandom.c", -+ "src/unix/random-sysctl-linux.c", -+ ] -+ libs += [ -+ "dl", -+ "rt", -+ ] -+ } -+ if (is_mac) { # is_bsd -+ sources += [ -+ "src/unix/bsd-ifaddrs.c", -+ "src/unix/kqueue.c", -+ ] -+ } - } -diff --git a/deps/uvwasi/BUILD.gn b/deps/uvwasi/BUILD.gn -index 4f8fb081df805a786e523e5f0ffbb0096fdeca99..d9fcf8dc972b1caa2b7a130b1144c685316035cd 100644 ---- a/deps/uvwasi/BUILD.gn -+++ b/deps/uvwasi/BUILD.gn -@@ -1,14 +1,39 @@ --############################################################################## --# # --# DO NOT EDIT THIS FILE! # --# # --############################################################################## -+config("uvwasi_config") { -+ include_dirs = [ "include" ] -+} -+ -+static_library("uvwasi") { -+ include_dirs = [ -+ "include", -+ "src", -+ ] -+ -+ defines = [] -+ if (is_linux) { -+ defines += [ -+ "_GNU_SOURCE", -+ "_POSIX_C_SOURCE=200112" -+ ] -+ } -+ -+ deps = [ "../../deps/uv" ] - --# This file is used by GN for building, which is NOT the build system used for --# building official binaries. --# Please modify the gyp files if you are making changes to build system. -+ public_configs = [ ":uvwasi_config" ] - --import("unofficial.gni") -+ cflags_c = [] -+ if (!is_win) { -+ cflags_c += [ "-fvisibility=hidden" ] -+ } - --uvwasi_gn_build("uvwasi") { -+ sources = [ -+ "src/clocks.c", -+ "src/fd_table.c", -+ "src/path_resolver.c", -+ "src/poll_oneoff.c", -+ "src/sync_helpers.c", -+ "src/uv_mapping.c", -+ "src/uvwasi.c", -+ "src/wasi_rights.c", -+ "src/wasi_serdes.c" -+ ] - } -diff --git a/electron_node.gni b/electron_node.gni -new file mode 100644 -index 0000000000000000000000000000000000000000..af9cbada10203b387fb9732b346583b1c4349223 ---- /dev/null -+++ b/electron_node.gni -@@ -0,0 +1,4 @@ -+declare_args() { -+ # Allows embedders to override the NODE_MODULE_VERSION define -+ node_module_version = "" -+} + if (is_win) { +- cflags_c = [ ++ cflags_c += [ + "-Wno-sign-compare", + "-Wno-unused-but-set-variable", + "-Wno-unused-function", diff --git a/filenames.json b/filenames.json new file mode 100644 -index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a607bb12f +index 0000000000000000000000000000000000000000..5af3886d8d3d74d31249a4d79030a8373b8dad52 --- /dev/null +++ b/filenames.json -@@ -0,0 +1,741 @@ +@@ -0,0 +1,756 @@ +// This file is automatically generated by generate_gn_filenames_json.py +// DO NOT EDIT +{ @@ -1279,6 +69,7 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "lib/internal/fs/cp/cp-sync.js", + "lib/internal/fs/cp/cp.js", + "lib/internal/fs/dir.js", ++ "lib/internal/fs/glob.js", + "lib/internal/fs/promises.js", + "lib/internal/fs/read/context.js", + "lib/internal/fs/recursive_watch.js", @@ -1481,7 +272,10 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "lib/internal/assert/assertion_error.js", + "lib/internal/assert/calltracker.js", + "lib/internal/assert/utils.js", ++ "lib/internal/async_context_frame.js", + "lib/internal/async_hooks.js", ++ "lib/internal/async_local_storage/async_context_frame.js", ++ "lib/internal/async_local_storage/async_hooks.js", + "lib/internal/blob.js", + "lib/internal/blocklist.js", + "lib/internal/bootstrap/node.js", @@ -1527,6 +321,7 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "lib/internal/crypto/webcrypto.js", + "lib/internal/crypto/webidl.js", + "lib/internal/crypto/x509.js", ++ "lib/internal/data_url.js", + "lib/internal/debugger/inspect.js", + "lib/internal/debugger/inspect_client.js", + "lib/internal/debugger/inspect_repl.js", @@ -1582,7 +377,6 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "lib/internal/modules/esm/loader.js", + "lib/internal/modules/esm/module_job.js", + "lib/internal/modules/esm/module_map.js", -+ "lib/internal/modules/esm/package_config.js", + "lib/internal/modules/esm/resolve.js", + "lib/internal/modules/esm/shared_constants.js", + "lib/internal/modules/esm/translators.js", @@ -1607,13 +401,11 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "lib/internal/perf/timerify.js", + "lib/internal/perf/usertiming.js", + "lib/internal/perf/utils.js", -+ "lib/internal/policy/manifest.js", -+ "lib/internal/policy/sri.js", + "lib/internal/priority_queue.js", + "lib/internal/process/execution.js", ++ "lib/internal/process/finalization.js", + "lib/internal/process/per_thread.js", + "lib/internal/process/permission.js", -+ "lib/internal/process/policy.js", + "lib/internal/process/pre_execution.js", + "lib/internal/process/promises.js", + "lib/internal/process/report.js", @@ -1637,6 +429,7 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "lib/internal/source_map/prepare_stack_trace.js", + "lib/internal/source_map/source_map.js", + "lib/internal/source_map/source_map_cache.js", ++ "lib/internal/source_map/source_map_cache_map.js", + "lib/internal/stream_base_commons.js", + "lib/internal/streams/add-abort-signal.js", + "lib/internal/streams/compose.js", @@ -1671,6 +464,7 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "lib/internal/test_runner/reporter/utils.js", + "lib/internal/test_runner/reporter/v8-serializer.js", + "lib/internal/test_runner/runner.js", ++ "lib/internal/test_runner/snapshot.js", + "lib/internal/test_runner/test.js", + "lib/internal/test_runner/tests_stream.js", + "lib/internal/test_runner/utils.js", @@ -1684,10 +478,8 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "lib/internal/util/colors.js", + "lib/internal/util/comparisons.js", + "lib/internal/util/debuglog.js", -+ "lib/internal/util/embedding.js", + "lib/internal/util/inspect.js", + "lib/internal/util/inspector.js", -+ "lib/internal/util/iterable_weak_map.js", + "lib/internal/util/parse_args/parse_args.js", + "lib/internal/util/parse_args/utils.js", + "lib/internal/util/types.js", @@ -1701,6 +493,7 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "lib/internal/watch_mode/files_watcher.js", + "lib/internal/watchdog.js", + "lib/internal/webidl.js", ++ "lib/internal/webstorage.js", + "lib/internal/webstreams/adapters.js", + "lib/internal/webstreams/compression.js", + "lib/internal/webstreams/encoding.js", @@ -1713,6 +506,7 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "lib/internal/worker.js", + "lib/internal/worker/io.js", + "lib/internal/worker/js_transferable.js", ++ "lib/internal/worker/messaging.js", + "lib/module.js", + "lib/net.js", + "lib/os.js", @@ -1727,6 +521,7 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "lib/readline/promises.js", + "lib/repl.js", + "lib/sea.js", ++ "lib/sqlite.js", + "lib/stream.js", + "lib/stream/consumers.js", + "lib/stream/promises.js", @@ -1775,10 +570,12 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "src/api/exceptions.cc", + "src/api/hooks.cc", + "src/api/utils.cc", ++ "src/async_context_frame.cc", + "src/async_wrap.cc", + "src/base_object.cc", + "src/cares_wrap.cc", + "src/cleanup_queue.cc", ++ "src/compile_cache.cc", + "src/connect_wrap.cc", + "src/connection_wrap.cc", + "src/dataqueue/queue.cc", @@ -1812,6 +609,7 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "src/node_constants.cc", + "src/node_contextify.cc", + "src/node_credentials.cc", ++ "src/node_debug.cc", + "src/node_dir.cc", + "src/node_dotenv.cc", + "src/node_env_var.cc", @@ -1824,6 +622,7 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "src/node_main_instance.cc", + "src/node_messaging.cc", + "src/node_metadata.cc", ++ "src/node_modules.cc", + "src/node_options.cc", + "src/node_os.cc", + "src/node_perf.cc", @@ -1841,9 +640,11 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "src/node_shadow_realm.cc", + "src/node_snapshotable.cc", + "src/node_sockaddr.cc", ++ "src/node_sqlite.cc", + "src/node_stat_watcher.cc", + "src/node_symbols.cc", + "src/node_task_queue.cc", ++ "src/node_task_runner.cc", + "src/node_trace_events.cc", + "src/node_types.cc", + "src/node_url.cc", @@ -1852,6 +653,7 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "src/node_wasi.cc", + "src/node_wasm_web_api.cc", + "src/node_watchdog.cc", ++ "src/node_webstorage.cc", + "src/node_worker.cc", + "src/node_zlib.cc", + "src/path.cc", @@ -1886,19 +688,19 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "src/aliased_buffer-inl.h", + "src/aliased_struct.h", + "src/aliased_struct-inl.h", ++ "src/async_context_frame.h", + "src/async_wrap.h", + "src/async_wrap-inl.h", + "src/base_object.h", + "src/base_object-inl.h", + "src/base_object_types.h", -+ "src/base64.h", -+ "src/base64-inl.h", + "src/blob_serializer_deserializer.h", + "src/blob_serializer_deserializer-inl.h", + "src/callback_queue.h", + "src/callback_queue-inl.h", + "src/cleanup_queue.h", + "src/cleanup_queue-inl.h", ++ "src/compile_cache.h", + "src/connect_wrap.h", + "src/connection_wrap.h", + "src/dataqueue/queue.h", @@ -1929,6 +731,7 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "src/node_constants.h", + "src/node_context_data.h", + "src/node_contextify.h", ++ "src/node_debug.h", + "src/node_dir.h", + "src/node_dotenv.h", + "src/node_errors.h", @@ -1948,6 +751,7 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "src/node_messaging.h", + "src/node_metadata.h", + "src/node_mutex.h", ++ "src/node_modules.h", + "src/node_object_wrap.h", + "src/node_options.h", + "src/node_options-inl.h", @@ -1967,6 +771,7 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "src/node_snapshot_builder.h", + "src/node_sockaddr.h", + "src/node_sockaddr-inl.h", ++ "src/node_sqlite.h", + "src/node_stat_watcher.h", + "src/node_union_bytes.h", + "src/node_url.h", @@ -1975,6 +780,7 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "src/node_v8_platform-inl.h", + "src/node_wasi.h", + "src/node_watchdog.h", ++ "src/node_webstorage.h", + "src/node_worker.h", + "src/path.h", + "src/permission/child_process_permission.h", @@ -1994,7 +800,6 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "src/string_bytes.h", + "src/string_decoder.h", + "src/string_decoder-inl.h", -+ "src/string_search.h", + "src/tcp_wrap.h", + "src/timers.h", + "src/tracing/agent.h", @@ -2013,234 +818,46 @@ index 0000000000000000000000000000000000000000..889a487e24721a8ecfef91f5a655892a + "deps/postject/postject-api.h" + ] +} -diff --git a/src/inspector/BUILD.gn b/src/inspector/BUILD.gn -index 909fd14345fcd988c381e640280f4b33f2e0c351..3b430a666a7d5cb52ec41f8d828284625f916701 100644 ---- a/src/inspector/BUILD.gn -+++ b/src/inspector/BUILD.gn -@@ -1,14 +1,208 @@ --############################################################################## --# # --# DO NOT EDIT THIS FILE! # --# # --############################################################################## -+import("//v8/gni/v8.gni") +diff --git a/node.gni b/node.gni +index 9dca810decebd75aab427e306b3cc37c80fb55c9..32709b860ccb12d8d1e75342a65dda0b86129b21 100644 +--- a/node.gni ++++ b/node.gni +@@ -5,10 +5,10 @@ + # Embedder options. + declare_args() { + # The location of Node.js in source code tree. +- node_path = "//node" ++ node_path = "//third_party/electron_node" --# This file is used by GN for building, which is NOT the build system used for --# building official binaries. --# Please modify the gyp files if you are making changes to build system. -+inspector_protocol_dir = "../../tools/inspector_protocol" + # The location of V8, use the one from node's deps by default. +- node_v8_path = "$node_path/deps/v8" ++ node_v8_path = "//v8" --import("unofficial.gni") -+_protocol_generated = [ -+ "protocol/Forward.h", -+ "protocol/Protocol.cpp", -+ "protocol/Protocol.h", -+ "protocol/NodeWorker.cpp", -+ "protocol/NodeWorker.h", -+ "protocol/NodeTracing.cpp", -+ "protocol/NodeTracing.h", -+ "protocol/NodeRuntime.cpp", -+ "protocol/NodeRuntime.h", -+ "protocol/Network.cpp", -+ "protocol/Network.h", -+] + # The NODE_MODULE_VERSION defined in node_version.h. + node_module_version = exec_script("$node_path/tools/getmoduleversion.py", [], "value") +@@ -38,7 +38,7 @@ declare_args() { + node_openssl_system_ca_path = "" --inspector_gn_build("inspector") { -+# These are from node_protocol_config.json -+# These convoluted path hacks are to work around the fact that node.js is very -+# confused about what paths are in its includes, without changing node at all. -+# Hopefully, keying everything in this file off the paths that are in -+# node_protocol_config.json will mean that the paths stay in sync. -+inspector_protocol_package = "src/node/inspector/protocol" -+inspector_protocol_output = "node/inspector/protocol" -+ -+config("inspector_config") { -+ include_dirs = [ -+ "$target_gen_dir", -+ "$target_gen_dir/src", -+ ] -+ -+ configs = [ "../..:node_features" ] -+} -+ -+source_set("inspector") { -+ sources = [ -+ "main_thread_interface.cc", -+ "main_thread_interface.h", -+ "node_string.cc", -+ "node_string.h", -+ "runtime_agent.cc", -+ "runtime_agent.h", -+ "tracing_agent.cc", -+ "tracing_agent.h", -+ "worker_agent.cc", -+ "worker_agent.h", -+ "network_inspector.cc", -+ "network_inspector.h", -+ "network_agent.cc", -+ "network_agent.h", -+ "worker_inspector.cc", -+ "worker_inspector.h", -+ ] -+ sources += rebase_path(_protocol_generated, -+ ".", -+ "$target_gen_dir/$inspector_protocol_package/..") -+ include_dirs = [ -+ "//v8/include", -+ "..", -+ ] -+ deps = [ -+ ":protocol_generated_sources", -+ ":v8_inspector_compress_protocol_json", -+ "../../deps/uv", -+ "../../deps/simdutf", -+ "//third_party/icu:icuuc", -+ ] -+ configs += [ -+ "../..:node_internal_config", -+ "../..:node_lib_config", -+ ] -+ public_configs = [ ":inspector_config" ] -+} -+ -+# This based on the template from //v8/../inspector_protocol.gni -+action("protocol_generated_sources") { -+ # This is to ensure that the output directory exists--the code generator -+ # doesn't create it. -+ write_file("$target_gen_dir/$inspector_protocol_package/.dummy", "") -+ script = "$inspector_protocol_dir/code_generator.py" -+ -+ inputs = [ -+ "$target_gen_dir/node_protocol_config.json", -+ "$target_gen_dir/src/node_protocol.json", -+ "$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/DispatcherBase_cpp.template", -+ "$inspector_protocol_dir/lib/DispatcherBase_h.template", -+ "$inspector_protocol_dir/lib/ErrorSupport_cpp.template", -+ "$inspector_protocol_dir/lib/ErrorSupport_h.template", -+ "$inspector_protocol_dir/lib/Forward_h.template", -+ "$inspector_protocol_dir/lib/FrontendChannel_h.template", -+ "$inspector_protocol_dir/lib/Maybe_h.template", -+ "$inspector_protocol_dir/lib/Object_cpp.template", -+ "$inspector_protocol_dir/lib/Object_h.template", -+ "$inspector_protocol_dir/lib/Parser_cpp.template", -+ "$inspector_protocol_dir/lib/Parser_h.template", -+ "$inspector_protocol_dir/lib/Protocol_cpp.template", -+ "$inspector_protocol_dir/lib/ValueConversions_h.template", -+ "$inspector_protocol_dir/lib/Values_cpp.template", -+ "$inspector_protocol_dir/lib/Values_h.template", -+ "$inspector_protocol_dir/templates/Exported_h.template", -+ "$inspector_protocol_dir/templates/Imported_h.template", -+ "$inspector_protocol_dir/templates/TypeBuilder_cpp.template", -+ "$inspector_protocol_dir/templates/TypeBuilder_h.template", -+ ] -+ -+ deps = [ -+ ":node_protocol_config", -+ ":node_protocol_json", -+ ] -+ -+ args = [ -+ "--jinja_dir", -+ rebase_path("//third_party/", root_build_dir), # jinja is in chromium's third_party -+ "--output_base", -+ rebase_path("$target_gen_dir/src", root_build_dir), -+ "--config", -+ rebase_path("$target_gen_dir/node_protocol_config.json", root_build_dir), -+ ] -+ -+ outputs = -+ get_path_info(rebase_path(rebase_path(_protocol_generated, -+ ".", -+ "$inspector_protocol_output/.."), -+ ".", -+ "$target_gen_dir/src"), -+ "abspath") -+} -+ -+template("generate_protocol_json") { -+ copy_target_name = target_name + "_copy" -+ copy(copy_target_name) { -+ sources = invoker.sources -+ outputs = [ -+ "$target_gen_dir/{{source_file_part}}", -+ ] -+ } -+ copied_pdl = get_target_outputs(":$copy_target_name") -+ action(target_name) { -+ deps = [ -+ ":$copy_target_name", -+ ] -+ sources = copied_pdl -+ outputs = invoker.outputs -+ script = "$inspector_protocol_dir/convert_protocol_to_json.py" -+ args = rebase_path(sources + outputs, root_build_dir) -+ } -+} -+ -+copy("node_protocol_config") { -+ sources = [ -+ "node_protocol_config.json", -+ ] -+ outputs = [ -+ "$target_gen_dir/{{source_file_part}}", -+ ] -+} -+ -+generate_protocol_json("node_protocol_json") { -+ sources = [ -+ "node_protocol.pdl", -+ ] -+ outputs = [ -+ "$target_gen_dir/src/node_protocol.json", -+ ] -+} -+ -+generate_protocol_json("v8_protocol_json") { -+ sources = [ -+ "//v8/include/js_protocol.pdl", -+ ] -+ outputs = [ -+ "$target_gen_dir/js_protocol.json", -+ ] -+} -+ -+action("concatenate_protocols") { -+ deps = [ -+ ":node_protocol_json", -+ ":v8_protocol_json", -+ ] -+ inputs = [ -+ "$target_gen_dir/js_protocol.json", -+ "$target_gen_dir/src/node_protocol.json", -+ ] -+ outputs = [ -+ "$target_gen_dir/concatenated_protocol.json", -+ ] -+ script = "//v8/third_party/inspector_protocol/concatenate_protocols.py" -+ args = rebase_path(inputs + outputs, root_build_dir) -+} -+ -+action("v8_inspector_compress_protocol_json") { -+ deps = [ -+ ":concatenate_protocols", -+ ] -+ inputs = [ -+ "$target_gen_dir/concatenated_protocol.json", -+ ] -+ outputs = [ -+ "$target_gen_dir/v8_inspector_protocol_json.h", -+ ] -+ script = "../../tools/compress_json.py" -+ args = rebase_path(inputs + outputs, root_build_dir) + # Initialize v8 platform during node.js startup. +- node_use_v8_platform = true ++ node_use_v8_platform = false + + # Custom build tag. + node_tag = "" +@@ -58,7 +58,7 @@ declare_args() { + # TODO(zcbenz): There are few broken things for now: + # 1. cross-os compilation is not supported. + # 2. node_mksnapshot crashes when cross-compiling for x64 from arm64. +- node_use_node_snapshot = (host_os == target_os) && !(host_cpu == "arm64" && target_cpu == "x64") ++ node_use_node_snapshot = false } + + assert(!node_enable_inspector || node_use_openssl, diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index 706ea4f5cb90525c8ea56f794320a733c45a193f..c7ae7759595bfc7fdc31dab174a7514ddd8345e7 100644 +index 2bc7155f7c075e5a22ece7159a64a1c9ba3d8ac9..48d29a0d05538cd1d992f3f086d826e78d0d8882 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc -@@ -773,6 +773,7 @@ void BuiltinLoader::RegisterExternalReferences( +@@ -775,6 +775,7 @@ void BuiltinLoader::RegisterExternalReferences( registry->Register(GetNatives); RegisterExternalReferencesForInternalizedBuiltinCode(registry); @@ -2261,12 +878,25 @@ index 1cb85b9058d06555382e565dc32192a9fa48ed9f..cec9be01abd107e8612f70daf19b4834 // Handles compilation and caching of built-in JavaScript modules and // bootstrap scripts, whose source are bundled into the binary as static data. +diff --git a/tools/generate_config_gypi.py b/tools/generate_config_gypi.py +index 45b3ac5006140fb55aad0e6b78084b753a947a76..8667857107e4f2481fd98032d4333b086fb7b479 100755 +--- a/tools/generate_config_gypi.py ++++ b/tools/generate_config_gypi.py +@@ -21,7 +21,7 @@ import getnapibuildversion + GN_RE = re.compile(r'(\w+)\s+=\s+(.*?)$', re.MULTILINE) + + if sys.platform == 'win32': +- GN = 'gn.exe' ++ GN = 'gn.bat' + else: + GN = 'gn' + diff --git a/tools/generate_gn_filenames_json.py b/tools/generate_gn_filenames_json.py new file mode 100755 -index 0000000000000000000000000000000000000000..37c16859003e61636fe2f1a4040b1e904c472d0b +index 0000000000000000000000000000000000000000..54b761d91734aead50aeeba8c91a1262531df713 --- /dev/null +++ b/tools/generate_gn_filenames_json.py -@@ -0,0 +1,117 @@ +@@ -0,0 +1,118 @@ +#!/usr/bin/env python3 +import json +import os @@ -2318,6 +948,7 @@ index 0000000000000000000000000000000000000000..37c16859003e61636fe2f1a4040b1e90 + '<@(deps_files)', + '<@(node_sources)', + 'common.gypi', ++ 'common_node.gypi', + '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc', + } + @@ -2385,27 +1016,10 @@ index 0000000000000000000000000000000000000000..37c16859003e61636fe2f1a4040b1e90 + f.write(json.dumps(out, sort_keys=True, indent=2, separators=(',', ': '))) + f.write('\n') diff --git a/tools/install.py b/tools/install.py -index b132c7bf26c02886a7ab341a1973bf449744ba0f..757e3e60a7be01fac55c5fbb010dbbae00b1bfca 100755 +index bf54249b66c0d4e179deaae5a9fd55568e694fe0..57b51b03d237fba4b25aa69a663c88e9541b6cb5 100755 --- a/tools/install.py +++ b/tools/install.py -@@ -264,6 +264,7 @@ def headers(options, action): - 'include/v8-forward.h', - 'include/v8-function-callback.h', - 'include/v8-function.h', -+ 'include/v8-handle-base.h', - 'include/v8-initialization.h', - 'include/v8-internal.h', - 'include/v8-isolate.h', -@@ -284,6 +285,8 @@ def headers(options, action): - 'include/v8-promise.h', - 'include/v8-proxy.h', - 'include/v8-regexp.h', -+ "include/v8-sandbox.h", -+ "include/v8-source-location.h", - 'include/v8-script.h', - 'include/v8-snapshot.h', - 'include/v8-statistics.h', -@@ -390,7 +393,7 @@ def parse_options(args): +@@ -392,7 +392,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', @@ -2417,7 +1031,7 @@ index b132c7bf26c02886a7ab341a1973bf449744ba0f..757e3e60a7be01fac55c5fbb010dbbae diff --git a/tools/js2c.cc b/tools/js2c.cc old mode 100644 new mode 100755 -index e0f3d8844718ab8a6478c40ff713c1fd6bcff95a..c73a5b666dbaf555c749d836c20a7ae19a840847 +index a536b5dcd857275d3b02e361bd7d37a939f6b573..b2d5678d58a79774d5aeedc15ac5d5fd786f64bb --- a/tools/js2c.cc +++ b/tools/js2c.cc @@ -30,6 +30,7 @@ namespace js2c { @@ -2552,7 +1166,7 @@ index e0f3d8844718ab8a6478c40ff713c1fd6bcff95a..c73a5b666dbaf555c749d836c20a7ae1 // Should have exactly 3 types: `.js`, `.mjs` and `.gypi`. assert(file_map.size() == 3); auto gypi_it = file_map.find(".gypi"); -@@ -932,6 +989,7 @@ int Main(int argc, char* argv[]) { +@@ -939,6 +996,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); @@ -2560,10 +1174,171 @@ index e0f3d8844718ab8a6478c40ff713c1fd6bcff95a..c73a5b666dbaf555c749d836c20a7ae1 } } // namespace js2c } // namespace node -@@ -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); --} -+} -\ No newline at end of file +diff --git a/tools/search_files.py b/tools/search_files.py +index 65d0e1be42f0a85418491ebb548278cf431aa6a0..d4a31342f1c6107b029394c6e1d00a1d1e877e03 100755 +--- a/tools/search_files.py ++++ b/tools/search_files.py +@@ -14,6 +14,7 @@ if __name__ == '__main__': + try: + files = SearchFiles(*sys.argv[2:]) + files = [ os.path.relpath(x, sys.argv[1]) for x in files ] ++ files = [os.path.normpath(x).replace(os.sep, '/') for x in files] + print('\n'.join(files)) + except Exception as e: + print(str(e)) +diff --git a/unofficial.gni b/unofficial.gni +index c3b311e4a7f5444b07d4d7028d4621806959804e..de6ff5548ca5282199b7d85c11941c1fa351a9d9 100644 +--- a/unofficial.gni ++++ b/unofficial.gni +@@ -139,6 +139,7 @@ template("node_gn_build") { + public_deps = [ + "deps/ada", + "deps/uv", ++ "//electron:electron_js2c", + "deps/simdjson", + "$node_v8_path", + ] +@@ -150,7 +151,6 @@ template("node_gn_build") { + "deps/llhttp", + "deps/nbytes", + "deps/nghttp2", +- "deps/ngtcp2", + "deps/postject", + "deps/simdutf", + "deps/sqlite", +@@ -159,7 +159,11 @@ template("node_gn_build") { + "$node_v8_path:v8_libplatform", + ] + ++ cflags_cc = [ "-Wno-unguarded-availability-new" ] ++ + sources = [ ++ "src/node_snapshot_stub.cc", ++ "$root_gen_dir/electron_natives.cc", + "$target_gen_dir/node_javascript.cc", + ] + gypi_values.node_sources + +@@ -178,8 +182,10 @@ template("node_gn_build") { + deps += [ "//third_party/icu" ] + } + if (node_use_openssl) { +- deps += [ "deps/ncrypto" ] +- public_deps += [ "deps/openssl" ] ++ deps += [ ++ "deps/ncrypto", ++ "//third_party/boringssl" ++ ] + sources += gypi_values.node_crypto_sources + } + if (node_enable_inspector) { +@@ -276,6 +282,7 @@ template("node_gn_build") { + } + + executable("node_js2c") { ++ defines = [] + deps = [ + "deps/simdutf", + "deps/uv", +@@ -286,26 +293,75 @@ template("node_gn_build") { + "src/embedded_data.cc", + "src/embedded_data.h", + ] +- include_dirs = [ "src" ] ++ include_dirs = [ "src", "tools" ] ++ ++ if (!is_win) { ++ defines += [ "NODE_JS2C_USE_STRING_LITERALS" ] ++ } ++ } ++ ++ node_deps_files = gypi_values.deps_files + node_builtin_shareable_builtins ++ node_library_files = exec_script("./tools/search_files.py", ++ [ rebase_path(".", root_build_dir), ++ rebase_path("lib", root_build_dir), ++ "js" ], ++ "list lines") ++ ++ fs_files = [ ++ "lib/internal/fs/cp/cp-sync.js", ++ "lib/internal/fs/cp/cp.js", ++ "lib/internal/fs/dir.js", ++ "lib/internal/fs/glob.js", ++ "lib/internal/fs/promises.js", ++ "lib/internal/fs/read/context.js", ++ "lib/internal/fs/recursive_watch.js", ++ "lib/internal/fs/rimraf.js", ++ "lib/internal/fs/streams.js", ++ "lib/internal/fs/sync_write_stream.js", ++ "lib/internal/fs/utils.js", ++ "lib/internal/fs/watchers.js", ++ "lib/fs.js", ++ "lib/fs/promises.js" ++ ] ++ ++ original_fs_files = [] ++ foreach(file, fs_files) { ++ original_fs_files += [string_replace(string_replace(string_replace(file, "internal/fs/", "internal/original-fs/"), "lib/fs.js", "lib/original-fs.js"), "lib/fs/", "lib/original-fs/")] ++ } ++ ++ copy("node_js2c_inputs") { ++ sources = node_deps_files + node_library_files ++ outputs = [ ++ "$target_gen_dir/js2c_inputs/{{source_target_relative}}", ++ ] ++ } ++ ++ action("node_js2c_original_fs") { ++ script = "//electron/script/node/generate_original_fs.py" ++ inputs = fs_files ++ deps = [ ":node_js2c_inputs" ] ++ ++ outputs = [] ++ foreach(file, original_fs_files) { ++ outputs += ["$target_gen_dir/js2c_inputs/$file"] ++ } ++ ++ args = [rebase_path("$target_gen_dir/js2c_inputs")] + fs_files + } + + action("run_node_js2c") { +- script = "$node_v8_path/tools/run.py" ++ script = "//electron/build/run-in-dir.py" + deps = [ ++ ":node_js2c_original_fs", + ":node_js2c($host_toolchain)", + ":generate_config_gypi", + ] + +- node_deps_files = gypi_values.deps_files + node_builtin_shareable_builtins +- node_library_files = exec_script("./tools/search_files.py", +- [ rebase_path(".", root_build_dir), +- rebase_path("lib", root_build_dir), +- "js" ], +- "list lines") +- ++ config_gypi = [ "$target_gen_dir/config.gypi" ] + inputs = node_library_files + + node_deps_files + +- [ "$target_gen_dir/config.gypi" ] ++ get_target_outputs(":node_js2c_original_fs") + ++ config_gypi + outputs = [ "$target_gen_dir/node_javascript.cc" ] + + # Get the path to node_js2c executable of the host toolchain. +@@ -319,11 +375,11 @@ template("node_gn_build") { + get_label_info(":node_js2c($host_toolchain)", "name") + + host_executable_suffix + +- args = [ rebase_path(node_js2c_path), +- rebase_path("$target_gen_dir/node_javascript.cc"), +- "--root", rebase_path("."), +- "lib", rebase_path("$target_gen_dir/config.gypi") ] + +- node_deps_files ++ args = [ rebase_path("$target_gen_dir/js2c_inputs"), ++ rebase_path(node_js2c_path), ++ rebase_path("$target_gen_dir/node_javascript.cc")] + ++ rebase_path(config_gypi) + node_deps_files + ++ original_fs_files + node_library_files + } + + executable("node_cctest") { diff --git a/patches/node/build_compile_with_c_20_support.patch b/patches/node/build_compile_with_c_20_support.patch index bef0bb28e9..c83de137e2 100644 --- a/patches/node/build_compile_with_c_20_support.patch +++ b/patches/node/build_compile_with_c_20_support.patch @@ -10,28 +10,19 @@ V8 requires C++20 support as of https://chromium-review.googlesource.com/c/v8/v8 This can be removed when Electron upgrades to a version of Node.js containing the required V8 version. diff --git a/common.gypi b/common.gypi -index bdf1a1f33f3ea09d933757c7fee87c563cc833ab..2eb62610db2f0ebf68fa9a55ffba98291ecfe451 100644 +index 74616453e2e047acbb9e25f2f93ebeab06011669..bce15fc4a8b3f2fa0b5a588e6a2b28d2b8b6ac45 100644 --- a/common.gypi +++ b/common.gypi -@@ -305,7 +305,7 @@ - 'VCCLCompilerTool': { - 'AdditionalOptions': [ - '/Zc:__cplusplus', -- '-std:c++17' -+ '-std:c++20' +@@ -518,7 +518,7 @@ + '-fno-rtti', + '-fno-exceptions', + '-fno-strict-aliasing', +- '-std=gnu++17', ++ '-std=gnu++20', ], - 'BufferSecurityCheck': 'true', - 'DebugInformationFormat': 1, # /Z7 embed info in .obj files -@@ -487,7 +487,7 @@ - }], - [ 'OS in "linux freebsd openbsd solaris android aix os400 cloudabi"', { - 'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ], -- 'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++17' ], -+ 'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++20' ], 'defines': [ '__STDC_FORMAT_MACROS' ], 'ldflags': [ '-rdynamic' ], - 'target_conditions': [ -@@ -658,7 +658,7 @@ +@@ -688,7 +688,7 @@ ['clang==1', { 'xcode_settings': { 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', diff --git a/patches/node/build_enable_perfetto.patch b/patches/node/build_enable_perfetto.patch index 2d8e77f07f..0bfc4367eb 100644 --- a/patches/node/build_enable_perfetto.patch +++ b/patches/node/build_enable_perfetto.patch @@ -12,6 +12,19 @@ adding associated guards there should be relatively small. We should upstream this as it will eventually impact Node.js as well. +diff --git a/filenames.json b/filenames.json +index 5af3886d8d3d74d31249a4d79030a8373b8dad52..8ab04d0b1b58454c6ea21f33870f9557f3a57b56 100644 +--- a/filenames.json ++++ b/filenames.json +@@ -739,8 +739,6 @@ + "src/tcp_wrap.h", + "src/timers.h", + "src/tracing/agent.h", +- "src/tracing/node_trace_buffer.h", +- "src/tracing/node_trace_writer.h", + "src/tracing/trace_event.h", + "src/tracing/trace_event_common.h", + "src/tracing/traced_value.h", diff --git a/lib/internal/constants.js b/lib/internal/constants.js index 8d7204f6cb48f783adc4d1c1eb2de0c83b7fffe2..a154559a56bf383d3c26af523c9bb07b564ef600 100644 --- a/lib/internal/constants.js @@ -63,11 +76,62 @@ index 251f51ec454f9cba4023b8b6729241ee753aac13..1de8cac6e3953ce9cab9db03530da327 } module.exports = { +diff --git a/node.gyp b/node.gyp +index 11474953b186c7b3ec2edb0539f34572e6c551b7..eeaaef8a06cdc2d17e89f9c719f9922e6e04ce92 100644 +--- a/node.gyp ++++ b/node.gyp +@@ -174,7 +174,6 @@ + 'src/timers.cc', + 'src/timer_wrap.cc', + 'src/tracing/agent.cc', +- 'src/tracing/node_trace_buffer.cc', + 'src/tracing/node_trace_writer.cc', + 'src/tracing/trace_event.cc', + 'src/tracing/traced_value.cc', +@@ -302,7 +301,6 @@ + 'src/tcp_wrap.h', + 'src/timers.h', + 'src/tracing/agent.h', +- 'src/tracing/node_trace_buffer.h', + 'src/tracing/node_trace_writer.h', + 'src/tracing/trace_event.h', + 'src/tracing/trace_event_common.h', +diff --git a/src/inspector/tracing_agent.cc b/src/inspector/tracing_agent.cc +index e7b6d3b3ea63bdc80e569f56209e958b4fcde328..b52d5b1c7293539315626cd67f794cce4cfd1760 100644 +--- a/src/inspector/tracing_agent.cc ++++ b/src/inspector/tracing_agent.cc +@@ -84,14 +84,14 @@ class InspectorTraceWriter : public node::tracing::AsyncTraceWriter { + explicit InspectorTraceWriter(int frontend_object_id, + std::shared_ptr main_thread) + : frontend_object_id_(frontend_object_id), main_thread_(main_thread) {} +- ++#ifndef V8_USE_PERFETTO + void AppendTraceEvent( + v8::platform::tracing::TraceObject* trace_event) override { + if (!json_writer_) + json_writer_.reset(TraceWriter::CreateJSONTraceWriter(stream_, "value")); + json_writer_->AppendTraceEvent(trace_event); + } +- ++#endif + void Flush(bool) override { + if (!json_writer_) + return; diff --git a/src/tracing/agent.cc b/src/tracing/agent.cc -index 7ce59674356f9743438350949be42fa7ead2afbe..c5fedc3be86a77730c57321b9c73cc8e94a001d7 100644 +index 7ce59674356f9743438350949be42fa7ead2afbe..30bff4272ed8eb5146e3b73a4849c187177fc3bd 100644 --- a/src/tracing/agent.cc +++ b/src/tracing/agent.cc -@@ -50,7 +50,9 @@ using v8::platform::tracing::TraceWriter; +@@ -2,7 +2,9 @@ + + #include + #include "trace_event.h" ++#ifndef V8_USE_PERFETTO + #include "tracing/node_trace_buffer.h" ++#endif + #include "debug_utils-inl.h" + #include "env-inl.h" + +@@ -50,7 +52,9 @@ using v8::platform::tracing::TraceWriter; using std::string; Agent::Agent() : tracing_controller_(new TracingController()) { @@ -77,7 +141,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..c5fedc3be86a77730c57321b9c73cc8e CHECK_EQ(uv_loop_init(&tracing_loop_), 0); CHECK_EQ(uv_async_init(&tracing_loop_, -@@ -86,10 +88,14 @@ Agent::~Agent() { +@@ -86,10 +90,14 @@ Agent::~Agent() { void Agent::Start() { if (started_) return; @@ -93,7 +157,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..c5fedc3be86a77730c57321b9c73cc8e // This thread should be created *after* async handles are created // (within NodeTraceWriter and NodeTraceBuffer constructors). -@@ -143,8 +149,10 @@ void Agent::StopTracing() { +@@ -143,8 +151,10 @@ void Agent::StopTracing() { return; // Perform final Flush on TraceBuffer. We don't want the tracing controller // to flush the buffer again on destruction of the V8::Platform. @@ -105,7 +169,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..c5fedc3be86a77730c57321b9c73cc8e started_ = false; // Thread should finish when the tracing loop is stopped. -@@ -202,6 +210,7 @@ std::string Agent::GetEnabledCategories() const { +@@ -202,6 +212,7 @@ std::string Agent::GetEnabledCategories() const { return categories; } @@ -113,7 +177,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..c5fedc3be86a77730c57321b9c73cc8e void Agent::AppendTraceEvent(TraceObject* trace_event) { for (const auto& id_writer : writers_) id_writer.second->AppendTraceEvent(trace_event); -@@ -211,18 +220,21 @@ void Agent::AddMetadataEvent(std::unique_ptr event) { +@@ -211,18 +222,21 @@ void Agent::AddMetadataEvent(std::unique_ptr event) { Mutex::ScopedLock lock(metadata_events_mutex_); metadata_events_.push_back(std::move(event)); } @@ -136,7 +200,7 @@ index 7ce59674356f9743438350949be42fa7ead2afbe..c5fedc3be86a77730c57321b9c73cc8e void TracingController::AddMetadataEvent( const unsigned char* category_group_enabled, const char* name, -@@ -246,6 +258,6 @@ void TracingController::AddMetadataEvent( +@@ -246,6 +260,6 @@ void TracingController::AddMetadataEvent( if (node_agent != nullptr) node_agent->AddMetadataEvent(std::move(trace_event)); } @@ -198,26 +262,20 @@ index b542a849fe8da7e8bbbcca7067b73dc32b18d6d3..059ce6f6ea17199ead09c6c13bcc680f }; void AgentWriterHandle::reset() { -diff --git a/src/tracing/node_trace_buffer.cc b/src/tracing/node_trace_buffer.cc -index e187a1d78c81972b69cd4e03f7079cdb727956ad..3256c6326a08c6cafd83f1e49e3350193e813b51 100644 ---- a/src/tracing/node_trace_buffer.cc -+++ b/src/tracing/node_trace_buffer.cc -@@ -55,6 +55,7 @@ TraceObject* InternalTraceBuffer::GetEventByHandle(uint64_t handle) { - } - - void InternalTraceBuffer::Flush(bool blocking) { +diff --git a/src/tracing/node_trace_buffer.h b/src/tracing/node_trace_buffer.h +index 18e4f43efaae3a60b924e697918867e604513194..7cbaf01235750138c680c8ec2ed5d206d638f8b6 100644 +--- a/src/tracing/node_trace_buffer.h ++++ b/src/tracing/node_trace_buffer.h +@@ -42,7 +42,9 @@ class InternalTraceBuffer { + bool flushing_; + size_t max_chunks_; + Agent* agent_; +#ifndef V8_USE_PERFETTO - { - Mutex::ScopedLock scoped_lock(mutex_); - if (total_chunks_ > 0) { -@@ -75,6 +76,7 @@ void InternalTraceBuffer::Flush(bool blocking) { - flushing_ = false; - } - } + std::vector> chunks_; +#endif - agent_->Flush(blocking); - } - + size_t total_chunks_ = 0; + uint32_t current_chunk_seq_ = 1; + uint32_t id_; diff --git a/src/tracing/node_trace_writer.cc b/src/tracing/node_trace_writer.cc index 8f053efe93324b9acbb4e85f7b974b4f7712e200..e331ed5567caa39ade90ce28cea69f1d10533812 100644 --- a/src/tracing/node_trace_writer.cc 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 ae020d1bb1..4001cf3cb6 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 697b8bba6a55358924d6986f2eb347a99ff73889..bdf1a1f33f3ea09d933757c7fee87c563cc833ab 100644 +index 229cb96c1385c597138719f2b01f78bd54ad44ab..74616453e2e047acbb9e25f2f93ebeab06011669 100644 --- a/common.gypi +++ b/common.gypi @@ -86,6 +86,8 @@ @@ -19,7 +19,7 @@ index 697b8bba6a55358924d6986f2eb347a99ff73889..bdf1a1f33f3ea09d933757c7fee87c56 ##### end V8 defaults ##### # When building native modules using 'npm install' with the system npm, -@@ -285,6 +287,7 @@ +@@ -291,6 +293,7 @@ # Defines these mostly for node-gyp to pickup. 'defines': [ '_GLIBCXX_USE_CXX11_ABI=1', @@ -27,7 +27,7 @@ index 697b8bba6a55358924d6986f2eb347a99ff73889..bdf1a1f33f3ea09d933757c7fee87c56 ], # Forcibly disable -Werror. We support a wide range of compilers, it's -@@ -414,6 +417,11 @@ +@@ -437,6 +440,11 @@ }], ], }], @@ -40,19 +40,19 @@ index 697b8bba6a55358924d6986f2eb347a99ff73889..bdf1a1f33f3ea09d933757c7fee87c56 # list in v8/BUILD.gn. ['v8_enable_v8_checks == 1', { diff --git a/configure.py b/configure.py -index a6f66c41f75bffcfaf75d4415c694300b7624136..7ca0762fe3590fef7b88ba684de44d99aaecace4 100755 +index d03db1970fd7a1629a7a7719a5ff267402ab4a66..ce055fb5dfc84c75c486b99f01fea6b9531ff54b 100755 --- a/configure.py +++ b/configure.py -@@ -1585,6 +1585,7 @@ def configure_library(lib, output, pkgname=None): +@@ -1634,6 +1634,7 @@ def configure_library(lib, output, pkgname=None): + def configure_v8(o, configs): + set_configuration_variable(configs, 'v8_enable_v8_checks', release=1, debug=0) - - def configure_v8(o): + o['variables']['using_electron_config_gypi'] = 1 o['variables']['v8_enable_webassembly'] = 0 if options.v8_lite_mode else 1 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 4f2eb9d0aab88b70c86339e750799080e980d7da..df3fb3372d6357b5d77b4f683e309b8483998128 100644 +index 0fec9477fd0f2a3c2aa68284131c510b0da0e025..c16204ad2a4787eeffe61eedda254d3a5509df8c 100644 --- a/src/node.h +++ b/src/node.h @@ -22,6 +22,12 @@ 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 6c5aa02753..aaba7297e7 100644 --- a/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch +++ b/patches/node/build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch @@ -34,10 +34,10 @@ index f5ecc15159f457cd0b8069c0427b7c758c916c4e..c9ce67391f321989b0af48159b4da3ab let kResistStopPropagation; diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index c7ae7759595bfc7fdc31dab174a7514ddd8345e7..4bf80aa6cc6385dc376fd0a3538efc27fe5bd0a2 100644 +index 48d29a0d05538cd1d992f3f086d826e78d0d8882..8987234c2d08449242b5fd037ed314b725bc42a5 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc -@@ -35,6 +35,7 @@ using v8::Value; +@@ -34,6 +34,7 @@ using v8::Value; BuiltinLoader::BuiltinLoader() : config_(GetConfig()), code_cache_(std::make_shared()) { LoadJavaScriptSource(); diff --git a/patches/node/build_restore_clang_as_default_compiler_on_macos.patch b/patches/node/build_restore_clang_as_default_compiler_on_macos.patch index 0423182e8b..5cee2b1aef 100644 --- a/patches/node/build_restore_clang_as_default_compiler_on_macos.patch +++ b/patches/node/build_restore_clang_as_default_compiler_on_macos.patch @@ -11,7 +11,7 @@ node-gyp will use the result of `process.config` that reflects the environment in which the binary got built. diff --git a/common.gypi b/common.gypi -index 2eb62610db2f0ebf68fa9a55ffba98291ecfe451..3ec08ee144b586d05c4e49c2251416734cbc02c5 100644 +index bce15fc4a8b3f2fa0b5a588e6a2b28d2b8b6ac45..289ab5d282e93c795eafb5fb992c3bbc4790a687 100644 --- a/common.gypi +++ b/common.gypi @@ -125,6 +125,7 @@ diff --git a/patches/node/cherry-pick_src_remove_calls_to_recently_deprecated_v8_apis.patch b/patches/node/cherry-pick_src_remove_calls_to_recently_deprecated_v8_apis.patch deleted file mode 100644 index 2d33d6a273..0000000000 --- a/patches/node/cherry-pick_src_remove_calls_to_recently_deprecated_v8_apis.patch +++ /dev/null @@ -1,182 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Adam Klein -Date: Wed, 15 May 2024 09:16:00 +0200 -Subject: cherry-pick: src: remove calls to recently deprecated V8 APIs - -Node.js Commit: a6d54f179d997497a95c18456bef6bc3ee15e2c4 -Node.js PR: https://github.com/nodejs/node/pull/52996 -V8 API Removal CL: https://chromium-review.googlesource.com/c/v8/v8/+/5539888 - -This patch is slightly modified from the original commit in order to -resolve conflicts due to the base commit difference between the Node.js -PR and the current upgrade roll. - -This patch is expected to be deleted once we catch up with a Node.js -upgrade that includes the original Node.js commit above. - -diff --git a/src/module_wrap.cc b/src/module_wrap.cc -index ff658ec88e5161cd66536ee6e95dba675b16eccc..9bbb8ab908d8d992abb43254860d51f57f56387b 100644 ---- a/src/module_wrap.cc -+++ b/src/module_wrap.cc -@@ -202,8 +202,7 @@ void ModuleWrap::New(const FunctionCallbackInfo& args) { - } - - Local source_text = args[2].As(); -- ScriptOrigin origin(isolate, -- url, -+ ScriptOrigin origin(url, - line_offset, - column_offset, - true, // is cross origin -@@ -464,7 +463,6 @@ void ModuleWrap::Evaluate(const FunctionCallbackInfo& args) { - - ShouldNotAbortOnUncaughtScope no_abort_scope(realm->env()); - TryCatchScope try_catch(realm->env()); -- Isolate::SafeForTerminationScope safe_for_termination(isolate); - - bool timed_out = false; - bool received_signal = false; -diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index 4bf80aa6cc6385dc376fd0a3538efc27fe5bd0a2..3e37aa8b0c9696cceb3f3cfab9721f38c74a2fba 100644 ---- a/src/node_builtins.cc -+++ b/src/node_builtins.cc -@@ -267,7 +267,7 @@ MaybeLocal BuiltinLoader::LookupAndCompileInternal( - std::string filename_s = std::string("node:") + id; - Local filename = - OneByteString(isolate, filename_s.c_str(), filename_s.size()); -- ScriptOrigin origin(isolate, filename, 0, 0, true); -+ ScriptOrigin origin(filename, 0, 0, true); - - BuiltinCodeCacheData cached_data{}; - { -diff --git a/src/node_contextify.cc b/src/node_contextify.cc -index 6456d87d4202c013aafe071adbac06852b3ae2c1..28ba7dbe66a44a43c39e3d75edf0be9513bcf732 100644 ---- a/src/node_contextify.cc -+++ b/src/node_contextify.cc -@@ -877,16 +877,15 @@ void ContextifyScript::New(const FunctionCallbackInfo& args) { - host_defined_options->Set( - isolate, loader::HostDefinedOptions::kID, id_symbol); - -- ScriptOrigin origin(isolate, -- filename, -- line_offset, // line offset -- column_offset, // column offset -- true, // is cross origin -- -1, // script id -- Local(), // source map URL -- false, // is opaque (?) -- false, // is WASM -- false, // is ES Module -+ ScriptOrigin origin(filename, -+ line_offset, // line offset -+ column_offset, // column offset -+ true, // is cross origin -+ -1, // script id -+ Local(), // source map URL -+ false, // is opaque (?) -+ false, // is WASM -+ false, // is ES Module - host_defined_options); - ScriptCompiler::Source source(code, origin, cached_data); - ScriptCompiler::CompileOptions compile_options = -@@ -998,7 +997,7 @@ MaybeLocal CompileFunction(Local context, - Local filename, - Local content, - std::vector>* parameters) { -- ScriptOrigin script_origin(context->GetIsolate(), filename, 0, 0, true); -+ ScriptOrigin script_origin(filename, 0, 0, true); - ScriptCompiler::Source script_source(content, script_origin); - - return ScriptCompiler::CompileFunction(context, -@@ -1108,7 +1107,6 @@ bool ContextifyScript::EvalMachine(Local context, - } - - TryCatchScope try_catch(env); -- Isolate::SafeForTerminationScope safe_for_termination(env->isolate()); - ContextifyScript* wrapped_script; - ASSIGN_OR_RETURN_UNWRAP(&wrapped_script, args.This(), false); - Local unbound_script = -@@ -1286,8 +1284,7 @@ void ContextifyContext::CompileFunction( - Local host_defined_options = - GetHostDefinedOptions(isolate, id_symbol); - ScriptCompiler::Source source = -- GetCommonJSSourceInstance(isolate, -- code, -+ GetCommonJSSourceInstance(code, - filename, - line_offset, - column_offset, -@@ -1342,15 +1339,13 @@ void ContextifyContext::CompileFunction( - } - - ScriptCompiler::Source ContextifyContext::GetCommonJSSourceInstance( -- Isolate* isolate, - Local code, - Local filename, - int line_offset, - int column_offset, - Local host_defined_options, - ScriptCompiler::CachedData* cached_data) { -- ScriptOrigin origin(isolate, -- filename, -+ ScriptOrigin origin(filename, - line_offset, // line offset - column_offset, // column offset - true, // is cross origin -@@ -1528,7 +1523,7 @@ void ContextifyContext::ContainsModuleSyntax( - Local host_defined_options = - GetHostDefinedOptions(isolate, id_symbol); - ScriptCompiler::Source source = GetCommonJSSourceInstance( -- isolate, code, filename, 0, 0, host_defined_options, nullptr); -+ code, filename, 0, 0, host_defined_options, nullptr); - ScriptCompiler::CompileOptions options = GetCompileOptions(source); - - std::vector> params = GetCJSParameters(env->isolate_data()); -@@ -1576,7 +1571,7 @@ void ContextifyContext::ContainsModuleSyntax( - code, - String::NewFromUtf8(isolate, "})();").ToLocalChecked()); - ScriptCompiler::Source wrapped_source = GetCommonJSSourceInstance( -- isolate, code, filename, 0, 0, host_defined_options, nullptr); -+ code, filename, 0, 0, host_defined_options, nullptr); - std::ignore = ScriptCompiler::CompileFunction( - context, - &wrapped_source, -@@ -1629,8 +1624,7 @@ static void CompileFunctionForCJSLoader( - - Local symbol = env->vm_dynamic_import_default_internal(); - Local hdo = GetHostDefinedOptions(isolate, symbol); -- ScriptOrigin origin(isolate, -- filename, -+ ScriptOrigin origin(filename, - 0, // line offset - 0, // column offset - true, // is cross origin -diff --git a/src/node_contextify.h b/src/node_contextify.h -index 517e3f44d324900222e1da961a4cd60bbb4a85f9..10715c7eb07715cc11e49734bd54747dad95f6a4 100644 ---- a/src/node_contextify.h -+++ b/src/node_contextify.h -@@ -99,7 +99,6 @@ class ContextifyContext : public BaseObject { - v8::Local id_symbol, - const errors::TryCatchScope& try_catch); - static v8::ScriptCompiler::Source GetCommonJSSourceInstance( -- v8::Isolate* isolate, - v8::Local code, - v8::Local filename, - int line_offset, -diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc -index 64e38c83006a004ebc3519a5e9f8b04263244514..14e82cc80ff73084fb43b2ef07febfd2667a0abc 100644 ---- a/test/cctest/test_environment.cc -+++ b/test/cctest/test_environment.cc -@@ -620,12 +620,9 @@ TEST_F(EnvironmentTest, SetImmediateMicrotasks) { - - #ifndef _WIN32 // No SIGINT on Windows. - TEST_F(NodeZeroIsolateTestFixture, CtrlCWithOnlySafeTerminationTest) { -- // We need to go through the whole setup dance here because we want to -- // set only_terminate_in_safe_scope. - // Allocate and initialize Isolate. - v8::Isolate::CreateParams create_params; - create_params.array_buffer_allocator = allocator.get(); -- create_params.only_terminate_in_safe_scope = true; - v8::Isolate* isolate = v8::Isolate::Allocate(); - CHECK_NOT_NULL(isolate); - platform->RegisterIsolate(isolate, ¤t_loop); diff --git a/patches/node/chore_add_context_to_context_aware_module_prevention.patch b/patches/node/chore_add_context_to_context_aware_module_prevention.patch index b0119bd437..c74109225a 100644 --- a/patches/node/chore_add_context_to_context_aware_module_prevention.patch +++ b/patches/node/chore_add_context_to_context_aware_module_prevention.patch @@ -8,7 +8,7 @@ modules from being used in the renderer process. This should be upstreamed as a customizable error message. diff --git a/src/node_binding.cc b/src/node_binding.cc -index 4e750be66452de47040e3a46555c062dfccf7807..5e1caeee18e447cc76b980df712521cf8b60e8da 100644 +index b5c0a93d83ab4d4f6792d0eb648e7198de874bcf..0fd01987c29b06b91944d18266ba67994c1fac45 100644 --- a/src/node_binding.cc +++ b/src/node_binding.cc @@ -4,6 +4,7 @@ @@ -19,7 +19,7 @@ index 4e750be66452de47040e3a46555c062dfccf7807..5e1caeee18e447cc76b980df712521cf #include "util.h" #include -@@ -483,7 +484,12 @@ void DLOpen(const FunctionCallbackInfo& args) { +@@ -495,7 +496,12 @@ void DLOpen(const FunctionCallbackInfo& args) { if (mp->nm_context_register_func == nullptr) { if (env->force_context_aware()) { dlib->Close(); 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 db246d414e..23e2ee6694 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 364469160af5e348f8890417de16a63c0d1dca67..75d5f58fe02fa8cfa7716ffaf761d567ab403a2c 100644 +index d49941881e6cfd8647a6d44a57e0daaf1c874702..f696fb263b356a76b87cd4b6c4b1a0fd60a84afd 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -1441,6 +1441,13 @@ Module.prototype._compile = function(content, filename, loadAsESM = false) { +@@ -1518,6 +1518,13 @@ Module.prototype._compile = function(content, filename, format) { 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 364469160af5e348f8890417de16a63c0d1dca67..75d5f58fe02fa8cfa7716ffaf761d567 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 ea7afd52fab1cf3fde1674be1429a00562b714c0..02cfc8b3328fedb6306abf6c738bea772c674458 100644 +index cb96fd1bc4fcdce750ce241ee5f47f2ae39cfdc6..c46b270109697f7cc1683f8f9f463575e5040216 100644 --- a/lib/internal/process/pre_execution.js +++ b/lib/internal/process/pre_execution.js -@@ -247,12 +247,14 @@ function patchProcessObject(expandArgv1) { +@@ -243,12 +243,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_disable_deprecation_ftbfs_in_simdjson_header.patch b/patches/node/chore_disable_deprecation_ftbfs_in_simdjson_header.patch new file mode 100644 index 0000000000..266554c00c --- /dev/null +++ b/patches/node/chore_disable_deprecation_ftbfs_in_simdjson_header.patch @@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Charles Kerr +Date: Mon, 4 Nov 2024 17:40:17 -0600 +Subject: chore: disable deprecation ftbfs in simdjson header + +Without this patch, building with simdjson fails with + +> error: identifier '_padded' preceded by whitespace in a literal operator +> declaration is deprecated [-Werror,-Wdeprecated-literal-operator] + +This patch can be removed once this is fixed upstream in simdjson. + +diff --git a/deps/simdjson/simdjson.h b/deps/simdjson/simdjson.h +index ddb6f2e4e0a6edd23d5e16db07bc4bb18974d4aa..533dfea4d5fd3c7f6f7fdf0ea525479b11634fd3 100644 +--- a/deps/simdjson/simdjson.h ++++ b/deps/simdjson/simdjson.h +@@ -3650,12 +3650,17 @@ inline std::ostream& operator<<(std::ostream& out, simdjson_result padded_string::load(std::string_view filen + + } // namespace simdjson + ++#pragma clang diagnostic push ++#pragma clang diagnostic ignored "-Wdeprecated-literal-operator" ++ + inline simdjson::padded_string operator "" _padded(const char *str, size_t len) { + return simdjson::padded_string(str, len); + } +@@ -4041,6 +4049,8 @@ inline simdjson::padded_string operator "" _padded(const char8_t *str, size_t le + return simdjson::padded_string(reinterpret_cast(str), len); + } + #endif ++#pragma clang diagnostic pop ++ + #endif // SIMDJSON_PADDED_STRING_INL_H + /* end file simdjson/padded_string-inl.h */ + /* skipped duplicate #include "simdjson/padded_string_view.h" */ +@@ -118280,4 +118290,4 @@ namespace simdjson { + /* end file simdjson/ondemand.h */ + + #endif // SIMDJSON_H +-/* end file simdjson.h */ ++/* end file simdjson.h */ +\ No newline at end of file diff --git a/patches/node/chore_expose_importmoduledynamically_and.patch b/patches/node/chore_expose_importmoduledynamically_and.patch index 18583f403a..53d3d0a6e0 100644 --- a/patches/node/chore_expose_importmoduledynamically_and.patch +++ b/patches/node/chore_expose_importmoduledynamically_and.patch @@ -11,7 +11,7 @@ its own blended handler between Node and Blink. Not upstreamable. diff --git a/lib/internal/modules/esm/utils.js b/lib/internal/modules/esm/utils.js -index 150816057129c147c13ce044474f341581679f34..dd8627653265e22f55e67ec4a47641b20fba6c9d 100644 +index d393d4336a0c1e681e4f6b4e5c7cf2bcc5fc287e..807cb5172e0c2178b6c20e81f8175141d3a0284f 100644 --- a/lib/internal/modules/esm/utils.js +++ b/lib/internal/modules/esm/utils.js @@ -30,7 +30,7 @@ const { @@ -40,10 +40,10 @@ index 150816057129c147c13ce044474f341581679f34..dd8627653265e22f55e67ec4a47641b2 /** diff --git a/src/module_wrap.cc b/src/module_wrap.cc -index eea74bed4bb8a980f99a9a1404c9a2df203ca09c..e862b51293135995c527c32aa3c3579780d7831c 100644 +index 48b61e8b7600701c4992a98ff802614ce915faee..4e9835e502a8d078a448aa4253f37de0f49f4854 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc -@@ -752,7 +752,7 @@ MaybeLocal ModuleWrap::ResolveModuleCallback( +@@ -813,7 +813,7 @@ MaybeLocal ModuleWrap::ResolveModuleCallback( return module->module_.Get(isolate); } @@ -52,7 +52,7 @@ index eea74bed4bb8a980f99a9a1404c9a2df203ca09c..e862b51293135995c527c32aa3c35797 Local context, Local host_defined_options, Local resource_name, -@@ -817,12 +817,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback( +@@ -878,12 +878,13 @@ void ModuleWrap::SetImportModuleDynamicallyCallback( Realm* realm = Realm::GetCurrent(args); HandleScope handle_scope(isolate); @@ -68,7 +68,7 @@ index eea74bed4bb8a980f99a9a1404c9a2df203ca09c..e862b51293135995c527c32aa3c35797 } void ModuleWrap::HostInitializeImportMetaObjectCallback( -@@ -864,13 +865,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback( +@@ -925,13 +926,14 @@ void ModuleWrap::SetInitializeImportMetaObjectCallback( Realm* realm = Realm::GetCurrent(args); Isolate* isolate = realm->isolate(); @@ -87,18 +87,18 @@ index eea74bed4bb8a980f99a9a1404c9a2df203ca09c..e862b51293135995c527c32aa3c35797 MaybeLocal ModuleWrap::SyntheticModuleEvaluationStepsCallback( diff --git a/src/module_wrap.h b/src/module_wrap.h -index 45a338b38e01c824f69ea59ee286130c67e9eddf..99bb079df11696fc3ba5e6bcca7e7a42818fe3d1 100644 +index 83b5793013cbc453cf92c0a006fc7be3c06ad276..90353954bc497cb4ae413dc134850f8abb4efc7c 100644 --- a/src/module_wrap.h +++ b/src/module_wrap.h -@@ -7,6 +7,7 @@ - #include +@@ -8,6 +8,7 @@ + #include #include #include "base_object.h" +#include "node.h" + #include "v8-script.h" namespace node { - -@@ -31,7 +32,14 @@ enum HostDefinedOptions : int { +@@ -33,7 +34,14 @@ enum HostDefinedOptions : int { kLength = 9, }; @@ -114,20 +114,20 @@ index 45a338b38e01c824f69ea59ee286130c67e9eddf..99bb079df11696fc3ba5e6bcca7e7a42 public: enum InternalFields { kModuleSlot = BaseObject::kInternalFieldCount, -@@ -68,6 +76,8 @@ class ModuleWrap : public BaseObject { - return true; - } +@@ -91,6 +99,8 @@ class ModuleWrap : public BaseObject { + static void CreateRequiredModuleFacade( + const v8::FunctionCallbackInfo& args); + static ModuleWrap* GetFromModule(node::Environment*, v8::Local); + private: ModuleWrap(Realm* realm, v8::Local object, -@@ -110,7 +120,6 @@ class ModuleWrap : public BaseObject { +@@ -129,7 +139,6 @@ class ModuleWrap : public BaseObject { v8::Local specifier, v8::Local import_attributes, v8::Local referrer); - static ModuleWrap* GetFromModule(node::Environment*, v8::Local); v8::Global module_; - std::unordered_map> resolve_cache_; + std::unordered_map> resolve_cache_; diff --git a/patches/node/chore_remove_--no-harmony-atomics_related_code.patch b/patches/node/chore_remove_--no-harmony-atomics_related_code.patch deleted file mode 100644 index cc52a3017c..0000000000 --- a/patches/node/chore_remove_--no-harmony-atomics_related_code.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Wed, 19 Apr 2023 14:13:23 +0200 -Subject: chore: remove --no-harmony-atomics related code - -This was removed in https://chromium-review.googlesource.com/c/v8/v8/+/4416459. - -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 74e867ace6207751a96b4da03802b50b620dbd7b..53ceabeb58f56ebd27e60fd49c362d26e361e6d8 100644 ---- a/lib/.eslintrc.yaml -+++ b/lib/.eslintrc.yaml -@@ -30,10 +30,6 @@ rules: - message: Use `const { AbortController } = require('internal/abort_controller');` instead of the global. - - name: AbortSignal - message: Use `const { AbortSignal } = require('internal/abort_controller');` instead of the global. -- # Atomics is not available in primordials because it can be -- # disabled with --no-harmony-atomics CLI flag. -- - name: Atomics -- message: Use `const { Atomics } = globalThis;` instead of the global. - - name: Blob - message: Use `const { Blob } = require('buffer');` instead of the global. - - name: BroadcastChannel -diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js -index 30f7a5f79e50fdeb4e1775a0e56dafa4c6908898..f7250985277c4127425ef36dff566c1fe06603e2 100644 ---- a/lib/internal/main/worker_thread.js -+++ b/lib/internal/main/worker_thread.js -@@ -112,7 +112,7 @@ port.on('message', (message) => { - - require('internal/worker').assignEnvironmentData(environmentData); - -- if (SharedArrayBuffer !== undefined && Atomics !== undefined) { -+ if (SharedArrayBuffer !== undefined) { - // The counter is only passed to the workers created by the main thread, - // not to workers created by other workers. - let cachedCwd = ''; -diff --git a/lib/internal/worker.js b/lib/internal/worker.js -index 401bc43550ea7f19847dfd588e3fba0507243905..560f69c6c2de2bd976bcd62cd7ac9c770b838446 100644 ---- a/lib/internal/worker.js -+++ b/lib/internal/worker.js -@@ -101,8 +101,7 @@ let cwdCounter; - const environmentData = new SafeMap(); - - // SharedArrayBuffers can be disabled with --no-harmony-sharedarraybuffer. --// Atomics can be disabled with --no-harmony-atomics. --if (isMainThread && SharedArrayBuffer !== undefined && Atomics !== undefined) { -+if (isMainThread && SharedArrayBuffer !== undefined) { - cwdCounter = new Uint32Array(new SharedArrayBuffer(4)); - const originalChdir = process.chdir; - process.chdir = function(path) { diff --git a/patches/node/chore_remove_use_of_deprecated_kmaxlength.patch b/patches/node/chore_remove_use_of_deprecated_kmaxlength.patch deleted file mode 100644 index ded4d1f30d..0000000000 --- a/patches/node/chore_remove_use_of_deprecated_kmaxlength.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Charles Kerr -Date: Tue, 17 Oct 2023 10:58:41 -0500 -Subject: chore: remove use of deprecated kMaxLength - -https://chromium-review.googlesource.com/c/v8/v8/+/4935412 - -This patch can be removed when upstream moves to kMaxByteLength - -diff --git a/src/node_buffer.h b/src/node_buffer.h -index 606a6f5caa3b11b6d2a9068ed2fd65800530a5eb..080dcce21da05ccea398d8a856deb397b1ac8b07 100644 ---- a/src/node_buffer.h -+++ b/src/node_buffer.h -@@ -29,7 +29,7 @@ namespace node { - - namespace Buffer { - --static const size_t kMaxLength = v8::TypedArray::kMaxLength; -+static const size_t kMaxLength = v8::TypedArray::kMaxByteLength; - - typedef void (*FreeCallback)(char* data, void* hint); - -diff --git a/src/node_errors.h b/src/node_errors.h -index 1662491bac44311421eeb7ee35bb47c025162abf..a62b18e832986ee38d93b412b36020a2c22255a9 100644 ---- a/src/node_errors.h -+++ b/src/node_errors.h -@@ -230,7 +230,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", -- v8::TypedArray::kMaxLength); -+ v8::TypedArray::kMaxByteLength); - return ERR_BUFFER_TOO_LARGE(isolate, message); - } - 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 05a70dd710..ef4d76a3e8 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 @@ -7,53 +7,6 @@ Some node tests / test fixtures spawn other tests that clobber env, which causes the `ELECTRON_RUN_AS_NODE` variable to be lost. This patch re-injects it. -diff --git a/test/fixtures/errors/promise_unhandled_warn_with_error.snapshot b/test/fixtures/errors/promise_unhandled_warn_with_error.snapshot -index d7f1aa2f72007f6f70b6b66b81913f39e5678d2f..e091b1575954f5dc82a05a5d200ee028e053f616 100644 ---- a/test/fixtures/errors/promise_unhandled_warn_with_error.snapshot -+++ b/test/fixtures/errors/promise_unhandled_warn_with_error.snapshot -@@ -6,5 +6,5 @@ - at * - at * - at * --(Use `node --trace-warnings ...` to show where the warning was created) -+(Use `* --trace-warnings ...` to show where the warning was created) - (node:*) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https:*nodejs.org*api*cli.html#cli_unhandled_rejections_mode). (rejection id: 1) -diff --git a/test/fixtures/errors/throw_error_with_getter_throw.snapshot b/test/fixtures/errors/throw_error_with_getter_throw.snapshot -index 30bbb336a22aaffbd63333f297eb598a8f501d75..1786f96f19856cdc43e0e86c8271a845e337359f 100644 ---- a/test/fixtures/errors/throw_error_with_getter_throw.snapshot -+++ b/test/fixtures/errors/throw_error_with_getter_throw.snapshot -@@ -3,6 +3,6 @@ - throw { * eslint-disable-line no-throw-literal - ^ - [object Object] --(Use `node --trace-uncaught ...` to show where the exception was thrown) -+(Use `* --trace-uncaught ...` to show where the exception was thrown) - - Node.js * -diff --git a/test/fixtures/errors/throw_null.snapshot b/test/fixtures/errors/throw_null.snapshot -index 88494ec6832205b30e7ae159708112a45494834c..1a1191ca9ced90936b764c32c1c334cce114b46e 100644 ---- a/test/fixtures/errors/throw_null.snapshot -+++ b/test/fixtures/errors/throw_null.snapshot -@@ -3,6 +3,6 @@ - throw null; - ^ - null --(Use `node --trace-uncaught ...` to show where the exception was thrown) -+(Use `* --trace-uncaught ...` to show where the exception was thrown) - - Node.js * -diff --git a/test/fixtures/errors/throw_undefined.snapshot b/test/fixtures/errors/throw_undefined.snapshot -index baae7384453373f3a005b4f85abb702a4c165f98..b6b6060b17839f3452aa915c12bd5174b7585414 100644 ---- a/test/fixtures/errors/throw_undefined.snapshot -+++ b/test/fixtures/errors/throw_undefined.snapshot -@@ -3,6 +3,6 @@ - throw undefined; - ^ - undefined --(Use `node --trace-uncaught ...` to show where the exception was thrown) -+(Use `* --trace-uncaught ...` to show where the exception was thrown) - - Node.js * diff --git a/test/fixtures/test-runner/output/arbitrary-output-colored.js b/test/fixtures/test-runner/output/arbitrary-output-colored.js index af23e674cb361ed81dafa22670d5633559cd1144..1dd59990cb7cdba8aecf4f499ee6b92e7cd41b30 100644 --- a/test/fixtures/test-runner/output/arbitrary-output-colored.js @@ -67,32 +20,3 @@ index af23e674cb361ed81dafa22670d5633559cd1144..1dd59990cb7cdba8aecf4f499ee6b92e + 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-errors.mjs b/test/parallel/test-node-output-errors.mjs -index 84f20a77dda367fe1ada8d616c7b6813d39efd43..9bebb256776c5be155a8de07abbe4284bc8dad8a 100644 ---- a/test/parallel/test-node-output-errors.mjs -+++ b/test/parallel/test-node-output-errors.mjs -@@ -3,6 +3,7 @@ import * as fixtures from '../common/fixtures.mjs'; - import * as snapshot from '../common/assertSnapshot.js'; - import * as os from 'node:os'; - import { describe, it } from 'node:test'; -+import { basename } from 'node:path'; - import { pathToFileURL } from 'node:url'; - - const skipForceColors = -@@ -20,13 +21,15 @@ function replaceForceColorsStackTrace(str) { - - describe('errors output', { concurrency: true }, () => { - function normalize(str) { -+ const baseName = basename(process.argv0 || 'node', '.exe'); - return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '') - .replaceAll(pathToFileURL(process.cwd()).pathname, '') - .replaceAll('//', '*') - .replaceAll(/\/(\w)/g, '*$1') - .replaceAll('*test*', '*') - .replaceAll('*fixtures*errors*', '*') -- .replaceAll('file:**', 'file:*/'); -+ .replaceAll('file:**', 'file:*/') -+ .replaceAll(`${baseName} --`, '* --'); - } - - function normalizeNoNumbers(str) { diff --git a/patches/node/cli_remove_deprecated_v8_flag.patch b/patches/node/cli_remove_deprecated_v8_flag.patch index 0a4e8eb25b..8a9772f144 100644 --- a/patches/node/cli_remove_deprecated_v8_flag.patch +++ b/patches/node/cli_remove_deprecated_v8_flag.patch @@ -18,10 +18,10 @@ Reviewed-By: Michaël Zasso Reviewed-By: Yagiz Nizipli diff --git a/doc/api/cli.md b/doc/api/cli.md -index ed0a43306e87962cf0e756d9e059ec5c08ad674b..7ada2802b2590e78fa5b9847935866b743cf94ed 100644 +index 0cfed4a4a91a3d3fb5aee6c9a4db3405ba836565..61d980a12fcf7c799e726e1462c65ce478a8ed0c 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md -@@ -2868,7 +2868,6 @@ V8 options that are allowed are: +@@ -3151,7 +3151,6 @@ V8 options that are allowed are: * `--disallow-code-generation-from-strings` * `--enable-etw-stack-walking` * `--expose-gc` @@ -30,10 +30,10 @@ index ed0a43306e87962cf0e756d9e059ec5c08ad674b..7ada2802b2590e78fa5b9847935866b7 * `--jitless` * `--max-old-space-size` diff --git a/src/node_options.cc b/src/node_options.cc -index 4e3c82e9528b04fd1a0cc99d30fb885e4b224bc9..38e173f72b446aa2db07f676b6ece26247bbf56b 100644 +index 4b3f7751db2871c8ce76b197a84a2417097030ea..21e53e1053fe2e4194d91b27a726d3a1306b1683 100644 --- a/src/node_options.cc +++ b/src/node_options.cc -@@ -866,11 +866,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser( +@@ -922,11 +922,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser( "disallow eval and friends", V8Option{}, kAllowedInEnvvar); @@ -46,7 +46,7 @@ index 4e3c82e9528b04fd1a0cc99d30fb885e4b224bc9..38e173f72b446aa2db07f676b6ece262 "disable runtime allocation of executable memory", V8Option{}, diff --git a/test/parallel/test-cli-node-options.js b/test/parallel/test-cli-node-options.js -index 8d614e607177cdd922fef65a85a2ccdcf54116c0..146df3a21a0551e910c46248d2fd97dde8896164 100644 +index e898a81af09ca6852ddc866310e5b8e0dc82971b..22d5a342df5d55f065383a6ebe1aebe59dc0f8d2 100644 --- a/test/parallel/test-cli-node-options.js +++ b/test/parallel/test-cli-node-options.js @@ -70,7 +70,6 @@ if (common.hasCrypto) { diff --git a/patches/node/deprecate_vector_v8_local_in_v8.patch b/patches/node/deprecate_vector_v8_local_in_v8.patch deleted file mode 100644 index 7462efb97f..0000000000 --- a/patches/node/deprecate_vector_v8_local_in_v8.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Sun, 10 Mar 2024 16:59:30 +0100 -Subject: Deprecate vector in v8 - -Adapts for changes in https://chromium-review.googlesource.com/c/v8/v8/+/4866222. - -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 e862b51293135995c527c32aa3c3579780d7831c..ff658ec88e5161cd66536ee6e95dba675b16eccc 100644 ---- a/src/module_wrap.cc -+++ b/src/module_wrap.cc -@@ -186,7 +186,9 @@ void ModuleWrap::New(const FunctionCallbackInfo& args) { - export_names[i] = export_name_val.As(); - } - -- module = Module::CreateSyntheticModule(isolate, url, export_names, -+ -+ module = Module::CreateSyntheticModule(isolate, url, -+ v8::MemorySpan>(export_names.begin(), export_names.end()), - SyntheticModuleEvaluationStepsCallback); - } else { - ScriptCompiler::CachedData* cached_data = nullptr; diff --git a/patches/node/enable_crashpad_linux_node_processes.patch b/patches/node/enable_crashpad_linux_node_processes.patch index 931c066507..6f403b6ac8 100644 --- a/patches/node/enable_crashpad_linux_node_processes.patch +++ b/patches/node/enable_crashpad_linux_node_processes.patch @@ -8,7 +8,7 @@ to child processes spawned with `ELECTRON_RUN_AS_NODE` which is used by the crashpad client to connect with the handler process. diff --git a/lib/child_process.js b/lib/child_process.js -index 48870b35ad0f3411f2d509b12d92a9e0d20046f9..e7ef454d2d71207ae7b2788a437b82bf7732716e 100644 +index 580a441a803bdd0b57871c0cdd8af576f11609b1..755712d24219de7ffe491957d941df7c8cf7baad 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -61,6 +61,7 @@ let debug = require('internal/util/debuglog').debuglog( @@ -19,7 +19,7 @@ index 48870b35ad0f3411f2d509b12d92a9e0d20046f9..e7ef454d2d71207ae7b2788a437b82bf const { AbortError, -@@ -154,7 +155,6 @@ function fork(modulePath, args = [], options) { +@@ -153,7 +154,6 @@ function fork(modulePath, args = [], options) { ArrayPrototypeSplice(execArgv, index - 1, 2); } } @@ -27,7 +27,7 @@ index 48870b35ad0f3411f2d509b12d92a9e0d20046f9..e7ef454d2d71207ae7b2788a437b82bf args = [...execArgv, modulePath, ...args]; if (typeof options.stdio === 'string') { -@@ -618,6 +618,22 @@ function normalizeSpawnArguments(file, args, options) { +@@ -617,6 +617,22 @@ function normalizeSpawnArguments(file, args, options) { 'options.windowsVerbatimArguments'); } @@ -50,7 +50,7 @@ index 48870b35ad0f3411f2d509b12d92a9e0d20046f9..e7ef454d2d71207ae7b2788a437b82bf if (options.shell) { validateArgumentNullCheck(options.shell, 'options.shell'); const command = ArrayPrototypeJoin([file, ...args], ' '); -@@ -651,7 +667,6 @@ function normalizeSpawnArguments(file, args, options) { +@@ -650,7 +666,6 @@ function normalizeSpawnArguments(file, args, options) { ArrayPrototypeUnshift(args, file); } diff --git a/patches/node/esm_drop_support_for_import_assertions.patch b/patches/node/esm_drop_support_for_import_assertions.patch deleted file mode 100644 index ff45e7c990..0000000000 --- a/patches/node/esm_drop_support_for_import_assertions.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= -Date: Fri, 19 Apr 2024 02:01:24 +0200 -Subject: esm: drop support for import assertions - -This patch removes support for the `assert` keyword -for import attributes. It was an old variant of the -proposal that was only shipped in V8 and no other -engine, and that has then been replaced by the `with` -keyword. - -Chrome is planning to remove support for `assert` -in version 126, which will be released in June. - -Node.js already supports the `with` keyword for -import attributes, and this patch does not change that. - -PR-URL: https://github.com/nodejs/node/pull/52104 -Reviewed-By: Matteo Collina -Reviewed-By: Joyee Cheung -Reviewed-By: Yagiz Nizipli -Reviewed-By: Ethan Arrowood -Reviewed-By: Geoffrey Booth -(cherry picked from commit 25c79f333104d1feb0d84794d5bcdb4227177c9b) - -esm: remove --no-import-harmony-assertions - -It is off by default now. - -PR-URL: https://github.com/nodejs/node/pull/54890 -Reviewed-By: Luigi Pinca -Reviewed-By: Yagiz Nizipli -Reviewed-By: Antoine du Hamel -Reviewed-By: James M Snell -(cherry picked from commit 8fd90938f923ef2a04bb3ebb08b89568fe6fd4ee) - -diff --git a/src/node.cc b/src/node.cc -index 9f6f8e53abd7e447d88c187c447431a0d96cd150..4415f18ecbd84c1f41e0febbf2446fb636242d58 100644 ---- a/src/node.cc -+++ b/src/node.cc -@@ -778,12 +778,6 @@ static ExitCode ProcessGlobalArgsInternal(std::vector* args, - return ExitCode::kInvalidCommandLineArgument2; - } - -- // TODO(aduh95): remove this when the harmony-import-assertions flag -- // is removed in V8. -- if (std::find(v8_args.begin(), v8_args.end(), -- "--no-harmony-import-assertions") == v8_args.end()) { -- v8_args.emplace_back("--harmony-import-assertions"); -- } - // TODO(aduh95): remove this when the harmony-import-attributes flag - // is removed in V8. - if (std::find(v8_args.begin(), diff --git a/patches/node/expose_get_builtin_module_function.patch b/patches/node/expose_get_builtin_module_function.patch index 4a9b451241..39d3c031d4 100644 --- a/patches/node/expose_get_builtin_module_function.patch +++ b/patches/node/expose_get_builtin_module_function.patch @@ -9,10 +9,10 @@ modules to sandboxed renderers. TODO(codebytere): remove and replace with a public facing API. diff --git a/src/node_binding.cc b/src/node_binding.cc -index 6b0297d8984ccb34b8d0019fedd1307d48cf49f8..4e750be66452de47040e3a46555c062dfccf7807 100644 +index c2ef9b36d5b2967c798c123b6cbbd099b15c2791..b5c0a93d83ab4d4f6792d0eb648e7198de874bcf 100644 --- a/src/node_binding.cc +++ b/src/node_binding.cc -@@ -641,6 +641,10 @@ void GetInternalBinding(const FunctionCallbackInfo& args) { +@@ -653,6 +653,10 @@ void GetInternalBinding(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(exports); } @@ -24,10 +24,10 @@ index 6b0297d8984ccb34b8d0019fedd1307d48cf49f8..4e750be66452de47040e3a46555c062d Environment* env = Environment::GetCurrent(args); diff --git a/src/node_binding.h b/src/node_binding.h -index 7256bf2bbcf73214a25e61156305cc212b6f2451..d129981ad8588376eeee61155964062f624695d6 100644 +index eb1364cb01a2bea52bce768056e73b0f3a86ae35..d421a2773403e7b22fcca2fcf8275ef2d9654c55 100644 --- a/src/node_binding.h +++ b/src/node_binding.h -@@ -137,6 +137,8 @@ void GetInternalBinding(const v8::FunctionCallbackInfo& args); +@@ -146,6 +146,8 @@ void GetInternalBinding(const v8::FunctionCallbackInfo& args); void GetLinkedBinding(const v8::FunctionCallbackInfo& args); void DLOpen(const v8::FunctionCallbackInfo& args); diff --git a/patches/node/feat_add_uv_loop_interrupt_on_io_change_option_to_uv_loop_configure.patch b/patches/node/feat_add_uv_loop_interrupt_on_io_change_option_to_uv_loop_configure.patch index a1b2774b5c..68284309f8 100644 --- a/patches/node/feat_add_uv_loop_interrupt_on_io_change_option_to_uv_loop_configure.patch +++ b/patches/node/feat_add_uv_loop_interrupt_on_io_change_option_to_uv_loop_configure.patch @@ -26,7 +26,7 @@ index 0f5ddfb3ca21b7e5b38d0a4ce4b9e77387597199..ba815202fb157aa82859ec0518523cf6 .. c:function:: int uv_loop_close(uv_loop_t* loop) diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h -index 02397dd0fdd43d51f86c0dde9a62046702f12bdb..3375600023e39ddacf62cc17deb4f206db942084 100644 +index a62b3fa69b1087847f37c7093954e19a07959b74..7f48b7daa87d1a5b14bc6f641b60f21263fa5ec3 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -260,7 +260,8 @@ typedef struct uv_metrics_s uv_metrics_t; @@ -101,10 +101,10 @@ index 0ff2669e30a628dbb2df9e28ba14b38cf14114e5..117190ef26338944b78dbed7380c631d static int uv__async_start(uv_loop_t* loop) { int pipefd[2]; diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c -index 25c5181f370e94983e8a5f797f02f7a8dc207e00..f4d9059796d2c65339a5d48ecb273b09d9364d21 100644 +index 965e7f775250cf9899266bc3aaf62eda69367264..45b3dec662b093a61af356e431416530b35343d2 100644 --- a/deps/uv/src/unix/core.c +++ b/deps/uv/src/unix/core.c -@@ -926,6 +926,9 @@ void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events) { +@@ -927,6 +927,9 @@ void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events) { loop->watchers[w->fd] = w; loop->nfds++; } @@ -114,7 +114,7 @@ index 25c5181f370e94983e8a5f797f02f7a8dc207e00..f4d9059796d2c65339a5d48ecb273b09 } -@@ -957,6 +960,9 @@ void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) { +@@ -958,6 +961,9 @@ void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) { } else if (uv__queue_empty(&w->watcher_queue)) uv__queue_insert_tail(&loop->watcher_queue, &w->watcher_queue); @@ -124,7 +124,7 @@ index 25c5181f370e94983e8a5f797f02f7a8dc207e00..f4d9059796d2c65339a5d48ecb273b09 } -@@ -973,6 +979,9 @@ void uv__io_close(uv_loop_t* loop, uv__io_t* w) { +@@ -974,6 +980,9 @@ void uv__io_close(uv_loop_t* loop, uv__io_t* w) { void uv__io_feed(uv_loop_t* loop, uv__io_t* w) { if (uv__queue_empty(&w->pending_queue)) uv__queue_insert_tail(&loop->pending_queue, &w->pending_queue); @@ -241,7 +241,7 @@ index e9885a0f1ff3890a8d957c8793e22b01cedc0e97..ae3d09878253fe7169ad7b74b3faea02 return -1; } diff --git a/deps/uv/test/test-embed.c b/deps/uv/test/test-embed.c -index bbe56e176db17a502d7f3864ba529212f553590a..b0da9d1cddc69428e9fb3379d1338cf893ab93d2 100644 +index 6e9917239aa5626dd56fffd6eb2469d3e63224bf..b0da9d1cddc69428e9fb3379d1338cf893ab93d2 100644 --- a/deps/uv/test/test-embed.c +++ b/deps/uv/test/test-embed.c @@ -25,54 +25,184 @@ @@ -278,7 +278,7 @@ index bbe56e176db17a502d7f3864ba529212f553590a..b0da9d1cddc69428e9fb3379d1338cf8 -static void thread_main(void* arg) { - ASSERT_LE(0, uv_barrier_wait(&barrier)); - uv_sleep(250); -- ASSERT_EQ(0, uv_async_send(&async)); +- ASSERT_OK(uv_async_send(&async)); -} +static uv_timer_t main_timer; +static int main_timer_called; @@ -333,9 +333,9 @@ index bbe56e176db17a502d7f3864ba529212f553590a..b0da9d1cddc69428e9fb3379d1338cf8 - uv_loop_t* loop; - - loop = uv_default_loop(); -- ASSERT_EQ(0, uv_async_init(loop, &async, async_cb)); -- ASSERT_EQ(0, uv_barrier_init(&barrier, 2)); -- ASSERT_EQ(0, uv_thread_create(&thread, thread_main, NULL)); +- ASSERT_OK(uv_async_init(loop, &async, async_cb)); +- ASSERT_OK(uv_barrier_init(&barrier, 2)); +- ASSERT_OK(uv_thread_create(&thread, thread_main, NULL)); - ASSERT_LE(0, uv_barrier_wait(&barrier)); - - while (uv_loop_alive(loop)) { @@ -457,7 +457,7 @@ index bbe56e176db17a502d7f3864ba529212f553590a..b0da9d1cddc69428e9fb3379d1338cf8 + uv_timer_init(&external_loop, &external_timer); + uv_timer_start(&external_timer, external_timer_cb, 100, 0); -- ASSERT_EQ(0, uv_thread_join(&thread)); +- ASSERT_OK(uv_thread_join(&thread)); - uv_barrier_destroy(&barrier); + run_loop(); + ASSERT_EQ(main_timer_called, 1); @@ -465,10 +465,10 @@ index bbe56e176db17a502d7f3864ba529212f553590a..b0da9d1cddc69428e9fb3379d1338cf8 MAKE_VALGRIND_HAPPY(loop); return 0; diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h -index 78ff9c2d1621676feab5d357609970cdf1ba5864..204160f324ad1a80c9b042e62c4bedcb745666ba 100644 +index d30f02faa8515ca3a995490d53f2e85fda11c6a2..a392f5e3d701b0d973db2bbc6553977ce55a8775 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h -@@ -273,6 +273,7 @@ TEST_DECLARE (process_priority) +@@ -276,6 +276,7 @@ TEST_DECLARE (process_priority) TEST_DECLARE (has_ref) TEST_DECLARE (active) TEST_DECLARE (embed) @@ -476,7 +476,7 @@ index 78ff9c2d1621676feab5d357609970cdf1ba5864..204160f324ad1a80c9b042e62c4bedcb TEST_DECLARE (async) TEST_DECLARE (async_null_cb) TEST_DECLARE (eintr_handling) -@@ -894,6 +895,7 @@ TASK_LIST_START +@@ -906,6 +907,7 @@ TASK_LIST_START TEST_ENTRY (active) TEST_ENTRY (embed) diff --git a/patches/node/fix_-wextra-semi_errors_in_nghttp2_helper_h.patch b/patches/node/fix_-wextra-semi_errors_in_nghttp2_helper_h.patch new file mode 100644 index 0000000000..238db21385 --- /dev/null +++ b/patches/node/fix_-wextra-semi_errors_in_nghttp2_helper_h.patch @@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Wed, 16 Oct 2024 16:09:37 +0200 +Subject: fix: -Wextra-semi errors in nghttp2_helper.h + +Introduced in https://github.com/nodejs/node/pull/52966 + +Upstreamed in https://github.com/nghttp2/nghttp2/pull/2258 + +diff --git a/deps/nghttp2/lib/nghttp2_helper.h b/deps/nghttp2/lib/nghttp2_helper.h +index 89b0d4f535db795cd1df582475c02b2f4d1ac98f..f5de6290dab0e17ae3aff10230dd8ad7414f9631 100644 +--- a/deps/nghttp2/lib/nghttp2_helper.h ++++ b/deps/nghttp2/lib/nghttp2_helper.h +@@ -38,28 +38,28 @@ + #define nghttp2_max_def(SUFFIX, T) \ + static inline T nghttp2_max_##SUFFIX(T a, T b) { return a < b ? b : a; } + +-nghttp2_max_def(int8, int8_t); +-nghttp2_max_def(int16, int16_t); +-nghttp2_max_def(int32, int32_t); +-nghttp2_max_def(int64, int64_t); +-nghttp2_max_def(uint8, uint8_t); +-nghttp2_max_def(uint16, uint16_t); +-nghttp2_max_def(uint32, uint32_t); +-nghttp2_max_def(uint64, uint64_t); +-nghttp2_max_def(size, size_t); ++nghttp2_max_def(int8, int8_t) ++nghttp2_max_def(int16, int16_t) ++nghttp2_max_def(int32, int32_t) ++nghttp2_max_def(int64, int64_t) ++nghttp2_max_def(uint8, uint8_t) ++nghttp2_max_def(uint16, uint16_t) ++nghttp2_max_def(uint32, uint32_t) ++nghttp2_max_def(uint64, uint64_t) ++nghttp2_max_def(size, size_t) + + #define nghttp2_min_def(SUFFIX, T) \ + static inline T nghttp2_min_##SUFFIX(T a, T b) { return a < b ? a : b; } + +-nghttp2_min_def(int8, int8_t); +-nghttp2_min_def(int16, int16_t); +-nghttp2_min_def(int32, int32_t); +-nghttp2_min_def(int64, int64_t); +-nghttp2_min_def(uint8, uint8_t); +-nghttp2_min_def(uint16, uint16_t); +-nghttp2_min_def(uint32, uint32_t); +-nghttp2_min_def(uint64, uint64_t); +-nghttp2_min_def(size, size_t); ++nghttp2_min_def(int8, int8_t) ++nghttp2_min_def(int16, int16_t) ++nghttp2_min_def(int32, int32_t) ++nghttp2_min_def(int64, int64_t) ++nghttp2_min_def(uint8, uint8_t) ++nghttp2_min_def(uint16, uint16_t) ++nghttp2_min_def(uint32, uint32_t) ++nghttp2_min_def(uint64, uint64_t) ++nghttp2_min_def(size, size_t) + + #define lstreq(A, B, N) ((sizeof((A)) - 1) == (N) && memcmp((A), (B), (N)) == 0) + diff --git a/patches/node/fix_account_for_createexternalizablestring_v8_global.patch b/patches/node/fix_account_for_createexternalizablestring_v8_global.patch deleted file mode 100644 index d0dc5f5e72..0000000000 --- a/patches/node/fix_account_for_createexternalizablestring_v8_global.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Tue, 23 May 2023 18:21:17 +0200 -Subject: fix: account for createExternalizableString V8 global - -Introduced in https://chromium-review.googlesource.com/c/v8/v8/+/4531903. - -This patch can be removed when Node.js upgrades to a version of V8 with the above -CL - they'll need to make the same change. - -diff --git a/test/parallel/test-fs-write.js b/test/parallel/test-fs-write.js -index 59b83f531cf0a60f960d0096aea70854f45bd629..9dcc35987a4757ea090e81c7de38a6af5bc3182f 100644 ---- a/test/parallel/test-fs-write.js -+++ b/test/parallel/test-fs-write.js -@@ -38,7 +38,7 @@ const constants = fs.constants; - const { externalizeString, isOneByteString } = global; - - // Account for extra globals exposed by --expose_externalize_string. --common.allowGlobals(externalizeString, isOneByteString, global.x); -+common.allowGlobals(createExternalizableString, externalizeString, isOneByteString, global.x); - - { - const expected = 'ümlaut sechzig'; // Must be a unique string. diff --git a/patches/node/fix_adapt_debugger_tests_for_upstream_v8_changes.patch b/patches/node/fix_adapt_debugger_tests_for_upstream_v8_changes.patch deleted file mode 100644 index 978b11d75f..0000000000 --- a/patches/node/fix_adapt_debugger_tests_for_upstream_v8_changes.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Wed, 29 Mar 2023 09:55:47 +0200 -Subject: fix: adapt debugger tests for upstream v8 changes - -Updates debugger tests to conform to changes in https://chromium-review.googlesource.com/c/v8/v8/+/4290476 - -This can be removed when Node.js updates to at least V8 11.4. - -diff --git a/test/common/debugger.js b/test/common/debugger.js -index 4aff5b9a0f74d99f8f605b68631f820e282091ab..d5d77fc7c648ddb45225f04c6cf23f9816b2186d 100644 ---- a/test/common/debugger.js -+++ b/test/common/debugger.js -@@ -4,7 +4,7 @@ const spawn = require('child_process').spawn; - - const BREAK_MESSAGE = new RegExp('(?:' + [ - 'assert', 'break', 'break on start', 'debugCommand', -- 'exception', 'other', 'promiseRejection', -+ 'exception', 'other', 'promiseRejection', 'step', - ].join('|') + ') in', 'i'); - - let TIMEOUT = common.platformTimeout(5000); -@@ -121,13 +121,13 @@ function startCLI(args, flags = [], spawnOpts = {}) { - get breakInfo() { - const output = this.output; - const breakMatch = -- output.match(/break (?:on start )?in ([^\n]+):(\d+)\n/i); -+ output.match(/(step |break (?:on start )?)in ([^\n]+):(\d+)\n/i); - - if (breakMatch === null) { - throw new Error( - `Could not find breakpoint info in ${JSON.stringify(output)}`); - } -- return { filename: breakMatch[1], line: +breakMatch[2] }; -+ return { filename: breakMatch[2], line: +breakMatch[3] }; - }, - - ctrlC() { -diff --git a/test/parallel/test-debugger-break.js b/test/parallel/test-debugger-break.js -index 65b4355cfe7bc25464626cca6f1c3b0de1dd9a45..8e3a290321a2e70304859eb57a2056c3a70af0f6 100644 ---- a/test/parallel/test-debugger-break.js -+++ b/test/parallel/test-debugger-break.js -@@ -27,7 +27,7 @@ const cli = startCLI(['--port=0', script]); - - await cli.stepCommand('n'); - assert.ok( -- cli.output.includes(`break in ${script}:2`), -+ cli.output.includes(`step in ${script}:2`), - 'pauses in next line of the script'); - assert.match( - cli.output, -@@ -36,7 +36,7 @@ const cli = startCLI(['--port=0', script]); - - await cli.stepCommand('next'); - assert.ok( -- cli.output.includes(`break in ${script}:3`), -+ cli.output.includes(`step in ${script}:3`), - 'pauses in next line of the script'); - assert.match( - cli.output, -@@ -89,7 +89,7 @@ const cli = startCLI(['--port=0', script]); - await cli.stepCommand(''); - assert.match( - cli.output, -- /break in node:timers/, -+ /step in node:timers/, - 'entered timers.js'); - - await cli.stepCommand('cont'); -diff --git a/test/parallel/test-debugger-run-after-quit-restart.js b/test/parallel/test-debugger-run-after-quit-restart.js -index 2c56f7227aed69d781392ce2f3f40e489e3501f2..0e1048699206dcc77696974e097e97de6b217811 100644 ---- a/test/parallel/test-debugger-run-after-quit-restart.js -+++ b/test/parallel/test-debugger-run-after-quit-restart.js -@@ -25,7 +25,7 @@ const path = require('path'); - .then(() => cli.stepCommand('n')) - .then(() => { - assert.ok( -- cli.output.includes(`break in ${script}:2`), -+ cli.output.includes(`step in ${script}:2`), - 'steps to the 2nd line' - ); - }) 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 0c0aebff56..d7cf142afa 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 1ece4f5e494533ea0fa25e0d35143fe424dbf70b..697b8bba6a55358924d6986f2eb347a99ff73889 100644 +index a97e77860e151f5126515d65ef99b34aa7301f76..229cb96c1385c597138719f2b01f78bd54ad44ab 100644 --- a/common.gypi +++ b/common.gypi @@ -88,6 +88,23 @@ diff --git a/patches/node/fix_add_property_query_interceptors.patch b/patches/node/fix_add_property_query_interceptors.patch deleted file mode 100644 index b0c4211c1c..0000000000 --- a/patches/node/fix_add_property_query_interceptors.patch +++ /dev/null @@ -1,574 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: VerteDinde -Date: Mon, 24 Jun 2024 21:48:40 -0700 -Subject: fix: add property query interceptors - -This commit cherry-picks an upstream interceptor API change -from node-v8/canary to accomodate V8's upstream changes to old -interceptor APIs. - -Node PR: https://github.com/nodejs/node-v8/commit/d1f18b0bf16efbc1e54ba04a54735ce4683cb936 -CL: https://chromium-review.googlesource.com/c/v8/v8/+/5630388 - -This patch can be removed when the node change is incorporated into main. - -diff --git a/src/node_contextify.cc b/src/node_contextify.cc -index 28ba7dbe66a44a43c39e3d75edf0be9513bcf732..0401b968916e5f45d148281c74b7e465e11439b8 100644 ---- a/src/node_contextify.cc -+++ b/src/node_contextify.cc -@@ -49,6 +49,7 @@ using v8::FunctionTemplate; - using v8::HandleScope; - using v8::IndexedPropertyHandlerConfiguration; - using v8::Int32; -+using v8::Intercepted; - using v8::Isolate; - using v8::Just; - using v8::Local; -@@ -484,14 +485,15 @@ bool ContextifyContext::IsStillInitializing(const ContextifyContext* ctx) { - } - - // static --void ContextifyContext::PropertyGetterCallback( -- Local property, -- const PropertyCallbackInfo& args) { -+Intercepted ContextifyContext::PropertyGetterCallback( -+ Local property, const PropertyCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); - ContextifyContext* ctx = ContextifyContext::Get(args); - - // Still initializing -- if (IsStillInitializing(ctx)) return; -+ if (IsStillInitializing(ctx)) { -+ return Intercepted::kNo; -+ } - - Local context = ctx->context(); - Local sandbox = ctx->sandbox(); -@@ -515,18 +517,22 @@ void ContextifyContext::PropertyGetterCallback( - rv = ctx->global_proxy(); - - args.GetReturnValue().Set(rv); -+ return Intercepted::kYes; - } -+ return Intercepted::kNo; - } - - // static --void ContextifyContext::PropertySetterCallback( -+Intercepted ContextifyContext::PropertySetterCallback( - Local property, - Local value, -- const PropertyCallbackInfo& args) { -+ const PropertyCallbackInfo& args) { - ContextifyContext* ctx = ContextifyContext::Get(args); - - // Still initializing -- if (IsStillInitializing(ctx)) return; -+ if (IsStillInitializing(ctx)) { -+ return Intercepted::kNo; -+ } - - Local context = ctx->context(); - PropertyAttribute attributes = PropertyAttribute::None; -@@ -544,8 +550,9 @@ void ContextifyContext::PropertySetterCallback( - (static_cast(attributes) & - static_cast(PropertyAttribute::ReadOnly)); - -- if (read_only) -- return; -+ if (read_only) { -+ return Intercepted::kNo; -+ } - - // true for x = 5 - // false for this.x = 5 -@@ -564,11 +571,16 @@ void ContextifyContext::PropertySetterCallback( - - bool is_declared = is_declared_on_global_proxy || is_declared_on_sandbox; - if (!is_declared && args.ShouldThrowOnError() && is_contextual_store && -- !is_function) -- return; -+ !is_function) { -+ return Intercepted::kNo; -+ } - -- if (!is_declared && property->IsSymbol()) return; -- if (ctx->sandbox()->Set(context, property, value).IsNothing()) return; -+ if (!is_declared && property->IsSymbol()) { -+ return Intercepted::kNo; -+ } -+ if (ctx->sandbox()->Set(context, property, value).IsNothing()) { -+ return Intercepted::kNo; -+ } - - Local desc; - if (is_declared_on_sandbox && -@@ -582,19 +594,23 @@ void ContextifyContext::PropertySetterCallback( - // We have to specify the return value for any contextual or get/set - // property - if (desc_obj->HasOwnProperty(context, env->get_string()).FromMaybe(false) || -- desc_obj->HasOwnProperty(context, env->set_string()).FromMaybe(false)) -+ desc_obj->HasOwnProperty(context, env->set_string()).FromMaybe(false)) { - args.GetReturnValue().Set(value); -+ return Intercepted::kYes; -+ } - } -+ return Intercepted::kNo; - } - - // static --void ContextifyContext::PropertyDescriptorCallback( -- Local property, -- const PropertyCallbackInfo& args) { -+Intercepted ContextifyContext::PropertyDescriptorCallback( -+ Local property, const PropertyCallbackInfo& args) { - ContextifyContext* ctx = ContextifyContext::Get(args); - - // Still initializing -- if (IsStillInitializing(ctx)) return; -+ if (IsStillInitializing(ctx)) { -+ return Intercepted::kNo; -+ } - - Local context = ctx->context(); - -@@ -604,19 +620,23 @@ void ContextifyContext::PropertyDescriptorCallback( - Local desc; - if (sandbox->GetOwnPropertyDescriptor(context, property).ToLocal(&desc)) { - args.GetReturnValue().Set(desc); -+ return Intercepted::kYes; - } - } -+ return Intercepted::kNo; - } - - // static --void ContextifyContext::PropertyDefinerCallback( -+Intercepted ContextifyContext::PropertyDefinerCallback( - Local property, - const PropertyDescriptor& desc, -- const PropertyCallbackInfo& args) { -+ const PropertyCallbackInfo& args) { - ContextifyContext* ctx = ContextifyContext::Get(args); - - // Still initializing -- if (IsStillInitializing(ctx)) return; -+ if (IsStillInitializing(ctx)) { -+ return Intercepted::kNo; -+ } - - Local context = ctx->context(); - Isolate* isolate = context->GetIsolate(); -@@ -635,7 +655,7 @@ void ContextifyContext::PropertyDefinerCallback( - // If the property is set on the global as neither writable nor - // configurable, don't change it on the global or sandbox. - if (is_declared && read_only && dont_delete) { -- return; -+ return Intercepted::kNo; - } - - Local sandbox = ctx->sandbox(); -@@ -658,6 +678,9 @@ void ContextifyContext::PropertyDefinerCallback( - desc.has_set() ? desc.set() : Undefined(isolate).As()); - - define_prop_on_sandbox(&desc_for_sandbox); -+ // TODO(https://github.com/nodejs/node/issues/52634): this should return -+ // kYes to behave according to the expected semantics. -+ return Intercepted::kNo; - } else { - Local value = - desc.has_value() ? desc.value() : Undefined(isolate).As(); -@@ -669,26 +692,32 @@ void ContextifyContext::PropertyDefinerCallback( - PropertyDescriptor desc_for_sandbox(value); - define_prop_on_sandbox(&desc_for_sandbox); - } -+ // TODO(https://github.com/nodejs/node/issues/52634): this should return -+ // kYes to behave according to the expected semantics. -+ return Intercepted::kNo; - } - } - - // static --void ContextifyContext::PropertyDeleterCallback( -- Local property, -- const PropertyCallbackInfo& args) { -+Intercepted ContextifyContext::PropertyDeleterCallback( -+ Local property, const PropertyCallbackInfo& args) { - ContextifyContext* ctx = ContextifyContext::Get(args); - - // Still initializing -- if (IsStillInitializing(ctx)) return; -+ if (IsStillInitializing(ctx)) { -+ return Intercepted::kNo; -+ } - - Maybe success = ctx->sandbox()->Delete(ctx->context(), property); - -- if (success.FromMaybe(false)) -- return; -+ if (success.FromMaybe(false)) { -+ return Intercepted::kNo; -+ } - - // Delete failed on the sandbox, intercept and do not delete on - // the global object. - args.GetReturnValue().Set(false); -+ return Intercepted::kYes; - } - - // static -@@ -708,76 +737,84 @@ void ContextifyContext::PropertyEnumeratorCallback( - } - - // static --void ContextifyContext::IndexedPropertyGetterCallback( -- uint32_t index, -- const PropertyCallbackInfo& args) { -+Intercepted ContextifyContext::IndexedPropertyGetterCallback( -+ uint32_t index, const PropertyCallbackInfo& args) { - ContextifyContext* ctx = ContextifyContext::Get(args); - - // Still initializing -- if (IsStillInitializing(ctx)) return; -+ if (IsStillInitializing(ctx)) { -+ return Intercepted::kNo; -+ } - -- ContextifyContext::PropertyGetterCallback( -+ return ContextifyContext::PropertyGetterCallback( - Uint32ToName(ctx->context(), index), args); - } - -- --void ContextifyContext::IndexedPropertySetterCallback( -+Intercepted ContextifyContext::IndexedPropertySetterCallback( - uint32_t index, - Local value, -- const PropertyCallbackInfo& args) { -+ const PropertyCallbackInfo& args) { - ContextifyContext* ctx = ContextifyContext::Get(args); - - // Still initializing -- if (IsStillInitializing(ctx)) return; -+ if (IsStillInitializing(ctx)) { -+ return Intercepted::kNo; -+ } - -- ContextifyContext::PropertySetterCallback( -+ return ContextifyContext::PropertySetterCallback( - Uint32ToName(ctx->context(), index), value, args); - } - - // static --void ContextifyContext::IndexedPropertyDescriptorCallback( -- uint32_t index, -- const PropertyCallbackInfo& args) { -+Intercepted ContextifyContext::IndexedPropertyDescriptorCallback( -+ uint32_t index, const PropertyCallbackInfo& args) { - ContextifyContext* ctx = ContextifyContext::Get(args); - - // Still initializing -- if (IsStillInitializing(ctx)) return; -+ if (IsStillInitializing(ctx)) { -+ return Intercepted::kNo; -+ } - -- ContextifyContext::PropertyDescriptorCallback( -+ return ContextifyContext::PropertyDescriptorCallback( - Uint32ToName(ctx->context(), index), args); - } - - --void ContextifyContext::IndexedPropertyDefinerCallback( -+Intercepted ContextifyContext::IndexedPropertyDefinerCallback( - uint32_t index, - const PropertyDescriptor& desc, -- const PropertyCallbackInfo& args) { -+ const PropertyCallbackInfo& args) { - ContextifyContext* ctx = ContextifyContext::Get(args); - - // Still initializing -- if (IsStillInitializing(ctx)) return; -+ if (IsStillInitializing(ctx)) { -+ return Intercepted::kNo; -+ } - -- ContextifyContext::PropertyDefinerCallback( -+ return ContextifyContext::PropertyDefinerCallback( - Uint32ToName(ctx->context(), index), desc, args); - } - - // static --void ContextifyContext::IndexedPropertyDeleterCallback( -- uint32_t index, -- const PropertyCallbackInfo& args) { -+Intercepted ContextifyContext::IndexedPropertyDeleterCallback( -+ uint32_t index, const PropertyCallbackInfo& args) { - ContextifyContext* ctx = ContextifyContext::Get(args); - - // Still initializing -- if (IsStillInitializing(ctx)) return; -+ if (IsStillInitializing(ctx)) { -+ return Intercepted::kNo; -+ } - - Maybe success = ctx->sandbox()->Delete(ctx->context(), index); - -- if (success.FromMaybe(false)) -- return; -+ if (success.FromMaybe(false)) { -+ return Intercepted::kNo; -+ } - - // Delete failed on the sandbox, intercept and do not delete on - // the global object. - args.GetReturnValue().Set(false); -+ return Intercepted::kYes; - } - - void ContextifyScript::CreatePerIsolateProperties( -diff --git a/src/node_contextify.h b/src/node_contextify.h -index 10715c7eb07715cc11e49734bd54747dad95f6a4..49b9fabb399aed962e0d29e784a25ca4e9780a8f 100644 ---- a/src/node_contextify.h -+++ b/src/node_contextify.h -@@ -111,42 +111,39 @@ class ContextifyContext : public BaseObject { - const v8::FunctionCallbackInfo& args); - static void WeakCallback( - const v8::WeakCallbackInfo& data); -- static void PropertyGetterCallback( -+ static v8::Intercepted PropertyGetterCallback( - v8::Local property, - const v8::PropertyCallbackInfo& args); -- static void PropertySetterCallback( -+ static v8::Intercepted PropertySetterCallback( - v8::Local property, - v8::Local value, -- const v8::PropertyCallbackInfo& args); -- static void PropertyDescriptorCallback( -+ const v8::PropertyCallbackInfo& args); -+ static v8::Intercepted PropertyDescriptorCallback( - v8::Local property, - const v8::PropertyCallbackInfo& args); -- static void PropertyDefinerCallback( -+ static v8::Intercepted PropertyDefinerCallback( - v8::Local property, - const v8::PropertyDescriptor& desc, -- const v8::PropertyCallbackInfo& args); -- static void PropertyDeleterCallback( -+ const v8::PropertyCallbackInfo& args); -+ static v8::Intercepted PropertyDeleterCallback( - v8::Local property, - const v8::PropertyCallbackInfo& args); - static void PropertyEnumeratorCallback( - const v8::PropertyCallbackInfo& args); -- static void IndexedPropertyGetterCallback( -- uint32_t index, -- const v8::PropertyCallbackInfo& args); -- static void IndexedPropertySetterCallback( -+ static v8::Intercepted IndexedPropertyGetterCallback( -+ uint32_t index, const v8::PropertyCallbackInfo& args); -+ static v8::Intercepted IndexedPropertySetterCallback( - uint32_t index, - v8::Local value, -- const v8::PropertyCallbackInfo& args); -- static void IndexedPropertyDescriptorCallback( -- uint32_t index, -- const v8::PropertyCallbackInfo& args); -- static void IndexedPropertyDefinerCallback( -+ const v8::PropertyCallbackInfo& args); -+ static v8::Intercepted IndexedPropertyDescriptorCallback( -+ uint32_t index, const v8::PropertyCallbackInfo& args); -+ static v8::Intercepted IndexedPropertyDefinerCallback( - uint32_t index, - const v8::PropertyDescriptor& desc, -- const v8::PropertyCallbackInfo& args); -- static void IndexedPropertyDeleterCallback( -- uint32_t index, -- const v8::PropertyCallbackInfo& args); -+ const v8::PropertyCallbackInfo& args); -+ static v8::Intercepted IndexedPropertyDeleterCallback( -+ uint32_t index, const v8::PropertyCallbackInfo& args); - - v8::Global context_; - std::unique_ptr microtask_queue_; -diff --git a/src/node_env_var.cc b/src/node_env_var.cc -index bce7ae07214ddf970a530db29ed6970e14b7a5ed..85f82180d48d6cfd7738cd7b1e504f23b38153e8 100644 ---- a/src/node_env_var.cc -+++ b/src/node_env_var.cc -@@ -16,6 +16,7 @@ using v8::DontEnum; - using v8::FunctionTemplate; - using v8::HandleScope; - using v8::Integer; -+using v8::Intercepted; - using v8::Isolate; - using v8::Just; - using v8::Local; -@@ -336,24 +337,27 @@ Maybe KVStore::AssignToObject(v8::Isolate* isolate, - return Just(true); - } - --static void EnvGetter(Local property, -- const PropertyCallbackInfo& info) { -+static Intercepted EnvGetter(Local property, -+ const PropertyCallbackInfo& info) { - Environment* env = Environment::GetCurrent(info); - CHECK(env->has_run_bootstrapping_code()); - if (property->IsSymbol()) { -- return info.GetReturnValue().SetUndefined(); -+ info.GetReturnValue().SetUndefined(); -+ return Intercepted::kYes; - } - CHECK(property->IsString()); - MaybeLocal value_string = - env->env_vars()->Get(env->isolate(), property.As()); - if (!value_string.IsEmpty()) { - info.GetReturnValue().Set(value_string.ToLocalChecked()); -+ return Intercepted::kYes; - } -+ return Intercepted::kNo; - } - --static void EnvSetter(Local property, -- Local value, -- const PropertyCallbackInfo& info) { -+static Intercepted EnvSetter(Local property, -+ Local value, -+ const PropertyCallbackInfo& info) { - Environment* env = Environment::GetCurrent(info); - CHECK(env->has_run_bootstrapping_code()); - // calling env->EmitProcessEnvWarning() sets a variable indicating that -@@ -369,35 +373,40 @@ static void EnvSetter(Local property, - "the " - "value to a string before setting process.env with it.", - "DEP0104") -- .IsNothing()) -- return; -+ .IsNothing()) { -+ return Intercepted::kNo; -+ } - } - - Local key; - Local value_string; - if (!property->ToString(env->context()).ToLocal(&key) || - !value->ToString(env->context()).ToLocal(&value_string)) { -- return; -+ return Intercepted::kNo; - } - - env->env_vars()->Set(env->isolate(), key, value_string); - -- // Whether it worked or not, always return value. -- info.GetReturnValue().Set(value); -+ return Intercepted::kYes; - } - --static void EnvQuery(Local property, -- const PropertyCallbackInfo& info) { -+static Intercepted EnvQuery(Local property, -+ const PropertyCallbackInfo& info) { - Environment* env = Environment::GetCurrent(info); - CHECK(env->has_run_bootstrapping_code()); - if (property->IsString()) { - int32_t rc = env->env_vars()->Query(env->isolate(), property.As()); -- if (rc != -1) info.GetReturnValue().Set(rc); -+ if (rc != -1) { -+ // Return attributes for the property. -+ info.GetReturnValue().Set(v8::None); -+ return Intercepted::kYes; -+ } - } -+ return Intercepted::kNo; - } - --static void EnvDeleter(Local property, -- const PropertyCallbackInfo& info) { -+static Intercepted EnvDeleter(Local property, -+ const PropertyCallbackInfo& info) { - Environment* env = Environment::GetCurrent(info); - CHECK(env->has_run_bootstrapping_code()); - if (property->IsString()) { -@@ -407,6 +416,7 @@ static void EnvDeleter(Local property, - // process.env never has non-configurable properties, so always - // return true like the tc39 delete operator. - info.GetReturnValue().Set(true); -+ return Intercepted::kYes; - } - - static void EnvEnumerator(const PropertyCallbackInfo& info) { -@@ -417,9 +427,9 @@ static void EnvEnumerator(const PropertyCallbackInfo& info) { - env->env_vars()->Enumerate(env->isolate())); - } - --static void EnvDefiner(Local property, -- const PropertyDescriptor& desc, -- const PropertyCallbackInfo& info) { -+static Intercepted EnvDefiner(Local property, -+ const PropertyDescriptor& desc, -+ const PropertyCallbackInfo& info) { - Environment* env = Environment::GetCurrent(info); - if (desc.has_value()) { - if (!desc.has_writable() || -@@ -430,6 +440,7 @@ static void EnvDefiner(Local property, - "configurable, writable," - " and enumerable " - "data descriptor"); -+ return Intercepted::kYes; - } else if (!desc.configurable() || - !desc.enumerable() || - !desc.writable()) { -@@ -438,6 +449,7 @@ static void EnvDefiner(Local property, - "configurable, writable," - " and enumerable " - "data descriptor"); -+ return Intercepted::kYes; - } else { - return EnvSetter(property, desc.value(), info); - } -@@ -447,12 +459,14 @@ static void EnvDefiner(Local property, - "'process.env' does not accept an" - " accessor(getter/setter)" - " descriptor"); -+ return Intercepted::kYes; - } else { - THROW_ERR_INVALID_OBJECT_DEFINE_PROPERTY(env, - "'process.env' only accepts a " - "configurable, writable," - " and enumerable " - "data descriptor"); -+ return Intercepted::kYes; - } - } - -diff --git a/src/node_external_reference.h b/src/node_external_reference.h -index c4aba23510872d66b58a1adc88cdd1ee85a86cfe..6d9988810b951771064de523bc20aaf389a9c08a 100644 ---- a/src/node_external_reference.h -+++ b/src/node_external_reference.h -@@ -66,16 +66,17 @@ class ExternalReferenceRegistry { - V(v8::FunctionCallback) \ - V(v8::AccessorNameGetterCallback) \ - V(v8::AccessorNameSetterCallback) \ -- V(v8::GenericNamedPropertyDefinerCallback) \ -- V(v8::GenericNamedPropertyDeleterCallback) \ -- V(v8::GenericNamedPropertyEnumeratorCallback) \ -- V(v8::GenericNamedPropertyQueryCallback) \ -- V(v8::GenericNamedPropertySetterCallback) \ -- V(v8::IndexedPropertySetterCallback) \ -- V(v8::IndexedPropertyDefinerCallback) \ -- V(v8::IndexedPropertyDeleterCallback) \ -- V(v8::IndexedPropertyQueryCallback) \ -- V(v8::IndexedPropertyDescriptorCallback) \ -+ V(v8::NamedPropertyGetterCallback) \ -+ V(v8::NamedPropertyDefinerCallback) \ -+ V(v8::NamedPropertyDeleterCallback) \ -+ V(v8::NamedPropertyEnumeratorCallback) \ -+ V(v8::NamedPropertyQueryCallback) \ -+ V(v8::NamedPropertySetterCallback) \ -+ V(v8::IndexedPropertyGetterCallbackV2) \ -+ V(v8::IndexedPropertySetterCallbackV2) \ -+ V(v8::IndexedPropertyDefinerCallbackV2) \ -+ V(v8::IndexedPropertyDeleterCallbackV2) \ -+ V(v8::IndexedPropertyQueryCallbackV2) \ - V(const v8::String::ExternalStringResourceBase*) - - #define V(ExternalReferenceType) \ diff --git a/patches/node/fix_add_trusted_space_and_trusted_lo_space_to_the_v8_heap.patch b/patches/node/fix_add_trusted_space_and_trusted_lo_space_to_the_v8_heap.patch deleted file mode 100644 index 311a90be6d..0000000000 --- a/patches/node/fix_add_trusted_space_and_trusted_lo_space_to_the_v8_heap.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Tue, 12 Sep 2023 11:08:18 +0200 -Subject: fix: Add TRUSTED_SPACE and TRUSTED_LO_SPACE to the V8 heap - -Added by V8 in https://chromium-review.googlesource.com/c/v8/v8/+/4791643 - -This patch can be removed when Node.js upgrades to a version of V8 that -includes this change. - -diff --git a/test/parallel/test-v8-stats.js b/test/parallel/test-v8-stats.js -index dd774267910aa0920ed077dd5bd5cfed93aab6cb..2366cbf716c11851bb3a759dce5db47d616516dc 100644 ---- a/test/parallel/test-v8-stats.js -+++ b/test/parallel/test-v8-stats.js -@@ -48,6 +48,8 @@ const expectedHeapSpaces = [ - 'read_only_space', - 'shared_large_object_space', - 'shared_space', -+ 'trusted_large_object_space', -+ 'trusted_space' - ]; - const heapSpaceStatistics = v8.getHeapSpaceStatistics(); - const actualHeapSpaceNames = heapSpaceStatistics.map((s) => s.space_name); 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 b89325039f..8bceb9a241 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 59b5a16f1309a5e4055bccfdb7a529045ad30402..bfdaf6211466a01b64b7942f7b16c480 let filename = call.getFileName(); const line = call.getLineNumber() - 1; diff --git a/src/api/environment.cc b/src/api/environment.cc -index b9098d102b40adad7fafcc331ac62870617019b9..cb9269a31e073caf86164aa39c0640370ade60fd 100644 +index f59abcb21d64b910d8d42eb23c03109f62558813..1b6613d1de8c89c8271066a652afd1024988362d 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -244,6 +244,9 @@ void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s) { @@ -58,10 +58,10 @@ index b9098d102b40adad7fafcc331ac62870617019b9..cb9269a31e073caf86164aa39c064037 } diff --git a/src/node_options.cc b/src/node_options.cc -index 818baf611fcab7838a339f3ea137467653e270d0..4e3c82e9528b04fd1a0cc99d30fb885e4b224bc9 100644 +index 29630fcccc3bd9d24ad6aec64bef2fedfc3c4031..4b3f7751db2871c8ce76b197a84a2417097030ea 100644 --- a/src/node_options.cc +++ b/src/node_options.cc -@@ -1405,14 +1405,16 @@ void GetEmbedderOptions(const FunctionCallbackInfo& args) { +@@ -1464,14 +1464,16 @@ void GetEmbedderOptions(const FunctionCallbackInfo& args) { } Isolate* isolate = args.GetIsolate(); 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 c2909b32d8..ac22a29a41 100644 --- a/patches/node/fix_capture_embedder_exceptions_before_entering_v8.patch +++ b/patches/node/fix_capture_embedder_exceptions_before_entering_v8.patch @@ -10,7 +10,7 @@ in the nodejs test suite. Need to be followed-up with upstream on the broader change as there maybe other callsites. diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc -index be02d4aaa04685cbd6a9ecfe082e38f179129ab5..277748a30bd97ae816d9ba1f2d73851a29b81010 100644 +index 70db7ddbeab5963f1bdf6cb05ee2763d76011cec..6ffe2a2ad01f33ff68c6646df330ec3ac7781a19 100644 --- a/src/handle_wrap.cc +++ b/src/handle_wrap.cc @@ -148,6 +148,9 @@ void HandleWrap::OnClose(uv_handle_t* handle) { @@ -21,62 +21,5 @@ index be02d4aaa04685cbd6a9ecfe082e38f179129ab5..277748a30bd97ae816d9ba1f2d73851a + return; + if (!wrap->persistent().IsEmpty() && - wrap->object()->Has(env->context(), env->handle_onclose_symbol()) - .FromMaybe(false)) { -diff --git a/src/node_contextify.cc b/src/node_contextify.cc -index 8951cd378a9025f58fada47cf96f686d14639f95..6456d87d4202c013aafe071adbac06852b3ae2c1 100644 ---- a/src/node_contextify.cc -+++ b/src/node_contextify.cc -@@ -487,6 +487,7 @@ bool ContextifyContext::IsStillInitializing(const ContextifyContext* ctx) { - void ContextifyContext::PropertyGetterCallback( - Local property, - const PropertyCallbackInfo& args) { -+ Environment* env = Environment::GetCurrent(args); - ContextifyContext* ctx = ContextifyContext::Get(args); - - // Still initializing -@@ -494,6 +495,8 @@ void ContextifyContext::PropertyGetterCallback( - - Local context = ctx->context(); - Local sandbox = ctx->sandbox(); -+ -+ TryCatchScope try_catch(env); - MaybeLocal maybe_rv = - sandbox->GetRealNamedProperty(context, property); - if (maybe_rv.IsEmpty()) { -@@ -503,6 +506,11 @@ void ContextifyContext::PropertyGetterCallback( - - Local rv; - if (maybe_rv.ToLocal(&rv)) { -+ if (try_catch.HasCaught() && -+ !try_catch.HasTerminated()) { -+ try_catch.ReThrow(); -+ } -+ - if (rv == sandbox) - rv = ctx->global_proxy(); - -diff --git a/src/node_messaging.cc b/src/node_messaging.cc -index e7d2bfbafef13f04a73dcbefe7d6e90b37b904d1..31b870c5f003b62b848c00d6032ed98eb829778d 100644 ---- a/src/node_messaging.cc -+++ b/src/node_messaging.cc -@@ -907,7 +907,7 @@ Maybe MessagePort::PostMessage(Environment* env, - const TransferList& transfer_v) { - Isolate* isolate = env->isolate(); - Local obj = object(isolate); -- -+ TryCatchScope try_catch(env); - std::shared_ptr msg = std::make_shared(); - - // Per spec, we need to both check if transfer list has the source port, and -@@ -915,6 +915,10 @@ Maybe MessagePort::PostMessage(Environment* env, - - Maybe serialization_maybe = - msg->Serialize(env, context, message_v, transfer_v, obj); -+ if (try_catch.HasCaught() && -+ !try_catch.HasTerminated()) { -+ try_catch.ReThrow(); -+ } - if (data_ == nullptr) { - return serialization_maybe; - } + wrap->object() + ->Has(env->context(), env->handle_onclose_symbol()) diff --git a/patches/node/fix_crypto_tests_to_run_with_bssl.patch b/patches/node/fix_crypto_tests_to_run_with_bssl.patch index 83b02e0c3f..544e4ef6af 100644 --- a/patches/node/fix_crypto_tests_to_run_with_bssl.patch +++ b/patches/node/fix_crypto_tests_to_run_with_bssl.patch @@ -10,15 +10,50 @@ This should be upstreamed in some form, though it may need to be tweaked before it's acceptable to upstream, as this patch comments out a couple of tests that upstream probably cares about. +diff --git a/test/common/index.js b/test/common/index.js +index 172cdb6b049824539a9850789e0e7c5baf613367..c29abc18191aec78ad8eb810093a9a4ef9e854e4 100644 +--- a/test/common/index.js ++++ b/test/common/index.js +@@ -65,6 +65,8 @@ const opensslVersionNumber = (major = 0, minor = 0, patch = 0) => { + return (major << 28) | (minor << 20) | (patch << 4); + }; + ++const openSSLIsBoringSSL = process.versions.openssl === '0.0.0'; ++ + let OPENSSL_VERSION_NUMBER; + const hasOpenSSL = (major = 0, minor = 0, patch = 0) => { + if (!hasCrypto) return false; +@@ -996,6 +998,7 @@ const common = { + mustNotMutateObjectDeep, + mustSucceed, + nodeProcessAborted, ++ openSSLIsBoringSSL, + PIPE, + parseTestFlags, + platformTimeout, +diff --git a/test/parallel/test-buffer-tostring-range.js b/test/parallel/test-buffer-tostring-range.js +index d033cd204b3200cdd736b581abe027d6e46e4ff3..73fec107a36c3db4af6f492137d0ca174f2d0547 100644 +--- a/test/parallel/test-buffer-tostring-range.js ++++ b/test/parallel/test-buffer-tostring-range.js +@@ -102,7 +102,8 @@ assert.throws(() => { + // Must not throw when start and end are within kMaxLength + // Cannot test on 32bit machine as we are testing the case + // when start and end are above the threshold +-common.skipIf32Bits(); ++if (!common.openSSLIsBoringSSL) { + const threshold = 0xFFFFFFFF; + const largeBuffer = Buffer.alloc(threshold + 20); + largeBuffer.toString('utf8', threshold, threshold + 20); ++} diff --git a/test/parallel/test-crypto-async-sign-verify.js b/test/parallel/test-crypto-async-sign-verify.js -index 4e3c32fdcd23fbe3e74bd5e624b739d224689f33..19d65aae7fa8ec9f9b907733ead17a208ed47909 100644 +index 4e3c32fdcd23fbe3e74bd5e624b739d224689f33..29149838ca76986928c7649a5f60a0f5e22a0705 100644 --- a/test/parallel/test-crypto-async-sign-verify.js +++ b/test/parallel/test-crypto-async-sign-verify.js @@ -88,6 +88,7 @@ test('rsa_public.pem', 'rsa_private.pem', 'sha256', false, // ED25519 test('ed25519_public.pem', 'ed25519_private.pem', undefined, true); // ED448 -+/* ++if (!common.openSSLIsBoringSSL) { test('ed448_public.pem', 'ed448_private.pem', undefined, true); // ECDSA w/ der signature encoding @@ -26,145 +61,10 @@ index 4e3c32fdcd23fbe3e74bd5e624b739d224689f33..19d65aae7fa8ec9f9b907733ead17a20 // DSA w/ ieee-p1363 signature encoding test('dsa_public.pem', 'dsa_private.pem', 'sha256', false, { dsaEncoding: 'ieee-p1363' }); -+*/ ++} // Test Parallel Execution w/ KeyObject is threadsafe in openssl3 { -diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js -index 59dd3b69c4bdf6dbd7b5e4f03df74caac551d459..1e0f9ce4c979683530afdf83ac3dc095acad2eb8 100644 ---- a/test/parallel/test-crypto-authenticated.js -+++ b/test/parallel/test-crypto-authenticated.js -@@ -48,7 +48,9 @@ const errMessages = { - const ciphers = crypto.getCiphers(); - - const expectedWarnings = common.hasFipsCrypto ? -- [] : [ -+ [] : !ciphers.includes('aes-192-ccm') ? [ -+ ['Use Cipheriv for counter mode of aes-192-gcm'], -+ ] : [ - ['Use Cipheriv for counter mode of aes-192-gcm'], - ['Use Cipheriv for counter mode of aes-192-ccm'], - ['Use Cipheriv for counter mode of aes-192-ccm'], -@@ -315,7 +317,9 @@ for (const test of TEST_CASES) { - - // Test that create(De|C)ipher(iv)? throws if the mode is CCM and an invalid - // authentication tag length has been specified. --{ -+if (!ciphers.includes('aes-256-ccm')) { -+ common.printSkipMessage(`unsupported aes-256-ccm test`); -+} else { - for (const authTagLength of [-1, true, false, NaN, 5.5]) { - assert.throws(() => { - crypto.createCipheriv('aes-256-ccm', -@@ -403,6 +407,10 @@ for (const test of TEST_CASES) { - // authentication tag has been specified. - { - for (const mode of ['ccm', 'ocb']) { -+ if (!ciphers.includes(`aes-256-${mode}`)) { -+ common.printSkipMessage(`unsupported aes-256-${mode} test`); -+ continue; -+ } - assert.throws(() => { - crypto.createCipheriv(`aes-256-${mode}`, - 'FxLKsqdmv0E9xrQhp0b1ZgI0K7JFZJM8', -@@ -437,7 +445,9 @@ for (const test of TEST_CASES) { - } - - // Test that setAAD throws if an invalid plaintext length has been specified. --{ -+if (!ciphers.includes('aes-256-ccm')) { -+ common.printSkipMessage(`unsupported aes-256-ccm test`); -+} else { - const cipher = crypto.createCipheriv('aes-256-ccm', - 'FxLKsqdmv0E9xrQhp0b1ZgI0K7JFZJM8', - 'qkuZpJWCewa6S', -@@ -458,7 +468,9 @@ for (const test of TEST_CASES) { - } - - // Test that setAAD and update throw if the plaintext is too long. --{ -+if (!ciphers.includes('aes-256-ccm')) { -+ common.printSkipMessage(`unsupported aes-256-ccm test`); -+} else { - for (const ivLength of [13, 12]) { - const maxMessageSize = (1 << (8 * (15 - ivLength))) - 1; - const key = 'FxLKsqdmv0E9xrQhp0b1ZgI0K7JFZJM8'; -@@ -489,7 +501,9 @@ for (const test of TEST_CASES) { - - // Test that setAAD throws if the mode is CCM and the plaintext length has not - // been specified. --{ -+if (!ciphers.includes('aes-256-ccm')) { -+ common.printSkipMessage(`unsupported aes-256-ccm test`); -+} else { - assert.throws(() => { - const cipher = crypto.createCipheriv('aes-256-ccm', - 'FxLKsqdmv0E9xrQhp0b1ZgI0K7JFZJM8', -@@ -514,7 +528,9 @@ for (const test of TEST_CASES) { - } - - // Test that final() throws in CCM mode when no authentication tag is provided. --{ -+if (!ciphers.includes('aes-128-ccm')) { -+ common.printSkipMessage(`unsupported aes-256-ccm test`); -+} else { - if (!common.hasFipsCrypto) { - const key = Buffer.from('1ed2233fa2223ef5d7df08546049406c', 'hex'); - const iv = Buffer.from('7305220bca40d4c90e1791e9', 'hex'); -@@ -546,7 +562,9 @@ for (const test of TEST_CASES) { - } - - // Test that an IV length of 11 does not overflow max_message_size_. --{ -+if (!ciphers.includes('aes-128-ccm')) { -+ common.printSkipMessage(`unsupported aes-128-ccm test`); -+} else { - const key = 'x'.repeat(16); - const iv = Buffer.from('112233445566778899aabb', 'hex'); - const options = { authTagLength: 8 }; -@@ -563,6 +581,10 @@ for (const test of TEST_CASES) { - const iv = Buffer.from('0123456789ab', 'utf8'); - - for (const mode of ['gcm', 'ocb']) { -+ if (!ciphers.includes(`aes-128-${mode}`)) { -+ common.printSkipMessage(`unsupported aes-128-${mode} test`); -+ continue; -+ } - for (const authTagLength of mode === 'gcm' ? [undefined, 8] : [8]) { - const cipher = crypto.createCipheriv(`aes-128-${mode}`, key, iv, { - authTagLength -@@ -597,6 +619,10 @@ for (const test of TEST_CASES) { - const opts = { authTagLength: 8 }; - - for (const mode of ['gcm', 'ccm', 'ocb']) { -+ if (!ciphers.includes(`aes-128-${mode}`)) { -+ common.printSkipMessage(`unsupported aes-128-${mode} test`); -+ continue; -+ } - const cipher = crypto.createCipheriv(`aes-128-${mode}`, key, iv, opts); - const ciphertext = Buffer.concat([cipher.update(plain), cipher.final()]); - const tag = cipher.getAuthTag(); -@@ -619,7 +645,9 @@ for (const test of TEST_CASES) { - // Test chacha20-poly1305 rejects invalid IV lengths of 13, 14, 15, and 16 (a - // length of 17 or greater was already rejected). - // - https://www.openssl.org/news/secadv/20190306.txt --{ -+if (!ciphers.includes('chacha20-poly1305')) { -+ common.printSkipMessage(`unsupported chacha20-poly1305 test`); -+} else { - // Valid extracted from TEST_CASES, check that it detects IV tampering. - const valid = { - algo: 'chacha20-poly1305', -@@ -664,6 +692,9 @@ for (const test of TEST_CASES) { - - { - // CCM cipher without data should not crash, see https://github.com/nodejs/node/issues/38035. -+ common.printSkipMessage(`unsupported aes-128-ccm test`); -+ return; -+ - const algo = 'aes-128-ccm'; - const key = Buffer.alloc(16); - const iv = Buffer.alloc(12); diff --git a/test/parallel/test-crypto-certificate.js b/test/parallel/test-crypto-certificate.js index 4a5f1f149fe6c739f7f1d2ee17df6e61a942d621..b3287f428ce6b3fde11d449c601a57ff5e3843f9 100644 --- a/test/parallel/test-crypto-certificate.js @@ -194,115 +94,6 @@ index 4a5f1f149fe6c739f7f1d2ee17df6e61a942d621..b3287f428ce6b3fde11d449c601a57ff } { -diff --git a/test/parallel/test-crypto-cipher-decipher.js b/test/parallel/test-crypto-cipher-decipher.js -index 35514afbea92562a81c163b1e4d918b4ab609f71..13098e1acf12c309f2ed6f6143a2c2eeb8a2763d 100644 ---- a/test/parallel/test-crypto-cipher-decipher.js -+++ b/test/parallel/test-crypto-cipher-decipher.js -@@ -22,7 +22,7 @@ common.expectWarning({ - function testCipher1(key) { - // Test encryption and decryption - const plaintext = 'Keep this a secret? No! Tell everyone about node.js!'; -- const cipher = crypto.createCipher('aes192', key); -+ const cipher = crypto.createCipher('aes-192-cbc', key); - - // Encrypt plaintext which is in utf8 format - // to a ciphertext which will be in hex -@@ -30,7 +30,7 @@ function testCipher1(key) { - // Only use binary or hex, not base64. - ciph += cipher.final('hex'); - -- const decipher = crypto.createDecipher('aes192', key); -+ const decipher = crypto.createDecipher('aes-192-cbc', key); - let txt = decipher.update(ciph, 'hex', 'utf8'); - txt += decipher.final('utf8'); - -@@ -40,11 +40,11 @@ function testCipher1(key) { - // NB: In real life, it's not guaranteed that you can get all of it - // in a single read() like this. But in this case, we know it's - // quite small, so there's no harm. -- const cStream = crypto.createCipher('aes192', key); -+ const cStream = crypto.createCipher('aes-192-cbc', key); - cStream.end(plaintext); - ciph = cStream.read(); - -- const dStream = crypto.createDecipher('aes192', key); -+ const dStream = crypto.createDecipher('aes-192-cbc', key); - dStream.end(ciph); - txt = dStream.read().toString('utf8'); - -@@ -59,14 +59,14 @@ function testCipher2(key) { - '32|RmVZZkFUVmpRRkp0TmJaUm56ZU9qcnJkaXNNWVNpTTU*|iXmckfRWZBGWWELw' + - 'eCBsThSsfUHLeRe0KCsK8ooHgxie0zOINpXxfZi/oNG7uq9JWFVCk70gfzQH8ZUJ' + - 'jAfaFg**'; -- const cipher = crypto.createCipher('aes256', key); -+ const cipher = crypto.createCipher('aes-256-cbc', key); - - // Encrypt plaintext which is in utf8 format to a ciphertext which will be in - // Base64. - let ciph = cipher.update(plaintext, 'utf8', 'base64'); - ciph += cipher.final('base64'); - -- const decipher = crypto.createDecipher('aes256', key); -+ const decipher = crypto.createDecipher('aes-256-cbc', key); - let txt = decipher.update(ciph, 'base64', 'utf8'); - txt += decipher.final('utf8'); - -@@ -170,7 +170,7 @@ testCipher2(Buffer.from('0123456789abcdef')); - // Regression test for https://github.com/nodejs/node-v0.x-archive/issues/5482: - // string to Cipher#update() should not assert. - { -- const c = crypto.createCipher('aes192', '0123456789abcdef'); -+ const c = crypto.createCipher('aes-192-cbc', '0123456789abcdef'); - c.update('update'); - c.final(); - } -@@ -178,15 +178,15 @@ testCipher2(Buffer.from('0123456789abcdef')); - // https://github.com/nodejs/node-v0.x-archive/issues/5655 regression tests, - // 'utf-8' and 'utf8' are identical. - { -- let c = crypto.createCipher('aes192', '0123456789abcdef'); -+ let c = crypto.createCipher('aes-192-cbc', '0123456789abcdef'); - c.update('update', ''); // Defaults to "utf8". - c.final('utf-8'); // Should not throw. - -- c = crypto.createCipher('aes192', '0123456789abcdef'); -+ c = crypto.createCipher('aes-192-cbc', '0123456789abcdef'); - c.update('update', 'utf8'); - c.final('utf-8'); // Should not throw. - -- c = crypto.createCipher('aes192', '0123456789abcdef'); -+ c = crypto.createCipher('aes-192-cbc', '0123456789abcdef'); - c.update('update', 'utf-8'); - c.final('utf8'); // Should not throw. - } -@@ -195,23 +195,23 @@ testCipher2(Buffer.from('0123456789abcdef')); - { - const key = '0123456789abcdef'; - const plaintext = 'Top secret!!!'; -- const c = crypto.createCipher('aes192', key); -+ const c = crypto.createCipher('aes-192-cbc', key); - let ciph = c.update(plaintext, 'utf16le', 'base64'); - ciph += c.final('base64'); - -- let decipher = crypto.createDecipher('aes192', key); -+ let decipher = crypto.createDecipher('aes-192-cbc', key); - - let txt; - txt = decipher.update(ciph, 'base64', 'ucs2'); - txt += decipher.final('ucs2'); - assert.strictEqual(txt, plaintext); - -- decipher = crypto.createDecipher('aes192', key); -+ decipher = crypto.createDecipher('aes-192-cbc', key); - txt = decipher.update(ciph, 'base64', 'ucs-2'); - txt += decipher.final('ucs-2'); - assert.strictEqual(txt, plaintext); - -- decipher = crypto.createDecipher('aes192', key); -+ decipher = crypto.createDecipher('aes-192-cbc', key); - txt = decipher.update(ciph, 'base64', 'utf-16le'); - txt += decipher.final('utf-16le'); - assert.strictEqual(txt, plaintext); diff --git a/test/parallel/test-crypto-cipheriv-decipheriv.js b/test/parallel/test-crypto-cipheriv-decipheriv.js index 3e3632203af72c54f2795d8de0cf345862a043bb..a066bbb803d41d9d1f26a02e41115b71233988d6 100644 --- a/test/parallel/test-crypto-cipheriv-decipheriv.js @@ -318,21 +109,6 @@ index 3e3632203af72c54f2795d8de0cf345862a043bb..a066bbb803d41d9d1f26a02e41115b71 // Test encryption and decryption with explicit key and iv. // AES Key Wrap test vector comes from RFC3394 const plaintext = Buffer.from('00112233445566778899AABBCCDDEEFF', 'hex'); -diff --git a/test/parallel/test-crypto-classes.js b/test/parallel/test-crypto-classes.js -index dd073274aef765e8f1e403aa2c8baf9694b521cb..fc6339e040debe61ecc61a3eb5b26823b102f1ff 100644 ---- a/test/parallel/test-crypto-classes.js -+++ b/test/parallel/test-crypto-classes.js -@@ -22,8 +22,8 @@ const TEST_CASES = { - }; - - if (!common.hasFipsCrypto) { -- TEST_CASES.Cipher = ['aes192', 'secret']; -- TEST_CASES.Decipher = ['aes192', 'secret']; -+ TEST_CASES.Cipher = ['aes-192-cbc', 'secret']; -+ TEST_CASES.Decipher = ['aes-192-cbc', 'secret']; - TEST_CASES.DiffieHellman = [common.hasOpenSSL3 ? 1024 : 256]; - } - diff --git a/test/parallel/test-crypto-dh-curves.js b/test/parallel/test-crypto-dh-curves.js index 81a469c226c261564dee1e0b06b6571b18a41f1f..58b66045dba4201b7ebedd78b129420ffc316051 100644 --- a/test/parallel/test-crypto-dh-curves.js @@ -381,7 +157,7 @@ index fcf1922bcdba733af6c22f142db4f7b099947757..9f72ae4e41a113e752f40795103c2af5 assert.throws(() => crypto.createDiffieHellman('abcdef', g), ex); assert.throws(() => crypto.createDiffieHellman('abcdef', 'hex', g), ex); diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js -index 8ae0a002fec0944737d2c6ae73fc8956e41beb50..5b37236a6c2f1ec1761d8143c8ea6a7e2a837a7a 100644 +index 9ebe14011eed223994e0901bc22dcc582b4b0739..e78f90eb76380916ce7098fb517c83a954edb053 100644 --- a/test/parallel/test-crypto-dh.js +++ b/test/parallel/test-crypto-dh.js @@ -55,18 +55,17 @@ const crypto = require('crypto'); @@ -411,13 +187,21 @@ index 8ae0a002fec0944737d2c6ae73fc8956e41beb50..5b37236a6c2f1ec1761d8143c8ea6a7e }; } -@@ -100,10 +99,16 @@ const crypto = require('crypto'); +@@ -93,17 +92,23 @@ const crypto = require('crypto'); + dh3.computeSecret(''); + }, { message: common.hasOpenSSL3 && !hasOpenSSL3WithNewErrorMessage ? + 'Unspecified validation error' : +- 'Supplied key is too small' }); ++ 'Supplied key is invalid' }); + } + } + // Through a fluke of history, g=0 defaults to DH_GENERATOR (2). { const g = 0; - crypto.createDiffieHellman('abcdef', g); + assert.throws(() => crypto.createDiffieHellman('abcdef', g), { -+ code: /INVALID_PARAMETERS/, ++ code: /ERR_CRYPTO_OPERATION_FAILED/, + name: 'Error' + }); crypto.createDiffieHellman('abcdef', 'hex', g); @@ -426,28 +210,28 @@ index 8ae0a002fec0944737d2c6ae73fc8956e41beb50..5b37236a6c2f1ec1761d8143c8ea6a7e { - crypto.createDiffieHellman('abcdef', Buffer.from([2])); // OK + assert.throws(() => crypto.createDiffieHellman('abcdef', Buffer.from([2])), { -+ code: /INVALID_PARAMETERS/, ++ code: /ERR_CRYPTO_OPERATION_FAILED/, + name: 'Error' + }); } diff --git a/test/parallel/test-crypto-getcipherinfo.js b/test/parallel/test-crypto-getcipherinfo.js -index 64b79fc36ccf4d38f763fcd8c1930473c82cefd7..892490fc7dd8da09f8aa10a20bec69385c0fee28 100644 +index 64b79fc36ccf4d38f763fcd8c1930473c82cefd7..1c6717ebd46497384b9b13174b65894ca89e7f2d 100644 --- a/test/parallel/test-crypto-getcipherinfo.js +++ b/test/parallel/test-crypto-getcipherinfo.js @@ -62,9 +62,13 @@ assert(getCipherInfo('aes-128-cbc', { ivLength: 16 })); assert(!getCipherInfo('aes-128-ccm', { ivLength: 1 })); assert(!getCipherInfo('aes-128-ccm', { ivLength: 14 })); -+/* ++if (!common.openSSLIsBoringSSL) { for (let n = 7; n <= 13; n++) assert(getCipherInfo('aes-128-ccm', { ivLength: n })); -+*/ ++} assert(!getCipherInfo('aes-128-ocb', { ivLength: 16 })); -+/* ++if (!common.openSSLIsBoringSSL) { for (let n = 1; n < 16; n++) assert(getCipherInfo('aes-128-ocb', { ivLength: n })); -+*/ ++} \ No newline at end of file diff --git a/test/parallel/test-crypto-hash-stream-pipe.js b/test/parallel/test-crypto-hash-stream-pipe.js index d22281abbd5c3cab3aaa3ac494301fa6b4a8a968..5f0c6a4aed2e868a1a1049212edf218791cd6868 100644 @@ -471,7 +255,7 @@ index d22281abbd5c3cab3aaa3ac494301fa6b4a8a968..5f0c6a4aed2e868a1a1049212edf2187 s.pipe(h).on('data', common.mustCall(function(c) { assert.strictEqual(c, expect); diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js -index af2146982c7a3bf7bd7527f44e4b17a3b605026e..f6b91f675cfea367c608892dee078b565814f2dd 100644 +index 83218c105a4596e0ae0381136f176bb8d759899e..afb3c8c592d2a8e2a053fd44f455af06c592a85e 100644 --- a/test/parallel/test-crypto-hash.js +++ b/test/parallel/test-crypto-hash.js @@ -182,6 +182,7 @@ assert.throws( @@ -549,7 +333,7 @@ index 1785f5eef3d202976666081d09850ed744d83446..e88227a215ba4f7fa196f7642ae694a5 }); diff --git a/test/parallel/test-crypto-rsa-dsa.js b/test/parallel/test-crypto-rsa-dsa.js -index 5f4fafdfffbf726b7cb39c472baa3df25c9794cf..73bb53b0405b20f51b13326cc70e52755c674366 100644 +index 5f4fafdfffbf726b7cb39c472baa3df25c9794cf..d52376da2cddd90adcdf8a9b7dcd03e348d9f2b4 100644 --- a/test/parallel/test-crypto-rsa-dsa.js +++ b/test/parallel/test-crypto-rsa-dsa.js @@ -28,12 +28,11 @@ const dsaPkcs8KeyPem = fixtures.readKey('dsa_private_pkcs8.pem'); @@ -580,22 +364,25 @@ index 5f4fafdfffbf726b7cb39c472baa3df25c9794cf..73bb53b0405b20f51b13326cc70e5275 if (!process.config.variables.node_shared_openssl) { assert.throws(() => { crypto.privateDecrypt({ -@@ -466,7 +466,7 @@ assert.throws(() => { +@@ -466,10 +466,10 @@ assert.throws(() => { assert.strictEqual(verify2.verify(publicKey, signature, 'hex'), true); } - -+/* // // Test DSA signing and verification // ++if (!common.openSSLIsBoringSSL) { + { + const input = 'I AM THE WALRUS'; + @@ -541,3 +541,4 @@ const input = 'I AM THE WALRUS'; assert.strictEqual(verify.verify(dsaPubPem, signature, 'hex'), true); } -+*/ ++} diff --git a/test/parallel/test-crypto-scrypt.js b/test/parallel/test-crypto-scrypt.js -index 61bd65fc92678c24baa3c0eb9ffb1ead64ace70b..cb690351696a811210b9d990ee4cde3cfb2a3446 100644 +index 338a19b0e88ad6f08d2f6b6a5d38b9980996ce11..a4ee215575d072450ba66c558ddca88bfb23d85f 100644 --- a/test/parallel/test-crypto-scrypt.js +++ b/test/parallel/test-crypto-scrypt.js @@ -178,7 +178,7 @@ for (const options of bad) { @@ -608,26 +395,19 @@ index 61bd65fc92678c24baa3c0eb9ffb1ead64ace70b..cb690351696a811210b9d990ee4cde3c }; assert.throws(() => crypto.scrypt('pass', 'salt', 1, options, () => {}), diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js -index 9dd586a1a1f9a00d9bb0af5b0532e81e7b96a5ce..1a0d0cfc09fb61d65472723ba54e1d0be69b5c68 100644 +index 9dd586a1a1f9a00d9bb0af5b0532e81e7b96a5ce..a37e6d50914345829c8260a97949cee7d17ab676 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js -@@ -28,6 +28,7 @@ const keySize = 2048; - 'instance when called without `new`'); +@@ -29,7 +29,7 @@ const keySize = 2048; } -+/* // Test handling of exceptional conditions - { +-{ ++if (!common.openSSLIsBoringSSL) { const library = { -@@ -68,6 +69,7 @@ const keySize = 2048; - - delete Object.prototype.opensslErrorStack; - } -+*/ - - assert.throws( - () => crypto.createVerify('SHA256').verify({ -@@ -341,15 +343,17 @@ assert.throws( + configurable: true, + set() { +@@ -341,15 +341,17 @@ assert.throws( padding: crypto.constants.RSA_PKCS1_OAEP_PADDING }); }, common.hasOpenSSL3 ? { @@ -649,7 +429,7 @@ index 9dd586a1a1f9a00d9bb0af5b0532e81e7b96a5ce..1a0d0cfc09fb61d65472723ba54e1d0b }); } -@@ -419,10 +423,12 @@ assert.throws( +@@ -419,10 +421,12 @@ assert.throws( public: fixtures.readKey('ed25519_public.pem', 'ascii'), algo: null, sigLen: 64 }, @@ -662,7 +442,7 @@ index 9dd586a1a1f9a00d9bb0af5b0532e81e7b96a5ce..1a0d0cfc09fb61d65472723ba54e1d0b { private: fixtures.readKey('rsa_private_2048.pem', 'ascii'), public: fixtures.readKey('rsa_public_2048.pem', 'ascii'), algo: 'sha1', -@@ -493,7 +499,7 @@ assert.throws( +@@ -493,7 +497,7 @@ assert.throws( { const data = Buffer.from('Hello world'); @@ -776,10 +556,10 @@ index 89a7521544f7051edc1779138551bbad1972b3fb..91df6acc65d4003999f29f0fa5f63905 } +*/ diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js -index a8ceb169de2b3de73f062083c42292babc673e73..8fb950d0814e5014faf5c1ef576b65795857da1b 100644 +index 4271121881379b6c6892e89e520345f77e4181df..6c87a1ac687aa37d4ba245d1b6fc746a5f1eeffc 100644 --- a/test/parallel/test-crypto.js +++ b/test/parallel/test-crypto.js -@@ -67,7 +67,7 @@ assert.throws(() => { +@@ -61,7 +61,7 @@ assert.throws(() => { // Throws general Error, so there is no opensslErrorStack property. return err instanceof Error && err.name === 'Error' && @@ -788,7 +568,7 @@ index a8ceb169de2b3de73f062083c42292babc673e73..8fb950d0814e5014faf5c1ef576b6579 !('opensslErrorStack' in err); }); -@@ -77,7 +77,7 @@ assert.throws(() => { +@@ -71,7 +71,7 @@ assert.throws(() => { // Throws general Error, so there is no opensslErrorStack property. return err instanceof Error && err.name === 'Error' && @@ -797,7 +577,7 @@ index a8ceb169de2b3de73f062083c42292babc673e73..8fb950d0814e5014faf5c1ef576b6579 !('opensslErrorStack' in err); }); -@@ -87,7 +87,7 @@ assert.throws(() => { +@@ -81,7 +81,7 @@ assert.throws(() => { // Throws general Error, so there is no opensslErrorStack property. return err instanceof Error && err.name === 'Error' && @@ -806,7 +586,7 @@ index a8ceb169de2b3de73f062083c42292babc673e73..8fb950d0814e5014faf5c1ef576b6579 !('opensslErrorStack' in err); }); -@@ -150,8 +150,6 @@ assert(crypto.getHashes().includes('sha1')); +@@ -144,8 +144,6 @@ assert(crypto.getHashes().includes('sha1')); assert(crypto.getHashes().includes('sha256')); assert(!crypto.getHashes().includes('SHA1')); assert(!crypto.getHashes().includes('SHA256')); @@ -815,16 +595,7 @@ index a8ceb169de2b3de73f062083c42292babc673e73..8fb950d0814e5014faf5c1ef576b6579 validateList(crypto.getHashes()); // Make sure all of the hashes are supported by OpenSSL for (const algo of crypto.getHashes()) -@@ -188,7 +186,7 @@ const encodingError = { - // hex input that's not a power of two should throw, not assert in C++ land. - ['createCipher', 'createDecipher'].forEach((funcName) => { - assert.throws( -- () => crypto[funcName]('aes192', 'test').update('0', 'hex'), -+ () => crypto[funcName]('aes-192-cbc', 'test').update('0', 'hex'), - (error) => { - assert.ok(!('opensslErrorStack' in error)); - if (common.hasFipsCrypto) { -@@ -219,7 +217,7 @@ assert.throws( +@@ -195,7 +193,7 @@ assert.throws( return true; } ); @@ -833,7 +604,7 @@ index a8ceb169de2b3de73f062083c42292babc673e73..8fb950d0814e5014faf5c1ef576b6579 assert.throws(() => { const priv = [ '-----BEGIN RSA PRIVATE KEY-----', -@@ -232,6 +230,7 @@ assert.throws(() => { +@@ -208,6 +206,7 @@ assert.throws(() => { ].join('\n'); crypto.createSign('SHA256').update('test').sign(priv); }, (err) => { @@ -841,7 +612,7 @@ index a8ceb169de2b3de73f062083c42292babc673e73..8fb950d0814e5014faf5c1ef576b6579 if (!common.hasOpenSSL3) assert.ok(!('opensslErrorStack' in err)); assert.throws(() => { throw err; }, common.hasOpenSSL3 ? { -@@ -240,10 +239,10 @@ assert.throws(() => { +@@ -216,10 +215,10 @@ assert.throws(() => { library: 'rsa routines', } : { name: 'Error', @@ -856,7 +627,7 @@ index a8ceb169de2b3de73f062083c42292babc673e73..8fb950d0814e5014faf5c1ef576b6579 code: 'ERR_OSSL_RSA_DIGEST_TOO_BIG_FOR_RSA_KEY' }); return true; -@@ -276,7 +275,7 @@ if (!common.hasOpenSSL3) { +@@ -252,7 +251,7 @@ if (!common.hasOpenSSL3) { return true; }); } @@ -954,56 +725,62 @@ index b06f2fa2c53ea72f9a66f0d002dd9281d0259a0f..864fffeebfad75d95416fd47efdea7f2 const server = https.createServer(opts, (req, res) => { diff --git a/test/parallel/test-webcrypto-derivebits.js b/test/parallel/test-webcrypto-derivebits.js -index eb09bc24f0cb8244b05987e3a7c1d203360d3a38..da891fffa29d5666d91e4445e54c43e3688b870a 100644 +index eb09bc24f0cb8244b05987e3a7c1d203360d3a38..011990db171faa708c5211f6ab9ae1ac0e0ab90e 100644 --- a/test/parallel/test-webcrypto-derivebits.js +++ b/test/parallel/test-webcrypto-derivebits.js -@@ -101,6 +101,7 @@ const { subtle } = globalThis.crypto; +@@ -101,8 +101,9 @@ const { subtle } = globalThis.crypto; tests.then(common.mustCall()); } -+/* ++ // Test X25519 and X448 bit derivation - { +-{ ++if (!common.openSSLIsBoringSSL) { async function test(name) { + const [alice, bob] = await Promise.all([ + subtle.generateKey({ name }, true, ['deriveBits']), @@ -126,3 +127,4 @@ const { subtle } = globalThis.crypto; test('X25519').then(common.mustCall()); test('X448').then(common.mustCall()); } -+*/ ++ diff --git a/test/parallel/test-webcrypto-derivekey.js b/test/parallel/test-webcrypto-derivekey.js -index 558d37d90d5796b30101d1b512c9df3e7661d0db..c18f9670b10cb84c6902391f20e0ff75729cc960 100644 +index 558d37d90d5796b30101d1b512c9df3e7661d0db..f42bf8f4be0b439dd7e7c8d0f6f8a41e01588870 100644 --- a/test/parallel/test-webcrypto-derivekey.js +++ b/test/parallel/test-webcrypto-derivekey.js -@@ -175,6 +175,7 @@ const { KeyObject } = require('crypto'); - })().then(common.mustCall()); +@@ -176,7 +176,7 @@ const { KeyObject } = require('crypto'); } -+/* // Test X25519 and X448 key derivation - { +-{ ++if (!common.openSSLIsBoringSSL) { async function test(name) { -@@ -209,3 +210,4 @@ const { KeyObject } = require('crypto'); - test('X25519').then(common.mustCall()); - test('X448').then(common.mustCall()); - } -+*/ + const [alice, bob] = await Promise.all([ + subtle.generateKey({ name }, true, ['deriveKey']), diff --git a/test/parallel/test-webcrypto-sign-verify.js b/test/parallel/test-webcrypto-sign-verify.js -index de736102bdcb71a5560c95f7041537f25026aed4..638fdf0d798f3309528c63f0f8598f3df5528339 100644 +index de736102bdcb71a5560c95f7041537f25026aed4..12d7fa39446c196bdf1479dbe74c9ee8ab02f949 100644 --- a/test/parallel/test-webcrypto-sign-verify.js +++ b/test/parallel/test-webcrypto-sign-verify.js -@@ -105,6 +105,7 @@ const { subtle } = globalThis.crypto; +@@ -105,8 +105,9 @@ const { subtle } = globalThis.crypto; test('hello world').then(common.mustCall()); } -+/* ++ // Test Sign/Verify Ed25519 - { +-{ ++if (!common.openSSLIsBoringSSL) { async function test(data) { -@@ -144,3 +145,4 @@ const { subtle } = globalThis.crypto; - - test('hello world').then(common.mustCall()); + const ec = new TextEncoder(); + const { publicKey, privateKey } = await subtle.generateKey({ +@@ -126,7 +127,7 @@ const { subtle } = globalThis.crypto; } -+*/ + + // Test Sign/Verify Ed448 +-{ ++if (!common.openSSLIsBoringSSL) { + async function test(data) { + const ec = new TextEncoder(); + const { publicKey, privateKey } = await subtle.generateKey({ diff --git a/test/parallel/test-webcrypto-wrap-unwrap.js b/test/parallel/test-webcrypto-wrap-unwrap.js index d1ca571af4be713082d32093bfb8a65f2aef9800..57b8df2ce18df58ff54b2d828af67e3c2e082fe0 100644 --- a/test/parallel/test-webcrypto-wrap-unwrap.js diff --git a/patches/node/fix_do_not_resolve_electron_entrypoints.patch b/patches/node/fix_do_not_resolve_electron_entrypoints.patch index e5177c8297..fba87eb85f 100644 --- a/patches/node/fix_do_not_resolve_electron_entrypoints.patch +++ b/patches/node/fix_do_not_resolve_electron_entrypoints.patch @@ -6,10 +6,10 @@ Subject: fix: do not resolve electron entrypoints This wastes fs cycles and can result in strange behavior if this path actually exists on disk diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js -index 22248b753c14960122f1d6b9bfe6b89fdb8d2010..9d245a04fbcb98dcd1c61e60f7cfe528bd1c8af0 100644 +index 463e76cb1abc0c2fdddba4db2ca2e00f7c591e12..d7bc3c35c77b5bf9ec122b38248d0cf1f4d2a548 100644 --- a/lib/internal/modules/esm/load.js +++ b/lib/internal/modules/esm/load.js -@@ -132,7 +132,7 @@ async function defaultLoad(url, context = kEmptyObject) { +@@ -111,7 +111,7 @@ async function defaultLoad(url, context = kEmptyObject) { source = null; format ??= 'builtin'; } else if (format !== 'commonjs' || defaultType === 'module') { @@ -19,10 +19,10 @@ index 22248b753c14960122f1d6b9bfe6b89fdb8d2010..9d245a04fbcb98dcd1c61e60f7cfe528 context = { __proto__: context, source }; } diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index f3dfc69cd2cdec50bc3b3f7cb2d63349812d87dd..b6f2d7194cb75ecc8c47869761c63184707ade40 100644 +index 06b31af80ebbfbf35ec787a94f345775eb512ebf..deca5aa4b8829ba9921440fcb5c285a10e40c8f0 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js -@@ -375,6 +375,9 @@ function cjsPreparseModuleExports(filename, source) { +@@ -354,6 +354,9 @@ function cjsPreparseModuleExports(filename, source) { if (module && module[kModuleExportNames] !== undefined) { return { module, exportNames: module[kModuleExportNames] }; } @@ -33,7 +33,7 @@ index f3dfc69cd2cdec50bc3b3f7cb2d63349812d87dd..b6f2d7194cb75ecc8c47869761c63184 if (!loaded) { module = new CJSModule(filename); diff --git a/lib/internal/modules/run_main.js b/lib/internal/modules/run_main.js -index ca401044c0178c46db9b439b27c440a5d7924c84..dc1a682f0a3cf1ba1095c60bf6a6ca992d6043b3 100644 +index 1e1a1ea46fc6c1b43cad4038ab0d9cdf21d6ba3d..95e2fa5479ea31559fdb5a2e03515f243b231b75 100644 --- a/lib/internal/modules/run_main.js +++ b/lib/internal/modules/run_main.js @@ -2,6 +2,7 @@ @@ -41,10 +41,10 @@ index ca401044c0178c46db9b439b27c440a5d7924c84..dc1a682f0a3cf1ba1095c60bf6a6ca99 const { StringPrototypeEndsWith, + StringPrototypeStartsWith, + globalThis, } = primordials; - const { containsModuleSyntax } = internalBinding('contextify'); -@@ -22,6 +23,13 @@ const { +@@ -26,6 +27,13 @@ const { * @param {string} main - Entry point path */ function resolveMainPath(main) { @@ -58,7 +58,7 @@ index ca401044c0178c46db9b439b27c440a5d7924c84..dc1a682f0a3cf1ba1095c60bf6a6ca99 const defaultType = getOptionValue('--experimental-default-type'); /** @type {string} */ let mainPath; -@@ -59,6 +67,13 @@ function resolveMainPath(main) { +@@ -63,6 +71,13 @@ function resolveMainPath(main) { * @param {string} mainPath - Absolute path to the main entry point */ function shouldUseESMLoader(mainPath) { 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 ee7a6cf34a..1f84223398 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 @@ -6,22 +6,22 @@ Subject: fix: expose the built-in electron module via the ESM loader This allows usage of `import { app } from 'electron'` and `import('electron')` natively in the browser + non-sandboxed renderer diff --git a/lib/internal/modules/esm/get_format.js b/lib/internal/modules/esm/get_format.js -index 1fe5564545dbc86d7f2968274a25ee1579bcbf28..b876af21a0e97ae06dc344d9f78c8f5c7e403d43 100644 +index a89446df710a941390c15171fea63c551776fc93..912f03bfa96c3aa12bfa6e709746642452568bb7 100644 --- a/lib/internal/modules/esm/get_format.js +++ b/lib/internal/modules/esm/get_format.js -@@ -31,6 +31,7 @@ const protocolHandlers = { - 'http:': getHttpProtocolModuleFormat, - 'https:': getHttpProtocolModuleFormat, +@@ -26,6 +26,7 @@ const protocolHandlers = { + 'data:': getDataProtocolModuleFormat, + 'file:': getFileProtocolModuleFormat, 'node:'() { return 'builtin'; }, + 'electron:'() { return 'electron'; }, }; /** diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js -index 7b77af35a1dfebf6ad45ace521f1a55b5fa18293..ac24cf305bd5995ad13b37ee36f9e1fe3589c5d7 100644 +index 8b157f0f461c7b92c567fffe4d99357dbc09aee7..605e812d515fc467001e4ab88fc15b4af3fd4aa2 100644 --- a/lib/internal/modules/esm/load.js +++ b/lib/internal/modules/esm/load.js -@@ -142,7 +142,7 @@ async function defaultLoad(url, context = kEmptyObject) { +@@ -121,7 +121,7 @@ async function defaultLoad(url, context = kEmptyObject) { // Now that we have the source for the module, run `defaultGetFormat` to detect its format. format = await defaultGetFormat(urlInstance, context); @@ -30,37 +30,35 @@ index 7b77af35a1dfebf6ad45ace521f1a55b5fa18293..ac24cf305bd5995ad13b37ee36f9e1fe // For backward compatibility reasons, we need to discard the source in // order for the CJS loader to re-fetch it. source = null; -@@ -234,6 +234,7 @@ function throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports) { +@@ -218,12 +218,13 @@ function throwIfUnsupportedURLScheme(parsed) { protocol !== 'file:' && protocol !== 'data:' && protocol !== 'node:' && + protocol !== 'electron:' && ( - !experimentalNetworkImports || - ( -@@ -242,7 +243,7 @@ function throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports) { - ) + protocol !== 'https:' && + protocol !== 'http:' ) ) { - const schemes = ['file', 'data', 'node']; + const schemes = ['file', 'data', 'node', 'electron']; - if (experimentalNetworkImports) { - ArrayPrototypePush(schemes, 'https', 'http'); - } + throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed, schemes); + } + } diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js -index e73a8ad60a13925d6773c32cead8d04ec9d96ee7..52cdb7d5e14a18ed7b1b65e429729cf47dce3f98 100644 +index 1fbbb6773c9479128408fa1f27cf19f1a7786ba6..f05c6f99c0037193c5802024be46a967d6cf47a0 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js -@@ -741,6 +741,8 @@ function packageImportsResolve(name, base, conditions) { - throw importNotDefined(name, packageJSONUrl, base); +@@ -772,6 +772,8 @@ function parsePackageName(specifier, base) { + return { packageName, packageSubpath, isScoped }; } +const electronTypes = ['electron', 'electron/main', 'electron/common', 'electron/renderer']; + /** - * Returns the package type for a given URL. - * @param {URL} url - The URL to get the package type for. -@@ -801,6 +803,11 @@ function packageResolve(specifier, base, conditions) { + * Resolves a package specifier to a URL. + * @param {string} specifier - The package specifier to resolve. +@@ -785,6 +787,11 @@ function packageResolve(specifier, base, conditions) { return new URL('node:' + specifier); } @@ -73,10 +71,10 @@ index e73a8ad60a13925d6773c32cead8d04ec9d96ee7..52cdb7d5e14a18ed7b1b65e429729cf4 parsePackageName(specifier, base); diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index 8f4b6b25d8889686d00613fd9821b0aa822a946a..89ca269294ee1afa7f5aeb0ac6b8958f7a8b49d0 100644 +index 8f88214f558c52ef26000fb0e1ef4d391327e84e..d182eedf5e96039e0029d36e51f40b75c6fb2a39 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js -@@ -272,7 +272,7 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) { +@@ -246,7 +246,7 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) { const { exportNames, module } = cjsPreparseModuleExports(filename, source); cjsCache.set(url, module); @@ -85,7 +83,7 @@ index 8f4b6b25d8889686d00613fd9821b0aa822a946a..89ca269294ee1afa7f5aeb0ac6b8958f [...exportNames] : ['default', ...exportNames]; if (isMain) { -@@ -294,8 +294,8 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) { +@@ -268,8 +268,8 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) { ({ exports } = module); } for (const exportName of exportNames) { @@ -96,7 +94,7 @@ index 8f4b6b25d8889686d00613fd9821b0aa822a946a..89ca269294ee1afa7f5aeb0ac6b8958f continue; } // We might trigger a getter -> dont fail. -@@ -329,6 +329,10 @@ translators.set('require-commonjs', (url, source, isMain) => { +@@ -304,6 +304,10 @@ translators.set('require-commonjs', (url, source, isMain) => { return createCJSModuleWrap(url, source); }); @@ -104,14 +102,14 @@ index 8f4b6b25d8889686d00613fd9821b0aa822a946a..89ca269294ee1afa7f5aeb0ac6b8958f + return createCJSModuleWrap('electron', ''); +}); + - // Handle CommonJS modules referenced by `import` statements or expressions, - // or as the initial entry point when the ESM loader handles a CommonJS entry. - translators.set('commonjs', async function commonjsStrategy(url, source, + // Handle CommonJS modules referenced by `require` calls. + // This translator function must be sync, as `require` is sync. + translators.set('require-commonjs-typescript', (url, source, isMain) => { diff --git a/lib/internal/url.js b/lib/internal/url.js -index e6ed5466b8807a52633d8406824058bdc8c2ce13..e055facddf086eb8fb456b865ce006cdb7602b0a 100644 +index 3cb186182947a14407e9d5c4d94ab0554298a658..e35ae9ac316ba2e5b8f562d353b2c5ae978abb63 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js -@@ -1485,6 +1485,8 @@ function fileURLToPath(path, options = kEmptyObject) { +@@ -1495,6 +1495,8 @@ function fileURLToPath(path, options = kEmptyObject) { 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 cf1dc86655..5f005aef01 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 46106fa94b3055648e4f01cd28860d427268a253..e0bf37f09dceb93af58990438ab577a9d4b843e8 100644 +index 77c20a4b6b9db414444974f68c5def8788386d2b..5fc1b6f2446d7c786024eb60800e2edab613dcd1 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -557,6 +557,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) { +@@ -564,6 +564,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) { return env->platform(); } @@ -22,7 +22,7 @@ index 46106fa94b3055648e4f01cd28860d427268a253..e0bf37f09dceb93af58990438ab577a9 int thread_pool_size, node::tracing::TracingController* tracing_controller) { diff --git a/src/node.h b/src/node.h -index 6373adacb628459a4c9d7237da2587aee318e2d8..4f2eb9d0aab88b70c86339e750799080e980d7da 100644 +index 60598f54114b2424f10706e57d8aa50c4634bcb0..0fec9477fd0f2a3c2aa68284131c510b0da0e025 100644 --- a/src/node.h +++ b/src/node.h @@ -133,6 +133,7 @@ struct SnapshotData; diff --git a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch index 82c13656c6..0ffc9526e8 100644 --- a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch +++ b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch @@ -16,11 +16,125 @@ Upstreams: - https://github.com/nodejs/node/pull/39138 - https://github.com/nodejs/node/pull/39136 +diff --git a/deps/ncrypto/ncrypto.cc b/deps/ncrypto/ncrypto.cc +index eb3533bb4623b152605c3c590f37f086cce5f073..ded231aeaa15af22845704cfcc7d24a44bd88f8e 100644 +--- a/deps/ncrypto/ncrypto.cc ++++ b/deps/ncrypto/ncrypto.cc +@@ -6,13 +6,11 @@ + #include + #include + #include ++#include + #include + #if OPENSSL_VERSION_MAJOR >= 3 + #include + #endif +-#ifdef OPENSSL_IS_BORINGSSL +-#include "dh-primes.h" +-#endif // OPENSSL_IS_BORINGSSL + + namespace ncrypto { + namespace { +@@ -665,7 +663,7 @@ bool SafeX509SubjectAltNamePrint(const BIOPointer& out, X509_EXTENSION* ext) { + + bool ok = true; + +- for (int i = 0; i < sk_GENERAL_NAME_num(names); i++) { ++ for (size_t i = 0; i < sk_GENERAL_NAME_num(names); i++) { + GENERAL_NAME* gen = sk_GENERAL_NAME_value(names, i); + + if (i != 0) +@@ -691,7 +689,7 @@ bool SafeX509InfoAccessPrint(const BIOPointer& out, X509_EXTENSION* ext) { + + bool ok = true; + +- for (int i = 0; i < sk_ACCESS_DESCRIPTION_num(descs); i++) { ++ for (size_t i = 0; i < sk_ACCESS_DESCRIPTION_num(descs); i++) { + ACCESS_DESCRIPTION* desc = sk_ACCESS_DESCRIPTION_value(descs, i); + + if (i != 0) +@@ -1002,7 +1000,11 @@ BIOPointer BIOPointer::NewMem() { + } + + BIOPointer BIOPointer::NewSecMem() { ++#ifdef OPENSSL_IS_BORINGSSL ++ return BIOPointer(BIO_new(BIO_s_mem())); ++#else + return BIOPointer(BIO_new(BIO_s_secmem())); ++#endif + } + + BIOPointer BIOPointer::New(const BIO_METHOD* method) { +@@ -1057,8 +1059,10 @@ BignumPointer DHPointer::FindGroup(const std::string_view name, + FindGroupOption option) { + #define V(n, p) if (EqualNoCase(name, n)) return BignumPointer(p(nullptr)); + if (option != FindGroupOption::NO_SMALL_PRIMES) { ++#ifndef OPENSSL_IS_BORINGSSL + V("modp1", BN_get_rfc2409_prime_768); + V("modp2", BN_get_rfc2409_prime_1024); ++#endif + V("modp5", BN_get_rfc3526_prime_1536); + } + V("modp14", BN_get_rfc3526_prime_2048); +@@ -1130,11 +1134,13 @@ DHPointer::CheckPublicKeyResult DHPointer::checkPublicKey(const BignumPointer& p + int codes = 0; + if (DH_check_pub_key(dh_.get(), pub_key.get(), &codes) != 1) + return DHPointer::CheckPublicKeyResult::CHECK_FAILED; ++#ifndef OPENSSL_IS_BORINGSSL + if (codes & DH_CHECK_PUBKEY_TOO_SMALL) { + return DHPointer::CheckPublicKeyResult::TOO_SMALL; + } else if (codes & DH_CHECK_PUBKEY_TOO_SMALL) { + return DHPointer::CheckPublicKeyResult::TOO_LARGE; +- } else if (codes != 0) { ++#endif ++ if (codes != 0) { + return DHPointer::CheckPublicKeyResult::INVALID; + } + return CheckPublicKeyResult::NONE; +diff --git a/deps/ncrypto/ncrypto.h b/deps/ncrypto/ncrypto.h +index 661c996889d0a89c1c38658a0933fcf5e3cdc1b9..1261d5d99fdf4e17b8dec66660028ce184f1cf89 100644 +--- a/deps/ncrypto/ncrypto.h ++++ b/deps/ncrypto/ncrypto.h +@@ -413,8 +413,8 @@ public: + #ifndef OPENSSL_IS_BORINGSSL + TOO_SMALL = DH_R_CHECK_PUBKEY_TOO_SMALL, + TOO_LARGE = DH_R_CHECK_PUBKEY_TOO_LARGE, +- INVALID = DH_R_CHECK_PUBKEY_INVALID, + #endif ++ INVALID = DH_R_INVALID_PUBKEY, + CHECK_FAILED = 512, + }; + // Check to see if the given public key is suitable for this DH instance. +diff --git a/deps/ncrypto/unofficial.gni b/deps/ncrypto/unofficial.gni +index ea024af73e215b3cad5f08796ac405f419530c86..41061b524eea74330b8d2452635a38c48f21386b 100644 +--- a/deps/ncrypto/unofficial.gni ++++ b/deps/ncrypto/unofficial.gni +@@ -27,6 +27,6 @@ template("ncrypto_gn_build") { + forward_variables_from(invoker, "*") + public_configs = [ ":ncrypto_config" ] + sources = gypi_values.ncrypto_sources +- deps = [ "../openssl" ] ++ deps = [ "$node_crypto_path" ] + } + } +diff --git a/node.gni b/node.gni +index 32709b860ccb12d8d1e75342a65dda0b86129b21..18d58591e3d0f1f3512db00033c3410a65702864 100644 +--- a/node.gni ++++ b/node.gni +@@ -10,6 +10,8 @@ declare_args() { + # The location of V8, use the one from node's deps by default. + node_v8_path = "//v8" + ++ node_crypto_path = "//third_party/boringssl" ++ + # The NODE_MODULE_VERSION defined in node_version.h. + node_module_version = exec_script("$node_path/tools/getmoduleversion.py", [], "value") + diff --git a/src/crypto/crypto_cipher.cc b/src/crypto/crypto_cipher.cc -index 4f0637f9511d1b90ae9d33760428dceb772667bd..5aba390c49613816ac359dfe995dc2c0a93f2206 100644 +index fe35a8e0f6bbb7ab515a0343a7ed046c44e86474..43a7abbf237d8d809953e302b83755a3283a1bf4 100644 --- a/src/crypto/crypto_cipher.cc +++ b/src/crypto/crypto_cipher.cc -@@ -1088,7 +1088,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo& args) { +@@ -1078,7 +1078,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo& args) { if (EVP_PKEY_decrypt_init(ctx.get()) <= 0) { return ThrowCryptoError(env, ERR_get_error()); } @@ -29,19 +143,19 @@ index 4f0637f9511d1b90ae9d33760428dceb772667bd..5aba390c49613816ac359dfe995dc2c0 int rsa_pkcs1_implicit_rejection = EVP_PKEY_CTX_ctrl_str(ctx.get(), "rsa_pkcs1_implicit_rejection", "1"); // From the doc -2 means that the option is not supported. -@@ -1104,6 +1104,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo& args) { +@@ -1094,6 +1094,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo& args) { "RSA_PKCS1_PADDING is no longer supported for private decryption," - " this can be reverted with --security-revert=CVE-2023-46809"); + " this can be reverted with --security-revert=CVE-2024-PEND"); } +#endif } const EVP_MD* digest = nullptr; diff --git a/src/crypto/crypto_common.cc b/src/crypto/crypto_common.cc -index 85d48dfd2c15c453707bf6eb94e22f89b4f856b2..fe31a9a7f465a03d2de365cef392dfbb7c540156 100644 +index 6a967702b22df0eb8aa10e853fd232794955860d..31058cccc6ffeed6b09aaecda320ee2f15849ec8 100644 --- a/src/crypto/crypto_common.cc +++ b/src/crypto/crypto_common.cc -@@ -158,7 +158,7 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { +@@ -134,7 +134,7 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { const unsigned char* buf; size_t len; size_t rem; @@ -50,7 +164,7 @@ index 85d48dfd2c15c453707bf6eb94e22f89b4f856b2..fe31a9a7f465a03d2de365cef392dfbb if (!SSL_client_hello_get0_ext( ssl.get(), TLSEXT_TYPE_application_layer_protocol_negotiation, -@@ -171,13 +171,15 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { +@@ -147,13 +147,15 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { len = (buf[0] << 8) | buf[1]; if (len + 2 != rem) return nullptr; return reinterpret_cast(buf + 3); @@ -67,7 +181,7 @@ index 85d48dfd2c15c453707bf6eb94e22f89b4f856b2..fe31a9a7f465a03d2de365cef392dfbb if (!SSL_client_hello_get0_ext( ssl.get(), TLSEXT_TYPE_server_name, -@@ -199,6 +201,8 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) { +@@ -175,6 +177,8 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) { if (len + 2 > rem) return nullptr; return reinterpret_cast(buf + 5); @@ -76,7 +190,25 @@ index 85d48dfd2c15c453707bf6eb94e22f89b4f856b2..fe31a9a7f465a03d2de365cef392dfbb } const char* GetServerName(SSL* ssl) { -@@ -1036,14 +1040,14 @@ MaybeLocal GetClientHelloCiphers( +@@ -282,7 +286,7 @@ StackOfX509 CloneSSLCerts(X509Pointer&& cert, + if (!peer_certs) return StackOfX509(); + if (cert && !sk_X509_push(peer_certs.get(), cert.release())) + return StackOfX509(); +- for (int i = 0; i < sk_X509_num(ssl_certs); i++) { ++ for (size_t i = 0; i < sk_X509_num(ssl_certs); i++) { + X509Pointer cert(X509_dup(sk_X509_value(ssl_certs, i))); + if (!cert || !sk_X509_push(peer_certs.get(), cert.get())) + return StackOfX509(); +@@ -298,7 +302,7 @@ MaybeLocal AddIssuerChainToObject(X509Pointer* cert, + Environment* const env) { + cert->reset(sk_X509_delete(peer_certs.get(), 0)); + for (;;) { +- int i; ++ size_t i; + for (i = 0; i < sk_X509_num(peer_certs.get()); i++) { + ncrypto::X509View ca(sk_X509_value(peer_certs.get(), i)); + if (!cert->view().isIssuedBy(ca)) continue; +@@ -384,14 +388,14 @@ MaybeLocal GetClientHelloCiphers( Environment* env, const SSLPointer& ssl) { EscapableHandleScope scope(env->isolate()); @@ -95,7 +227,7 @@ index 85d48dfd2c15c453707bf6eb94e22f89b4f856b2..fe31a9a7f465a03d2de365cef392dfbb Local obj = Object::New(env->isolate()); if (!Set(env->context(), obj, -@@ -1096,8 +1100,11 @@ MaybeLocal GetEphemeralKey(Environment* env, const SSLPointer& ssl) { +@@ -444,8 +448,11 @@ MaybeLocal GetEphemeralKey(Environment* env, const SSLPointer& ssl) { EscapableHandleScope scope(env->isolate()); Local info = Object::New(env->isolate()); @@ -109,19 +241,19 @@ index 85d48dfd2c15c453707bf6eb94e22f89b4f856b2..fe31a9a7f465a03d2de365cef392dfbb crypto::EVPKeyPointer key(raw_key); diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc -index cef0c877c67643d47da787eddb95ed5a410a941b..1b8af49a48f1a34a92d4f0b502d435f3a4ab5d8e 100644 +index c924a54639e8c22d765dc240dffacfffb200ca0c..287afcc792a0a2b7e19126ee9a48ebe21cc8844e 100644 --- a/src/crypto/crypto_context.cc +++ b/src/crypto/crypto_context.cc -@@ -63,7 +63,7 @@ inline X509_STORE* GetOrCreateRootCertStore() { - // Caller responsible for BIO_free_all-ing the returned object. - BIOPointer LoadBIO(Environment* env, Local v) { - if (v->IsString() || v->IsArrayBufferView()) { -- BIOPointer bio(BIO_new(BIO_s_secmem())); -+ BIOPointer bio(BIO_new(BIO_s_mem())); - if (!bio) return nullptr; - ByteSource bsrc = ByteSource::FromStringOrBuffer(env, v); - if (bsrc.size() > INT_MAX) return nullptr; -@@ -882,10 +882,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo& args) { +@@ -94,7 +94,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx, + // the CA certificates. + SSL_CTX_clear_extra_chain_certs(ctx); + +- for (int i = 0; i < sk_X509_num(extra_certs); i++) { ++ for (size_t i = 0; i < sk_X509_num(extra_certs); i++) { + X509* ca = sk_X509_value(extra_certs, i); + + // NOTE: Increments reference count on `ca` +@@ -920,11 +920,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo& args) { // If the user specified "auto" for dhparams, the JavaScript layer will pass // true to this function instead of the original string. Any other string // value will be interpreted as custom DH parameters below. @@ -130,66 +262,106 @@ index cef0c877c67643d47da787eddb95ed5a410a941b..1b8af49a48f1a34a92d4f0b502d435f3 CHECK(SSL_CTX_set_dh_auto(sc->ctx_.get(), true)); return; } +- +#endif - DHPointer dh; { + BIOPointer bio(LoadBIO(env, args[0])); +@@ -1150,7 +1151,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo& args) { + } + + // Add CA certs too +- for (int i = 0; i < sk_X509_num(extra_certs.get()); i++) { ++ for (size_t i = 0; i < sk_X509_num(extra_certs.get()); i++) { + X509* ca = sk_X509_value(extra_certs.get(), i); + + X509_STORE_add_cert(sc->GetCertStoreOwnedByThisSecureContext(), ca); diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc -index dac37f52b9687cadfa2d02152241e9a6e4c16ddf..d47cfa4ad8707ed7f0a42e7fe176fec25be64305 100644 +index e5664dfa2bc7e11922fa965f28acdf21470d1147..33ffbbb85d05f5356183e3aa1ca23707c5629b5d 100644 --- a/src/crypto/crypto_dh.cc +++ b/src/crypto/crypto_dh.cc -@@ -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) { -- ERR_put_error(ERR_LIB_BN, BN_F_BN_GENERATE_PRIME_EX, -- BN_R_BITS_TOO_SMALL, __FILE__, __LINE__); -+ OPENSSL_PUT_ERROR(BN, BN_R_BITS_TOO_SMALL); - return false; - } - if (g <= 1) { -- 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; - } - 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) { -- ERR_put_error(ERR_LIB_BN, BN_F_BN_GENERATE_PRIME_EX, -- BN_R_BITS_TOO_SMALL, __FILE__, __LINE__); -+ OPENSSL_PUT_ERROR(BN, BN_R_BITS_TOO_SMALL); - return false; - } - if (g_len <= 0) { -- 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; - } - 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; - } - 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

+@@ -7,7 +7,9 @@ + #include "memory_tracker-inl.h" + #include "ncrypto.h" + #include "node_errors.h" +#ifndef OPENSSL_IS_BORINGSSL - V("modp1", BN_get_rfc2409_prime_768); - V("modp2", BN_get_rfc2409_prime_1024); + #include "openssl/bnerr.h" +#endif - V("modp5", BN_get_rfc3526_prime_1536); - V("modp14", BN_get_rfc3526_prime_2048); - V("modp15", BN_get_rfc3526_prime_3072); -@@ -565,9 +562,11 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { + #include "openssl/dh.h" + #include "threadpoolwork-inl.h" + #include "v8.h" +@@ -86,11 +88,7 @@ void New(const FunctionCallbackInfo& args) { + if (args[0]->IsInt32()) { + int32_t bits = args[0].As()->Value(); + if (bits < 2) { +-#if OPENSSL_VERSION_MAJOR >= 3 +- ERR_put_error(ERR_LIB_DH, 0, DH_R_MODULUS_TOO_SMALL, __FILE__, __LINE__); +-#else +- ERR_put_error(ERR_LIB_BN, 0, BN_R_BITS_TOO_SMALL, __FILE__, __LINE__); +-#endif ++ OPENSSL_PUT_ERROR(BN, BN_R_BITS_TOO_SMALL); + return ThrowCryptoError(env, ERR_get_error(), "Invalid prime length"); + } + +@@ -103,7 +101,7 @@ void New(const FunctionCallbackInfo& args) { + } + int32_t generator = args[1].As()->Value(); + if (generator < 2) { +- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__); ++ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR); + return ThrowCryptoError(env, ERR_get_error(), "Invalid generator"); + } + +@@ -132,12 +130,12 @@ void New(const FunctionCallbackInfo& args) { + if (args[1]->IsInt32()) { + int32_t generator = args[1].As()->Value(); + if (generator < 2) { +- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__); ++ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR); + return ThrowCryptoError(env, ERR_get_error(), "Invalid generator"); + } + bn_g = BignumPointer::New(); + if (!bn_g.setWord(generator)) { +- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__); ++ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR); + return ThrowCryptoError(env, ERR_get_error(), "Invalid generator"); + } + } else { +@@ -146,11 +144,11 @@ void New(const FunctionCallbackInfo& args) { + return THROW_ERR_OUT_OF_RANGE(env, "generator is too big"); + bn_g = BignumPointer(reinterpret_cast(arg1.data()), arg1.size()); + if (!bn_g) { +- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__); ++ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR); + return ThrowCryptoError(env, ERR_get_error(), "Invalid generator"); + } + if (bn_g.getWord() < 2) { +- ERR_put_error(ERR_LIB_DH, 0, DH_R_BAD_GENERATOR, __FILE__, __LINE__); ++ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR); + return ThrowCryptoError(env, ERR_get_error(), "Invalid generator"); + } + } +@@ -258,15 +256,17 @@ void ComputeSecret(const FunctionCallbackInfo& args) { + BignumPointer key(key_buf.data(), key_buf.size()); + + switch (dh.checkPublicKey(key)) { +- case DHPointer::CheckPublicKeyResult::INVALID: +- // Fall-through + case DHPointer::CheckPublicKeyResult::CHECK_FAILED: + return THROW_ERR_CRYPTO_INVALID_KEYTYPE(env, + "Unspecified validation error"); ++#ifndef OPENSSL_IS_BORINGSSL + case DHPointer::CheckPublicKeyResult::TOO_SMALL: + return THROW_ERR_CRYPTO_INVALID_KEYLEN(env, "Supplied key is too small"); + case DHPointer::CheckPublicKeyResult::TOO_LARGE: + return THROW_ERR_CRYPTO_INVALID_KEYLEN(env, "Supplied key is too large"); ++#endif ++ case DHPointer::CheckPublicKeyResult::INVALID: ++ return THROW_ERR_CRYPTO_INVALID_KEYTYPE(env, "Supplied key is invalid"); + case DHPointer::CheckPublicKeyResult::NONE: + break; + } +@@ -398,9 +398,11 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { key_params = EVPKeyPointer(EVP_PKEY_new()); CHECK(key_params); CHECK_EQ(EVP_PKEY_assign_DH(key_params.get(), dh.release()), 1); @@ -202,7 +374,7 @@ index dac37f52b9687cadfa2d02152241e9a6e4c16ddf..d47cfa4ad8707ed7f0a42e7fe176fec2 if (!param_ctx || EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 || EVP_PKEY_CTX_set_dh_paramgen_prime_len( -@@ -581,6 +580,9 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { +@@ -414,6 +416,9 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { } key_params = EVPKeyPointer(raw_params); @@ -213,7 +385,7 @@ index dac37f52b9687cadfa2d02152241e9a6e4c16ddf..d47cfa4ad8707ed7f0a42e7fe176fec2 UNREACHABLE(); } diff --git a/src/crypto/crypto_dsa.cc b/src/crypto/crypto_dsa.cc -index 3fa4a415dc911a13afd90dfb31c1ed4ad0fd268f..fa48dffc31342c44a1c1207b9d4c3dc72ed93b60 100644 +index 5d081863cf2dcdcf8c2d09db6060eeb5e78c452f..67523ec1c406e345945e1dde663c784c43a1c624 100644 --- a/src/crypto/crypto_dsa.cc +++ b/src/crypto/crypto_dsa.cc @@ -40,7 +40,7 @@ namespace crypto { @@ -237,18 +409,18 @@ index 3fa4a415dc911a13afd90dfb31c1ed4ad0fd268f..fa48dffc31342c44a1c1207b9d4c3dc7 return EVPKeyCtxPointer(); diff --git a/src/crypto/crypto_keys.cc b/src/crypto/crypto_keys.cc -index 35474c31bfc2e3692b7ca10e4ed7026b9c275dfb..43c42c14f75018d4705f218fe4ed7e5dacb46bb8 100644 +index 8488fc57faaf722174032c5a927d150c76120d60..c51efc92d4818ee7701b4725585fb7e1d2d644ad 100644 --- a/src/crypto/crypto_keys.cc +++ b/src/crypto/crypto_keys.cc -@@ -1239,6 +1239,7 @@ void KeyObjectHandle::GetAsymmetricKeyType( +@@ -1204,6 +1204,7 @@ void KeyObjectHandle::GetAsymmetricKeyType( } bool KeyObjectHandle::CheckEcKeyData() const { +#ifndef OPENSSL_IS_BORINGSSL MarkPopErrorOnReturn mark_pop_error_on_return; - const ManagedEVPPKey& key = data_->GetAsymmetricKey(); -@@ -1257,6 +1258,9 @@ bool KeyObjectHandle::CheckEcKeyData() const { + const auto& key = data_.GetAsymmetricKey(); +@@ -1220,6 +1221,9 @@ bool KeyObjectHandle::CheckEcKeyData() const { #else return EVP_PKEY_public_check(ctx.get()) == 1; #endif @@ -259,43 +431,43 @@ index 35474c31bfc2e3692b7ca10e4ed7026b9c275dfb..43c42c14f75018d4705f218fe4ed7e5d void KeyObjectHandle::CheckEcKeyData(const FunctionCallbackInfo& args) { diff --git a/src/crypto/crypto_random.cc b/src/crypto/crypto_random.cc -index 48154df7dc91ed7c0d65323199bc2f59dfc68135..6431e5c3062890975854780d15ecb84370b81770 100644 +index b59e394d9a7e2c19fdf1f2b0177753ff488da0fa..91218f49da5392c6f769495ee7f9275a47ce09b1 100644 --- a/src/crypto/crypto_random.cc +++ b/src/crypto/crypto_random.cc -@@ -140,7 +140,7 @@ Maybe RandomPrimeTraits::AdditionalConfig( +@@ -134,7 +134,7 @@ Maybe RandomPrimeTraits::AdditionalConfig( params->bits = bits; params->safe = safe; -- params->prime.reset(BN_secure_new()); -+ params->prime.reset(BN_new()); +- params->prime = BignumPointer::NewSecure(); ++ params->prime = BignumPointer::New(); if (!params->prime) { THROW_ERR_CRYPTO_OPERATION_FAILED(env, "could not generate prime"); - return Nothing(); + return Nothing(); diff --git a/src/crypto/crypto_rsa.cc b/src/crypto/crypto_rsa.cc -index 23b2b8c56dec8ac600b8f14b78d9e80b7fa3ed3b..e7a8fe4181542252d9142ea9460cacc5b4acd00d 100644 +index 02e8e24b4054afd4c3ca797c19a78927319a0d9e..d2a931a3f8f9490fe17ef8a82d0204ee2cca409d 100644 --- a/src/crypto/crypto_rsa.cc +++ b/src/crypto/crypto_rsa.cc -@@ -616,10 +616,11 @@ Maybe GetRsaKeyDetail( +@@ -608,10 +608,11 @@ Maybe GetRsaKeyDetail(Environment* env, } if (params->saltLength != nullptr) { - if (ASN1_INTEGER_get_int64(&salt_length, params->saltLength) != 1) { - ThrowCryptoError(env, ERR_get_error(), "ASN1_INTEGER_get_in64 error"); -- return Nothing(); +- return Nothing(); - } + // TODO(codebytere): Upstream a shim to BoringSSL? + // if (ASN1_INTEGER_get_int64(&salt_length, params->saltLength) != 1) { + // ThrowCryptoError(env, ERR_get_error(), "ASN1_INTEGER_get_in64 error"); -+ // return Nothing(); ++ // return Nothing(); + // } } if (target diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc -index 990638ec3993bde40ad3dd40d373d816ebc66a6a..63d971e1fe6b861e29c12f04563701b01fdfb976 100644 +index 793c196f8ce538c66b20611d00e12392ff9e878b..ee81048caab4ccfe26ea9e677782c9c955d162a9 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc -@@ -518,24 +518,15 @@ Maybe Decorate(Environment* env, +@@ -495,24 +495,15 @@ Maybe Decorate(Environment* env, V(BIO) \ V(PKCS7) \ V(X509V3) \ @@ -321,7 +493,7 @@ index 990638ec3993bde40ad3dd40d373d816ebc66a6a..63d971e1fe6b861e29c12f04563701b0 V(USER) \ #define V(name) case ERR_LIB_##name: lib = #name "_"; break; -@@ -716,7 +707,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -654,7 +645,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { CHECK(args[0]->IsUint32()); Environment* env = Environment::GetCurrent(args); uint32_t len = args[0].As()->Value(); @@ -330,7 +502,7 @@ index 990638ec3993bde40ad3dd40d373d816ebc66a6a..63d971e1fe6b861e29c12f04563701b0 if (data == nullptr) { // There's no memory available for the allocation. // Return nothing. -@@ -727,7 +718,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -665,7 +656,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { data, len, [](void* data, size_t len, void* deleter_data) { @@ -339,7 +511,7 @@ index 990638ec3993bde40ad3dd40d373d816ebc66a6a..63d971e1fe6b861e29c12f04563701b0 }, data); Local buffer = ArrayBuffer::New(env->isolate(), store); -@@ -735,10 +726,12 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -673,10 +664,12 @@ void SecureBuffer(const FunctionCallbackInfo& args) { } void SecureHeapUsed(const FunctionCallbackInfo& args) { @@ -353,10 +525,10 @@ index 990638ec3993bde40ad3dd40d373d816ebc66a6a..63d971e1fe6b861e29c12f04563701b0 } // namespace diff --git a/src/env.h b/src/env.h -index 30561ab7a24c734be71ed29d963c11e2ea2c2b22..7cb77fb4f35a60fbda5b868798321ac8b6340bfa 100644 +index fc8dbd615255851cad90e1d8ffe225f5e0c6a718..49ca9c0042ccf22ad1fffa54f05fd443cbc681ba 100644 --- a/src/env.h +++ b/src/env.h -@@ -49,7 +49,7 @@ +@@ -50,7 +50,7 @@ #include "uv.h" #include "v8.h" @@ -365,7 +537,7 @@ index 30561ab7a24c734be71ed29d963c11e2ea2c2b22..7cb77fb4f35a60fbda5b868798321ac8 #include #endif -@@ -1065,7 +1065,7 @@ class Environment : public MemoryRetainer { +@@ -1073,7 +1073,7 @@ class Environment final : public MemoryRetainer { kExitInfoFieldCount }; @@ -375,7 +547,7 @@ index 30561ab7a24c734be71ed29d963c11e2ea2c2b22..7cb77fb4f35a60fbda5b868798321ac8 // We declare another alias here to avoid having to include crypto_util.h using EVPMDPointer = DeleteFnPtr; diff --git a/src/node_metadata.h b/src/node_metadata.h -index cf051585e779e2b03bd7b95fe5008b89cc7f8162..9de49c6828468fdf846dcd4ad445390f14446099 100644 +index c59e65ad1fe3fac23f1fc25ca77e6133d1ccaccd..f2f07434e076e2977755ef7dac7d489aedb760b0 100644 --- a/src/node_metadata.h +++ b/src/node_metadata.h @@ -6,7 +6,7 @@ @@ -388,7 +560,7 @@ index cf051585e779e2b03bd7b95fe5008b89cc7f8162..9de49c6828468fdf846dcd4ad445390f #if NODE_OPENSSL_HAS_QUIC #include diff --git a/src/node_options.cc b/src/node_options.cc -index dba59c5560c22899bd108789360f21fd85dd41bf..818baf611fcab7838a339f3ea137467653e270d0 100644 +index cfc599ec9a6197231c3469d318f02c620cdb03a8..29630fcccc3bd9d24ad6aec64bef2fedfc3c4031 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -6,7 +6,7 @@ @@ -401,7 +573,7 @@ index dba59c5560c22899bd108789360f21fd85dd41bf..818baf611fcab7838a339f3ea1374676 #endif diff --git a/src/node_options.h b/src/node_options.h -index 10c220f66122336215f25b9674acfdfe6df82a8e..e8b2243d24fe95ff31254071133fb646e186c07e 100644 +index 9e656a2815045aa5da7eb267708c03058be9f362..600e0850f01e01024414d42b25605f256200540a 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -11,7 +11,7 @@ @@ -413,3 +585,37 @@ index 10c220f66122336215f25b9674acfdfe6df82a8e..e8b2243d24fe95ff31254071133fb646 #include "openssl/opensslv.h" #endif +diff --git a/unofficial.gni b/unofficial.gni +index de6ff5548ca5282199b7d85c11941c1fa351a9d9..3d8b7957e791ce2fa2a8d0937a87b6010087803d 100644 +--- a/unofficial.gni ++++ b/unofficial.gni +@@ -145,7 +145,6 @@ template("node_gn_build") { + ] + deps = [ + ":run_node_js2c", +- "deps/brotli", + "deps/cares", + "deps/histogram", + "deps/llhttp", +@@ -156,6 +155,8 @@ template("node_gn_build") { + "deps/sqlite", + "deps/uvwasi", + "//third_party/zlib", ++ "//third_party/brotli:dec", ++ "//third_party/brotli:enc", + "$node_v8_path:v8_libplatform", + ] + +@@ -182,10 +183,8 @@ template("node_gn_build") { + deps += [ "//third_party/icu" ] + } + if (node_use_openssl) { +- deps += [ +- "deps/ncrypto", +- "//third_party/boringssl" +- ] ++ deps += [ "deps/ncrypto" ] ++ public_deps += [ "$node_crypto_path" ] + sources += gypi_values.node_crypto_sources + } + if (node_enable_inspector) { 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 787043e5cc..bc8e7cea5a 100644 --- a/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch +++ b/patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch @@ -6,39 +6,39 @@ Subject: fix: lazyload fs in esm loaders to apply asar patches Changes { foo } from fs to just "fs.foo" so that our patching of fs is applied to esm loaders diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js -index ac24cf305bd5995ad13b37ee36f9e1fe3589c5d7..22248b753c14960122f1d6b9bfe6b89fdb8d2010 100644 +index 605e812d515fc467001e4ab88fc15b4af3fd4aa2..463e76cb1abc0c2fdddba4db2ca2e00f7c591e12 100644 --- a/lib/internal/modules/esm/load.js +++ b/lib/internal/modules/esm/load.js -@@ -10,7 +10,7 @@ const { kEmptyObject } = require('internal/util'); +@@ -8,7 +8,7 @@ const { kEmptyObject } = require('internal/util'); const { defaultGetFormat } = require('internal/modules/esm/get_format'); const { validateAttributes, emitImportAssertionWarning } = require('internal/modules/esm/assert'); const { getOptionValue } = require('internal/options'); -const { readFileSync } = require('fs'); +const fs = require('fs'); - // Do not eagerly grab .manifest, it may be in TDZ - const policy = getOptionValue('--experimental-policy') ? -@@ -42,8 +42,7 @@ async function getSource(url, context) { - let responseURL = href; + const defaultType = + getOptionValue('--experimental-default-type'); +@@ -40,8 +40,7 @@ async function getSource(url, context) { + const responseURL = href; let source; if (protocol === 'file:') { - const { readFile: readFileAsync } = require('internal/fs/promises').exports; - source = await readFileAsync(url); + source = await fs.promises.readFile(url); } else if (protocol === 'data:') { - const match = RegExpPrototypeExec(DATA_URL_PATTERN, url.pathname); - if (!match) { -@@ -82,7 +81,7 @@ function getSourceSync(url, context) { + const result = dataURLProcessor(url); + if (result === 'failure') { +@@ -65,7 +64,7 @@ function getSourceSync(url, context) { const responseURL = href; let source; if (protocol === 'file:') { - source = readFileSync(url); + source = fs.readFileSync(url); } else if (protocol === 'data:') { - const match = RegExpPrototypeExec(DATA_URL_PATTERN, url.pathname); - if (!match) { + const result = dataURLProcessor(url); + if (result === 'failure') { diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js -index 52cdb7d5e14a18ed7b1b65e429729cf47dce3f98..69f73f829706deddc4f328b78af9d58434af647d 100644 +index f05c6f99c0037193c5802024be46a967d6cf47a0..f3dad958b2ec275992554477b9344214c8c1e2c8 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -24,7 +24,7 @@ const { @@ -49,17 +49,8 @@ index 52cdb7d5e14a18ed7b1b65e429729cf47dce3f98..69f73f829706deddc4f328b78af9d584 +const fs = require('fs'); const { getOptionValue } = require('internal/options'); // Do not eagerly grab .manifest, it may be in TDZ - const policy = getOptionValue('--experimental-policy') ? -@@ -251,7 +251,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) { - throw err; - } - -- const stats = internalModuleStat(toNamespacedPath(StringPrototypeEndsWith(path, '/') ? -+ const stats = internalFsBinding.internalModuleStat(toNamespacedPath(StringPrototypeEndsWith(path, '/') ? - StringPrototypeSlice(path, -1) : path)); - - // Check for stats.isDirectory() -@@ -267,7 +267,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) { + const { sep, posix: { relative: relativePosixPath }, resolve } = require('path'); +@@ -259,7 +259,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) { } if (!preserveSymlinks) { @@ -68,20 +59,11 @@ index 52cdb7d5e14a18ed7b1b65e429729cf47dce3f98..69f73f829706deddc4f328b78af9d584 [internalFS.realpathCacheKey]: realpathCache, }); const { search, hash } = resolved; -@@ -826,7 +826,7 @@ function packageResolve(specifier, base, conditions) { - let packageJSONPath = fileURLToPath(packageJSONUrl); - let lastPath; - do { -- const stat = internalModuleStat(toNamespacedPath(StringPrototypeSlice(packageJSONPath, 0, -+ const stat = internalFsBinding.internalModuleStat(toNamespacedPath(StringPrototypeSlice(packageJSONPath, 0, - packageJSONPath.length - 13))); - // Check for !stat.isDirectory() - if (stat !== 1) { diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index 89ca269294ee1afa7f5aeb0ac6b8958f7a8b49d0..f3dfc69cd2cdec50bc3b3f7cb2d63349812d87dd 100644 +index d182eedf5e96039e0029d36e51f40b75c6fb2a39..06b31af80ebbfbf35ec787a94f345775eb512ebf 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js -@@ -36,7 +36,7 @@ const { +@@ -34,7 +34,7 @@ const { const { BuiltinModule } = require('internal/bootstrap/realm'); const assert = require('internal/assert'); @@ -90,7 +72,7 @@ index 89ca269294ee1afa7f5aeb0ac6b8958f7a8b49d0..f3dfc69cd2cdec50bc3b3f7cb2d63349 const { dirname, extname, isAbsolute } = require('path'); const { loadBuiltinModule, -@@ -356,7 +356,7 @@ translators.set('commonjs', async function commonjsStrategy(url, source, +@@ -335,7 +335,7 @@ translators.set('commonjs', async function commonjsStrategy(url, source, try { // We still need to read the FS to detect the exports. @@ -99,7 +81,7 @@ index 89ca269294ee1afa7f5aeb0ac6b8958f7a8b49d0..f3dfc69cd2cdec50bc3b3f7cb2d63349 } catch { // Continue regardless of error. } -@@ -424,7 +424,7 @@ function cjsPreparseModuleExports(filename, source) { +@@ -403,7 +403,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 cf9b4ec08c..e86a1fada5 100644 --- a/patches/node/fix_remove_deprecated_errno_constants.patch +++ b/patches/node/fix_remove_deprecated_errno_constants.patch @@ -10,7 +10,7 @@ This change removes the usage of these constants to fix a compilation failure du See: https://github.com/llvm/llvm-project/pull/80542 diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h -index 3375600023e39ddacf62cc17deb4f206db942084..cc106422dd36aa0564e74dd8a16eec496433d3bd 100644 +index 7f48b7daa87d1a5b14bc6f641b60f21263fa5ec3..0be470c9139a6da19414295a59f1a237cc3a50d7 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -155,7 +155,6 @@ struct uv__queue { @@ -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 69e474257b0427f894375fbc8a2c031f1b8e0c55..f0e968c0dfa8963404c3b87827b8d11a139051cc 100644 +index 65f95c3157add2afca26a133183b65ccba6e9924..81091d364d32094dc91c7abb0c5fe9963d100a8b 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc -@@ -855,10 +855,6 @@ const char* errno_string(int errorno) { +@@ -857,10 +857,6 @@ const char* errno_string(int errorno) { ERRNO_CASE(ENOBUFS); #endif @@ -100,7 +100,7 @@ index 69e474257b0427f894375fbc8a2c031f1b8e0c55..f0e968c0dfa8963404c3b87827b8d11a #ifdef ENODEV ERRNO_CASE(ENODEV); #endif -@@ -897,14 +893,6 @@ const char* errno_string(int errorno) { +@@ -899,14 +895,6 @@ const char* errno_string(int errorno) { ERRNO_CASE(ENOSPC); #endif @@ -115,7 +115,7 @@ index 69e474257b0427f894375fbc8a2c031f1b8e0c55..f0e968c0dfa8963404c3b87827b8d11a #ifdef ENOSYS ERRNO_CASE(ENOSYS); #endif -@@ -987,10 +975,6 @@ const char* errno_string(int errorno) { +@@ -989,10 +977,6 @@ const char* errno_string(int errorno) { ERRNO_CASE(ESTALE); #endif diff --git a/patches/node/fix_remove_harmony-import-assertions_from_node_cc.patch b/patches/node/fix_remove_harmony-import-assertions_from_node_cc.patch new file mode 100644 index 0000000000..0e7268f6cf --- /dev/null +++ b/patches/node/fix_remove_harmony-import-assertions_from_node_cc.patch @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Fri, 18 Oct 2024 17:01:06 +0200 +Subject: fix: remove harmony-import-assertions from node.cc + +harmony-import-assertions has been removed from V8 as of +https://chromium-review.googlesource.com/c/v8/v8/+/5507047, +so we should remove it from node.cc as well. + +This patch can be removed when we upgrade to a V8 version that +contains the above CL. + +diff --git a/src/node.cc b/src/node.cc +index ccc1085a84b214d241687fa9ebd45b55b2cc60d8..1df8e1f00a0e2ffa63bfd4369240b837ab6a9c50 100644 +--- a/src/node.cc ++++ b/src/node.cc +@@ -804,7 +804,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector* args, + } + // TODO(nicolo-ribaudo): remove this once V8 doesn't enable it by default + // anymore. +- v8_args.emplace_back("--no-harmony-import-assertions"); ++ // v8_args.emplace_back("--no-harmony-import-assertions"); + + auto env_opts = per_process::cli_options->per_isolate->per_env; + if (std::find(v8_args.begin(), v8_args.end(), 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 831e237f29..15039649de 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,31 +15,27 @@ 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 69f73f829706deddc4f328b78af9d58434af647d..1d53a2a47423150e822bb917b2725d3a6a794814 100644 +index f3dad958b2ec275992554477b9344214c8c1e2c8..a086217046fd5ed7cfb09cfd2ed62f3987eb1f31 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'); - const experimentalNetworkImports = - getOptionValue('--experimental-network-imports'); +@@ -27,14 +27,13 @@ const { BuiltinModule } = require('internal/bootstrap/realm'); + const fs = require('fs'); + const { getOptionValue } = require('internal/options'); + // Do not eagerly grab .manifest, it may be in TDZ +-const { sep, posix: { relative: relativePosixPath }, resolve } = require('path'); ++const { sep, posix: { relative: relativePosixPath }, toNamespacedPath, resolve } = require('path'); + const preserveSymlinks = getOptionValue('--preserve-symlinks'); + const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); const inputTypeFlag = getOptionValue('--input-type'); --const { URL, pathToFileURL, fileURLToPath, isURL } = require('internal/url'); -+const { URL, pathToFileURL, fileURLToPath, isURL, toPathIfFileURL } = require('internal/url'); +-const { URL, pathToFileURL, fileURLToPath, isURL, URLParse } = require('internal/url'); ++const { URL, pathToFileURL, fileURLToPath, isURL, URLParse, toPathIfFileURL } = require('internal/url'); 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, -@@ -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'); --const { internalModuleStat } = internalBinding('fs'); -+const internalFsBinding = internalBinding('fs'); - - /** - * @typedef {import('internal/modules/esm/package_config.js').PackageConfig} PackageConfig -@@ -162,34 +161,13 @@ function emitLegacyIndexDeprecation(url, packageJSONUrl, base, main) { +@@ -154,34 +153,13 @@ function emitLegacyIndexDeprecation(url, packageJSONUrl, base, main) { const realpathCache = new SafeMap(); @@ -81,7 +77,7 @@ index 69f73f829706deddc4f328b78af9d58434af647d..1d53a2a47423150e822bb917b2725d3a /** * Legacy CommonJS main resolution: -@@ -204,22 +182,44 @@ const legacyMainResolveExtensionsIndexes = { +@@ -196,22 +174,44 @@ const legacyMainResolveExtensionsIndexes = { * @returns {URL} */ function legacyMainResolve(packageJSONUrl, packageConfig, base) { @@ -142,10 +138,10 @@ index 69f73f829706deddc4f328b78af9d58434af647d..1d53a2a47423150e822bb917b2725d3a const encodedSepRegEx = /%2F|%5C/i; diff --git a/src/node_file.cc b/src/node_file.cc -index 73ad5a1a2c092d7f8dac84585fb9b13e76e84e13..039f693de14bec248f93262ad70f2736c24827e3 100644 +index 0bb70eb0fcd42ddf4d5e585065cf1ad8e74faab3..b565beae625d970ba92ab667a145d8897d4e8a6e 100644 --- a/src/node_file.cc +++ b/src/node_file.cc -@@ -19,14 +19,11 @@ +@@ -19,14 +19,12 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. #include "node_file.h" // NOLINT(build/include_inline) @@ -153,14 +149,14 @@ index 73ad5a1a2c092d7f8dac84585fb9b13e76e84e13..039f693de14bec248f93262ad70f2736 #include "aliased_buffer-inl.h" #include "memory_tracker-inl.h" #include "node_buffer.h" --#include "node_errors.h" + #include "node_errors.h" #include "node_external_reference.h" #include "node_file-inl.h" -#include "node_metadata.h" #include "node_process-inl.h" #include "node_stat_watcher.h" #include "node_url.h" -@@ -3127,135 +3124,6 @@ constexpr std::array legacy_main_extensions = { +@@ -3208,146 +3206,6 @@ constexpr std::array legacy_main_extensions = { } // namespace @@ -202,14 +198,20 @@ index 73ad5a1a2c092d7f8dac84585fb9b13e76e84e13..039f693de14bec248f93262ad70f2736 - return; - } - -- node::url::FromNamespacedPath(&initial_file_path.value()); +- FromNamespacedPath(&initial_file_path.value()); - - package_initial_file = *initial_file_path; - - for (int i = 0; i < legacy_main_extensions_with_main_end; i++) { - file_path = *initial_file_path + std::string(legacy_main_extensions[i]); +- // TODO(anonrig): Remove this when ToNamespacedPath supports std::string +- Local local_file_path = +- Buffer::Copy(env->isolate(), file_path.c_str(), file_path.size()) +- .ToLocalChecked(); +- BufferValue buff_file_path(isolate, local_file_path); +- ToNamespacedPath(env, &buff_file_path); - -- switch (FilePathIsFile(env, file_path)) { +- switch (FilePathIsFile(env, buff_file_path.ToString())) { - case BindingData::FilePathIsFileReturnType::kIsFile: - return args.GetReturnValue().Set(i); - case BindingData::FilePathIsFileReturnType::kIsNotFile: @@ -239,14 +241,20 @@ index 73ad5a1a2c092d7f8dac84585fb9b13e76e84e13..039f693de14bec248f93262ad70f2736 - return; - } - -- node::url::FromNamespacedPath(&initial_file_path.value()); +- FromNamespacedPath(&initial_file_path.value()); - - for (int i = legacy_main_extensions_with_main_end; - i < legacy_main_extensions_package_fallback_end; - i++) { - file_path = *initial_file_path + std::string(legacy_main_extensions[i]); +- // TODO(anonrig): Remove this when ToNamespacedPath supports std::string +- Local local_file_path = +- Buffer::Copy(env->isolate(), file_path.c_str(), file_path.size()) +- .ToLocalChecked(); +- BufferValue buff_file_path(isolate, local_file_path); +- ToNamespacedPath(env, &buff_file_path); - -- switch (FilePathIsFile(env, file_path)) { +- switch (FilePathIsFile(env, buff_file_path.ToString())) { - case BindingData::FilePathIsFileReturnType::kIsFile: - return args.GetReturnValue().Set(i); - case BindingData::FilePathIsFileReturnType::kIsNotFile: @@ -292,11 +300,10 @@ index 73ad5a1a2c092d7f8dac84585fb9b13e76e84e13..039f693de14bec248f93262ad70f2736 - package_initial_file, - *module_base); -} -- + void BindingData::MemoryInfo(MemoryTracker* tracker) const { tracker->TrackField("stats_field_array", stats_field_array); - tracker->TrackField("stats_field_bigint_array", stats_field_bigint_array); -@@ -3355,19 +3223,6 @@ InternalFieldInfoBase* BindingData::Serialize(int index) { +@@ -3448,19 +3306,6 @@ InternalFieldInfoBase* BindingData::Serialize(int index) { return info; } @@ -316,15 +323,15 @@ index 73ad5a1a2c092d7f8dac84585fb9b13e76e84e13..039f693de14bec248f93262ad70f2736 static void CreatePerIsolateProperties(IsolateData* isolate_data, Local target) { Isolate* isolate = isolate_data->isolate(); -@@ -3422,7 +3277,6 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data, - SetMethod(isolate, target, "mkdtemp", Mkdtemp); +@@ -3520,7 +3365,6 @@ static void CreatePerIsolateProperties(IsolateData* isolate_data, + SetMethod(isolate, target, "cpSyncCheckPaths", CpSyncCheckPaths); StatWatcher::CreatePerIsolateProperties(isolate_data, target); - BindingData::CreatePerIsolateProperties(isolate_data, target); target->Set( FIXED_ONE_BYTE_STRING(isolate, "kFsStatsFieldsNumber"), -@@ -3495,7 +3349,6 @@ BindingData* FSReqBase::binding_data() { +@@ -3593,7 +3437,6 @@ BindingData* FSReqBase::binding_data() { void RegisterExternalReferences(ExternalReferenceRegistry* registry) { registry->Register(Access); StatWatcher::RegisterExternalReferences(registry); @@ -333,7 +340,7 @@ index 73ad5a1a2c092d7f8dac84585fb9b13e76e84e13..039f693de14bec248f93262ad70f2736 registry->Register(GetFormatOfExtensionlessFile); registry->Register(Close); diff --git a/src/node_file.h b/src/node_file.h -index 6f1b55284db0f4f8c70081b4834a074c717f3cc9..a969fff32bd156aa9393c1db9eec474eb7432cea 100644 +index bdad1ae25f4892cbbfd8cc30c4d8b4a6f600edbc..5a3c462853aa784d9ef61ff4f63010848c48b92c 100644 --- a/src/node_file.h +++ b/src/node_file.h @@ -86,13 +86,6 @@ class BindingData : public SnapshotableObject { diff --git a/patches/node/fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch b/patches/node/fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch index 391271a50f..0ff052ab11 100644 --- a/patches/node/fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch +++ b/patches/node/fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch @@ -6,10 +6,10 @@ Subject: fix: suppress clang -Wdeprecated-declarations in libuv Should be upstreamed. diff --git a/deps/uv/src/win/util.c b/deps/uv/src/win/util.c -index f6ec79cd57b5010ed5fd6829d952bcdacc8b7671..5cda078a55f7825d135a107fa98e1aa3527dd147 100644 +index a96cb915930a30a49ba55fd7d15ea48f0b471f89..3c15f348bd3a9a42afcf0e4d0182d2d6f3d05cb1 100644 --- a/deps/uv/src/win/util.c +++ b/deps/uv/src/win/util.c -@@ -1685,10 +1685,17 @@ int uv_os_uname(uv_utsname_t* buffer) { +@@ -1537,10 +1537,17 @@ int uv_os_uname(uv_utsname_t* buffer) { #ifdef _MSC_VER #pragma warning(suppress : 4996) #endif diff --git a/patches/node/pass_all_globals_through_require.patch b/patches/node/pass_all_globals_through_require.patch index 596b997812..d9d6dc91df 100644 --- a/patches/node/pass_all_globals_through_require.patch +++ b/patches/node/pass_all_globals_through_require.patch @@ -6,10 +6,10 @@ Subject: Pass all globals through "require" (cherry picked from commit 7d015419cb7a0ecfe6728431a4ed2056cd411d62) diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index c284b39b1ac13eaea8776b7b4f457c084dce5fb8..c794751ecd4448119ce33d661e694f83b3323f03 100644 +index 451b7c2195e7ad3ab0bde95259e054dc431d7de9..d49941881e6cfd8647a6d44a57e0daaf1c874702 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -185,6 +185,13 @@ const { +@@ -182,6 +182,13 @@ const { CHAR_FORWARD_SLASH, } = require('internal/constants'); @@ -23,7 +23,7 @@ index c284b39b1ac13eaea8776b7b4f457c084dce5fb8..c794751ecd4448119ce33d661e694f83 const { isProxy, } = require('internal/util/types'); -@@ -1464,10 +1471,12 @@ Module.prototype._compile = function(content, filename, loadAsESM = false) { +@@ -1541,10 +1548,12 @@ Module.prototype._compile = function(content, filename, format) { this[kIsExecuting] = true; if (inspectorWrapper) { result = inspectorWrapper(compiledWrapper, thisValue, exports, diff --git a/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch b/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch index f36422f981..5e5b538818 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 12262f40ce123440a9a0f974386cfbe8511f4459..f3c15b61d33bdae44de528e106fcc6f930f1c388 100644 +index f7a62364b6107ab0bad33ea2f745703c746991dc..bab2aaf3db66452216035db594dc3ebdc3606c8b 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -134,6 +134,10 @@ process.domain = null; @@ -21,47 +21,3 @@ index 12262f40ce123440a9a0f974386cfbe8511f4459..f3c15b61d33bdae44de528e106fcc6f9 // process.config is serialized config.gypi const binding = internalBinding('builtins'); -diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index c794751ecd4448119ce33d661e694f83b3323f03..364469160af5e348f8890417de16a63c0d1dca67 100644 ---- a/lib/internal/modules/cjs/loader.js -+++ b/lib/internal/modules/cjs/loader.js -@@ -138,7 +138,7 @@ const { - const assert = require('internal/assert'); - const fs = require('fs'); - const path = require('path'); --const { internalModuleStat } = internalBinding('fs'); -+const internalFsBinding = internalBinding('fs'); - const { safeGetenv } = internalBinding('credentials'); - const { - privateSymbols: { -@@ -233,7 +233,7 @@ function stat(filename) { - const result = statCache.get(filename); - if (result !== undefined) { return result; } - } -- const result = internalModuleStat(filename); -+ const result = internalFsBinding.internalModuleStat(filename); - if (statCache !== null && result >= 0) { - // Only set cache when `internalModuleStat(filename)` succeeds. - statCache.set(filename, result); -diff --git a/lib/internal/modules/package_json_reader.js b/lib/internal/modules/package_json_reader.js -index 88c079d10d116107aa34dc9281f64c799c48c0b5..069f922612777f226127dc44f4091eed30416925 100644 ---- a/lib/internal/modules/package_json_reader.js -+++ b/lib/internal/modules/package_json_reader.js -@@ -12,7 +12,7 @@ const { - const { - ERR_INVALID_PACKAGE_CONFIG, - } = require('internal/errors').codes; --const { internalModuleReadJSON } = internalBinding('fs'); -+const internalFsBinding = internalBinding('fs'); - const { resolve, sep, toNamespacedPath } = require('path'); - const permission = require('internal/process/permission'); - const { kEmptyObject } = require('internal/util'); -@@ -53,7 +53,7 @@ function read(jsonPath, { base, specifier, isESM } = kEmptyObject) { - const { - 0: string, - 1: containsKeys, -- } = internalModuleReadJSON( -+ } = internalFsBinding.internalModuleReadJSON( - toNamespacedPath(jsonPath), - ); - const result = { diff --git a/patches/node/spec_add_iterator_to_global_intrinsics.patch b/patches/node/spec_add_iterator_to_global_intrinsics.patch deleted file mode 100644 index 45f3a8e62c..0000000000 --- a/patches/node/spec_add_iterator_to_global_intrinsics.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samuel Attard -Date: Thu, 11 Jan 2024 15:14:43 +1300 -Subject: spec: add Iterator to global intrinsics - -Ref: https://chromium-review.googlesource.com/c/v8/v8/+/4266490 - -diff --git a/test/common/globals.js b/test/common/globals.js -index cb7c1629007ecfc6c6a1aae0e6d1e9a50f07d147..5d1c4415eeb09e92d062330afc0aecb1d297b6d3 100644 ---- a/test/common/globals.js -+++ b/test/common/globals.js -@@ -63,6 +63,7 @@ const intrinsics = new Set([ - 'SharedArrayBuffer', - 'Atomics', - 'WebAssembly', -+ 'Iterator', - ]); - - if (global.gc) { diff --git a/patches/node/src_do_not_use_deprecated_v8_api.patch b/patches/node/src_do_not_use_deprecated_v8_api.patch deleted file mode 100644 index 7e2ac1f2eb..0000000000 --- a/patches/node/src_do_not_use_deprecated_v8_api.patch +++ /dev/null @@ -1,118 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: ishell -Date: Mon, 25 Mar 2024 15:45:41 +0100 -Subject: src: do not use deprecated V8 API -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Namely: - - `v8::ObjectTemplate::SetAccessor(v8::Local, ...);` - - `v8::ObjectTemplate::SetNativeDataProperty` with `AccessControl` - -Refs: https://github.com/v8/v8/commit/46c241eb99557fe8205acac5c526650c3847d180 -Refs: https://github.com/v8/v8/commit/6ec883986bd417e2a42ddb960bd9449deb7e4639 -Co-authored-by: Michaël Zasso -PR-URL: https://github.com/nodejs/node/pull/53084 -Reviewed-By: Luigi Pinca -Reviewed-By: Tobias Nießen -Reviewed-By: James M Snell -Reviewed-By: Joyee Cheung -(cherry picked from commit 26d5cafff76d3a096ebfd7d7a6279d4b5b190230) - -diff --git a/src/base_object-inl.h b/src/base_object-inl.h -index da8fed7b3013df10ae02be2070545c74d9a978f0..518b22dabef0974c2e7ecb466669925338524059 100644 ---- a/src/base_object-inl.h -+++ b/src/base_object-inl.h -@@ -132,14 +132,14 @@ v8::EmbedderGraph::Node::Detachedness BaseObject::GetDetachedness() const { - - template - void BaseObject::InternalFieldGet( -- v8::Local property, -+ v8::Local property, - const v8::PropertyCallbackInfo& info) { - info.GetReturnValue().Set( - info.This()->GetInternalField(Field).As()); - } - --template --void BaseObject::InternalFieldSet(v8::Local property, -+template -+void BaseObject::InternalFieldSet(v8::Local property, - v8::Local value, - const v8::PropertyCallbackInfo& info) { - // This could be e.g. value->IsFunction(). -diff --git a/src/base_object.h b/src/base_object.h -index 5968694e8393d8434fb2ffee411dfac4c93aff29..5c16d0d1b32e2d056f4fcfa0e01781292932a0fa 100644 ---- a/src/base_object.h -+++ b/src/base_object.h -@@ -111,10 +111,10 @@ class BaseObject : public MemoryRetainer { - - // Setter/Getter pair for internal fields that can be passed to SetAccessor. - template -- static void InternalFieldGet(v8::Local property, -+ static void InternalFieldGet(v8::Local property, - const v8::PropertyCallbackInfo& info); - template -- static void InternalFieldSet(v8::Local property, -+ static void InternalFieldSet(v8::Local property, - v8::Local value, - const v8::PropertyCallbackInfo& info); - -diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index 3e37aa8b0c9696cceb3f3cfab9721f38c74a2fba..78f20de6b127961e9de7b5caaeca702ed7a36e01 100644 ---- a/src/node_builtins.cc -+++ b/src/node_builtins.cc -@@ -11,7 +11,6 @@ namespace node { - namespace builtins { - - using v8::Context; --using v8::DEFAULT; - using v8::EscapableHandleScope; - using v8::Function; - using v8::FunctionCallbackInfo; -@@ -720,7 +719,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data, - nullptr, - Local(), - None, -- DEFAULT, - SideEffectType::kHasNoSideEffect); - - target->SetNativeDataProperty(FIXED_ONE_BYTE_STRING(isolate, "builtinIds"), -@@ -728,7 +726,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data, - nullptr, - Local(), - None, -- DEFAULT, - SideEffectType::kHasNoSideEffect); - - target->SetNativeDataProperty( -@@ -737,7 +734,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data, - nullptr, - Local(), - None, -- DEFAULT, - SideEffectType::kHasNoSideEffect); - - target->SetNativeDataProperty(FIXED_ONE_BYTE_STRING(isolate, "natives"), -@@ -745,7 +741,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data, - nullptr, - Local(), - None, -- DEFAULT, - SideEffectType::kHasNoSideEffect); - - SetMethod(isolate, target, "getCacheUsage", BuiltinLoader::GetCacheUsage); -diff --git a/src/node_external_reference.h b/src/node_external_reference.h -index 4e2ad9024020fa0851da41da44afccdf188c7044..c4aba23510872d66b58a1adc88cdd1ee85a86cfe 100644 ---- a/src/node_external_reference.h -+++ b/src/node_external_reference.h -@@ -64,8 +64,6 @@ class ExternalReferenceRegistry { - V(CFunctionWithBool) \ - V(const v8::CFunctionInfo*) \ - V(v8::FunctionCallback) \ -- V(v8::AccessorGetterCallback) \ -- V(v8::AccessorSetterCallback) \ - V(v8::AccessorNameGetterCallback) \ - V(v8::AccessorNameSetterCallback) \ - V(v8::GenericNamedPropertyDefinerCallback) \ diff --git a/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch b/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch index 78b759febc..ef2c934d36 100644 --- a/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch +++ b/patches/node/src_remove_dependency_on_wrapper-descriptor-based_cppheap.patch @@ -16,7 +16,7 @@ patch: (cherry picked from commit 30329d06235a9f9733b1d4da479b403462d1b326) diff --git a/src/env-inl.h b/src/env-inl.h -index d98a32d6ec311459877bc3b0de33cca4766aeda7..9fc934975b015b97ddd84bf3eea5d53144130035 100644 +index 28a15aa741ddd40c664aae641797e7cc2813442f..08fe98e10b7716c694bbc882299fe0ed9e282d73 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -62,31 +62,6 @@ inline uv_loop_t* IsolateData::event_loop() const { @@ -52,10 +52,10 @@ index d98a32d6ec311459877bc3b0de33cca4766aeda7..9fc934975b015b97ddd84bf3eea5d531 return &(wrapper_data_->cppgc_id); } diff --git a/src/env.cc b/src/env.cc -index 38802b1e9acf9b3e99fdc4f39770e896393befe3..e0433e29ca98c42a38d1da6d66085fdea1edde29 100644 +index 665b064091d4cc42a4dc9ee5b0ea9e2f190338ca..4c8cb75945d82544ce2237d94cd1406d15efe424 100644 --- a/src/env.cc +++ b/src/env.cc -@@ -22,6 +22,7 @@ +@@ -23,6 +23,7 @@ #include "util-inl.h" #include "v8-cppgc.h" #include "v8-profiler.h" @@ -63,7 +63,7 @@ index 38802b1e9acf9b3e99fdc4f39770e896393befe3..e0433e29ca98c42a38d1da6d66085fde #include #include -@@ -68,7 +69,6 @@ using v8::TryCatch; +@@ -71,7 +72,6 @@ using v8::TryCatch; using v8::Uint32; using v8::Undefined; using v8::Value; @@ -71,7 +71,7 @@ index 38802b1e9acf9b3e99fdc4f39770e896393befe3..e0433e29ca98c42a38d1da6d66085fde using worker::Worker; int const ContextEmbedderTag::kNodeContextTag = 0x6e6f64; -@@ -530,6 +530,14 @@ void IsolateData::CreateProperties() { +@@ -532,6 +532,14 @@ void IsolateData::CreateProperties() { CreateEnvProxyTemplate(this); } @@ -86,7 +86,7 @@ index 38802b1e9acf9b3e99fdc4f39770e896393befe3..e0433e29ca98c42a38d1da6d66085fde constexpr uint16_t kDefaultCppGCEmbedderID = 0x90de; Mutex IsolateData::isolate_data_mutex_; std::unordered_map> -@@ -567,36 +575,16 @@ IsolateData::IsolateData(Isolate* isolate, +@@ -569,36 +577,16 @@ IsolateData::IsolateData(Isolate* isolate, v8::CppHeap* cpp_heap = isolate->GetCppHeap(); uint16_t cppgc_id = kDefaultCppGCEmbedderID; @@ -130,7 +130,7 @@ index 38802b1e9acf9b3e99fdc4f39770e896393befe3..e0433e29ca98c42a38d1da6d66085fde { // GC could still be run after the IsolateData is destroyed, so we store -@@ -628,11 +616,12 @@ IsolateData::~IsolateData() { +@@ -630,11 +618,12 @@ IsolateData::~IsolateData() { } } @@ -146,10 +146,10 @@ index 38802b1e9acf9b3e99fdc4f39770e896393befe3..e0433e29ca98c42a38d1da6d66085fde void IsolateData::MemoryInfo(MemoryTracker* tracker) const { diff --git a/src/env.h b/src/env.h -index 7cb77fb4f35a60fbda5b868798321ac8b6340bfa..06746554e1d60a9377ff6d7d970220f3fa88e4ac 100644 +index 49ca9c0042ccf22ad1fffa54f05fd443cbc681ba..945535d0dc40f1a32f7e3ecf7d50361e591ba6c8 100644 --- a/src/env.h +++ b/src/env.h -@@ -174,10 +174,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer { +@@ -175,10 +175,6 @@ class NODE_EXTERN_PRIVATE IsolateData : public MemoryRetainer { uint16_t* embedder_id_for_cppgc() const; uint16_t* embedder_id_for_non_cppgc() const; @@ -161,7 +161,7 @@ index 7cb77fb4f35a60fbda5b868798321ac8b6340bfa..06746554e1d60a9377ff6d7d970220f3 inline MultiIsolatePlatform* platform() const; inline const SnapshotData* snapshot_data() const; diff --git a/src/node.h b/src/node.h -index df3fb3372d6357b5d77b4f683e309b8483998128..01e8a4f2ed905bf5bbb803419012a014c204b460 100644 +index c16204ad2a4787eeffe61eedda254d3a5509df8c..c39f586e9c5e7e9db75d922d244ea8e4d6d56841 100644 --- a/src/node.h +++ b/src/node.h @@ -1561,24 +1561,14 @@ void RegisterSignalHandler(int signal, diff --git a/patches/node/src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch b/patches/node/src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch index 6aa803f630..861bd69338 100644 --- a/patches/node/src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch +++ b/patches/node/src_stop_using_deprecated_fields_of_fastapicallbackoptions.patch @@ -11,6 +11,20 @@ two fields in node.js. branch of Node.js. This patch can be removed when Electron upgrades to a stable Node release that contains the change. -- Charles) +diff --git a/src/crypto/crypto_timing.cc b/src/crypto/crypto_timing.cc +index 3d8ccc77b5952a999c5fe48792259d32b402c460..867a1c4aca54b9d41490d23a5eb55088b7e941cc 100644 +--- a/src/crypto/crypto_timing.cc ++++ b/src/crypto/crypto_timing.cc +@@ -59,7 +59,8 @@ bool FastTimingSafeEqual(Local receiver, + if (a.length() != b.length() || !a.getStorageIfAligned(&data_a) || + !b.getStorageIfAligned(&data_b)) { + TRACK_V8_FAST_API_CALL("crypto.timingSafeEqual.error"); +- options.fallback = true; ++ v8::HandleScope scope(options.isolate); ++ THROW_ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH(options.isolate); + return false; + } + diff --git a/src/histogram.cc b/src/histogram.cc index 4dbdea9be5721486d71a9dda77311b4919d450a3..4aacaa2a5d12533a039b4b96cb7f1fd79063d50f 100644 --- a/src/histogram.cc @@ -25,6 +39,36 @@ index 4dbdea9be5721486d71a9dda77311b4919d450a3..4aacaa2a5d12533a039b4b96cb7f1fd7 return; } HistogramBase* histogram; +diff --git a/src/node_file.cc b/src/node_file.cc +index b565beae625d970ba92ab667a145d8897d4e8a6e..31c2fe82299d6905855c4efffeea4a4d161a88d5 100644 +--- a/src/node_file.cc ++++ b/src/node_file.cc +@@ -1049,23 +1049,10 @@ static int32_t FastInternalModuleStat( + const FastOneByteString& input, + // NOLINTNEXTLINE(runtime/references) This is V8 api. + FastApiCallbackOptions& options) { +- // This needs a HandleScope which needs an isolate. +- Isolate* isolate = Isolate::TryGetCurrent(); +- if (!isolate) { +- options.fallback = true; +- return -1; +- } +- +- HandleScope scope(isolate); +- Environment* env = Environment::GetCurrent(recv->GetCreationContextChecked()); ++ Environment* env = Environment::GetCurrent(options.isolate); ++ HandleScope scope(env->isolate()); + + auto path = std::filesystem::path(input.data, input.data + input.length); +- if (UNLIKELY(!env->permission()->is_granted( +- env, permission::PermissionScope::kFileSystemRead, path.string()))) { +- options.fallback = true; +- return -1; +- } +- + switch (std::filesystem::status(path).type()) { + case std::filesystem::file_type::directory: + return 1; diff --git a/src/node_wasi.cc b/src/node_wasi.cc index ad1da44a01f437c97e06a3857eebd2edcebc83da..7123278e1a0942b61a76e9b1e7464eb8b5064079 100644 --- a/src/node_wasi.cc 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 deleted file mode 100644 index 8d576cc657..0000000000 --- a/patches/node/src_update_default_v8_platform_to_override_functions_with_location.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Etienne Pierre-Doray -Date: Mon, 11 Dec 2023 04:13:38 -0500 -Subject: src: update default V8 platform to override functions with location - -Xref: https://chromium-review.googlesource.com/c/v8/v8/+/4514946 -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 97cf6cb840bab5016e485b0dd90b3e4e1d8686c9..00ca9757bc4d0cdeb03a3f32be3ef19077cb7969 100644 ---- a/src/node_platform.cc -+++ b/src/node_platform.cc -@@ -501,17 +501,22 @@ bool PerIsolatePlatformData::FlushForegroundTasksInternal() { - return did_work; - } - --void NodePlatform::CallOnWorkerThread(std::unique_ptr task) { -+void NodePlatform::PostTaskOnWorkerThreadImpl( -+ v8::TaskPriority priority, -+ std::unique_ptr task, -+ const v8::SourceLocation& location) { - worker_thread_task_runner_->PostTask(std::move(task)); - } - --void NodePlatform::CallDelayedOnWorkerThread(std::unique_ptr task, -- double delay_in_seconds) { -+void NodePlatform::PostDelayedTaskOnWorkerThreadImpl( -+ v8::TaskPriority priority, -+ std::unique_ptr task, -+ double delay_in_seconds, -+ const v8::SourceLocation& location) { - worker_thread_task_runner_->PostDelayedTask(std::move(task), - delay_in_seconds); - } - -- - IsolatePlatformDelegate* NodePlatform::ForIsolate(Isolate* isolate) { - Mutex::ScopedLock lock(per_isolate_mutex_); - auto data = per_isolate_[isolate]; -@@ -533,8 +538,10 @@ bool NodePlatform::FlushForegroundTasks(Isolate* isolate) { - return per_isolate->FlushForegroundTasksInternal(); - } - --std::unique_ptr NodePlatform::CreateJob( -- v8::TaskPriority priority, std::unique_ptr job_task) { -+std::unique_ptr NodePlatform::CreateJobImpl( -+ v8::TaskPriority priority, -+ std::unique_ptr job_task, -+ const v8::SourceLocation& location) { - return v8::platform::NewDefaultJobHandle( - this, priority, std::move(job_task), NumberOfWorkerThreads()); - } -diff --git a/src/node_platform.h b/src/node_platform.h -index 1062f3b1b9c386a7bde8dca366c6f008bb183ab7..77cb5e6e4f891c510cdaf7fd6175a1f00d9bc420 100644 ---- a/src/node_platform.h -+++ b/src/node_platform.h -@@ -147,17 +147,23 @@ class NodePlatform : public MultiIsolatePlatform { - - // v8::Platform implementation. - int NumberOfWorkerThreads() override; -- void CallOnWorkerThread(std::unique_ptr task) override; -- void CallDelayedOnWorkerThread(std::unique_ptr task, -- double delay_in_seconds) override; -+ void PostTaskOnWorkerThreadImpl(v8::TaskPriority priority, -+ std::unique_ptr task, -+ const v8::SourceLocation& location) override; -+ void PostDelayedTaskOnWorkerThreadImpl( -+ v8::TaskPriority priority, -+ std::unique_ptr task, -+ double delay_in_seconds, -+ const v8::SourceLocation& location) override; - bool IdleTasksEnabled(v8::Isolate* isolate) override; - double MonotonicallyIncreasingTime() override; - double CurrentClockTimeMillis() override; - v8::TracingController* GetTracingController() override; - bool FlushForegroundTasks(v8::Isolate* isolate) override; -- std::unique_ptr CreateJob( -+ std::unique_ptr CreateJobImpl( - v8::TaskPriority priority, -- std::unique_ptr job_task) override; -+ std::unique_ptr job_task, -+ const v8::SourceLocation& location) override; - - void RegisterIsolate(v8::Isolate* isolate, uv_loop_t* loop) override; - void RegisterIsolate(v8::Isolate* isolate, diff --git a/patches/node/src_use_new_v8_api_to_define_stream_accessor.patch b/patches/node/src_use_new_v8_api_to_define_stream_accessor.patch deleted file mode 100644 index 3688d4d252..0000000000 --- a/patches/node/src_use_new_v8_api_to_define_stream_accessor.patch +++ /dev/null @@ -1,153 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Igor Sheludko -Date: Tue, 30 Apr 2024 15:22:06 +0200 -Subject: src: use new V8 API to define stream accessor -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Define XxxStream.prototype.onread as an accessor in JavaScript sense. - -Previously it was defined via soon-to-be-deprecated -`v8::ObjectTemplate::SetAccessor(..)` which used to call setter even -for property stores via stream object. - -The replacement V8 API `v8::ObjectTemplate::SetNativeDataProperty(..)` -defines a properly behaving data property and thus a store to a stream -object will not trigger the "onread" setter callback. - -In order to preserve the desired behavior of storing the value in the -receiver's internal field the "onread" property should be defined as -a proper JavaScript accessor. - -PR-URL: https://github.com/nodejs/node/pull/53084 -Refs: https://github.com/v8/v8/commit/46c241eb99557fe8205acac5c526650c3847d180 -Refs: https://github.com/v8/v8/commit/6ec883986bd417e2a42ddb960bd9449deb7e4639 -Reviewed-By: Luigi Pinca -Reviewed-By: Tobias Nießen -Reviewed-By: James M Snell -Reviewed-By: Joyee Cheung -(cherry picked from commit bd151552ef35b0eed415eb1c50d30dafd341cee8) - -diff --git a/src/base_object-inl.h b/src/base_object-inl.h -index 518b22dabef0974c2e7ecb466669925338524059..61f30b3cfbdb0f3d21fe8e93dc97c55162b69a69 100644 ---- a/src/base_object-inl.h -+++ b/src/base_object-inl.h -@@ -132,19 +132,18 @@ v8::EmbedderGraph::Node::Detachedness BaseObject::GetDetachedness() const { - - template - void BaseObject::InternalFieldGet( -- v8::Local property, -- const v8::PropertyCallbackInfo& info) { -- info.GetReturnValue().Set( -- info.This()->GetInternalField(Field).As()); -+ const v8::FunctionCallbackInfo& args) { -+ args.GetReturnValue().Set( -+ args.This()->GetInternalField(Field).As()); - } - - template --void BaseObject::InternalFieldSet(v8::Local property, -- v8::Local value, -- const v8::PropertyCallbackInfo& info) { -+void BaseObject::InternalFieldSet( -+ const v8::FunctionCallbackInfo& args) { -+ v8::Local value = args[0]; - // This could be e.g. value->IsFunction(). - CHECK(((*value)->*typecheck)()); -- info.This()->SetInternalField(Field, value); -+ args.This()->SetInternalField(Field, value); - } - - bool BaseObject::has_pointer_data() const { -diff --git a/src/base_object.h b/src/base_object.h -index 5c16d0d1b32e2d056f4fcfa0e01781292932a0fa..ce6277dec5a2b9313ecd3699b39ec17585d5adc5 100644 ---- a/src/base_object.h -+++ b/src/base_object.h -@@ -111,12 +111,9 @@ class BaseObject : public MemoryRetainer { - - // Setter/Getter pair for internal fields that can be passed to SetAccessor. - template -- static void InternalFieldGet(v8::Local property, -- const v8::PropertyCallbackInfo& info); -+ static void InternalFieldGet(const v8::FunctionCallbackInfo& args); - template -- static void InternalFieldSet(v8::Local property, -- v8::Local value, -- const v8::PropertyCallbackInfo& info); -+ static void InternalFieldSet(const v8::FunctionCallbackInfo& args); - - // This is a bit of a hack. See the override in async_wrap.cc for details. - virtual bool IsDoneInitializing() const; -diff --git a/src/stream_base.cc b/src/stream_base.cc -index d2649ea0a649bb2f6c6becf1891c0b6d773c1a62..9d855c2992492d3394d9f8af4e53781027a2dd83 100644 ---- a/src/stream_base.cc -+++ b/src/stream_base.cc -@@ -492,6 +492,29 @@ Local StreamBase::GetObject() { - return GetAsyncWrap()->object(); - } - -+void StreamBase::AddAccessor(v8::Isolate* isolate, -+ v8::Local signature, -+ enum v8::PropertyAttribute attributes, -+ v8::Local t, -+ JSMethodFunction* getter, -+ JSMethodFunction* setter, -+ v8::Local string) { -+ Local getter_templ = -+ NewFunctionTemplate(isolate, -+ getter, -+ signature, -+ ConstructorBehavior::kThrow, -+ SideEffectType::kHasNoSideEffect); -+ Local setter_templ = -+ NewFunctionTemplate(isolate, -+ setter, -+ signature, -+ ConstructorBehavior::kThrow, -+ SideEffectType::kHasSideEffect); -+ t->PrototypeTemplate()->SetAccessorProperty( -+ string, getter_templ, setter_templ, attributes); -+} -+ - void StreamBase::AddMethod(Isolate* isolate, - Local signature, - enum PropertyAttribute attributes, -@@ -561,11 +584,14 @@ void StreamBase::AddMethods(IsolateData* isolate_data, - JSMethod<&StreamBase::WriteString>); - t->PrototypeTemplate()->Set(FIXED_ONE_BYTE_STRING(isolate, "isStreamBase"), - True(isolate)); -- t->PrototypeTemplate()->SetAccessor( -- FIXED_ONE_BYTE_STRING(isolate, "onread"), -- BaseObject::InternalFieldGet, -- BaseObject::InternalFieldSet); -+ AddAccessor(isolate, -+ sig, -+ static_cast(DontDelete | DontEnum), -+ t, -+ BaseObject::InternalFieldGet, -+ BaseObject::InternalFieldSet, -+ FIXED_ONE_BYTE_STRING(isolate, "onread")); - } - - void StreamBase::RegisterExternalReferences( -diff --git a/src/stream_base.h b/src/stream_base.h -index 62a8928e144ad6aa67eeccdbc46d44da22887fb8..ccbd769ceaf3c1e024defb3104e601d037c98b6a 100644 ---- a/src/stream_base.h -+++ b/src/stream_base.h -@@ -413,6 +413,13 @@ class StreamBase : public StreamResource { - EmitToJSStreamListener default_listener_; - - void SetWriteResult(const StreamWriteResult& res); -+ static void AddAccessor(v8::Isolate* isolate, -+ v8::Local sig, -+ enum v8::PropertyAttribute attributes, -+ v8::Local t, -+ JSMethodFunction* getter, -+ JSMethodFunction* setter, -+ v8::Local str); - static void AddMethod(v8::Isolate* isolate, - v8::Local sig, - enum v8::PropertyAttribute attributes, diff --git a/patches/node/src_use_supported_api_to_get_stalled_tla_messages.patch b/patches/node/src_use_supported_api_to_get_stalled_tla_messages.patch deleted file mode 100644 index c4c302dc66..0000000000 --- a/patches/node/src_use_supported_api_to_get_stalled_tla_messages.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= -Date: Mon, 11 Mar 2024 09:27:11 +0000 -Subject: src: use supported API to get stalled TLA messages - -Refs: https://github.com/v8/v8/commit/23e3b6f650162ed2b332e55aa802adb8f41b50f2 - -diff --git a/src/module_wrap.cc b/src/module_wrap.cc -index 9bbb8ab908d8d992abb43254860d51f57f56387b..92edfc6fc6401edd3685a0137eac25d9e37566f6 100644 ---- a/src/module_wrap.cc -+++ b/src/module_wrap.cc -@@ -587,11 +587,10 @@ void ModuleWrap::EvaluateSync(const FunctionCallbackInfo& args) { - - if (module->IsGraphAsync()) { - CHECK(env->options()->print_required_tla); -- auto stalled = module->GetStalledTopLevelAwaitMessage(isolate); -- if (stalled.size() != 0) { -- for (auto pair : stalled) { -- Local message = std::get<1>(pair); -- -+ auto stalled_messages = -+ std::get<1>(module->GetStalledTopLevelAwaitMessages(isolate)); -+ if (stalled_messages.size() != 0) { -+ for (auto& message : stalled_messages) { - std::string reason = "Error: unexpected top-level await at "; - std::string info = - FormatErrorMessage(isolate, context, "", message, true); diff --git a/patches/node/support_v8_sandboxed_pointers.patch b/patches/node/support_v8_sandboxed_pointers.patch index abeae7e10d..40624c1ca8 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 e0bf37f09dceb93af58990438ab577a9d4b843e8..b9098d102b40adad7fafcc331ac62870617019b9 100644 +index 5fc1b6f2446d7c786024eb60800e2edab613dcd1..f59abcb21d64b910d8d42eb23c03109f62558813 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -101,6 +101,14 @@ MaybeLocal PrepareStackTraceCallback(Local context, @@ -25,11 +25,49 @@ index e0bf37f09dceb93af58990438ab577a9d4b843e8..b9098d102b40adad7fafcc331ac62870 void* NodeArrayBufferAllocator::Allocate(size_t size) { void* ret; if (zero_fill_field_ || per_process::cli_options->zero_fill_all_buffers) +diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc +index 33ffbbb85d05f5356183e3aa1ca23707c5629b5d..008d212ebe25b0022020379aa08963c12828940c 100644 +--- a/src/crypto/crypto_dh.cc ++++ b/src/crypto/crypto_dh.cc +@@ -51,6 +51,25 @@ void DiffieHellman::MemoryInfo(MemoryTracker* tracker) const { + namespace { + MaybeLocal DataPointerToBuffer(Environment* env, + ncrypto::DataPointer&& data) { ++#if defined(V8_ENABLE_SANDBOX) ++ std::unique_ptr backing; ++ if (data.size() > 0) { ++ std::unique_ptr allocator(ArrayBuffer::Allocator::NewDefaultAllocator()); ++ void* v8_data = allocator->Allocate(data.size()); ++ CHECK(v8_data); ++ memcpy(v8_data, data.get(), data.size()); ++ backing = ArrayBuffer::NewBackingStore( ++ v8_data, ++ data.size(), ++ [](void* data, size_t length, void*) { ++ std::unique_ptr allocator(ArrayBuffer::Allocator::NewDefaultAllocator()); ++ allocator->Free(data, length); ++ }, nullptr); ++ } else { ++ NoArrayBufferZeroFillScope no_zero_fill_scope(env->isolate_data()); ++ backing = v8::ArrayBuffer::NewBackingStore(env->isolate(), data.size()); ++ } ++#else + auto backing = ArrayBuffer::NewBackingStore( + data.get(), + data.size(), +@@ -59,6 +78,7 @@ MaybeLocal DataPointerToBuffer(Environment* env, + }, + nullptr); + data.release(); ++#endif + + auto ab = ArrayBuffer::New(env->isolate(), std::move(backing)); + return Buffer::New(env, ab, 0, ab->ByteLength()).FromMaybe(Local()); diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc -index 63d971e1fe6b861e29c12f04563701b01fdfb976..f39652a6f5196531cd78ce74e91076b1b9e970ca 100644 +index ee81048caab4ccfe26ea9e677782c9c955d162a9..643c9d31dc2737faa2ec51684ffceb35a1014a58 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc -@@ -348,10 +348,35 @@ ByteSource& ByteSource::operator=(ByteSource&& other) noexcept { +@@ -326,10 +326,35 @@ ByteSource& ByteSource::operator=(ByteSource&& other) noexcept { return *this; } @@ -66,7 +104,7 @@ index 63d971e1fe6b861e29c12f04563701b01fdfb976..f39652a6f5196531cd78ce74e91076b1 std::unique_ptr ptr = ArrayBuffer::NewBackingStore( allocated_data_, size(), -@@ -363,10 +388,11 @@ std::unique_ptr ByteSource::ReleaseToBackingStore() { +@@ -341,10 +366,11 @@ std::unique_ptr ByteSource::ReleaseToBackingStore() { data_ = nullptr; size_ = 0; return ptr; @@ -79,7 +117,7 @@ index 63d971e1fe6b861e29c12f04563701b01fdfb976..f39652a6f5196531cd78ce74e91076b1 return ArrayBuffer::New(env->isolate(), std::move(store)); } -@@ -703,6 +729,16 @@ namespace { +@@ -641,6 +667,16 @@ namespace { // in which case this has the same semantics as // using OPENSSL_malloc. However, if the secure heap is // initialized, SecureBuffer will automatically use it. @@ -96,7 +134,7 @@ index 63d971e1fe6b861e29c12f04563701b01fdfb976..f39652a6f5196531cd78ce74e91076b1 void SecureBuffer(const FunctionCallbackInfo& args) { CHECK(args[0]->IsUint32()); Environment* env = Environment::GetCurrent(args); -@@ -724,6 +760,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -662,6 +698,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { Local buffer = ArrayBuffer::New(env->isolate(), store); args.GetReturnValue().Set(Uint8Array::New(buffer, 0, len)); } @@ -105,10 +143,10 @@ index 63d971e1fe6b861e29c12f04563701b01fdfb976..f39652a6f5196531cd78ce74e91076b1 void SecureHeapUsed(const FunctionCallbackInfo& args) { #ifndef OPENSSL_IS_BORINGSSL diff --git a/src/crypto/crypto_util.h b/src/crypto/crypto_util.h -index 4ba261014695cf1aa8eb53b21a2873f4c4ea8e43..b695d131bcdc331974f544924138bb5eedc50c9f 100644 +index 922e77091d72172ed6cfc5e8477901e3608396c5..16a236c69caed6d60248c7973531a95adc8f2edb 100644 --- a/src/crypto/crypto_util.h +++ b/src/crypto/crypto_util.h -@@ -285,7 +285,7 @@ class ByteSource { +@@ -268,7 +268,7 @@ class ByteSource { // Creates a v8::BackingStore that takes over responsibility for // any allocated data. The ByteSource will be reset with size = 0 // after being called. @@ -117,11 +155,44 @@ index 4ba261014695cf1aa8eb53b21a2873f4c4ea8e43..b695d131bcdc331974f544924138bb5e v8::Local ToArrayBuffer(Environment* env); +diff --git a/src/crypto/crypto_x509.cc b/src/crypto/crypto_x509.cc +index af2f953f0388dbce326b0c519de3883552f8f009..7fb34057a486914dd886ec4d3d23be90cccb4fea 100644 +--- a/src/crypto/crypto_x509.cc ++++ b/src/crypto/crypto_x509.cc +@@ -174,6 +174,19 @@ MaybeLocal ToV8Value(Local context, const BIOPointer& bio) { + MaybeLocal ToBuffer(Environment* env, BIOPointer* bio) { + if (bio == nullptr || !*bio) return {}; + BUF_MEM* mem = *bio; ++#if defined(V8_ENABLE_SANDBOX) ++ std::unique_ptr allocator(ArrayBuffer::Allocator::NewDefaultAllocator()); ++ void* v8_data = allocator->Allocate(mem->length); ++ CHECK(v8_data); ++ memcpy(v8_data, mem->data, mem->length); ++ std::unique_ptr backing = ArrayBuffer::NewBackingStore( ++ v8_data, ++ mem->length, ++ [](void* data, size_t length, void*) { ++ std::unique_ptr allocator(ArrayBuffer::Allocator::NewDefaultAllocator()); ++ allocator->Free(data, length); ++ }, nullptr); ++#else + auto backing = ArrayBuffer::NewBackingStore( + mem->data, + mem->length, +@@ -181,6 +194,8 @@ MaybeLocal ToBuffer(Environment* env, BIOPointer* bio) { + BIOPointer free_me(static_cast(data)); + }, + bio->release()); ++#endif ++ + auto ab = ArrayBuffer::New(env->isolate(), std::move(backing)); + Local ret; + if (!Buffer::New(env, ab, 0, ab->ByteLength()).ToLocal(&ret)) return {}; diff --git a/src/node_i18n.cc b/src/node_i18n.cc -index 2aa7cd98ecc179519a6bb1932dafa86a38bda4f5..79376bef2e674f05fd95380dd419e8778cb98623 100644 +index 43bb68351bf0a68285e464601013bbdbd5d5df5f..4126bbff080548c91154a6dcc437359c82a6c771 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc -@@ -106,7 +106,7 @@ namespace { +@@ -107,7 +107,7 @@ namespace { template MaybeLocal ToBufferEndian(Environment* env, MaybeStackBuffer* buf) { @@ -130,7 +201,7 @@ index 2aa7cd98ecc179519a6bb1932dafa86a38bda4f5..79376bef2e674f05fd95380dd419e877 if (ret.IsEmpty()) return ret; -@@ -183,7 +183,7 @@ MaybeLocal TranscodeLatin1ToUcs2(Environment* env, +@@ -184,7 +184,7 @@ MaybeLocal TranscodeLatin1ToUcs2(Environment* env, return {}; } @@ -139,7 +210,7 @@ index 2aa7cd98ecc179519a6bb1932dafa86a38bda4f5..79376bef2e674f05fd95380dd419e877 } MaybeLocal TranscodeFromUcs2(Environment* env, -@@ -228,7 +228,7 @@ MaybeLocal TranscodeUcs2FromUtf8(Environment* env, +@@ -229,7 +229,7 @@ MaybeLocal TranscodeUcs2FromUtf8(Environment* env, return {}; } @@ -148,7 +219,7 @@ index 2aa7cd98ecc179519a6bb1932dafa86a38bda4f5..79376bef2e674f05fd95380dd419e877 } MaybeLocal TranscodeUtf8FromUcs2(Environment* env, -@@ -252,7 +252,7 @@ MaybeLocal TranscodeUtf8FromUcs2(Environment* env, +@@ -253,7 +253,7 @@ MaybeLocal TranscodeUtf8FromUcs2(Environment* env, return {}; } @@ -158,7 +229,7 @@ index 2aa7cd98ecc179519a6bb1932dafa86a38bda4f5..79376bef2e674f05fd95380dd419e877 constexpr const char* EncodingName(const enum encoding encoding) { diff --git a/src/node_internals.h b/src/node_internals.h -index 6264f23d54d6028bb0158f12a9296ba67a846358..613300215766aeb108219b0d1c3b95ee02db964f 100644 +index fe2d25decd883085e4c3f368ab4acc01a7f66f6e..bcd5c87afcff9c56429443363c63fc8079521451 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -117,7 +117,9 @@ v8::Maybe InitializePrimordials(v8::Local context); 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 79b02f4e85..5b01232074 100644 --- a/patches/node/test_formally_mark_some_tests_as_flaky.patch +++ b/patches/node/test_formally_mark_some_tests_as_flaky.patch @@ -7,7 +7,7 @@ Instead of disabling the tests, flag them as flaky so they still run but don't cause CI failures on flakes. diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status -index 79a953df7da64b7d7580e099a5cc5160e7842999..94616df356cab50c8ef4099e7863f5986deed377 100644 +index 24e1a74886bad536dc08df75fbdb0508e4e1420a..7f3be73474557788050a9110b0e29e602b7d6397 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -5,6 +5,16 @@ prefix parallel diff --git a/patches/node/test_make_test-node-output-v8-warning_generic.patch b/patches/node/test_make_test-node-output-v8-warning_generic.patch index 97df457cbd..85e434f823 100644 --- a/patches/node/test_make_test-node-output-v8-warning_generic.patch +++ b/patches/node/test_make_test-node-output-v8-warning_generic.patch @@ -14,7 +14,7 @@ meaningless. Fix it for now by replacing the process.argv0 basename instead. Some form of fix for this should be upstreamed. diff --git a/test/parallel/test-node-output-v8-warning.mjs b/test/parallel/test-node-output-v8-warning.mjs -index 8e497739d21c70d5c792f43c268746a200916063..cad1910e020b15775ee16122bc9d310680fed687 100644 +index 309e904c49b7124b64831293e0473a5d35249081..6636144f5074811f95bbe53a62718c8084088bdc 100644 --- a/test/parallel/test-node-output-v8-warning.mjs +++ b/test/parallel/test-node-output-v8-warning.mjs @@ -2,11 +2,18 @@ import '../common/index.mjs'; @@ -33,10 +33,10 @@ index 8e497739d21c70d5c792f43c268746a200916063..cad1910e020b15775ee16122bc9d3106 + return str.replaceAll(`${baseName} --`, '* --'); +} + - describe('v8 output', { concurrency: true }, () => { + describe('v8 output', { concurrency: !process.env.TEST_PARALLEL }, () => { function normalize(str) { return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '') -@@ -15,10 +22,10 @@ describe('v8 output', { concurrency: true }, () => { +@@ -15,10 +22,10 @@ describe('v8 output', { concurrency: !process.env.TEST_PARALLEL }, () => { .replaceAll('*test*', '*') .replaceAll(/.*?\*fixtures\*v8\*/g, '(node:*) V8: *') // Replace entire path before fixtures/v8 .replaceAll('*fixtures*v8*', '*') diff --git a/patches/node/test_match_wpt_streams_transferable_transform-stream-members_any_js.patch b/patches/node/test_match_wpt_streams_transferable_transform-stream-members_any_js.patch deleted file mode 100644 index 6a0a9f4b9d..0000000000 --- a/patches/node/test_match_wpt_streams_transferable_transform-stream-members_any_js.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Tue, 16 Jan 2024 19:39:10 +0100 -Subject: test: match wpt/streams/transferable/transform-stream-members.any.js - to upstream - -All four of this calls should fail - see third_party/blink/web_tests/external/wpt/streams/transferable/transform-stream-members.any-expected.txt - -diff --git a/test/wpt/status/streams.json b/test/wpt/status/streams.json -index 5425c86bba85079a44745779d998337aaa063df1..775661cd59b14132c9a811e448792ea02198f949 100644 ---- a/test/wpt/status/streams.json -+++ b/test/wpt/status/streams.json -@@ -60,7 +60,9 @@ - "fail": { - "expected": [ - "Transferring [object TransformStream],[object ReadableStream] should fail", -- "Transferring [object TransformStream],[object WritableStream] should fail" -+ "Transferring [object TransformStream],[object WritableStream] should fail", -+ "Transferring [object ReadableStream],[object TransformStream] should fail", -+ "Transferring [object WritableStream],[object TransformStream] should fail" - ] - } - }, diff --git a/patches/node/test_update_v8-stats_test_for_v8_12_6.patch b/patches/node/test_update_v8-stats_test_for_v8_12_6.patch index 1e0ac6eaca..671fcb14ed 100644 --- a/patches/node/test_update_v8-stats_test_for_v8_12_6.patch +++ b/patches/node/test_update_v8-stats_test_for_v8_12_6.patch @@ -6,7 +6,7 @@ Subject: test: update v8-stats test for V8 12.6 Refs: https://github.com/v8/v8/commit/e30e228ee6e034de49a40af0173113198a19b497 diff --git a/test/parallel/test-v8-stats.js b/test/parallel/test-v8-stats.js -index 2366cbf716c11851bb3a759dce5db47d616516dc..9d2971ba9411bb98107f6a9acc8a07ec438b76e5 100644 +index bb954165f42c9de3db66bc5fdcac647654ad71ea..07be833e6e749a2bb68490c935c6791c178d126f 100644 --- a/test/parallel/test-v8-stats.js +++ b/test/parallel/test-v8-stats.js @@ -48,6 +48,8 @@ const expectedHeapSpaces = [ @@ -16,5 +16,5 @@ index 2366cbf716c11851bb3a759dce5db47d616516dc..9d2971ba9411bb98107f6a9acc8a07ec + 'shared_trusted_large_object_space', + 'shared_trusted_space', 'trusted_large_object_space', - 'trusted_space' + 'trusted_space', ]; diff --git a/patches/node/win_almost_fix_race_detecting_esrch_in_uv_kill.patch b/patches/node/win_almost_fix_race_detecting_esrch_in_uv_kill.patch new file mode 100644 index 0000000000..4a210d885a --- /dev/null +++ b/patches/node/win_almost_fix_race_detecting_esrch_in_uv_kill.patch @@ -0,0 +1,70 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Santiago Gimeno +Date: Tue, 5 Mar 2024 14:54:59 +0100 +Subject: win: almost fix race detecting ESRCH in uv_kill + +It might happen that only using `WaitForSingleObject()` with timeout 0 +could return WAIT_TIMEOUT as the process might not have been signaled +yet. To improve things, first use `GetExitCodeProcess()` and check +that `status` is not `STILL_ACTIVE`. Then, to cover for the case that the exit +code was actually `STILL_ACTIVE` use `WaitForSingleObject()`. This could +still be prone to the race condition but only for that case. + +diff --git a/deps/uv/src/win/process.c b/deps/uv/src/win/process.c +index 4e94dee90e13eede63d8e97ddc9992726f874ea9..f46f34289e8e7d3a2af914d89e6164b751a3e47d 100644 +--- a/deps/uv/src/win/process.c ++++ b/deps/uv/src/win/process.c +@@ -1308,16 +1308,34 @@ static int uv__kill(HANDLE process_handle, int signum) { + /* Unconditionally terminate the process. On Windows, killed processes + * normally return 1. */ + int err; ++ DWORD status; + + if (TerminateProcess(process_handle, 1)) + return 0; + +- /* If the process already exited before TerminateProcess was called,. ++ /* If the process already exited before TerminateProcess was called, + * TerminateProcess will fail with ERROR_ACCESS_DENIED. */ + err = GetLastError(); +- if (err == ERROR_ACCESS_DENIED && +- WaitForSingleObject(process_handle, 0) == WAIT_OBJECT_0) { +- return UV_ESRCH; ++ if (err == ERROR_ACCESS_DENIED) { ++ /* First check using GetExitCodeProcess() with status different from ++ * STILL_ACTIVE (259). This check can be set incorrectly by the process, ++ * though that is uncommon. */ ++ if (GetExitCodeProcess(process_handle, &status) && ++ status != STILL_ACTIVE) { ++ return UV_ESRCH; ++ } ++ ++ /* But the process could have exited with code == STILL_ACTIVE, use then ++ * WaitForSingleObject with timeout zero. This is prone to a race ++ * condition as it could return WAIT_TIMEOUT because the handle might ++ * not have been signaled yet.That would result in returning the wrong ++ * error code here (UV_EACCES instead of UV_ESRCH), but we cannot fix ++ * the kernel synchronization issue that TerminateProcess is ++ * inconsistent with WaitForSingleObject with just the APIs available to ++ * us in user space. */ ++ if (WaitForSingleObject(process_handle, 0) == WAIT_OBJECT_0) { ++ return UV_ESRCH; ++ } + } + + return uv_translate_sys_error(err); +@@ -1325,6 +1343,14 @@ static int uv__kill(HANDLE process_handle, int signum) { + + case 0: { + /* Health check: is the process still alive? */ ++ DWORD status; ++ ++ if (!GetExitCodeProcess(process_handle, &status)) ++ return uv_translate_sys_error(GetLastError()); ++ ++ if (status != STILL_ACTIVE) ++ return UV_ESRCH; ++ + switch (WaitForSingleObject(process_handle, 0)) { + case WAIT_OBJECT_0: + return UV_ESRCH; diff --git a/patches/node/win_process_avoid_assert_after_spawning_store_app_4152.patch b/patches/node/win_process_avoid_assert_after_spawning_store_app_4152.patch deleted file mode 100644 index ff3ed47f1d..0000000000 --- a/patches/node/win_process_avoid_assert_after_spawning_store_app_4152.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jameson Nash -Date: Mon, 2 Oct 2023 15:15:18 +0200 -Subject: win,process: avoid assert after spawning Store app (#4152) - -Make sure this handle is functional. The Windows kernel seems to have a -bug that if the first use of AssignProcessToJobObject is for a Windows -Store program, subsequent attempts to use the handle with fail with -INVALID_PARAMETER (87). This is possilby because all uses of the handle -must be for the same Terminal Services session. We can ensure it is -tied to our current session now by adding ourself to it. We could -remove ourself afterwards, but there doesn't seem to be a reason to. - -Secondly, we start the process suspended so that we can make sure we -added it to the job control object before it does anything itself (such -as launch more jobs or exit). - -Fixes: https://github.com/JuliaLang/julia/issues/51461 - -diff --git a/deps/uv/src/win/process.c b/deps/uv/src/win/process.c -index 3e451e2291d6ed200ec258e874becbbea22bbc27..a71a08bdd60166ef1d4ef490ff3e083b44188852 100644 ---- a/deps/uv/src/win/process.c -+++ b/deps/uv/src/win/process.c -@@ -105,6 +105,21 @@ static void uv__init_global_job_handle(void) { - &info, - sizeof info)) - uv_fatal_error(GetLastError(), "SetInformationJobObject"); -+ -+ -+ if (!AssignProcessToJobObject(uv_global_job_handle_, GetCurrentProcess())) { -+ /* Make sure this handle is functional. The Windows kernel has a bug that -+ * if the first use of AssignProcessToJobObject is for a Windows Store -+ * program, subsequent attempts to use the handle with fail with -+ * INVALID_PARAMETER (87). This is possibly because all uses of the handle -+ * must be for the same Terminal Services session. We can ensure it is tied -+ * to our current session now by adding ourself to it. We could remove -+ * ourself afterwards, but there doesn't seem to be a reason to. -+ */ -+ DWORD err = GetLastError(); -+ if (err != ERROR_ACCESS_DENIED) -+ uv_fatal_error(err, "AssignProcessToJobObject"); -+ } - } - - -@@ -1102,6 +1117,7 @@ int uv_spawn(uv_loop_t* loop, - * breakaway. - */ - process_flags |= DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP; -+ process_flags |= CREATE_SUSPENDED; - } - - if (!CreateProcessW(application_path, -@@ -1119,11 +1135,6 @@ int uv_spawn(uv_loop_t* loop, - goto done; - } - -- /* Spawn succeeded. Beyond this point, failure is reported asynchronously. */ -- -- process->process_handle = info.hProcess; -- process->pid = info.dwProcessId; -- - /* If the process isn't spawned as detached, assign to the global job object - * so windows will kill it when the parent process dies. */ - if (!(options->flags & UV_PROCESS_DETACHED)) { -@@ -1146,6 +1157,19 @@ int uv_spawn(uv_loop_t* loop, - } - } - -+ if (process_flags & CREATE_SUSPENDED) { -+ if (ResumeThread(info.hThread) == ((DWORD)-1)) { -+ err = GetLastError(); -+ TerminateProcess(info.hProcess, 1); -+ goto done; -+ } -+ } -+ -+ /* Spawn succeeded. Beyond this point, failure is reported asynchronously. */ -+ -+ process->process_handle = info.hProcess; -+ process->pid = info.dwProcessId; -+ - /* Set IPC pid to all IPC pipes. */ - for (i = 0; i < options->stdio_count; i++) { - const uv_stdio_container_t* fdopt = &options->stdio[i]; diff --git a/patches/sqlite/.patches b/patches/sqlite/.patches new file mode 100644 index 0000000000..ce35559581 --- /dev/null +++ b/patches/sqlite/.patches @@ -0,0 +1 @@ +fix_rename_sqlite_win32_exports_to_avoid_conflicts_with_node_js.patch diff --git a/patches/sqlite/fix_rename_sqlite_win32_exports_to_avoid_conflicts_with_node_js.patch b/patches/sqlite/fix_rename_sqlite_win32_exports_to_avoid_conflicts_with_node_js.patch new file mode 100644 index 0000000000..0978319495 --- /dev/null +++ b/patches/sqlite/fix_rename_sqlite_win32_exports_to_avoid_conflicts_with_node_js.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Sun, 27 Oct 2024 21:01:11 +0100 +Subject: fix: rename sqlite win32 exports to avoid conflicts with Node.js + +As of https://github.com/nodejs/node/pull/53752, a number of symbols +exported by SQLite are now exported by Node.js. This change renames +the exported symbols in SQLite to avoid conflicts with Node.js. + +This should be upstreamed to SQLite. + +diff --git a/amalgamation/rename_exports.h b/amalgamation/rename_exports.h +index b1c485159a624ea1bfbec603aabc58074721e72a..8eb71ae67acc3e0ad17bae2e87e85bf12c10b9af 100644 +--- a/amalgamation/rename_exports.h ++++ b/amalgamation/rename_exports.h +@@ -367,6 +367,15 @@ + #define sqlite3session_patchset chrome_sqlite3session_patchset // Lines 11449-11453 + #define sqlite3session_patchset_strm chrome_sqlite3session_patchset_strm // Lines 12728-12732 + #define sqlite3session_table_filter chrome_sqlite3session_table_filter // Lines 11219-11226 ++#define sqlite3_win32_write_debug chrome_sqlite3_win32_write_debug ++#define sqlite3_win32_sleep chrome_sqlite3_win32_sleep ++#define sqlite3_win32_is_nt chrome_sqlite3_win32_is_nt ++#define sqlite3_win32_utf8_to_unicode chrome_sqlite3_win32_utf8_to_unicode ++#define sqlite3_win32_unicode_to_utf8 chrome_sqlite3_win32_unicode_to_utf8 ++#define sqlite3_win32_mbcs_to_utf8 chrome_sqlite3_win32_mbcs_to_utf8 ++#define sqlite3_win32_utf8_to_mbcs_v2 chrome_sqlite3_win32_utf8_to_mbcs_v2 ++#define sqlite3_win32_utf8_to_mbcs chrome_sqlite3_win32_utf8_to_mbcs ++#define sqlite3_win32_mbcs_to_utf8_v2 chrome_sqlite3_win32_mbcs_to_utf8_v2 + + #endif // THIRD_PARTY_SQLITE_AMALGAMATION_RENAME_EXPORTS_H_ + diff --git a/script/node-disabled-tests.json b/script/node-disabled-tests.json index e14cf2394a..e967f2e10c 100644 --- a/script/node-disabled-tests.json +++ b/script/node-disabled-tests.json @@ -1,12 +1,14 @@ [ "abort/test-abort-backtrace", "es-module/test-vm-compile-function-lineoffset", + "parallel/test-async-context-frame", "parallel/test-bootstrap-modules", "parallel/test-child-process-fork-exec-path", "parallel/test-code-cache", "parallel/test-cluster-primary-error", "parallel/test-cluster-primary-kill", "parallel/test-crypto-aes-wrap", + "parallel/test-crypto-authenticated", "parallel/test-crypto-authenticated-stream", "parallel/test-crypto-des3-wrap", "parallel/test-crypto-dh-group-setters", @@ -35,6 +37,7 @@ "parallel/test-inspector-port-zero-cluster", "parallel/test-inspector-tracing-domain", "parallel/test-module-loading-globalpaths", + "parallel/test-module-print-timing", "parallel/test-openssl-ca-options", "parallel/test-process-versions", "parallel/test-process-get-builtin", @@ -60,6 +63,7 @@ "parallel/test-snapshot-incompatible", "parallel/test-snapshot-namespaced-builtin", "parallel/test-snapshot-net", + "parallel/test-snapshot-reproducible", "parallel/test-snapshot-typescript", "parallel/test-snapshot-umd", "parallel/test-snapshot-warning", diff --git a/shell/app/node_main.cc b/shell/app/node_main.cc index 8db8d80c14..782357ac37 100644 --- a/shell/app/node_main.cc +++ b/shell/app/node_main.cc @@ -183,7 +183,7 @@ int NodeMain() { const std::vector args = ElectronCommandLine::AsUtf8(); ExitIfContainsDisallowedFlags(args); - std::unique_ptr result = + std::shared_ptr result = node::InitializeOncePerProcess( args, {node::ProcessInitializationFlags::kNoInitializeV8, diff --git a/shell/browser/file_system_access/file_system_access_permission_context.cc b/shell/browser/file_system_access/file_system_access_permission_context.cc index 4addf43708..6e8d360982 100644 --- a/shell/browser/file_system_access/file_system_access_permission_context.cc +++ b/shell/browser/file_system_access/file_system_access_permission_context.cc @@ -165,8 +165,10 @@ bool ShouldBlockAccessToPath(const base::FilePath& path, ChromeFileSystemAccessPermissionContext::kBlockedPaths) { if (key == ChromeFileSystemAccessPermissionContext::kNoBasePathKey) { rules.emplace_back(base::FilePath{rule_path}, type); - } else if (base::FilePath path; base::PathService::Get(key, &path)) { - rules.emplace_back(rule_path ? path.Append(rule_path) : path, type); + } else if (base::FilePath block_path; + base::PathService::Get(key, &block_path)) { + rules.emplace_back(rule_path ? block_path.Append(rule_path) : block_path, + type); } } diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc index b2b94d89e0..5a0aaa6e96 100644 --- a/shell/common/node_bindings.cc +++ b/shell/common/node_bindings.cc @@ -568,7 +568,7 @@ void NodeBindings::Initialize(v8::Local context) { if (!fuses::IsNodeOptionsEnabled()) process_flags |= node::ProcessInitializationFlags::kDisableNodeOptionsEnv; - std::unique_ptr result = + std::shared_ptr result = node::InitializeOncePerProcess( args, static_cast(process_flags)); diff --git a/spec/api-utility-process-spec.ts b/spec/api-utility-process-spec.ts index b17a6f70a8..9e2dad10df 100644 --- a/spec/api-utility-process-spec.ts +++ b/spec/api-utility-process-spec.ts @@ -510,7 +510,8 @@ describe('utilityProcess module', () => { expect(output).to.equal(result); }); - it('does not inherit parent env when custom env is provided', async () => { + // TODO(codebytere): figure out why this is failing in ASAN- builds on Linux. + ifit(!process.env.IS_ASAN)('does not inherit parent env when custom env is provided', async () => { const appProcess = childProcess.spawn(process.execPath, [path.join(fixturesPath, 'env-app'), '--create-custom-env'], { env: { FROM: 'parent', diff --git a/spec/fixtures/native-addon/external-ab/binding.cc b/spec/fixtures/native-addon/external-ab/binding.cc index 277e13f97e..df1d52546c 100644 --- a/spec/fixtures/native-addon/external-ab/binding.cc +++ b/spec/fixtures/native-addon/external-ab/binding.cc @@ -1,5 +1,4 @@ #include -#undef NAPI_VERSION #include #include diff --git a/spec/lib/events-helpers.ts b/spec/lib/events-helpers.ts index 2eca91da38..ead2cb5539 100644 --- a/spec/lib/events-helpers.ts +++ b/spec/lib/events-helpers.ts @@ -20,4 +20,5 @@ export const emittedUntil = async (emitter: NodeJS.EventEmitter, eventName: stri for await (const args of on(emitter, eventName)) { if (untilFn(...args)) { return args; } } + return []; }; diff --git a/yarn.lock b/yarn.lock index f7dc46f92f..cac51c4a3f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -997,12 +997,12 @@ dependencies: undici-types "~6.19.2" -"@types/node@^20.9.0": - version "20.9.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.0.tgz#bfcdc230583aeb891cf51e73cfdaacdd8deae298" - integrity sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw== +"@types/node@^22.7.7": + version "22.7.7" + resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.7.tgz#6cd9541c3dccb4f7e8b141b491443f4a1570e307" + integrity sha512-SRxCrrg9CL/y54aiMCG3edPKdprgMVGDXjA3gB8UmmBW5TcXzRUYAh8EWzTnSJFAd1rgImPELza+A3bJ+qxz8Q== dependencies: - undici-types "~5.26.4" + undici-types "~6.19.2" "@types/normalize-package-data@^2.4.0": version "2.4.1" @@ -7042,14 +7042,7 @@ stringify-object@^3.3.0: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - -strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -7441,11 +7434,6 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" -undici-types@~5.26.4: - version "5.26.5" - resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" - integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== - undici-types@~6.19.2: version "6.19.8" resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02"