From 5dc5801324d19de8d6ed330c9d63281e593db027 Mon Sep 17 00:00:00 2001 From: "electron-roller[bot]" <84116207+electron-roller[bot]@users.noreply.github.com> Date: Tue, 8 Aug 2023 17:52:51 -0500 Subject: [PATCH] chore: bump node to v18.17.0 (main) (#39154) * chore: bump node in DEPS to v18.17.0 * chore: update build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch Xref: https://github.com/nodejs/node/pull/46930 manually sync patch to minor upstream code shear * chore: update build_ensure_native_module_compilation_fails_if_not_using_a_new.patch Xref: https://github.com/nodejs/node/pull/48248 manually sync patch to minor upstream code shear * chore: update fix_expose_the_built-in_electron_module_via_the_esm_loader.patch Xref: https://github.com/nodejs/node/pull/47824 chore: upstream func throwIfUnsupportedURLProtocol() has been removed, so no need to patch it * chore: update api_pass_oomdetails_to_oomerrorcallback.patch Xref: https://github.com/nodejs/node/pull/47695 manually sync patch to minor upstream code shear * chore: remove fix_prevent_changing_functiontemplateinfo_after_publish.patch Xref: https://github.com/nodejs/node/pull/46979 (upstreamed patch) Xref: https://chromium-review.googlesource.com/c/v8/v8/+/2718147 (related) * chore: update fix_adapt_debugger_tests_for_upstream_v8_changes.patch Xref: https://github.com/nodejs/node/pull/47274 manually sync patch to minor upstream code shear some tests moved from sequential to parallel * chore: remove fix_libc_buffer_overflow_in_string_view_ctor.patch Xref: fix_libc_buffer_overflow_in_string_view_ctor.patch patch is no longer needed due to upstream bump to ada 2.2.0 * chore: remove fix_preventing_potential_oob_in_ada_no_scheme_parsing.patch Xref: https://github.com/nodejs/node/pull/47339 patch is no longer needed due to upstream bump to ada 2.2.0 * chore: rebuild filenames.json several files removed/added/changed upstream * chore: update build_add_gn_build_files.patch upstream dep histogram 0.11.7 moved its include path from src/ to include/ Xref: https://github.com/nodejs/node/pull/47742 * chore: update fix_crypto_tests_to_run_with_bssl.patch Xref: https://github.com/nodejs/node/pull/47160 BoringSSL doesn't support BIO_s_secmem() (a secure heap variant of BIO_s_mem()), so use BIO_s_mem() instead. Related discussion of secure heap support in BoringSSL: https://boringssl-review.googlesource.com/c/boringssl/+/54309 * fix: ftbfs in node dep ada * fix: ftbfs in node dep uvwasi * chore: rebuild patches * chore: update fix_handle_boringssl_and_openssl_incompatibilities.patch Upstream used `BIO_s_secmem()`, a secure heap variant of `BIO_s_mem()`. BoringSSL doesn't support it, so this PR opts for `BIO_s_mem()` instead. Upstream Node.js change that prompted this: https://github.com/nodejs/node/pull/47160 Related discussion of BoringSSL support of secure heap: https://boringssl-review.googlesource.com/c/boringssl/+/54309 * fix: work around Node 18 isURL() regression * chore: sort script/node-disabled-tests.json alphabetically * test: add parallel/test-snapshot-argv1 to disabled list test: add parallel/test-snapshot-namespaced-builtin to disabled list We don't support that type of snapshotting at the moment. * chore: disable flaky node test parallel/test-dgram-send-cb-quelches-error fails upstream in v18.x on my box as well * ci: ensure spawned node tests have ELECTRON_RUN_AS_NODE set * fixup! fix: work around Node 18 isURL() regression fix: infinite loop regression * fixup! fix: work around Node 18 isURL() regression * chore: patch fixtures/errors/force_colors.snapshot The line numbers in the stacktrace from our v8 build don't match what Node's tests are expecting, so update the stacktrace to match our build. The specific numbers probably aren't t needed for the force_colors test, which is trying to see whether or not the lines are greyed out. One option is to upstream a test change to stop hardcoding the stacktrace. * fixup! fix: work around Node 18 isURL() regression fix; pull in upstream bugfix * fixup! ci: ensure spawned node tests have ELECTRON_RUN_AS_NODE set chore: do not inject ELECTRON_RUN_AS_NODE in test-assert-colors.js * chore: disable flaky node test parallel/test-debugger-random-port-with-inspect-port --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr --- DEPS | 2 +- patches/node/.patches | 8 ++- ..._pass_oomdetails_to_oomerrorcallback.patch | 16 ++--- patches/node/build_add_gn_build_files.patch | 26 +++---- ...compilation_fails_if_not_using_a_new.patch | 8 +-- ...pression_sandbox_is_enabled_on_64bit.patch | 4 +- ...f_original-fs_and_custom_embedder_js.patch | 13 ++-- ...t_to_context_aware_module_prevention.patch | 4 +- ...de_entrypoint_to_be_a_builtin_module.patch | 6 +- ...ve_--no-harmony-atomics_related_code.patch | 2 +- ...ixtures_errors_force_colors_snapshot.patch | 34 +++++++++ ..._node_tests_set_electron_run_as_node.patch | 60 ++++++++++++++++ ...enable_crashpad_linux_node_processes.patch | 2 +- .../expose_get_builtin_module_function.patch | 8 +-- ...nalhandler_to_environment_to_prevent.patch | 16 ++--- .../node/feat_initialize_asar_support.patch | 4 +- patches/node/fix_-wshadow_warning.patch | 2 +- ...bugger_tests_for_upstream_v8_changes.patch | 22 +++--- .../fix_crypto_tests_to_run_with_bssl.patch | 2 +- ...ose_lookupandcompile_with_parameters.patch | 4 +- ...n_electron_module_via_the_esm_loader.patch | 23 ++---- ...se_tracing_tracingcontroller_instead.patch | 10 +-- .../node/fix_ftbfs_werror_wextra-semi.patch | 30 ++++++++ ...ftbfs_werror_wunreachable-code-break.patch | 30 ++++++++ ...ingssl_and_openssl_incompatibilities.patch | 33 +++++---- patches/node/fix_isurl_implementation.patch | 71 +++++++++++++++++++ ..._buffer_overflow_in_string_view_ctor.patch | 40 ----------- ...g_functiontemplateinfo_after_publish.patch | 61 ---------------- ...tential_oob_in_ada_no_scheme_parsing.patch | 21 ------ ..._undefined_symbol_error_on_woa_arm64.patch | 2 +- .../pass_all_globals_through_require.patch | 2 +- ...dder_overriding_of_internal_fs_calls.patch | 2 +- ...cess_fork_to_use_execute_script_with.patch | 2 +- .../node/support_v8_sandboxed_pointers.patch | 14 ++-- ...st_formally_mark_some_tests_as_flaky.patch | 4 +- .../node/v8_api_advance_api_deprecation.patch | 2 +- script/node-disabled-tests.json | 22 +++--- 37 files changed, 362 insertions(+), 250 deletions(-) create mode 100644 patches/node/chore_update_fixtures_errors_force_colors_snapshot.patch create mode 100644 patches/node/ci_ensure_node_tests_set_electron_run_as_node.patch create mode 100644 patches/node/fix_ftbfs_werror_wextra-semi.patch create mode 100644 patches/node/fix_ftbfs_werror_wunreachable-code-break.patch create mode 100644 patches/node/fix_isurl_implementation.patch delete mode 100644 patches/node/fix_libc_buffer_overflow_in_string_view_ctor.patch delete mode 100644 patches/node/fix_prevent_changing_functiontemplateinfo_after_publish.patch delete mode 100644 patches/node/fix_preventing_potential_oob_in_ada_no_scheme_parsing.patch diff --git a/DEPS b/DEPS index 743a01fa3c931..c44e0dd0e2fdf 100644 --- a/DEPS +++ b/DEPS @@ -4,7 +4,7 @@ vars = { 'chromium_version': '117.0.5921.0', 'node_version': - 'v18.16.1', + 'v18.17.0', 'nan_version': '16fa32231e2ccd89d2804b3f765319128b20c4ac', 'squirrel.mac_version': diff --git a/patches/node/.patches b/patches/node/.patches index 2b2e03219c8be..f419622b86399 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -27,15 +27,17 @@ fix_parallel_test-v8-stats.patch fix_expose_the_built-in_electron_module_via_the_esm_loader.patch api_pass_oomdetails_to_oomerrorcallback.patch fix_expose_lookupandcompile_with_parameters.patch -fix_prevent_changing_functiontemplateinfo_after_publish.patch enable_crashpad_linux_node_processes.patch test_formally_mark_some_tests_as_flaky.patch fix_adapt_debugger_tests_for_upstream_v8_changes.patch -fix_libc_buffer_overflow_in_string_view_ctor.patch -fix_preventing_potential_oob_in_ada_no_scheme_parsing.patch chore_remove_--no-harmony-atomics_related_code.patch fix_account_for_createexternalizablestring_v8_global.patch fix_wunreachable-code_warning_in_ares_init_rand_engine.patch fix_-wshadow_warning.patch fix_do_not_resolve_electron_entrypoints.patch fix_adapt_generator_tostringtag_prototype_to_v8.patch +fix_ftbfs_werror_wunreachable-code-break.patch +fix_ftbfs_werror_wextra-semi.patch +fix_isurl_implementation.patch +ci_ensure_node_tests_set_electron_run_as_node.patch +chore_update_fixtures_errors_force_colors_snapshot.patch diff --git a/patches/node/api_pass_oomdetails_to_oomerrorcallback.patch b/patches/node/api_pass_oomdetails_to_oomerrorcallback.patch index 8e316f8f3aa79..79d0d2fb1c0c9 100644 --- a/patches/node/api_pass_oomdetails_to_oomerrorcallback.patch +++ b/patches/node/api_pass_oomdetails_to_oomerrorcallback.patch @@ -8,15 +8,15 @@ Introduced in https://chromium-review.googlesource.com/c/v8/v8/+/3647827. This patch can be removed when Electron updates to Node.js v20. diff --git a/src/node_errors.cc b/src/node_errors.cc -index 2dc9e085269222c70902698020fc5c7b1af2f004..655f54e369c35efefa75c69cc57776249405dc76 100644 +index e58e45be7bbb642f2277361d6312d444cfa27d16..54402bd5663666425b17fd267ba05ba7b800791c 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc -@@ -527,9 +527,9 @@ void OnFatalError(const char* location, const char* message) { +@@ -521,9 +521,9 @@ static void ReportFatalException(Environment* env, ABORT(); } --void OOMErrorHandler(const char* location, bool is_heap_oom) { -+void OOMErrorHandler(const char* location, const v8::OOMDetails& details) { +-[[noreturn]] void OOMErrorHandler(const char* location, bool is_heap_oom) { ++[[noreturn]] void OOMErrorHandler(const char* location, const v8::OOMDetails& details) { const char* message = - is_heap_oom ? "Allocation failed - JavaScript heap out of memory" + details.is_heap_oom ? "Allocation failed - JavaScript heap out of memory" @@ -24,15 +24,15 @@ index 2dc9e085269222c70902698020fc5c7b1af2f004..655f54e369c35efefa75c69cc5777624 if (location) { FPrintF(stderr, "FATAL ERROR: %s %s\n", location, message); diff --git a/src/node_errors.h b/src/node_errors.h -index 850d437acdfe09fc43a7a37790c2926e6109749d..5a33d17b0e90e8ca8dc670e14f93de8fef99d526 100644 +index cc336536af0170e63cf9ccde99f9fa0a0be3f216..1687eed35717ae385aedad952c03ebab4f0f3bf7 100644 --- a/src/node_errors.h +++ b/src/node_errors.h @@ -21,7 +21,7 @@ void AppendExceptionLine(Environment* env, [[noreturn]] void FatalError(const char* location, const char* message); - void OnFatalError(const char* location, const char* message); --void OOMErrorHandler(const char* location, bool is_heap_oom); -+void OOMErrorHandler(const char* location, const v8::OOMDetails& details); + [[noreturn]] void OnFatalError(const char* location, const char* message); +-[[noreturn]] void OOMErrorHandler(const char* location, bool is_heap_oom); ++[[noreturn]] void OOMErrorHandler(const char* location, const v8::OOMDetails& details); // Helpers to construct errors similar to the ones provided by // lib/internal/errors.js. diff --git a/patches/node/build_add_gn_build_files.patch b/patches/node/build_add_gn_build_files.patch index 4cb30d5e17cb3..ec9b2069a3985 100644 --- a/patches/node/build_add_gn_build_files.patch +++ b/patches/node/build_add_gn_build_files.patch @@ -887,12 +887,12 @@ index 0000000000000000000000000000000000000000..0daf8c006cef89e76d7eccec3e924bd2 +} diff --git a/deps/histogram/BUILD.gn b/deps/histogram/BUILD.gn new file mode 100644 -index 0000000000000000000000000000000000000000..8ba89a379fa2937b4b2fa5092f18727c7d0788a6 +index 0000000000000000000000000000000000000000..02bc887db7c8545e1d8adc57f73f203eec2f2592 --- /dev/null +++ b/deps/histogram/BUILD.gn @@ -0,0 +1,19 @@ +config("histogram_config") { -+ include_dirs = [ "src" ] ++ include_dirs = [ "include" ] + + cflags = [ + "-Wno-implicit-function-declaration", @@ -910,6 +910,7 @@ index 0000000000000000000000000000000000000000..8ba89a379fa2937b4b2fa5092f18727c + "src/hdr_histogram.h", + ] +} +\ No newline at end of file diff --git a/deps/llhttp/BUILD.gn b/deps/llhttp/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..fb000f8ee7647c375bc190d1729d67bb7770d109 @@ -1261,10 +1262,10 @@ index 0000000000000000000000000000000000000000..2c9d2826c85bdd033f1df1d6188df636 +} diff --git a/filenames.json b/filenames.json new file mode 100644 -index 0000000000000000000000000000000000000000..bfed2576bda1371c35533bcf50888f84d82b57f3 +index 0000000000000000000000000000000000000000..7d86765bf229275ba55d37a452ef24832a7afadb --- /dev/null +++ b/filenames.json -@@ -0,0 +1,663 @@ +@@ -0,0 +1,664 @@ +// This file is automatically generated by generate_gn_filenames_json.py +// DO NOT EDIT +{ @@ -1470,6 +1471,7 @@ index 0000000000000000000000000000000000000000..bfed2576bda1371c35533bcf50888f84 + "lib/internal/crypto/sig.js", + "lib/internal/crypto/util.js", + "lib/internal/crypto/webcrypto.js", ++ "lib/internal/crypto/webidl.js", + "lib/internal/crypto/x509.js", + "lib/internal/debugger/inspect.js", + "lib/internal/debugger/inspect_client.js", @@ -1616,14 +1618,11 @@ index 0000000000000000000000000000000000000000..bfed2576bda1371c35533bcf50888f84 + "lib/internal/test_runner/reporter/dot.js", + "lib/internal/test_runner/reporter/spec.js", + "lib/internal/test_runner/reporter/tap.js", ++ "lib/internal/test_runner/reporter/v8-serializer.js", + "lib/internal/test_runner/runner.js", -+ "lib/internal/test_runner/tap_checker.js", -+ "lib/internal/test_runner/tap_lexer.js", -+ "lib/internal/test_runner/tap_parser.js", + "lib/internal/test_runner/test.js", + "lib/internal/test_runner/tests_stream.js", + "lib/internal/test_runner/utils.js", -+ "lib/internal/test_runner/yaml_to_js.js", + "lib/internal/timers.js", + "lib/internal/tls/secure-context.js", + "lib/internal/tls/secure-pair.js", @@ -1649,6 +1648,7 @@ index 0000000000000000000000000000000000000000..bfed2576bda1371c35533bcf50888f84 + "lib/internal/wasm_web_api.js", + "lib/internal/watch_mode/files_watcher.js", + "lib/internal/watchdog.js", ++ "lib/internal/webidl.js", + "lib/internal/webstreams/adapters.js", + "lib/internal/webstreams/compression.js", + "lib/internal/webstreams/encoding.js", @@ -1681,6 +1681,7 @@ index 0000000000000000000000000000000000000000..bfed2576bda1371c35533bcf50888f84 + "lib/string_decoder.js", + "lib/sys.js", + "lib/test.js", ++ "lib/test/reporters.js", + "lib/timers.js", + "lib/timers/promises.js", + "lib/tls.js", @@ -1707,6 +1708,7 @@ index 0000000000000000000000000000000000000000..bfed2576bda1371c35533bcf50888f84 + "//v8/tools/tickprocessor-driver.mjs", + "deps/acorn/acorn/dist/acorn.js", + "deps/acorn/acorn-walk/dist/walk.js", ++ "deps/minimatch/index.js", + "deps/cjs-module-lexer/lexer.js", + "deps/cjs-module-lexer/dist/lexer.js", + "deps/undici/undici.js" @@ -1964,10 +1966,10 @@ index 0000000000000000000000000000000000000000..9b1a4048a4a64c36d88de0bbe1a548c9 + } +} diff --git a/node.gyp b/node.gyp -index cf52281bb4479ba20fbe852518edadc2185f0dae..81254f1d4fff9be925ecbb85fb0811c0909900dd 100644 +index 6b554d75d89077f0fcfcaaf1636c8a537478f679..7f88a4466cb4a6b55b91345bb3af6b3600afd47a 100644 --- a/node.gyp +++ b/node.gyp -@@ -687,7 +687,7 @@ +@@ -688,7 +688,7 @@ 'src/util-inl.h', # Dependency headers 'deps/v8/include/v8.h', @@ -2183,7 +2185,7 @@ index 0000000000000000000000000000000000000000..4ab828dcbf322a9e28674e48c4a6868b + args = rebase_path(inputs + outputs, root_build_dir) +} diff --git a/src/node_version.h b/src/node_version.h -index d08a0d731f6c14b0e66076a858214147821b5a32..67c008ee7724f10de476e7e523e902fa087eb2c8 100644 +index 5509ad145e59ce62341a479c2b2fdc377ede1c30..0bbfeabf2966734d5c6b143be89d7a914e7d9b99 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -89,7 +89,10 @@ @@ -2457,7 +2459,7 @@ index f13f2ecd662a5fb985839b394b45319c091b56d4..21bc48324946d52ed2b1c9eec35c1fcd if 'false' == variables.get('node_shared_libuv'): subdir_files('deps/uv/include', 'include/node/', action) diff --git a/tools/js2c.py b/tools/js2c.py -index f9c202e861b986e3171aa21079c3b29f51fe0398..ef24c4de0aaa2cd5f3c06e5bd8dd90de2b30ffcb 100755 +index 54c7dfce3631001e108570b19d34966edafd624f..077bba1572f05f1aa16553894703b12abc19a985 100755 --- a/tools/js2c.py +++ b/tools/js2c.py @@ -131,6 +131,14 @@ def NormalizeFileName(filename): 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 5e45b90c66908..10d601584777d 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 @@ -40,19 +40,19 @@ index f3e0047fea1319034bf8b05b8d54d8a4ef181b4b..be0289ea7df50d7c2cb002c6343b7501 'defines': [ 'V8_COMPRESS_POINTERS', diff --git a/configure.py b/configure.py -index 03ccbae0a1a837a382b98b828990d5a511f7a9d7..b5c747971a10b549007a8a3247aa5bd8058f311f 100755 +index 875d83e5db0037b902cff03c74852ea347513b03..8776cd057607ffe913bdd822a0aed5f9f1aa4a7a 100755 --- a/configure.py +++ b/configure.py -@@ -1529,6 +1529,7 @@ def configure_library(lib, output, pkgname=None): +@@ -1524,6 +1524,7 @@ def configure_library(lib, output, pkgname=None): def configure_v8(o): + o['variables']['using_electron_config_gypi'] = 1 - o['variables']['v8_enable_webassembly'] = 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 4b9b416e77b07407eae7b9587705b74ad3e6f211..deefda5c684c062f3c707fbdee30878a74d5dbb0 100644 +index c4cce244359d893acf31e78f935152d4d47b14cd..26368061a909e6abc62a4cf261a5dbbd79404f1a 100644 --- a/src/node.h +++ b/src/node.h @@ -22,6 +22,12 @@ diff --git a/patches/node/build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch b/patches/node/build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch index e0804226ebc8c..45c61827c4ff8 100644 --- a/patches/node/build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch +++ b/patches/node/build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch @@ -42,10 +42,10 @@ index 543ede0020fd79251bdd9eac897d9a0e330ef239..f3e0047fea1319034bf8b05b8d54d8a4 'defines': ['V8_31BIT_SMIS_ON_64BIT_ARCH'], }], diff --git a/configure.py b/configure.py -index 40e0395ebd2c3cbcff587294bf9f1646dcab21aa..03ccbae0a1a837a382b98b828990d5a511f7a9d7 100755 +index 7006ee65816989976b1648374565ebbae4b188f1..875d83e5db0037b902cff03c74852ea347513b03 100755 --- a/configure.py +++ b/configure.py -@@ -1542,6 +1542,7 @@ def configure_v8(o): +@@ -1537,6 +1537,7 @@ def configure_v8(o): o['variables']['v8_use_siphash'] = 0 if options.without_siphash else 1 o['variables']['v8_enable_pointer_compression'] = 1 if options.enable_pointer_compression else 0 o['variables']['v8_enable_31bit_smis_on_64bit_arch'] = 1 if options.enable_pointer_compression else 0 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 952d101465590..86000f4dbc2e3 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 @@ -37,7 +37,7 @@ index ce885c154c81c5703365fa34957697698da9aff6..229b0d522aeee3632145c86715bea139 async function* watch(filename, options = kEmptyObject) { const path = toNamespacedPath(getValidatedPath(filename)); diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index 40d9025746d3c39cf9ea27b6cffc8f2eb7e62c1e..d3a0dd7cedb0d239ae427d1af2335e155345a454 100644 +index 2220869fa76f35fdfba72eba993b20748b07c546..522670ed5c9951c506dcdf2745585552ad2a081f 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -33,6 +33,7 @@ BuiltinLoader BuiltinLoader::instance_; @@ -61,7 +61,7 @@ index 90b158b84bb2a66781cf92f5b4c1a64f9e2ee651..8d9f7c409659a30747e5feeac6cfec42 std::vector GetBuiltinIds(); diff --git a/tools/js2c.py b/tools/js2c.py -index ef24c4de0aaa2cd5f3c06e5bd8dd90de2b30ffcb..ece70a8d7a1fdca051d4b821ba114be54bd34e4e 100755 +index 077bba1572f05f1aa16553894703b12abc19a985..bb9f26e3adc863757ad8ede5069d299c2d138369 100755 --- a/tools/js2c.py +++ b/tools/js2c.py @@ -39,6 +39,8 @@ import codecs @@ -159,22 +159,23 @@ index ef24c4de0aaa2cd5f3c06e5bd8dd90de2b30ffcb..ece70a8d7a1fdca051d4b821ba114be5 write_if_chaged(out, target) -@@ -218,6 +237,7 @@ def main(): +@@ -222,6 +241,7 @@ def main(): default=None, - help='input file directory') + help='root directory containing the sources') parser.add_argument('--verbose', action='store_true', help='output file') + parser.add_argument('--only-js', action='store_true', help='do not require or parse any config.gypi files') parser.add_argument('sources', nargs='*', help='input files') options = parser.parse_args() global is_verbose -@@ -230,12 +250,15 @@ def main(): +@@ -238,13 +258,15 @@ def main(): source_files = functools.reduce(SourceFileByExt, sources, {}) - # Should have exactly 3 types: `.js`, `.mjs` and `.gypi` - assert len(source_files) == 3 - # Currently config.gypi is the only `.gypi` file allowed -- assert source_files['.gypi'] == ['config.gypi'] +- assert len(source_files['.gypi']) == 1 +- assert os.path.basename(source_files['.gypi'][0]) == 'config.gypi' - source_files['config.gypi'] = source_files.pop('.gypi')[0] - JS2C(source_files, options.target) + if options.only_js: 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 a2884b2039669..49628b8e071ca 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 5093c3e53cee6d0ad9a9100b487549c3b4e7ae46..3e7b796fe5d285289e409985a5dba77b0d230910 100644 +index a82763cc5ad47f25b63b8c72e08bdc09ab841448..eb25fb4a81f53e2e443d0276bb1acbbf5700533a 100644 --- a/src/node_binding.cc +++ b/src/node_binding.cc @@ -4,6 +4,7 @@ @@ -19,7 +19,7 @@ index 5093c3e53cee6d0ad9a9100b487549c3b4e7ae46..3e7b796fe5d285289e409985a5dba77b #include "util.h" #include -@@ -475,7 +476,12 @@ void DLOpen(const FunctionCallbackInfo& args) { +@@ -481,7 +482,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 d5ab99a3c915b..01cfadc80b80a 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,7 +8,7 @@ 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 9783d9235ed43c7919ed2f26e35c96ae7ff1a08b..e4fd5e7dadb8230c9e07dbb7bc70b2117135c59a 100644 +index 8ce3d78839944ddd15bed299d89aeb61a7fd53e5..b3a54aecb06b07834e38f9c94c5246df31c7a47a 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -1230,6 +1230,13 @@ Module.prototype._compile = function(content, filename) { @@ -26,10 +26,10 @@ index 9783d9235ed43c7919ed2f26e35c96ae7ff1a08b..e4fd5e7dadb8230c9e07dbb7bc70b211 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 f91a32c0348f805d01d9c198c39cff4c5c72c88b..421b0ada67e281b4d269c7d3154e42f63e1e2cc7 100644 +index 2e35cbba2ac02494c44821af395fe0195b1ab6b5..f5b6fecf6843a6204ec532a77f39a36d33bf061d 100644 --- a/lib/internal/process/pre_execution.js +++ b/lib/internal/process/pre_execution.js -@@ -150,11 +150,13 @@ function patchProcessObject(expandArgv1) { +@@ -149,11 +149,13 @@ 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_remove_--no-harmony-atomics_related_code.patch b/patches/node/chore_remove_--no-harmony-atomics_related_code.patch index 2d2afa975520b..c57dee0102e69 100644 --- a/patches/node/chore_remove_--no-harmony-atomics_related_code.patch +++ b/patches/node/chore_remove_--no-harmony-atomics_related_code.patch @@ -37,7 +37,7 @@ index 7fbfb64984c290a1d71c99c92084975c31ce18fe..be4d82086199855a10108528b3dacc66 // not to workers created by other workers. let cachedCwd = ''; diff --git a/lib/internal/worker.js b/lib/internal/worker.js -index 59de3085cf65d532c1d8a9a3ff7fe75447639a10..9a2b8c06ec807fa62ef5130ad7b8aea21c7f049a 100644 +index 3d828d2f6f2b19554f7fc01ea880c0c144d8837d..78fcaec8d694580798783c83c3282ec1aaac4aa7 100644 --- a/lib/internal/worker.js +++ b/lib/internal/worker.js @@ -93,8 +93,7 @@ let cwdCounter; diff --git a/patches/node/chore_update_fixtures_errors_force_colors_snapshot.patch b/patches/node/chore_update_fixtures_errors_force_colors_snapshot.patch new file mode 100644 index 0000000000000..3aea2d4d028f4 --- /dev/null +++ b/patches/node/chore_update_fixtures_errors_force_colors_snapshot.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Charles Kerr +Date: Mon, 7 Aug 2023 20:29:10 -0500 +Subject: chore: update fixtures/errors/force_colors.snapshot + +The line numbers in the stacktrace from our v8 build don't match what +Node's tests are expecting, so update the stacktrace to match our build. + +The specific probably isn't needed for the force_colors test, which is +trying to see whether or not the lines are greyed out. One possibility +would be to upstream a changed test that doesn't hardcode line numbers. + +diff --git a/test/fixtures/errors/force_colors.snapshot b/test/fixtures/errors/force_colors.snapshot +index 0334a0b4faa3633aa8617b9538873e7f3540513b..d8c710e07602b68c9ad4eaaeab2bdf399ed5150b 100644 +--- a/test/fixtures/errors/force_colors.snapshot ++++ b/test/fixtures/errors/force_colors.snapshot +@@ -4,11 +4,12 @@ throw new Error('Should include grayed stack trace') + + Error: Should include grayed stack trace + at Object. (/test*force_colors.js:1:7) +- at Module._compile (node:internal*modules*cjs*loader:1256:14) +- at Module._extensions..js (node:internal*modules*cjs*loader:1310:10) +- at Module.load (node:internal*modules*cjs*loader:1119:32) +- at Module._load (node:internal*modules*cjs*loader:960:12) +- at Function.executeUserEntryPoint [as runMain] (node:internal*modules*run_main:81:12) ++ at Module._compile (node:internal*modules*cjs*loader:1271:14) ++ at Object..js (node:internal*modules*cjs*loader:1326:10) ++ at Module.load (node:internal*modules*cjs*loader:1126:32) ++ at node:internal*modules*cjs*loader:967:12 ++ at Function._load (node:electron*js2c*asar_bundle:756:32) ++ at Function.executeUserEntryPoint [as runMain] (node:internal*modules*run_main:87:12) +  at node:internal*main*run_main_module:23:47 + + Node.js * 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 new file mode 100644 index 0000000000000..481c2c00ba2ec --- /dev/null +++ b/patches/node/ci_ensure_node_tests_set_electron_run_as_node.patch @@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Charles Kerr +Date: Mon, 7 Aug 2023 13:12:29 -0500 +Subject: ci: ensure node tests set ELECTRON_RUN_AS_NODE=1 + +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/common/assertSnapshot.js b/test/common/assertSnapshot.js +index c403751ac3ef5e39e7c0b1a1a8fb704ebf843dd7..83ee45f5f906adddcbc701112f373332dd1f66f9 100644 +--- a/test/common/assertSnapshot.js ++++ b/test/common/assertSnapshot.js +@@ -62,6 +62,7 @@ async function spawnAndAssert(filename, transform = (x) => x, { tty = false, ... + const flags = common.parseTestFlags(filename); + const executable = tty ? 'tools/pseudo-tty.py' : process.execPath; + const args = tty ? [process.execPath, ...flags, filename] : [...flags, filename]; ++ if (options && options.env) options.env.ELECTRON_RUN_AS_NODE = 1; + const { stdout, stderr } = await common.spawnPromisified(executable, args, options); + await assertSnapshot(transform(`${stdout}${stderr}`), filename); + } +diff --git a/test/fixtures/test-runner/output/arbitrary-output-colored.js b/test/fixtures/test-runner/output/arbitrary-output-colored.js +index b09eeeb9971cf6dfbdccc700757487fe2236e5a8..dd8296e63133eec6babac9b35e77da301a44b86f 100644 +--- a/test/fixtures/test-runner/output/arbitrary-output-colored.js ++++ b/test/fixtures/test-runner/output/arbitrary-output-colored.js +@@ -6,6 +6,6 @@ const fixtures = require('../../../common/fixtures'); + + (async function run() { + const test = fixtures.path('test-runner/output/arbitrary-output-colored-1.js'); +- await once(spawn(process.execPath, ['--test', test], { stdio: 'inherit', env: { FORCE_COLOR: 1 } }), 'exit'); +- await once(spawn(process.execPath, ['--test', '--test-reporter', 'tap', test], { stdio: 'inherit', env: { FORCE_COLOR: 1 } }), 'exit'); +-})().then(common.mustCall()); ++ await once(spawn(process.execPath, ['--test', test], { stdio: 'inherit', env: { ELECTRON_RUN_AS_NODE: 1, FORCE_COLOR: 1 } }), 'exit'); ++ await once(spawn(process.execPath, ['--test', '--test-reporter', 'tap', test], { stdio: 'inherit', env: { ELECTRON_RUN_AS_NODE: 1, FORCE_COLOR: 1 } }), 'exit'); ++})().then(common.mustCall()); +\ No newline at end of file +diff --git a/test/parallel/test-node-output-console.mjs b/test/parallel/test-node-output-console.mjs +index 5a1b9feb6c8bedb50b89f5c4f3c5983455bb042d..efca7811dc0b6a590c5ee023c71801703a642882 100644 +--- a/test/parallel/test-node-output-console.mjs ++++ b/test/parallel/test-node-output-console.mjs +@@ -31,6 +31,7 @@ describe('console output', { concurrency: true }, () => { + .transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, replaceStackTrace); + for (const { name, transform, env } of tests) { + it(name, async () => { ++ if (env) env.ELECTRON_RUN_AS_NODE = 1; + await snapshot.spawnAndAssert(fixtures.path(name), transform ?? defaultTransform, { env }); + }); + } +diff --git a/test/parallel/test-node-output-errors.mjs b/test/parallel/test-node-output-errors.mjs +index fca2149fea32123dc4d4c6f21c64cc3c583454b3..b9a55fb7ea22e62553f69bd035797f7aaee1fc38 100644 +--- a/test/parallel/test-node-output-errors.mjs ++++ b/test/parallel/test-node-output-errors.mjs +@@ -53,6 +53,7 @@ describe('errors output', { concurrency: true }, () => { + !skipForceColors ? { name: 'errors/force_colors.js', env: { FORCE_COLOR: 1 } } : null, + ].filter(Boolean); + for (const { name, transform, env } of tests) { ++ if (env) env.ELECTRON_RUN_AS_NODE = 1; + it(name, async () => { + await snapshot.spawnAndAssert(fixtures.path(name), transform ?? defaultTransform, { env }); + }); diff --git a/patches/node/enable_crashpad_linux_node_processes.patch b/patches/node/enable_crashpad_linux_node_processes.patch index 92b3bddda966f..cd16b942d540e 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 07ad7906a7be156926d0c770c3d766c1a411203b..31061418c21d3764685110e827fc5ff536c74430 100644 +index da553f6556a06d57d7490d74a3b4dd8f0132600c..168a6c72520d6540f0dbf84a62bc5e2b2f3ae022 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -60,6 +60,7 @@ let debug = require('internal/util/debuglog').debuglog( diff --git a/patches/node/expose_get_builtin_module_function.patch b/patches/node/expose_get_builtin_module_function.patch index 508edc68b35b1..7059546cc8323 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 60b5eea61cf05344de9862a028165fecdb63fd35..5093c3e53cee6d0ad9a9100b487549c3b4e7ae46 100644 +index 259ce86b4c443c960dae6cb1c9d6c62b9ff23b30..a82763cc5ad47f25b63b8c72e08bdc09ab841448 100644 --- a/src/node_binding.cc +++ b/src/node_binding.cc -@@ -609,6 +609,10 @@ void GetInternalBinding(const FunctionCallbackInfo& args) { +@@ -620,6 +620,10 @@ void GetInternalBinding(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(exports); } @@ -24,10 +24,10 @@ index 60b5eea61cf05344de9862a028165fecdb63fd35..5093c3e53cee6d0ad9a9100b487549c3 Environment* env = Environment::GetCurrent(args); diff --git a/src/node_binding.h b/src/node_binding.h -index 13681bac67c64f5b9c81a034f0be1eeb2b346bb1..76898adc448c48715d8b9dc4aa782217a4fc7e05 100644 +index 32106afb0b7260b297c0e1a94527e03ed6039ee0..62a7473f64a618bb631b08cd5a32a1bcaa296aa8 100644 --- a/src/node_binding.h +++ b/src/node_binding.h -@@ -91,6 +91,8 @@ void GetInternalBinding(const v8::FunctionCallbackInfo& args); +@@ -98,6 +98,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_knostartdebugsignalhandler_to_environment_to_prevent.patch b/patches/node/feat_add_knostartdebugsignalhandler_to_environment_to_prevent.patch index 9b40a3eee5242..b9d61dee90750 100644 --- a/patches/node/feat_add_knostartdebugsignalhandler_to_environment_to_prevent.patch +++ b/patches/node/feat_add_knostartdebugsignalhandler_to_environment_to_prevent.patch @@ -7,10 +7,10 @@ Subject: feat: add kNoStartDebugSignalHandler to Environment to prevent This patch should be upstreamed, it allows embedders to prevent the call to StartDebugSignalHandler which handles SIGUSR1 and starts the inspector agent. Apps that have --inspect disabled also don't want SIGUSR1 to have this affect. diff --git a/src/env-inl.h b/src/env-inl.h -index bea695bd8c92d44cb9526f347a9464549155ed85..0cbd1b25c107b5deba5fdd14551cc641904f7f21 100644 +index 7ceab0da0c632f857f6e2d0fbf479bbc4f55df07..debd982c75805c51ea7d01229b9d635550060503 100644 --- a/src/env-inl.h +++ b/src/env-inl.h -@@ -669,6 +669,10 @@ inline bool Environment::no_global_search_paths() const { +@@ -627,6 +627,10 @@ inline bool Environment::no_global_search_paths() const { !options_->global_search_paths; } @@ -22,10 +22,10 @@ index bea695bd8c92d44cb9526f347a9464549155ed85..0cbd1b25c107b5deba5fdd14551cc641 // configure --no-browser-globals #ifdef NODE_NO_BROWSER_GLOBALS diff --git a/src/env.h b/src/env.h -index 82f2dd1689114ec9c89fa32130985f0e9e78cc5f..4cb02112598459ea78a4b7b683ddd57e21ecb4c4 100644 +index b0f10cfca00f380728903d5e0ea24cf3156ead0f..c914b621f50bcd6bce2617fef9e48737235aa516 100644 --- a/src/env.h +++ b/src/env.h -@@ -767,6 +767,7 @@ class Environment : public MemoryRetainer { +@@ -748,6 +748,7 @@ class Environment : public MemoryRetainer { inline bool tracks_unmanaged_fds() const; inline bool hide_console_windows() const; inline bool no_global_search_paths() const; @@ -34,10 +34,10 @@ index 82f2dd1689114ec9c89fa32130985f0e9e78cc5f..4cb02112598459ea78a4b7b683ddd57e inline uint64_t thread_id() const; inline worker::Worker* worker_context() const; diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc -index 214f992c9d015593ccdecd6eff0af4d960eccfbb..e5307b529c88d0e4db7fd7c6bd1b032d219b8c31 100644 +index b1ba86b7b0b2349f771e01143630e45cf0aecc3b..4c9f7f636aeeb19a87150ac5a05e28159503f051 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc -@@ -693,8 +693,10 @@ bool Agent::Start(const std::string& path, +@@ -703,8 +703,10 @@ bool Agent::Start(const std::string& path, StartIoThreadAsyncCallback)); uv_unref(reinterpret_cast(&start_io_thread_async)); start_io_thread_async.data = this; @@ -51,10 +51,10 @@ index 214f992c9d015593ccdecd6eff0af4d960eccfbb..e5307b529c88d0e4db7fd7c6bd1b032d parent_env_->AddCleanupHook([](void* data) { Environment* env = static_cast(data); diff --git a/src/node.h b/src/node.h -index 8314edbc82971148310c5c99e5a4b18dffa14e51..4b9b416e77b07407eae7b9587705b74ad3e6f211 100644 +index b50bd5a941d381778d464fdb2770566a3ac34fed..c4cce244359d893acf31e78f935152d4d47b14cd 100644 --- a/src/node.h +++ b/src/node.h -@@ -559,7 +559,11 @@ enum Flags : uint64_t { +@@ -575,7 +575,11 @@ enum Flags : uint64_t { // This control is needed by embedders who may not want to initialize the V8 // inspector in situations where one has already been created, // e.g. Blink's in Chromium. diff --git a/patches/node/feat_initialize_asar_support.patch b/patches/node/feat_initialize_asar_support.patch index fede0b77ac3f5..972c40956ed20 100644 --- a/patches/node/feat_initialize_asar_support.patch +++ b/patches/node/feat_initialize_asar_support.patch @@ -6,10 +6,10 @@ Subject: feat: initialize asar support This patch initializes asar support in Node.js. diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js -index a4cc80d48064fe4f58edf569de4ea962cecb4540..f91a32c0348f805d01d9c198c39cff4c5c72c88b 100644 +index 250a43c5455b4f9ff72dd3a34d5b0aa270f43cc6..2e35cbba2ac02494c44821af395fe0195b1ab6b5 100644 --- a/lib/internal/process/pre_execution.js +++ b/lib/internal/process/pre_execution.js -@@ -118,12 +118,17 @@ function setupUserModules() { +@@ -117,12 +117,17 @@ function setupUserModules() { loadPreloadModules(); // Need to be done after --require setup. initializeFrozenIntrinsics(); diff --git a/patches/node/fix_-wshadow_warning.patch b/patches/node/fix_-wshadow_warning.patch index 1ff7a9a1b1ce2..88ff6d4a9a71b 100644 --- a/patches/node/fix_-wshadow_warning.patch +++ b/patches/node/fix_-wshadow_warning.patch @@ -28,7 +28,7 @@ In file included from ../../third_party/electron_node/src/env-inl.h:32: 1 error generated. diff --git a/src/util.h b/src/util.h -index b1750f7b718f664153a96aa90be6efd94a46cda0..aef06b22076f4a288b00d348ee47d5978d41e75b 100644 +index a50d92601bf0ac278fa4137e056d5172a7589358..d18c263ae73d6181f07097bfcb1e4ef6f2e27e5e 100644 --- a/src/util.h +++ b/src/util.h @@ -129,10 +129,10 @@ void DumpBacktrace(FILE* fp); 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 index 0096f7517454a..978b11d75f86b 100644 --- a/patches/node/fix_adapt_debugger_tests_for_upstream_v8_changes.patch +++ b/patches/node/fix_adapt_debugger_tests_for_upstream_v8_changes.patch @@ -36,11 +36,11 @@ index 4aff5b9a0f74d99f8f605b68631f820e282091ab..d5d77fc7c648ddb45225f04c6cf23f98 }, ctrlC() { -diff --git a/test/sequential/test-debugger-break.js b/test/sequential/test-debugger-break.js -index 1d92331d4e10136ddc9d811c3eb07e6b24d0fc51..8f37b71571225eb6b264cd44fa031f82c701cdbc 100644 ---- a/test/sequential/test-debugger-break.js -+++ b/test/sequential/test-debugger-break.js -@@ -27,7 +27,7 @@ const cli = startCLI([script]); +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( @@ -49,7 +49,7 @@ index 1d92331d4e10136ddc9d811c3eb07e6b24d0fc51..8f37b71571225eb6b264cd44fa031f82 'pauses in next line of the script'); assert.match( cli.output, -@@ -36,7 +36,7 @@ const cli = startCLI([script]); +@@ -36,7 +36,7 @@ const cli = startCLI(['--port=0', script]); await cli.stepCommand('next'); assert.ok( @@ -58,7 +58,7 @@ index 1d92331d4e10136ddc9d811c3eb07e6b24d0fc51..8f37b71571225eb6b264cd44fa031f82 'pauses in next line of the script'); assert.match( cli.output, -@@ -89,7 +89,7 @@ const cli = startCLI([script]); +@@ -89,7 +89,7 @@ const cli = startCLI(['--port=0', script]); await cli.stepCommand(''); assert.match( cli.output, @@ -67,10 +67,10 @@ index 1d92331d4e10136ddc9d811c3eb07e6b24d0fc51..8f37b71571225eb6b264cd44fa031f82 'entered timers.js'); await cli.stepCommand('cont'); -diff --git a/test/sequential/test-debugger-run-after-quit-restart.js b/test/sequential/test-debugger-run-after-quit-restart.js -index a9da07dcdff8bd0b8cc69ccff8f29a67ff553592..2da4cea6359c8564a93863e43fc4a3f14a27e693 100644 ---- a/test/sequential/test-debugger-run-after-quit-restart.js -+++ b/test/sequential/test-debugger-run-after-quit-restart.js +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(() => { 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 2f52efa0e0bd3..b242c647ade0c 100644 --- a/patches/node/fix_crypto_tests_to_run_with_bssl.patch +++ b/patches/node/fix_crypto_tests_to_run_with_bssl.patch @@ -1030,7 +1030,7 @@ index 6c6b15781549a4b37781bf0b8014054dc5d8c746..142d41b169c836201660d78c19383f3f } +*/ diff --git a/test/parallel/test-webcrypto-wrap-unwrap.js b/test/parallel/test-webcrypto-wrap-unwrap.js -index 8d107a99bdd8c5ce0c32cfbbc337b2c880bde200..2a2b7e2253ed2d55b3fb973d06dec768ba9b1e1c 100644 +index 670f19b7e4a190a222cc997f67975c3d49f65035..d4c4812cab56bcb51435aa6dd27545368fc11ed7 100644 --- a/test/parallel/test-webcrypto-wrap-unwrap.js +++ b/test/parallel/test-webcrypto-wrap-unwrap.js @@ -18,14 +18,15 @@ const kWrappingData = { diff --git a/patches/node/fix_expose_lookupandcompile_with_parameters.patch b/patches/node/fix_expose_lookupandcompile_with_parameters.patch index c9f6a91a7735d..7eab7217eaba7 100644 --- a/patches/node/fix_expose_lookupandcompile_with_parameters.patch +++ b/patches/node/fix_expose_lookupandcompile_with_parameters.patch @@ -10,10 +10,10 @@ parameters. This should be upstreamed. diff --git a/src/node_builtins.cc b/src/node_builtins.cc -index d3a0dd7cedb0d239ae427d1af2335e155345a454..de0c39234bb4155c56b4e51e42a399df3c4b8f87 100644 +index 522670ed5c9951c506dcdf2745585552ad2a081f..12ea7cdabb16a7f4ea350bdf1cd5d073e035fda1 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc -@@ -439,6 +439,22 @@ MaybeLocal BuiltinLoader::LookupAndCompile( +@@ -435,6 +435,22 @@ MaybeLocal BuiltinLoader::LookupAndCompile( return maybe; } 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 b84b765d1c617..406b6bbabba52 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,7 +6,7 @@ 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 eb5f0be49395b0192f18738d549241ae98793df7..522fd5cc6bea3e7fe4089eb25d64d65d2e8784ca 100644 +index 219ef03a21214deb8961044cfc18ef9c1e711b60..7749b37001f869fe565d8c450ff7ca2b6f3faa7a 100644 --- a/lib/internal/modules/esm/get_format.js +++ b/lib/internal/modules/esm/get_format.js @@ -30,6 +30,7 @@ const protocolHandlers = { @@ -18,10 +18,10 @@ index eb5f0be49395b0192f18738d549241ae98793df7..522fd5cc6bea3e7fe4089eb25d64d65d /** diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js -index fd7d2feada9bbbba589fe89230e45954fa2dd3be..3c9b1ad93f2c6b5fde5e9ed2a8bf1dc01d94a8de 100644 +index 2cac6f2d450fab014544d15439e51575f86ccb38..ce2d851da2577e6e99980eb75337f629b38fddbf 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js -@@ -824,6 +824,8 @@ function parsePackageName(specifier, base) { +@@ -822,6 +822,8 @@ function parsePackageName(specifier, base) { return { packageName, packageSubpath, isScoped }; } @@ -30,7 +30,7 @@ index fd7d2feada9bbbba589fe89230e45954fa2dd3be..3c9b1ad93f2c6b5fde5e9ed2a8bf1dc0 /** * @param {string} specifier * @param {string | URL | undefined} base -@@ -836,6 +838,10 @@ function packageResolve(specifier, base, conditions) { +@@ -834,6 +836,10 @@ function packageResolve(specifier, base, conditions) { return new URL('node:' + specifier); } @@ -41,15 +41,6 @@ index fd7d2feada9bbbba589fe89230e45954fa2dd3be..3c9b1ad93f2c6b5fde5e9ed2a8bf1dc0 const { packageName, packageSubpath, isScoped } = parsePackageName(specifier, base); -@@ -1034,7 +1040,7 @@ function checkIfDisallowedImport(specifier, parsed, parsedParentURL) { - - function throwIfUnsupportedURLProtocol(url) { - if (url.protocol !== 'file:' && url.protocol !== 'data:' && -- url.protocol !== 'node:') { -+ url.protocol !== 'node:' && url.protocol !== 'electron:') { - throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(url); - } - } diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index a425749e82acd7593c9fb1ceffedc119a4e416f2..1ceb89da21610c703f4a18be5888373c7feaa370 100644 --- a/lib/internal/modules/esm/translators.js @@ -77,12 +68,12 @@ index a425749e82acd7593c9fb1ceffedc119a4e416f2..1ceb89da21610c703f4a18be5888373c // We might trigger a getter -> dont fail. let value; diff --git a/lib/internal/url.js b/lib/internal/url.js -index 7b2e0b4ffa6cc71b78dd1a1f64f7f491a6669383..41327e0f33828b1a3f276c9054293d89a7956e1d 100644 +index 51688b8403076a328c2c62b6434fc310ee4f1ea7..36604c9de2179b5f6941dd9a7af66cdb03facd7f 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js -@@ -1221,6 +1221,8 @@ function fileURLToPath(path) { +@@ -1399,6 +1399,8 @@ function fileURLToPath(path) { path = new URL(path); - else if (!isURLInstance(path)) + else if (!isURL(path)) throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path); + if (path.protocol === 'electron:') + return 'electron'; 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 93091bcb2202d..214695d67d33a 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 0de7ae88c2a715aa85a83217a2d9b2532e3be1f0..89236434d4816f619b30fe30bee1046a61c598ae 100644 +index e1095037f3b9970e3ffd314b641b454f1248e33e..7ef6d04794c31064c70dbbb0bfc1dd7bf4d1b8fc 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -516,6 +516,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) { +@@ -520,6 +520,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) { return env->platform(); } @@ -22,10 +22,10 @@ index 0de7ae88c2a715aa85a83217a2d9b2532e3be1f0..89236434d4816f619b30fe30bee1046a int thread_pool_size, node::tracing::TracingController* tracing_controller) { diff --git a/src/node.h b/src/node.h -index 04edec35975c6b9db1d44e896d92a9f5bc606d51..8314edbc82971148310c5c99e5a4b18dffa14e51 100644 +index ac9bce58f33380cd8b687a088176a446c1e8cf34..b50bd5a941d381778d464fdb2770566a3ac34fed 100644 --- a/src/node.h +++ b/src/node.h -@@ -129,6 +129,7 @@ namespace node { +@@ -130,6 +130,7 @@ namespace node { namespace tracing { @@ -33,7 +33,7 @@ index 04edec35975c6b9db1d44e896d92a9f5bc606d51..8314edbc82971148310c5c99e5a4b18d class TracingController; } -@@ -671,6 +672,8 @@ NODE_EXTERN void GetNodeReport(Environment* env, +@@ -688,6 +689,8 @@ NODE_EXTERN void GetNodeReport(Environment* env, NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(Environment* env); NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env); diff --git a/patches/node/fix_ftbfs_werror_wextra-semi.patch b/patches/node/fix_ftbfs_werror_wextra-semi.patch new file mode 100644 index 0000000000000..cb8a07961867f --- /dev/null +++ b/patches/node/fix_ftbfs_werror_wextra-semi.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Charles Kerr +Date: Wed, 19 Jul 2023 16:00:08 -0500 +Subject: fix ftbfs Werror Wextra-semi + +Fix a deps warning that causes FTBFS when building with -Werror. + +This patch can be removed if fixed upstream. +Upstream PR: https://github.com/nodejs/uvwasi/pull/217 + +diff --git a/deps/uvwasi/src/uvwasi.c b/deps/uvwasi/src/uvwasi.c +index 9e7fc7681664b8430bbd2d2324352be8c6735106..708a52b0621666133b5215790cb9d5fd6a71d4fa 100644 +--- a/deps/uvwasi/src/uvwasi.c ++++ b/deps/uvwasi/src/uvwasi.c +@@ -2564,7 +2564,7 @@ uvwasi_errno_t uvwasi_sock_accept(uvwasi_t* uvwasi, + /* TODO(mhdawson): Needs implementation */ + UVWASI_DEBUG("uvwasi_sock_accept(uvwasi=%p, unimplemented)\n", uvwasi); + return UVWASI_ENOTSUP; +-}; ++} + + + const char* uvwasi_embedder_err_code_to_string(uvwasi_errno_t code) { +@@ -2651,4 +2651,4 @@ const char* uvwasi_embedder_err_code_to_string(uvwasi_errno_t code) { + default: + return "UVWASI_UNKNOWN_ERROR"; + } +-} ++} +\ No newline at end of file diff --git a/patches/node/fix_ftbfs_werror_wunreachable-code-break.patch b/patches/node/fix_ftbfs_werror_wunreachable-code-break.patch new file mode 100644 index 0000000000000..5aee0a822fdd6 --- /dev/null +++ b/patches/node/fix_ftbfs_werror_wunreachable-code-break.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Charles Kerr +Date: Wed, 19 Jul 2023 15:57:19 -0500 +Subject: fix ftbfs Werror Wunreachable-code-break + +Fix a deps warning that causes FTBFS when building with -Werror. + +This patch can be removed if fixed upstream. +Upstream PR 1: https://github.com/ada-url/ada/pull/464 +Upstream PR 2: https://github.com/ada-url/idna/pull/31 + +diff --git a/deps/ada/ada.cpp b/deps/ada/ada.cpp +index 570a659d118de5404003d0cd3731523d863de16b..43147d495f78eea916f895258f9c1846bd55f40a 100644 +--- a/deps/ada/ada.cpp ++++ b/deps/ada/ada.cpp +@@ -2829,7 +2829,6 @@ std::u32string map(std::u32string_view input) { + break; + case 2: + return error; // disallowed +- break; + + // case 3 : + default: +@@ -15175,4 +15174,4 @@ const ada_url_components* ada_get_components(ada_url result) noexcept { + } + } // extern "C" + /* end file src/ada_c.cpp */ +-/* end file src/ada.cpp */ ++/* end file src/ada.cpp */ +\ No newline at end of file diff --git a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch index 49ac942b63033..9930fdbc5b40a 100644 --- a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch +++ b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch @@ -104,10 +104,19 @@ index 41e607e9298314bd7dd9e61643650f3ec75caea8..bd3228a67e1bda671488b347bd53ca80 if (!Set(env->context(), obj, diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc -index b9f323035ff543ecb6f7bd577512729f0d60a156..0262dee543359c85c2c293ee22a8697b05f75feb 100644 +index 838ee2a68dffc5a2aeca2bdb51b076795b2b145f..b0b18cd30c854c8c30d74afbf3ed352d3d23f30d 100644 --- a/src/crypto/crypto_context.cc +++ b/src/crypto/crypto_context.cc -@@ -857,10 +857,12 @@ void SecureContext::SetDHParam(const FunctionCallbackInfo& args) { +@@ -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; +@@ -855,10 +855,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. @@ -208,7 +217,7 @@ index dd69323b80076d7333b80453c9cc9ef5b680ce27..6431b768c83fa27b2287588e936f93ae UNREACHABLE(); } diff --git a/src/crypto/crypto_dsa.cc b/src/crypto/crypto_dsa.cc -index 6839283fbf4ca7ee7dd586e749c80671ad965658..4e186abdf13613cbe576da5b7d547408c0ee9f93 100644 +index 3fa4a415dc911a13afd90dfb31c1ed4ad0fd268f..fa48dffc31342c44a1c1207b9d4c3dc72ed93b60 100644 --- a/src/crypto/crypto_dsa.cc +++ b/src/crypto/crypto_dsa.cc @@ -40,7 +40,7 @@ namespace crypto { @@ -232,10 +241,10 @@ index 6839283fbf4ca7ee7dd586e749c80671ad965658..4e186abdf13613cbe576da5b7d547408 return EVPKeyCtxPointer(); diff --git a/src/crypto/crypto_random.cc b/src/crypto/crypto_random.cc -index 2f9e9aacb1e652202d72c69b46f8e76d6c5405a8..5f19c38a78e37d3e8d92bcc20ae1357f20349ad4 100644 +index 9850104cd607f877a8e867e83a8d4d4ccd4a4395..f153b3366e2795133ff3df7b7a2153a6106237e4 100644 --- a/src/crypto/crypto_random.cc +++ b/src/crypto/crypto_random.cc -@@ -146,7 +146,7 @@ Maybe RandomPrimeTraits::AdditionalConfig( +@@ -140,7 +140,7 @@ Maybe RandomPrimeTraits::AdditionalConfig( params->bits = bits; params->safe = safe; @@ -265,10 +274,10 @@ index 47a42246eddfc795b735f5efd08edf2832bbf6c1..7e6afaa1d3a4612fd567924b40438a31 if (target diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc -index 247067a9908717ba1323bd610eeeedf3aba008a4..0fe7358d3f419f6e6f00eb4cc8422e9c5cb6cb9a 100644 +index 87d6ab3b9970e48db53cf7061d7208679c8b1dfc..4d79fbb4a30a7e57a7456413685706d9af36b1b3 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc -@@ -508,24 +508,15 @@ Maybe Decorate(Environment* env, Local obj, +@@ -518,24 +518,15 @@ Maybe Decorate(Environment* env, Local obj, V(BIO) \ V(PKCS7) \ V(X509V3) \ @@ -294,7 +303,7 @@ index 247067a9908717ba1323bd610eeeedf3aba008a4..0fe7358d3f419f6e6f00eb4cc8422e9c V(USER) \ #define V(name) case ERR_LIB_##name: lib = #name "_"; break; -@@ -699,7 +690,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -709,7 +700,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { CHECK(args[0]->IsUint32()); Environment* env = Environment::GetCurrent(args); uint32_t len = args[0].As()->Value(); @@ -303,7 +312,7 @@ index 247067a9908717ba1323bd610eeeedf3aba008a4..0fe7358d3f419f6e6f00eb4cc8422e9c if (data == nullptr) { // There's no memory available for the allocation. // Return nothing. -@@ -710,7 +701,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -720,7 +711,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { data, len, [](void* data, size_t len, void* deleter_data) { @@ -312,7 +321,7 @@ index 247067a9908717ba1323bd610eeeedf3aba008a4..0fe7358d3f419f6e6f00eb4cc8422e9c }, data); Local buffer = ArrayBuffer::New(env->isolate(), store); -@@ -718,10 +709,12 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -728,10 +719,12 @@ void SecureBuffer(const FunctionCallbackInfo& args) { } void SecureHeapUsed(const FunctionCallbackInfo& args) { @@ -352,7 +361,7 @@ index 1831bfd0baaac70277fc274a72235bf6a04697cb..1c0a3fcdeb44dc947bb8c38459533779 #if NODE_OPENSSL_HAS_QUIC #include diff --git a/src/node_options.cc b/src/node_options.cc -index 6e156fa1ba448f8d0c709eb7ba7112e92909a8fc..8bbee83ddb32a31ada18d7a6e8be7cdf33321b69 100644 +index 47a24ef5e59f049848637afbbfae6c9cfb9b8902..499d048fcb82e50a302d74e2c7f87f3696103a40 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -6,7 +6,7 @@ @@ -365,7 +374,7 @@ index 6e156fa1ba448f8d0c709eb7ba7112e92909a8fc..8bbee83ddb32a31ada18d7a6e8be7cdf #endif diff --git a/src/node_options.h b/src/node_options.h -index 665ea4ceb779f7c7747e53aba4beba0494fa7ebe..22a346eb23274374d5a5aa4a1b2219e6ebdee48a 100644 +index c57e7a93b13a856e834b77707feaf691241ebc41..f8bdd016e13a8775520bfee7eb61d1c8d667bb58 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -11,7 +11,7 @@ diff --git a/patches/node/fix_isurl_implementation.patch b/patches/node/fix_isurl_implementation.patch new file mode 100644 index 0000000000000..63fa1d8a5ae15 --- /dev/null +++ b/patches/node/fix_isurl_implementation.patch @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Charles Kerr +Date: Thu, 20 Jul 2023 14:18:19 -0500 +Subject: fix: isURL() implementation + +Modify Node's lib/internal/url.js isURL() to return the correct value for +URLs created both inside and outside of Node. + +The isURL() impl in `main` is Electron-safe but can't be backported in +isolation because it relies on other changes from 18 to main. But we can +safely get there by trying the 18 version first (catching Node URLs), +then the `main` version (catching Electron URLs). + +More background w/upstream links at +https://github.com/electron/electron/pull/39154#issuecomment-1644433388 + +This patch can be removed when we update to Node 20. + +diff --git a/lib/internal/url.js b/lib/internal/url.js +index 36604c9de2179b5f6941dd9a7af66cdb03facd7f..525b18e58a3e2f8e5ddfb138b1c54fd9b23a20cf 100644 +--- a/lib/internal/url.js ++++ b/lib/internal/url.js +@@ -592,7 +592,12 @@ ObjectDefineProperties(URLSearchParams.prototype, { + * @returns {self is URL} + */ + function isURL(self) { +- return self != null && ObjectPrototypeHasOwnProperty(self, context); ++ // if it has `context` it is a Node.js URL... ++ if (self != null && ObjectPrototypeHasOwnProperty(self, context)) ++ return true; ++ ++ // ...but also honor 3rd party URLs e.g. from Electron. ++ return Boolean(self?.href && self.protocol && self.auth === undefined && self.path === undefined); + } + + class URL { +@@ -688,14 +693,10 @@ class URL { + } + + get href() { +- if (!isURL(this)) +- throw new ERR_INVALID_THIS('URL'); + return this[context].href; + } + + set href(value) { +- if (!isURL(this)) +- throw new ERR_INVALID_THIS('URL'); + value = `${value}`; + const href = bindingUrl.update(this[context].href, updateActions.kHref, value); + if (!href) { throw ERR_INVALID_URL(value); } +diff --git a/test/parallel/test-whatwg-url-invalidthis.js b/test/parallel/test-whatwg-url-invalidthis.js +index 790c28e37c13ed6763cb61b549ab4a983f384717..bddf48b8302632a275d996a53b09343938dc7dc9 100644 +--- a/test/parallel/test-whatwg-url-invalidthis.js ++++ b/test/parallel/test-whatwg-url-invalidthis.js +@@ -15,7 +15,6 @@ const assert = require('assert'); + }); + + [ +- 'href', + 'protocol', + 'username', + 'password', +@@ -36,7 +35,6 @@ const assert = require('assert'); + }); + + [ +- 'origin', + 'searchParams', + ].forEach((i) => { + assert.throws(() => Reflect.get(URL.prototype, i, {}), { diff --git a/patches/node/fix_libc_buffer_overflow_in_string_view_ctor.patch b/patches/node/fix_libc_buffer_overflow_in_string_view_ctor.patch deleted file mode 100644 index fe8cc72968dab..0000000000000 --- a/patches/node/fix_libc_buffer_overflow_in_string_view_ctor.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Tue, 18 Apr 2023 11:24:59 +0200 -Subject: fix: libc++ buffer overflow in string_view ctor - -Refs https://github.com/nodejs/node/pull/46410 -Refs https://github.com/llvm/llvm-project/issues/61100. - -Fixes a buffer overflow crash in std::string view constructor. This -happens as a result of a limitation of libc++'s implementation of the -string_view constructor. If string_view receives a pointer to a string start point, -and then a length as a size_t, the spec says that a size_t that exceeds the length -of the null terminated string found at pointer only be read up until the null terminator. - -However, Chromium's implementation however does a hard check that this length is less than -or equal to static_cast(std::numeric_limits::max()): -https://source.chromium.org/chromium/chromium/src/+/main:buildtools/third_party/libc++/trunk/include/string_view;drc=1718a75513d114e6b9aa4474e5c55d8dabee92fb;l=309 - -This doesn't break in Node.js right now because that hard assert is missing, but will -break in the next version of Xcode that's shipped and this Node.js too. - -This should be upstreamed to ada. - -diff --git a/deps/ada/ada.cpp b/deps/ada/ada.cpp -index 8b2cdd38ad0bb1e5757cdf5724c5a5917fc8e577..7d2f75fe559c1878e129aa681c86d6780d2e8233 100644 ---- a/deps/ada/ada.cpp -+++ b/deps/ada/ada.cpp -@@ -825,8 +825,10 @@ namespace ada::helpers { - - // Let path be url’s path. - // If url’s scheme is "file", path’s size is 1, and path[0] is a normalized Windows drive letter, then return. -- if (type == ada::scheme::type::FILE && first_delimiter == std::string_view::npos) { -- if (checkers::is_normalized_windows_drive_letter(std::string_view(path.data() + 1, first_delimiter - 1))) { -+ if (!path.empty() && type == ada::scheme::type::FILE && -+ first_delimiter == std::string_view::npos) { -+ if (checkers::is_normalized_windows_drive_letter( -+ std::string_view(path.data() + 1, path.length() - 1))) { - return; - } - } diff --git a/patches/node/fix_prevent_changing_functiontemplateinfo_after_publish.patch b/patches/node/fix_prevent_changing_functiontemplateinfo_after_publish.patch deleted file mode 100644 index ef4a5f23184fc..0000000000000 --- a/patches/node/fix_prevent_changing_functiontemplateinfo_after_publish.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Sun, 23 Oct 2022 23:36:19 +0200 -Subject: fix: prevent changing FunctionTemplateInfo after publish - -Refs https://chromium-review.googlesource.com/c/v8/v8/+/2718147 - -Fixes an issue where Node.js would try to call SetClassName on a -FunctionTemplate twice in some cases. The above CL made it so that -V8 CHECKs when this occurs. It is fixed by ensuring SetClassName -is only called once. - -This should be upstreamed. - -diff --git a/src/histogram.cc b/src/histogram.cc -index 3a3228ddc9eb6b53efc0721466479a9f62cd8967..175a67840348ca507d6e8b29835e5ab3b6d3e71a 100644 ---- a/src/histogram.cc -+++ b/src/histogram.cc -@@ -340,8 +340,9 @@ void HistogramBase::RegisterExternalReferences( - } - - void HistogramBase::Initialize(Environment* env, Local target) { -- SetConstructorFunction( -- env->context(), target, "Histogram", GetConstructorTemplate(env)); -+ SetConstructorFunction(env->context(), target, "Histogram", -+ GetConstructorTemplate(env), -+ SetConstructorFunctionFlag::NONE); - } - - BaseObjectPtr HistogramBase::HistogramTransferData::Deserialize( -@@ -367,6 +368,7 @@ Local IntervalHistogram::GetConstructorTemplate( - Isolate* isolate = env->isolate(); - tmpl = NewFunctionTemplate(isolate, nullptr); - tmpl->Inherit(HandleWrap::GetConstructorTemplate(env)); -+ tmpl->SetClassName(OneByteString(isolate, "Histogram")); - tmpl->InstanceTemplate()->SetInternalFieldCount( - HistogramBase::kInternalFieldCount); - SetProtoMethodNoSideEffect(isolate, tmpl, "count", GetCount); -diff --git a/src/node_messaging.cc b/src/node_messaging.cc -index d1296fe20c290bd137cb0aa0c077d1672c18c7a1..1c0f54286f9269efa436ba0fbc730766224891c0 100644 ---- a/src/node_messaging.cc -+++ b/src/node_messaging.cc -@@ -1495,13 +1495,16 @@ static void InitMessaging(Local target, - t->Inherit(BaseObject::GetConstructorTemplate(env)); - t->InstanceTemplate()->SetInternalFieldCount( - JSTransferable::kInternalFieldCount); -- SetConstructorFunction(context, target, "JSTransferable", t); -+ t->SetClassName(OneByteString(isolate, "JSTransferable")); -+ SetConstructorFunction(context, target, "JSTransferable", t, -+ SetConstructorFunctionFlag::NONE); - } - - SetConstructorFunction(context, - target, - env->message_port_constructor_string(), -- GetMessagePortConstructorTemplate(env)); -+ GetMessagePortConstructorTemplate(env), -+ SetConstructorFunctionFlag::NONE); - - // These are not methods on the MessagePort prototype, because - // the browser equivalents do not provide them. diff --git a/patches/node/fix_preventing_potential_oob_in_ada_no_scheme_parsing.patch b/patches/node/fix_preventing_potential_oob_in_ada_no_scheme_parsing.patch deleted file mode 100644 index 44596f96ce2ae..0000000000000 --- a/patches/node/fix_preventing_potential_oob_in_ada_no_scheme_parsing.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Tue, 18 Apr 2023 15:08:05 +0200 -Subject: fix: preventing potential oob in ada NO_SCHEME parsing - -https://github.com/ada-url/ada/pull/286 - -diff --git a/deps/ada/ada.cpp b/deps/ada/ada.cpp -index 7d2f75fe559c1878e129aa681c86d6780d2e8233..7bf541834d22511eefcc58517cc75117f53eb475 100644 ---- a/deps/ada/ada.cpp -+++ b/deps/ada/ada.cpp -@@ -2243,7 +2243,8 @@ namespace ada::parser { - ada_log("NO_SCHEME ", helpers::substring(url_data, input_position)); - // If base is null, or base has an opaque path and c is not U+0023 (#), validation error, return failure. - // SCHEME state updates the state to NO_SCHEME and validates url_data is not empty. -- if (base_url == nullptr || (base_url->has_opaque_path && url_data[input_position] != '#')) { -+ if (base_url == nullptr || -+ (base_url->has_opaque_path && !fragment.has_value())) { - ada_log("NO_SCHEME validation error"); - url.is_valid = false; - return url; diff --git a/patches/node/fix_readbarrier_undefined_symbol_error_on_woa_arm64.patch b/patches/node/fix_readbarrier_undefined_symbol_error_on_woa_arm64.patch index caba4ad4d5b7c..2b9cf7f55067b 100644 --- a/patches/node/fix_readbarrier_undefined_symbol_error_on_woa_arm64.patch +++ b/patches/node/fix_readbarrier_undefined_symbol_error_on_woa_arm64.patch @@ -10,7 +10,7 @@ if they're missing. We should upstream or otherwise handle this. diff --git a/deps/histogram/src/hdr_atomic.h b/deps/histogram/src/hdr_atomic.h -index ae1056a83612af5e370ce12fea82f334fce0c62c..9acc5c2d78d7f3d718e8b0f69e9a5e17d9609835 100644 +index 11b0cbd3facfdce648d7cf59ef3418e4e1049090..e1dfeaed6f0dd38aed5a0ddd5660d5b4ba4f46ab 100644 --- a/deps/histogram/src/hdr_atomic.h +++ b/deps/histogram/src/hdr_atomic.h @@ -14,6 +14,13 @@ diff --git a/patches/node/pass_all_globals_through_require.patch b/patches/node/pass_all_globals_through_require.patch index 8430a6fcea988..cd9ad3cd452e8 100644 --- a/patches/node/pass_all_globals_through_require.patch +++ b/patches/node/pass_all_globals_through_require.patch @@ -6,7 +6,7 @@ Subject: Pass all globals through "require" (cherry picked from commit 7d015419cb7a0ecfe6728431a4ed2056cd411d62) diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index 55931329dcddb60fff0bdf681bbfad6f62fdcbb7..65e685a7cacf3f70fddf15b1068d59fa604323ea 100644 +index ebf53afd41454cd2c87050f3c086a9df7021202b..83702fbab45f57f40319a5bbd7e2c7baf217c384 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -142,6 +142,13 @@ const { 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 0bddb008be101..5d48976d26482 100644 --- a/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch +++ b/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch @@ -22,7 +22,7 @@ index 07c6d5e9351a96aeca1179c20287dc3fb7ec1eab..13ea68c96fd415f976aab0f291a1b7c6 // release cycle, remove the Proxy and setter and update the // getter to either return a read-only object or always return diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index 65e685a7cacf3f70fddf15b1068d59fa604323ea..9783d9235ed43c7919ed2f26e35c96ae7ff1a08b 100644 +index 83702fbab45f57f40319a5bbd7e2c7baf217c384..8ce3d78839944ddd15bed299d89aeb61a7fd53e5 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -94,7 +94,7 @@ const fs = require('fs'); diff --git a/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch b/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch index 5cd31707dfe61..e9e3a4ff27968 100644 --- a/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch +++ b/patches/node/refactor_alter_child_process_fork_to_use_execute_script_with.patch @@ -7,7 +7,7 @@ Subject: refactor: alter child_process.fork to use execute script with When forking a child script, we setup a special environment to make the Electron binary run like the upstream node. On Mac, we use the helper app as node binary. diff --git a/lib/child_process.js b/lib/child_process.js -index 5d3e2d63a744c20fd325e07107c50da5757c0a99..07ad7906a7be156926d0c770c3d766c1a411203b 100644 +index 59c37b97672d39a9da89ca2b78aa28a77ca78699..da553f6556a06d57d7490d74a3b4dd8f0132600c 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -137,7 +137,18 @@ function fork(modulePath, args = [], options) { diff --git a/patches/node/support_v8_sandboxed_pointers.patch b/patches/node/support_v8_sandboxed_pointers.patch index 52ee2398834c2..40da8c5a7f684 100644 --- a/patches/node/support_v8_sandboxed_pointers.patch +++ b/patches/node/support_v8_sandboxed_pointers.patch @@ -7,10 +7,10 @@ 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 89236434d4816f619b30fe30bee1046a61c598ae..53db99ed5d2d9811eef2db26021c982890cc9cbe 100644 +index 7ef6d04794c31064c70dbbb0bfc1dd7bf4d1b8fc..d5a03d5e10faaa204b3f9f290fed79be824c78b1 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -86,6 +86,14 @@ MaybeLocal PrepareStackTraceCallback(Local context, +@@ -87,6 +87,14 @@ MaybeLocal PrepareStackTraceCallback(Local context, return result; } @@ -26,10 +26,10 @@ index 89236434d4816f619b30fe30bee1046a61c598ae..53db99ed5d2d9811eef2db26021c9828 void* ret; if (zero_fill_field_ || per_process::cli_options->zero_fill_all_buffers) diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc -index 0fe7358d3f419f6e6f00eb4cc8422e9c5cb6cb9a..1a8337412f2fe1f10df280fbf8bdefb8982b9f74 100644 +index 4d79fbb4a30a7e57a7456413685706d9af36b1b3..13e4d8b532cdb4c39fab30a8f4118ff8d2bca33c 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc -@@ -339,10 +339,35 @@ ByteSource& ByteSource::operator=(ByteSource&& other) noexcept { +@@ -349,10 +349,35 @@ ByteSource& ByteSource::operator=(ByteSource&& other) noexcept { return *this; } @@ -66,7 +66,7 @@ index 0fe7358d3f419f6e6f00eb4cc8422e9c5cb6cb9a..1a8337412f2fe1f10df280fbf8bdefb8 std::unique_ptr ptr = ArrayBuffer::NewBackingStore( allocated_data_, size(), -@@ -354,10 +379,11 @@ std::unique_ptr ByteSource::ReleaseToBackingStore() { +@@ -364,10 +389,11 @@ std::unique_ptr ByteSource::ReleaseToBackingStore() { data_ = nullptr; size_ = 0; return ptr; @@ -79,7 +79,7 @@ index 0fe7358d3f419f6e6f00eb4cc8422e9c5cb6cb9a..1a8337412f2fe1f10df280fbf8bdefb8 return ArrayBuffer::New(env->isolate(), std::move(store)); } -@@ -686,6 +712,16 @@ namespace { +@@ -696,6 +722,16 @@ namespace { // in which case this has the same semantics as // using OPENSSL_malloc. However, if the secure heap is // initialized, SecureBuffer will automatically use it. @@ -96,7 +96,7 @@ index 0fe7358d3f419f6e6f00eb4cc8422e9c5cb6cb9a..1a8337412f2fe1f10df280fbf8bdefb8 void SecureBuffer(const FunctionCallbackInfo& args) { CHECK(args[0]->IsUint32()); Environment* env = Environment::GetCurrent(args); -@@ -707,6 +743,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -717,6 +753,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { Local buffer = ArrayBuffer::New(env->isolate(), store); args.GetReturnValue().Set(Uint8Array::New(buffer, 0, len)); } 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 5feaad2b9f610..829d03001e68a 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 1cbcefb9712fae45b9a0ec7ed361bfe4ec7790be..6a6b52e9ae4150e7215e3587d8ddb41ce4374780 100644 +index 913ae4b0b10a7d508d864539cf075fa9c2f9362c..985f1c0d0c0c6afc049bf1d89f91412ecf431215 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -5,6 +5,12 @@ prefix parallel @@ -24,7 +24,7 @@ index 1cbcefb9712fae45b9a0ec7ed361bfe4ec7790be..6a6b52e9ae4150e7215e3587d8ddb41c [$system==win32] # https://github.com/nodejs/node/issues/24497 diff --git a/test/sequential/sequential.status b/test/sequential/sequential.status -index 5d88747b7066ce795b091eaaec2a5653f42b2c26..c40cb8827c3e1b91f46147cead5a91a7520019b9 100644 +index 5cefcb95773bedc80bc462e058a11045be176741..33f50be5898754af696468499bcfa8e3c721434d 100644 --- a/test/sequential/sequential.status +++ b/test/sequential/sequential.status @@ -7,6 +7,18 @@ prefix sequential diff --git a/patches/node/v8_api_advance_api_deprecation.patch b/patches/node/v8_api_advance_api_deprecation.patch index 1b1ada3a92c47..92933aeca8488 100644 --- a/patches/node/v8_api_advance_api_deprecation.patch +++ b/patches/node/v8_api_advance_api_deprecation.patch @@ -8,7 +8,7 @@ Refs https://chromium-review.googlesource.com/c/v8/v8/+/3702449 This can be removed when Electron upgrades to Node.js v20. diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc -index e5307b529c88d0e4db7fd7c6bd1b032d219b8c31..f6923be7a9ccdac2396cb625b227094f2686e54b 100644 +index 4c9f7f636aeeb19a87150ac5a05e28159503f051..6f3821247f7a1b9e4615c2f21d4098114e64d798 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -219,7 +219,8 @@ class ChannelImpl final : public v8_inspector::V8Inspector::Channel, diff --git a/script/node-disabled-tests.json b/script/node-disabled-tests.json index 406deb8fa6cba..8ec96fd5634d7 100644 --- a/script/node-disabled-tests.json +++ b/script/node-disabled-tests.json @@ -6,23 +6,25 @@ "parallel/test-crypto-aes-wrap", "parallel/test-crypto-authenticated-stream", "parallel/test-crypto-des3-wrap", - "parallel/test-crypto-modp1-error", "parallel/test-crypto-dh-modp2", "parallel/test-crypto-dh-modp2-views", "parallel/test-crypto-dh-stateless", "parallel/test-crypto-ecb", "parallel/test-crypto-fips", + "parallel/test-crypto-key-objects", "parallel/test-crypto-keygen", "parallel/test-crypto-keygen-deprecation", - "parallel/test-crypto-key-objects", + "parallel/test-crypto-modp1-error", "parallel/test-crypto-padding-aes256", "parallel/test-crypto-secure-heap", + "parallel/test-debugger-random-port-with-inspect-port", + "parallel/test-dgram-send-cb-quelches-error", "parallel/test-fs-utimes-y2K38", "parallel/test-http2-clean-output", "parallel/test-https-agent-session-reuse", "parallel/test-https-options-boolean-check", - "parallel/test-icu-minimum-version", "parallel/test-icu-env", + "parallel/test-icu-minimum-version", "parallel/test-inspector-port-zero-cluster", "parallel/test-inspector-tracing-domain", "parallel/test-module-loading-globalpaths", @@ -32,21 +34,23 @@ "parallel/test-repl-underscore", "parallel/test-single-executable-application", "parallel/test-snapshot-api", + "parallel/test-snapshot-argv1", "parallel/test-snapshot-basic", - "parallel/test-snapshot-console", "parallel/test-snapshot-cjs-main", + "parallel/test-snapshot-console", "parallel/test-snapshot-dns-lookup-localhost", "parallel/test-snapshot-dns-lookup-localhost-promise", "parallel/test-snapshot-dns-resolve-localhost", "parallel/test-snapshot-dns-resolve-localhost-promise", "parallel/test-snapshot-error", - "parallel/test-snapshot-incompatible", + "parallel/test-snapshot-eval", "parallel/test-snapshot-gzip", + "parallel/test-snapshot-incompatible", + "parallel/test-snapshot-namespaced-builtin", + "parallel/test-snapshot-typescript", "parallel/test-snapshot-umd", - "parallel/test-snapshot-eval", "parallel/test-snapshot-warning", "parallel/test-snapshot-weak-reference", - "parallel/test-snapshot-typescript", "parallel/test-strace-openat-openssl", "parallel/test-tls-cert-chains-concat", "parallel/test-tls-cert-chains-in-ca", @@ -129,10 +133,10 @@ "parallel/test-worker-no-atomics", "parallel/test-worker-no-sab", "parallel/test-zlib-unused-weak", - "report/test-report-fatalerror-oomerror-set", + "report/test-report-fatalerror-oomerror-compact", "report/test-report-fatalerror-oomerror-directory", "report/test-report-fatalerror-oomerror-filename", - "report/test-report-fatalerror-oomerror-compact", + "report/test-report-fatalerror-oomerror-set", "report/test-report-getreport", "report/test-report-signal", "report/test-report-uncaught-exception",