diff --git a/DEPS b/DEPS index 86f587a8b708c6..0fd699c24c056b 100644 --- a/DEPS +++ b/DEPS @@ -4,7 +4,7 @@ vars = { 'chromium_version': '109.0.5382.0', 'node_version': - 'v16.17.1', + 'v18.10.0', 'nan_version': '16fa32231e2ccd89d2804b3f765319128b20c4ac', 'squirrel.mac_version': diff --git a/patches/node/.patches b/patches/node/.patches index 432a9d45b562f0..e276c698a7a428 100644 --- a/patches/node/.patches +++ b/patches/node/.patches @@ -9,9 +9,7 @@ build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.pa refactor_allow_embedder_overriding_of_internal_fs_calls.patch chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch chore_add_context_to_context_aware_module_prevention.patch -chore_read_nobrowserglobals_from_global_not_process.patch fix_handle_boringssl_and_openssl_incompatibilities.patch -src_allow_embedders_to_provide_a_custom_pageallocator_to.patch fix_crypto_tests_to_run_with_bssl.patch fix_account_for_debugger_agent_race_condition.patch repl_fix_crash_when_sharedarraybuffer_disabled.patch @@ -20,10 +18,8 @@ fix_crash_caused_by_gethostnamew_on_windows_7.patch fix_suppress_clang_-wdeprecated-declarations_in_libuv.patch fix_serdes_test.patch darwin_bump_minimum_supported_version_to_10_15_3406.patch -fix_failing_node_js_test_on_outdated.patch be_compatible_with_cppgc.patch feat_add_knostartdebugsignalhandler_to_environment_to_prevent.patch -worker_thread_add_asar_support.patch process_monitor_for_exit_with_kqueue_on_bsds_3441.patch process_bsd_handle_kevent_note_exit_failure_3451.patch reland_macos_use_posix_spawn_instead_of_fork_3257.patch @@ -35,15 +31,12 @@ process_simplify_uv_write_int_calls_3519.patch macos_don_t_use_thread-unsafe_strtok_3524.patch process_fix_hang_after_note_exit_3521.patch feat_add_uv_loop_interrupt_on_io_change_option_to_uv_loop_configure.patch -fix_preserve_proper_method_names_as-is_in_error_stack.patch macos_avoid_posix_spawnp_cwd_bug_3597.patch -src_update_importmoduledynamically.patch json_parse_errors_made_user-friendly.patch support_v8_sandboxed_pointers.patch build_ensure_v8_pointer_compression_sandbox_is_enabled_on_64bit.patch build_ensure_native_module_compilation_fails_if_not_using_a_new.patch fix_override_createjob_in_node_platform.patch -src_fix_ssize_t_error_from_nghttp2_h.patch v8_api_advance_api_deprecation.patch enable_-wunqualified-std-cast-call.patch fixup_for_error_declaration_shadows_a_local_variable.patch @@ -53,3 +46,7 @@ fix_parallel_test-v8-stats.patch fix_expose_the_built-in_electron_module_via_the_esm_loader.patch heap_remove_allocationspace_map_space_enum_constant.patch test_remove_experimental-wasm-threads_flag.patch +api_pass_oomdetails_to_oomerrorcallback.patch +src_iwyu_in_cleanup_queue_cc.patch +fix_expose_lookupandcompile_with_parameters.patch +fix_prevent_changing_functiontemplateinfo_after_publish.patch diff --git a/patches/node/api_pass_oomdetails_to_oomerrorcallback.patch b/patches/node/api_pass_oomdetails_to_oomerrorcallback.patch new file mode 100644 index 00000000000000..32823a778655a5 --- /dev/null +++ b/patches/node/api_pass_oomdetails_to_oomerrorcallback.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Wed, 12 Oct 2022 21:25:49 +0200 +Subject: Pass OOMDetails to OOMErrorCallback + +Introduced in https://chromium-review.googlesource.com/c/v8/v8/+/3647827. + +This patch can be removed when Node.js updates to a V8 version containing +the above CL. + +diff --git a/src/node_errors.cc b/src/node_errors.cc +index 323fc7d4ff635ca287ee241cee234da0600340a2..36ab78f739f3faecab47eead99f9aa3c403672c0 100644 +--- a/src/node_errors.cc ++++ b/src/node_errors.cc +@@ -495,9 +495,9 @@ void OnFatalError(const char* location, const char* message) { + ABORT(); + } + +-void OOMErrorHandler(const char* location, bool is_heap_oom) { ++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" + : "Allocation failed - process out of memory"; + if (location) { + FPrintF(stderr, "FATAL ERROR: %s %s\n", location, message); +diff --git a/src/node_errors.h b/src/node_errors.h +index 5587c2348626102febe33a20ff45748a6eec61ad..6dbba32858dc82bc04171da7ee2a33a0b4dee791 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); + + // Helpers to construct errors similar to the ones provided by + // lib/internal/errors.js. diff --git a/patches/node/be_compatible_with_cppgc.patch b/patches/node/be_compatible_with_cppgc.patch index c25df6ffe2dee1..0ff406d305a26e 100644 --- a/patches/node/be_compatible_with_cppgc.patch +++ b/patches/node/be_compatible_with_cppgc.patch @@ -46,7 +46,7 @@ This patch should be upstreamed to Node. See also: https://source.chromium.org/chromium/chromium/src/+/main:v8/include/v8-cppgc.h;l=70-76;drc=5a758a97032f0b656c3c36a3497560762495501a diff --git a/src/base_object.h b/src/base_object.h -index 842f763a56d75c55509534e3d44a8080dd283127..b6078fe83c82a5edec0f7652b8c2d1b6c2491ca4 100644 +index a17879be5b452aa208caf1b29c86f8e5d9baa693..c48d7a7e9d0535cabb4eb84b5700d0cf537ddc88 100644 --- a/src/base_object.h +++ b/src/base_object.h @@ -40,7 +40,7 @@ class TransferData; @@ -59,10 +59,10 @@ index 842f763a56d75c55509534e3d44a8080dd283127..b6078fe83c82a5edec0f7652b8c2d1b6 // Associates this object with `object`. It uses the 0th internal field for // that, and in particular aborts if there is no such field. diff --git a/src/env.cc b/src/env.cc -index 22be69ec30a5b8466caacc698c791494891e5dee..cc44d578df9e146aa72f8273c1271d6a3c00d610 100644 +index 24aeb329c593bfd5a35877d6f4e2b7afa9848306..de41e5b7f6ff9f818c661484a93b74db7569e31f 100644 --- a/src/env.cc +++ b/src/env.cc -@@ -2119,11 +2119,20 @@ void Environment::RunWeakRefCleanup() { +@@ -2013,11 +2013,20 @@ void Environment::RunWeakRefCleanup() { isolate()->ClearKeptObjects(); } @@ -84,7 +84,7 @@ index 22be69ec30a5b8466caacc698c791494891e5dee..cc44d578df9e146aa72f8273c1271d6a object->SetAlignedPointerInInternalField(BaseObject::kSlot, static_cast(this)); env->AddCleanupHook(DeleteMe, static_cast(this)); -@@ -2177,7 +2186,8 @@ void BaseObject::MakeWeak() { +@@ -2071,7 +2080,8 @@ void BaseObject::MakeWeak() { void BaseObject::LazilyInitializedJSTemplateConstructor( const FunctionCallbackInfo& args) { DCHECK(args.IsConstructCall()); diff --git a/patches/node/build_add_gn_build_files.patch b/patches/node/build_add_gn_build_files.patch index 74da2afe93b7c6..39af302fc0d548 100644 --- a/patches/node/build_add_gn_build_files.patch +++ b/patches/node/build_add_gn_build_files.patch @@ -7,7 +7,7 @@ This adds GN build files for Node, so we don't have to build with GYP. diff --git a/BUILD.gn b/BUILD.gn new file mode 100644 -index 0000000000000000000000000000000000000000..a47875642d8f825c84ba1e82e3892a97e98e76e4 +index 0000000000000000000000000000000000000000..db80a8f00a84bf54f723c21300e7579c994d0514 --- /dev/null +++ b/BUILD.gn @@ -0,0 +1,438 @@ @@ -224,6 +224,7 @@ index 0000000000000000000000000000000000000000..a47875642d8f825c84ba1e82e3892a97 + ":node_js2c", + "deps/googletest:gtest", + "deps/uvwasi", ++ "deps/base64", + "//third_party/zlib", + "//third_party/brotli:dec", + "//third_party/brotli:enc", @@ -281,7 +282,6 @@ index 0000000000000000000000000000000000000000..a47875642d8f825c84ba1e82e3892a97 + sources += [ + "$root_gen_dir/electron_natives.cc", + "$target_gen_dir/node_javascript.cc", -+ "src/node_code_cache_stub.cc", + "src/node_snapshot_stub.cc", + ] + @@ -449,6 +449,192 @@ index 0000000000000000000000000000000000000000..a47875642d8f825c84ba1e82e3892a97 + ":tar_headers", + ] +} +diff --git a/deps/base64/BUILD.gn b/deps/base64/BUILD.gn +new file mode 100644 +index 0000000000000000000000000000000000000000..694e1991bb11c9ea85fcc69a0e06265d4b0c5aab +--- /dev/null ++++ b/deps/base64/BUILD.gn +@@ -0,0 +1,152 @@ ++config("base64_config") { ++ include_dirs = [ ++ "base64/include", ++ "base64/lib", ++ ] ++ ++ defines = [ "BASE64_STATIC_DEFINE" ] ++} ++ ++static_library("base64") { ++ defines = [] ++ deps = [] ++ ++ public_configs = [ ":base64_config" ] ++ ++ cflags_c = [ ++ "-Wno-implicit-fallthrough", ++ "-Wno-unused-but-set-variable", ++ "-Wno-shadow", ++ ] ++ ++ sources = [ ++ "base64/include/libbase64.h", ++ "base64/lib/arch/generic/codec.c", ++ "base64/lib/codec_choose.c", ++ "base64/lib/codecs.h", ++ "base64/lib/lib.c", ++ "base64/lib/tables/tables.c", ++ ] ++ ++ if (target_cpu == "arm") { ++ defines += [ "HAVE_NEON32=1" ] ++ deps += [ ":base64_neon32" ] ++ } else { ++ sources += [ "base64/lib/arch/neon32/neon32_codec.c" ] ++ } ++ ++ if (target_cpu == "arm64") { ++ defines += [ "HAVE_NEON64=1" ] ++ deps += [ ":base64_neon64" ] ++ } else { ++ sources += [ "base64/lib/arch/neon64/neon64_codec.c" ] ++ } ++ ++ if (target_cpu == "ia32" || target_cpu == "x64" || target_cpu == "x32") { ++ defines += [ ++ "HAVE_SSSE3=1", ++ "HAVE_SSE41=1", ++ "HAVE_SSE42=1", ++ "HAVE_AVX=1", ++ "HAVE_AVX2=1", ++ ] ++ ++ deps += [ ++ ":base64_avx", ++ ":base64_avx2", ++ ":base64_sse41", ++ ":base64_sse42", ++ ":base64_ssse3", ++ ] ++ } else { ++ sources += [ ++ "base64/lib/arch/avx/avx_codec.c", ++ "base64/lib/arch/avx2/avx2_codec.c", ++ "base64/lib/arch/sse41/sse41_codec.c", ++ "base64/lib/arch/sse42/sse42_codec.c", ++ "base64/lib/arch/ssse3/ssse3_codec.c", ++ ] ++ } ++} ++ ++source_set("base64_ssse3") { ++ public_configs = [ ":base64_config" ] ++ ++ defines = [ "HAVE_SSSE3=1" ] ++ ++ cflags = [ "-mssse3" ] ++ cflags_c = [ "-Wno-implicit-fallthrough" ] ++ ++ sources = [ "base64/lib/arch/ssse3/ssse3_codec.c" ] ++} ++ ++source_set("base64_sse41") { ++ public_configs = [ ":base64_config" ] ++ ++ defines = [ "HAVE_SSE41=1" ] ++ ++ cflags = [ "-msse4.1" ] ++ cflags_c = [ "-Wno-implicit-fallthrough" ] ++ ++ sources = [ "base64/lib/arch/sse41/sse41_codec.c" ] ++} ++ ++source_set("base64_sse42") { ++ public_configs = [ ":base64_config" ] ++ ++ defines = [ ++ "BASE64_STATIC_DEFINE", ++ "HAVE_SSE42=1", ++ ] ++ ++ cflags = [ "-msse4.2" ] ++ cflags_c = [ "-Wno-implicit-fallthrough" ] ++ ++ sources = [ "base64/lib/arch/sse42/sse42_codec.c" ] ++} ++ ++source_set("base64_avx") { ++ public_configs = [ ":base64_config" ] ++ ++ defines = [ "HAVE_AVX=1" ] ++ ++ cflags = [ "-mavx" ] ++ cflags_c = [ "-Wno-implicit-fallthrough" ] ++ ++ sources = [ "base64/lib/arch/avx/avx_codec.c" ] ++} ++ ++source_set("base64_avx2") { ++ public_configs = [ ":base64_config" ] ++ ++ defines = [ "HAVE_AVX2=1" ] ++ ++ cflags = [ "-mavx2" ] ++ cflags_c = [ ++ "-Wno-implicit-fallthrough", ++ "-Wno-implicit-function-declaration", ++ ] ++ ++ sources = [ "base64/lib/arch/avx2/avx2_codec.c" ] ++} ++ ++source_set("base64_neon32") { ++ public_configs = [ ":base64_config" ] ++ ++ defines = [ "HAVE_NEON32=1" ] ++ ++ cflags = [ "-mfpu=neon" ] ++ cflags_c = [ "-Wno-implicit-fallthrough" ] ++ ++ sources = [ "base64/lib/arch/neon32/neon32_codec.c" ] ++} ++ ++source_set("base64_neon64") { ++ public_configs = [ ":base64_config" ] ++ ++ defines = [ "HAVE_NEON64=1" ] ++ ++ cflags_c = [ "-Wno-implicit-fallthrough" ] ++ ++ sources = [ "base64/lib/arch/neon64/neon64_codec.c" ] ++} +diff --git a/deps/base64/base64/lib/arch/avx/codec.c b/deps/base64/base64/lib/arch/avx/avx_codec.c +similarity index 100% +rename from deps/base64/base64/lib/arch/avx/codec.c +rename to deps/base64/base64/lib/arch/avx/avx_codec.c +diff --git a/deps/base64/base64/lib/arch/avx2/codec.c b/deps/base64/base64/lib/arch/avx2/avx2_codec.c +similarity index 100% +rename from deps/base64/base64/lib/arch/avx2/codec.c +rename to deps/base64/base64/lib/arch/avx2/avx2_codec.c +diff --git a/deps/base64/base64/lib/arch/neon32/codec.c b/deps/base64/base64/lib/arch/neon32/neon32_codec.c +similarity index 100% +rename from deps/base64/base64/lib/arch/neon32/codec.c +rename to deps/base64/base64/lib/arch/neon32/neon32_codec.c +diff --git a/deps/base64/base64/lib/arch/neon64/codec.c b/deps/base64/base64/lib/arch/neon64/neon64_codec.c +similarity index 100% +rename from deps/base64/base64/lib/arch/neon64/codec.c +rename to deps/base64/base64/lib/arch/neon64/neon64_codec.c +diff --git a/deps/base64/base64/lib/arch/sse41/codec.c b/deps/base64/base64/lib/arch/sse41/sse41_codec.c +similarity index 100% +rename from deps/base64/base64/lib/arch/sse41/codec.c +rename to deps/base64/base64/lib/arch/sse41/sse41_codec.c +diff --git a/deps/base64/base64/lib/arch/sse42/codec.c b/deps/base64/base64/lib/arch/sse42/sse42_codec.c +similarity index 100% +rename from deps/base64/base64/lib/arch/sse42/codec.c +rename to deps/base64/base64/lib/arch/sse42/sse42_codec.c +diff --git a/deps/base64/base64/lib/arch/ssse3/codec.c b/deps/base64/base64/lib/arch/ssse3/ssse3_codec.c +similarity index 100% +rename from deps/base64/base64/lib/arch/ssse3/codec.c +rename to deps/base64/base64/lib/arch/ssse3/ssse3_codec.c diff --git a/deps/cares/BUILD.gn b/deps/cares/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..71a37834f4e693c190eb7e7d04e3f5ce67c487ad @@ -1006,10 +1192,10 @@ index 0000000000000000000000000000000000000000..2c9d2826c85bdd033f1df1d6188df636 +} diff --git a/filenames.json b/filenames.json new file mode 100644 -index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15f6312138 +index 0000000000000000000000000000000000000000..da2056ec2ab06924d64a3028646d983824263778 --- /dev/null +++ b/filenames.json -@@ -0,0 +1,625 @@ +@@ -0,0 +1,635 @@ +// This file is automatically generated by generate_gn_filenames_json.py +// DO NOT EDIT +{ @@ -1197,6 +1383,7 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "lib/stream/consumers.js", + "lib/stream/promises.js", + "lib/stream/web.js", ++ "lib/readline/promises.js", + "lib/internal/constants.js", + "lib/internal/abort_controller.js", + "lib/internal/net.js", @@ -1211,6 +1398,7 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "lib/internal/histogram.js", + "lib/internal/error_serdes.js", + "lib/internal/dgram.js", ++ "lib/internal/structured_clone.js", + "lib/internal/child_process.js", + "lib/internal/assert.js", + "lib/internal/fixed_queue.js", @@ -1238,11 +1426,13 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "lib/internal/stream_base_commons.js", + "lib/internal/url.js", + "lib/internal/async_hooks.js", ++ "lib/internal/wasm_web_api.js", + "lib/internal/http.js", + "lib/internal/buffer.js", + "lib/internal/trace_events_async_hooks.js", + "lib/internal/v8/startup_snapshot.js", + "lib/internal/test_runner/test.js", ++ "lib/internal/test_runner/runner.js", + "lib/internal/test_runner/harness.js", + "lib/internal/test_runner/utils.js", + "lib/internal/test_runner/tap_stream.js", @@ -1282,9 +1472,8 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "lib/internal/webstreams/adapters.js", + "lib/internal/webstreams/transfer.js", + "lib/internal/bootstrap/loaders.js", -+ "lib/internal/bootstrap/pre_execution.js", + "lib/internal/bootstrap/node.js", -+ "lib/internal/bootstrap/environment.js", ++ "lib/internal/bootstrap/browser.js", + "lib/internal/bootstrap/switches/does_not_own_process_state.js", + "lib/internal/bootstrap/switches/is_not_main_thread.js", + "lib/internal/bootstrap/switches/does_own_process_state.js", @@ -1318,6 +1507,7 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "lib/internal/streams/duplex.js", + "lib/internal/streams/pipeline.js", + "lib/internal/readline/interface.js", ++ "lib/internal/readline/promises.js", + "lib/internal/readline/utils.js", + "lib/internal/readline/emitKeypressEvents.js", + "lib/internal/readline/callbacks.js", @@ -1326,6 +1516,7 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "lib/internal/repl/await.js", + "lib/internal/legacy/processbinding.js", + "lib/internal/assert/calltracker.js", ++ "lib/internal/assert/snapshot.js", + "lib/internal/assert/assertion_error.js", + "lib/internal/http2/util.js", + "lib/internal/http2/core.js", @@ -1335,7 +1526,6 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "lib/internal/per_context/domexception.js", + "lib/internal/vm/module.js", + "lib/internal/tls/secure-pair.js", -+ "lib/internal/tls/parse-cert-string.js", + "lib/internal/tls/secure-context.js", + "lib/internal/child_process/serialization.js", + "lib/internal/debugger/inspect_repl.js", @@ -1354,6 +1544,7 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "lib/internal/main/inspect.js", + "lib/internal/main/eval_stdin.js", + "lib/internal/main/run_main_module.js", ++ "lib/internal/main/environment.js", + "lib/internal/modules/run_main.js", + "lib/internal/modules/package_json_reader.js", + "lib/internal/modules/esm/module_job.js", @@ -1367,6 +1558,7 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "lib/internal/modules/esm/initialize_import_meta.js", + "lib/internal/modules/esm/module_map.js", + "lib/internal/modules/esm/get_format.js", ++ "lib/internal/modules/esm/package_config.js", + "lib/internal/modules/esm/formats.js", + "lib/internal/modules/esm/loader.js", + "lib/internal/modules/cjs/helpers.js", @@ -1374,6 +1566,7 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "lib/internal/source_map/source_map.js", + "lib/internal/source_map/prepare_stack_trace.js", + "lib/internal/source_map/source_map_cache.js", ++ "lib/internal/dns/callback_resolver.js", + "lib/internal/dns/promises.js", + "lib/internal/dns/utils.js", + "lib/internal/fs/watchers.js", @@ -1403,6 +1596,7 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "lib/internal/process/warning.js", + "lib/internal/process/policy.js", + "lib/internal/process/promises.js", ++ "lib/internal/process/pre_execution.js", + "lib/internal/process/signal.js", + "lib/internal/process/execution.js", + "lib/internal/process/esm_loader.js", @@ -1441,6 +1635,7 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "src/api/utils.cc", + "src/async_wrap.cc", + "src/cares_wrap.cc", ++ "src/cleanup_queue.cc", + "src/connect_wrap.cc", + "src/connection_wrap.cc", + "src/debug_utils.cc", @@ -1463,6 +1658,7 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "src/node_binding.cc", + "src/node_blob.cc", + "src/node_buffer.cc", ++ "src/node_builtins.cc", + "src/node_config.cc", + "src/node_constants.cc", + "src/node_contextify.cc", @@ -1478,8 +1674,6 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "src/node_main_instance.cc", + "src/node_messaging.cc", + "src/node_metadata.cc", -+ "src/node_native_module.cc", -+ "src/node_native_module_env.cc", + "src/node_options.cc", + "src/node_os.cc", + "src/node_perf.cc", @@ -1504,6 +1698,7 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "src/node_util.cc", + "src/node_v8.cc", + "src/node_wasi.cc", ++ "src/node_wasm_web_api.cc", + "src/node_watchdog.cc", + "src/node_worker.cc", + "src/node_zlib.cc", @@ -1539,6 +1734,8 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "src/base64-inl.h", + "src/callback_queue.h", + "src/callback_queue-inl.h", ++ "src/cleanup_queue.h", ++ "src/cleanup_queue-inl.h", + "src/connect_wrap.h", + "src/connection_wrap.h", + "src/debug_utils.h", @@ -1561,6 +1758,7 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "src/node_binding.h", + "src/node_blob.h", + "src/node_buffer.h", ++ "src/node_builtins.h", + "src/node_constants.h", + "src/node_context_data.h", + "src/node_contextify.h", @@ -1581,8 +1779,6 @@ index 0000000000000000000000000000000000000000..13fd1469ef0aa33853ddc6f31eda5b15 + "src/node_messaging.h", + "src/node_metadata.h", + "src/node_mutex.h", -+ "src/node_native_module.h", -+ "src/node_native_module_env.h", + "src/node_object_wrap.h", + "src/node_options.h", + "src/node_options-inl.h", @@ -1876,7 +2072,7 @@ index 0000000000000000000000000000000000000000..d1d6b51e8c0c5bc6a5d09e217eb30483 + args = rebase_path(inputs + outputs, root_build_dir) +} diff --git a/src/node_version.h b/src/node_version.h -index aea46f3dad19d604d76b6726ce46141be48746c4..8620780de82f08940c40bddc449d281e4e348736 100644 +index 5403dd847814737132dfd004daddee0efc1bc34d..eba54c354ae930ce957a150bc52d78c4dc6b8322 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -89,7 +89,10 @@ @@ -1885,7 +2081,7 @@ index aea46f3dad19d604d76b6726ce46141be48746c4..8620780de82f08940c40bddc449d281e */ +// Electron sets NODE_MODULE_VERSION in their GN configuration +#ifndef NODE_MODULE_VERSION - #define NODE_MODULE_VERSION 93 + #define NODE_MODULE_VERSION 108 +#endif // The NAPI_VERSION provided by this version of the runtime. This is the version @@ -2003,10 +2199,10 @@ index 0000000000000000000000000000000000000000..2a92eccfa582df361f2a889c0d9b32c1 + + out_file.writelines(new_contents) diff --git a/tools/install.py b/tools/install.py -index a6d1f8b3caa8e24148b1930ea109508f8e612735..c80c1b8202ba59bd63340baca36df8bca5e1f81d 100755 +index 9d5f4a48bca2c926b3ffb3c51c070222d4f7ce7b..728b8596b348b827dbc279498123053aea446ff3 100755 --- a/tools/install.py +++ b/tools/install.py -@@ -202,17 +202,72 @@ def files(action): +@@ -202,60 +202,72 @@ def files(action): def headers(action): def wanted_v8_headers(files_arg, dest): v8_headers = [ @@ -2015,10 +2211,53 @@ index a6d1f8b3caa8e24148b1930ea109508f8e612735..c80c1b8202ba59bd63340baca36df8bc - 'deps/v8/include/libplatform/libplatform-export.h', - 'deps/v8/include/libplatform/v8-tracing.h', - 'deps/v8/include/v8.h', +- 'deps/v8/include/v8-array-buffer.h', +- 'deps/v8/include/v8-callbacks.h', +- 'deps/v8/include/v8-container.h', +- 'deps/v8/include/v8-context.h', +- 'deps/v8/include/v8-data.h', +- 'deps/v8/include/v8-date.h', +- 'deps/v8/include/v8-debug.h', +- 'deps/v8/include/v8-embedder-heap.h', +- 'deps/v8/include/v8-embedder-state-scope.h', +- 'deps/v8/include/v8-exception.h', +- 'deps/v8/include/v8-extension.h', +- 'deps/v8/include/v8-external.h', +- 'deps/v8/include/v8-forward.h', +- 'deps/v8/include/v8-function-callback.h', +- 'deps/v8/include/v8-function.h', +- 'deps/v8/include/v8-initialization.h', - 'deps/v8/include/v8-internal.h', +- 'deps/v8/include/v8-isolate.h', +- 'deps/v8/include/v8-json.h', +- 'deps/v8/include/v8-local-handle.h', +- 'deps/v8/include/v8-locker.h', +- 'deps/v8/include/v8-maybe.h', +- 'deps/v8/include/v8-memory-span.h', +- 'deps/v8/include/v8-message.h', +- 'deps/v8/include/v8-microtask-queue.h', +- 'deps/v8/include/v8-microtask.h', +- 'deps/v8/include/v8-object.h', +- 'deps/v8/include/v8-persistent-handle.h', - 'deps/v8/include/v8-platform.h', +- 'deps/v8/include/v8-primitive-object.h', +- 'deps/v8/include/v8-primitive.h', - 'deps/v8/include/v8-profiler.h', +- 'deps/v8/include/v8-promise.h', +- 'deps/v8/include/v8-proxy.h', +- 'deps/v8/include/v8-regexp.h', +- 'deps/v8/include/v8-script.h', +- 'deps/v8/include/v8-snapshot.h', +- 'deps/v8/include/v8-statistics.h', +- 'deps/v8/include/v8-template.h', +- 'deps/v8/include/v8-traced-handle.h', +- 'deps/v8/include/v8-typed-array.h', +- 'deps/v8/include/v8-unwinder.h', +- 'deps/v8/include/v8-value-serializer.h', +- 'deps/v8/include/v8-value.h', - 'deps/v8/include/v8-version.h', +- 'deps/v8/include/v8-wasm.h', +- 'deps/v8/include/v8-weak-callback-info.h', - 'deps/v8/include/v8config.h', + '../../v8/include/cppgc/common.h', + '../../v8/include/libplatform/libplatform.h', @@ -2089,7 +2328,7 @@ index a6d1f8b3caa8e24148b1930ea109508f8e612735..c80c1b8202ba59bd63340baca36df8bc files_arg = [name for name in files_arg if name in v8_headers] action(files_arg, dest) -@@ -239,7 +294,7 @@ def headers(action): +@@ -282,7 +294,7 @@ def headers(action): if sys.platform.startswith('aix'): action(['out/Release/node.exp'], 'include/node/') @@ -2099,7 +2338,7 @@ index a6d1f8b3caa8e24148b1930ea109508f8e612735..c80c1b8202ba59bd63340baca36df8bc 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 d93be2123e0f8c75dd6a0041ef164982db0860e4..4d9317527d46ac8c6d8066bfba707233053b8615 100755 +index e295949a18508d7989f0925093a9dd6a284fecd6..8ba46c5d78c5c86d9f7b8b6972f3febbe87de61e 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 2e234773691603..854eaec1d9f687 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,10 +7,10 @@ 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 a80b57fbba17b5025351ef41dd83f62832bbd781..8441a5270212af7e4643e6b4ee100a22f8e6f51c 100644 +index 3e73073fb3f0e3bed74ff00521fc1b98997d9540..ca089eee5eafef6e08960d2a96ef27d8cfa95180 100644 --- a/common.gypi +++ b/common.gypi -@@ -83,6 +83,8 @@ +@@ -79,6 +79,8 @@ # TODO(refack): make v8-perfetto happen 'v8_use_perfetto': 0, @@ -19,7 +19,7 @@ index a80b57fbba17b5025351ef41dd83f62832bbd781..8441a5270212af7e4643e6b4ee100a22 ##### end V8 defaults ##### # When building native modules using 'npm install' with the system npm, -@@ -288,6 +290,7 @@ +@@ -282,6 +284,7 @@ 'V8_DEPRECATION_WARNINGS', 'V8_IMMINENT_DEPRECATION_WARNINGS', '_GLIBCXX_USE_CXX11_ABI=1', @@ -27,7 +27,7 @@ index a80b57fbba17b5025351ef41dd83f62832bbd781..8441a5270212af7e4643e6b4ee100a22 ], # Forcibly disable -Werror. We support a wide range of compilers, it's -@@ -395,6 +398,11 @@ +@@ -392,6 +395,11 @@ }], ], }], @@ -40,19 +40,19 @@ index a80b57fbba17b5025351ef41dd83f62832bbd781..8441a5270212af7e4643e6b4ee100a22 'defines': [ 'V8_COMPRESS_POINTERS', diff --git a/configure.py b/configure.py -index 08894bf3908916d1cb639810c5e1b2afae74ff4d..19cbde58df38009258db145c5f7dbe73b0dc5cdf 100755 +index 1b7a721585764aecfd855ee47c47a3bd235d2ef3..c152ea9f29478729ec3752132140e3ec44dbd366 100755 --- a/configure.py +++ b/configure.py -@@ -1447,6 +1447,7 @@ def configure_library(lib, output, pkgname=None): +@@ -1464,6 +1464,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_javascript_promise_hooks'] = 1 o['variables']['v8_enable_lite_mode'] = 1 if options.v8_lite_mode else 0 - o['variables']['v8_enable_gdbjit'] = 1 if options.gdb else 0 diff --git a/src/node.h b/src/node.h -index b6a26f8adf11959f94a00de0cbf9016fcc8707cb..38bbb20968772a4ba6bceddb04a83589f8582fc8 100644 +index 4966df8d4dd0726ba0777b5b8f2f1bfc3071d951..30cfd68159be7f4e22da463ccac5e9bc5ac6e6dd 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 4b508b6cc09eaa..b108f9a447e625 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 @@ -8,7 +8,7 @@ Aligns common.gypi with the current build flag state of //v8. Specifically enables `V8_ENABLE_SANDBOX`, `V8_SANDBOXED_POINTERS`, `V8_COMPRESS_POINTERS` and `V8_COMPRESS_POINTERS_IN_SHARED_CAGE`. diff --git a/common.gypi b/common.gypi -index fcd55b95b44050e4d88eeb0d3100ba6e6a5d5e78..a80b57fbba17b5025351ef41dd83f62832bbd781 100644 +index e58cc4b4fb4ba28f23133530dc3d908c4cb68426..3e73073fb3f0e3bed74ff00521fc1b98997d9540 100644 --- a/common.gypi +++ b/common.gypi @@ -65,6 +65,7 @@ @@ -17,9 +17,9 @@ index fcd55b95b44050e4d88eeb0d3100ba6e6a5d5e78..a80b57fbba17b5025351ef41dd83f628 'v8_enable_31bit_smis_on_64bit_arch%': 0, + 'v8_enable_sandbox%': 0, - # Disable V8 untrusted code mitigations. - # See https://github.com/v8/v8/wiki/Untrusted-code-mitigations -@@ -132,6 +133,7 @@ + # Disable v8 hugepage by default. + 'v8_enable_hugepage%': 0, +@@ -123,6 +124,7 @@ ['target_arch in "arm ia32 mips mipsel ppc"', { 'v8_enable_pointer_compression': 0, 'v8_enable_31bit_smis_on_64bit_arch': 0, @@ -27,7 +27,7 @@ index fcd55b95b44050e4d88eeb0d3100ba6e6a5d5e78..a80b57fbba17b5025351ef41dd83f628 }], ['target_arch in "ppc64 s390x"', { 'v8_enable_backtrace': 1, -@@ -396,9 +398,14 @@ +@@ -393,9 +395,12 @@ ['v8_enable_pointer_compression == 1', { 'defines': [ 'V8_COMPRESS_POINTERS', @@ -36,22 +36,20 @@ index fcd55b95b44050e4d88eeb0d3100ba6e6a5d5e78..a80b57fbba17b5025351ef41dd83f628 ], }], + ['v8_enable_sandbox == 1', { -+ 'defines': [ -+ 'V8_ENABLE_SANDBOX', -+ ] ++ 'defines': ['V8_ENABLE_SANDBOX'] + }], ['v8_enable_pointer_compression == 1 or v8_enable_31bit_smis_on_64bit_arch == 1', { 'defines': ['V8_31BIT_SMIS_ON_64BIT_ARCH'], }], diff --git a/configure.py b/configure.py -index 1a7023dece588631b8281c67b223204c1ebb5ee7..08894bf3908916d1cb639810c5e1b2afae74ff4d 100755 +index a4e5723067f286d4a836f329d0049b6bbaac9419..1b7a721585764aecfd855ee47c47a3bd235d2ef3 100755 --- a/configure.py +++ b/configure.py -@@ -1459,6 +1459,7 @@ def configure_v8(o): +@@ -1477,6 +1477,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 + o['variables']['v8_enable_sandbox'] = 1 if options.enable_pointer_compression else 0 + o['variables']['v8_enable_shared_ro_heap'] = 0 if options.enable_pointer_compression else 1 o['variables']['v8_trace_maps'] = 1 if options.trace_maps else 0 o['variables']['node_use_v8_platform'] = b(not options.without_v8_platform) - o['variables']['node_use_bundled_v8'] = b(not options.without_bundled_v8) 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 c069383f9f984d..74350012467b1a 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 @@ -36,32 +36,32 @@ index 7b820e70df1613a9f5565d6221b71354ff059560..405bda5d83c3312909439082ef69e8f2 async function* watch(filename, options = {}) { const path = toNamespacedPath(getValidatedPath(filename)); -diff --git a/src/node_native_module.cc b/src/node_native_module.cc -index 5d20e1d6a86416c0de9f01a22b992aad889078d3..c836540c7d9328ae4646097ecc18023c1d8add8f 100644 ---- a/src/node_native_module.cc -+++ b/src/node_native_module.cc -@@ -20,6 +20,7 @@ NativeModuleLoader NativeModuleLoader::instance_; +diff --git a/src/node_builtins.cc b/src/node_builtins.cc +index 4a8e5f2d23ecb50b127a20a3d0f6216ae60455fe..3bc9d113b6b818dcda332966f09f17248b421263 100644 +--- a/src/node_builtins.cc ++++ b/src/node_builtins.cc +@@ -32,6 +32,7 @@ BuiltinLoader BuiltinLoader::instance_; - NativeModuleLoader::NativeModuleLoader() : config_(GetConfig()) { + BuiltinLoader::BuiltinLoader() : config_(GetConfig()), has_code_cache_(false) { LoadJavaScriptSource(); + LoadEmbedderJavaScriptSource(); } - NativeModuleLoader* NativeModuleLoader::GetInstance() { -diff --git a/src/node_native_module.h b/src/node_native_module.h -index 7acd154d419de8fd1349a9811f68becec5902297..4981586b4b62cb642e10e1f737a136472ea50697 100644 ---- a/src/node_native_module.h -+++ b/src/node_native_module.h -@@ -44,6 +44,7 @@ class NODE_EXTERN_PRIVATE NativeModuleLoader { + BuiltinLoader* BuiltinLoader::GetInstance() { +diff --git a/src/node_builtins.h b/src/node_builtins.h +index fa87a2042c043bb20fedbb83e60cc160c3f9b7e5..7f0a25af306ffefbc51ac43689ed208d4cd94f0b 100644 +--- a/src/node_builtins.h ++++ b/src/node_builtins.h +@@ -69,6 +69,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader { // Generated by tools/js2c.py as node_javascript.cc void LoadJavaScriptSource(); // Loads data into source_ + void LoadEmbedderJavaScriptSource(); // Loads embedder data into source_ UnionBytes GetConfig(); // Return data for config.gypi - bool Exists(const char* id); + std::vector GetBuiltinIds(); diff --git a/tools/js2c.py b/tools/js2c.py -index 4d9317527d46ac8c6d8066bfba707233053b8615..83225036208b68087a6066adf1d1948b84c5c234 100755 +index 8ba46c5d78c5c86d9f7b8b6972f3febbe87de61e..38057495e04eba46ca87f6a0ea607f0fff46846e 100755 --- a/tools/js2c.py +++ b/tools/js2c.py @@ -39,6 +39,8 @@ import codecs @@ -73,23 +73,23 @@ index 4d9317527d46ac8c6d8066bfba707233053b8615..83225036208b68087a6066adf1d1948b if is_verbose: print(filename) with codecs.open(filename, "r", "utf-8") as f: -@@ -57,13 +59,15 @@ namespace native_module {{ +@@ -57,13 +59,15 @@ namespace builtins {{ {0} --void NativeModuleLoader::LoadJavaScriptSource() {{ -+void NativeModuleLoader::Load{4}JavaScriptSource() {{ +-void BuiltinLoader::LoadJavaScriptSource() {{ ++void BuiltinLoader::Load{4}JavaScriptSource() {{ {1} }} +#if {2} - UnionBytes NativeModuleLoader::GetConfig() {{ + UnionBytes BuiltinLoader::GetConfig() {{ - return UnionBytes(config_raw, {2}); // config.gypi + return UnionBytes(config_raw, {3}); // config.gypi }} +#endif - }} // namespace native_module + }} // namespace builtins @@ -113,8 +117,8 @@ def GetDefinition(var, source, step=30): return definition, len(code_points) 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 98d8cc711d7ae9..d9ea79fee3234b 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,18 +8,18 @@ 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 03e26027406e655ce876a9af689c7d97920c4327..d188b393ee1bd2ee7de6f4454dfa7785d4a5c52b 100644 +index 14b447c2245a2154399b89f15aa33288c194d4fc..c52fbc6a72d1842f56f1e37f3725b7ba2284bf29 100644 --- a/src/node_binding.cc +++ b/src/node_binding.cc @@ -4,6 +4,7 @@ + #include "node_builtins.h" #include "node_errors.h" #include "node_external_reference.h" - #include "node_native_module_env.h" +#include "node_process.h" #include "util.h" #include -@@ -473,7 +474,12 @@ void DLOpen(const FunctionCallbackInfo& args) { +@@ -474,7 +475,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 49475c8cf17792..7f09d38e5c4c99 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 @@ -7,11 +7,29 @@ This allows embedders to tell Node.js what the first "real" file is when they use themselves as the entry point. We should try to upstream some form of this. -diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js -index 25a8464e4833ff4655db2fe37f4bd482dc147865..4b1f1b05b6c67f206f87618792fa528deb238d8d 100644 ---- a/lib/internal/bootstrap/pre_execution.js -+++ b/lib/internal/bootstrap/pre_execution.js -@@ -122,11 +122,13 @@ function patchProcessObject(expandArgv1) { +diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js +index 4b592b0f7d9d481ee746b4e6db07620a27284f17..79b21e33ebf5849d83f462374905357d244224b0 100644 +--- a/lib/internal/modules/cjs/loader.js ++++ b/lib/internal/modules/cjs/loader.js +@@ -1123,6 +1123,13 @@ Module.prototype._compile = function(content, filename) { + if (getOptionValue('--inspect-brk') && process._eval == null) { + if (!resolvedArgv) { + // We enter the repl if we're not given a filename argument. ++ // process._firstFileName is used by Embedders to tell node what ++ // the first "real" file is when they use themselves as the entry ++ // point ++ if (process._firstFileName) { ++ resolvedArgv = process._firstFileName ++ delete process._firstFileName ++ } else + if (process.argv[1]) { + 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 db8bf724af5f113c7c86350a210d5eee82879d13..6659f03e9aa45c35d355399597f533ad20232575 100644 +--- a/lib/internal/process/pre_execution.js ++++ b/lib/internal/process/pre_execution.js +@@ -135,11 +135,13 @@ function patchProcessObject(expandArgv1) { if (expandArgv1 && process.argv[1] && !StringPrototypeStartsWith(process.argv[1], '-')) { // Expand process.argv[1] into a full path. @@ -30,21 +48,3 @@ index 25a8464e4833ff4655db2fe37f4bd482dc147865..4b1f1b05b6c67f206f87618792fa528d } } -diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index 3a536aab1bdeea6829d76d6af48fdefe0e08908d..4e3388b0b1fe69f8aaff15e651f7f0201208a40f 100644 ---- a/lib/internal/modules/cjs/loader.js -+++ b/lib/internal/modules/cjs/loader.js -@@ -1100,6 +1100,13 @@ Module.prototype._compile = function(content, filename) { - if (getOptionValue('--inspect-brk') && process._eval == null) { - if (!resolvedArgv) { - // We enter the repl if we're not given a filename argument. -+ // process._firstFileName is used by Embedders to tell node what -+ // the first "real" file is when they use themselves as the entry -+ // point -+ if (process._firstFileName) { -+ resolvedArgv = process._firstFileName -+ delete process._firstFileName -+ } else - if (process.argv[1]) { - try { - resolvedArgv = Module._resolveFilename(process.argv[1], null, false); diff --git a/patches/node/chore_read_nobrowserglobals_from_global_not_process.patch b/patches/node/chore_read_nobrowserglobals_from_global_not_process.patch deleted file mode 100644 index 0ba77a8435bc6e..00000000000000 --- a/patches/node/chore_read_nobrowserglobals_from_global_not_process.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samuel Attard -Date: Mon, 15 Jul 2019 17:45:02 -0700 -Subject: chore: read _noBrowserGlobals from global not config - -This is used so that we can modify the flag at runtime where -config can only be set at compile time. - -diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js -index 376680f015d09a2cf3ce62de1fdeb9c5ed4c300b..026b47299ff3633a57c57af1512a0921fdafb0c4 100644 ---- a/lib/internal/bootstrap/node.js -+++ b/lib/internal/bootstrap/node.js -@@ -210,7 +210,7 @@ const { - queueMicrotask - } = require('internal/process/task_queues'); - --if (!config.noBrowserGlobals) { -+if (!global._noBrowserGlobals) { - // Override global console from the one provided by the VM - // to the one implemented by Node.js - // https://console.spec.whatwg.org/#console-namespace diff --git a/patches/node/drop_deserializerequest_move_constructor_for_c_20_compat.patch b/patches/node/drop_deserializerequest_move_constructor_for_c_20_compat.patch index 508606e6fc0f4b..46252805024990 100644 --- a/patches/node/drop_deserializerequest_move_constructor_for_c_20_compat.patch +++ b/patches/node/drop_deserializerequest_move_constructor_for_c_20_compat.patch @@ -22,10 +22,10 @@ specified move constructor "shadows" the implicit initializer-list constructor. This patch seems to fix things, in any case. diff --git a/src/env.h b/src/env.h -index 6b18b6efd231d986c391a16966fdbc82a5d99eda..099d8c9efeeda1c851d526e4bf4ddece444c7299 100644 +index 417f0b3657cb068e7708cbeb787f8cb116501876..34c88c1addc5f64bd46332451e5b4ba8343c8818 100644 --- a/src/env.h +++ b/src/env.h -@@ -939,9 +939,6 @@ struct DeserializeRequest { +@@ -932,9 +932,6 @@ struct DeserializeRequest { v8::Global holder; int index; InternalFieldInfo* info = nullptr; // Owned by the request diff --git a/patches/node/enable_-wunqualified-std-cast-call.patch b/patches/node/enable_-wunqualified-std-cast-call.patch index 0f8322430f13e5..a40710debc227a 100644 --- a/patches/node/enable_-wunqualified-std-cast-call.patch +++ b/patches/node/enable_-wunqualified-std-cast-call.patch @@ -7,7 +7,7 @@ Refs https://chromium-review.googlesource.com/c/chromium/src/+/3825237 Should be upstreamed. diff --git a/src/node_http2.cc b/src/node_http2.cc -index 8df924a29028e2cfb31a22e72ee88887f790d777..c466fd8aecd6045841c2b39f707f747ee6f9fc6d 100644 +index 7a1e751929286d97c663c6feea133dae08126684..a1908f9b54807ce73daf775d9745234a27650c72 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -644,7 +644,7 @@ void Http2Stream::EmitStatistics() { diff --git a/patches/node/expose_get_builtin_module_function.patch b/patches/node/expose_get_builtin_module_function.patch index a651f9d2beae83..568481ce1b4b35 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 29b9ccdaed8b109dcc93374ba9abc59b9d2ffdb9..03e26027406e655ce876a9af689c7d97920c4327 100644 +index 06af1841eb3d102a6883ae1a8ab69fee4791be6b..14b447c2245a2154399b89f15aa33288c194d4fc 100644 --- a/src/node_binding.cc +++ b/src/node_binding.cc -@@ -615,6 +615,10 @@ void GetInternalBinding(const FunctionCallbackInfo& args) { +@@ -608,6 +608,10 @@ void GetInternalBinding(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(exports); } 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 faf4f5643c0b04..69859135d8ff1d 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 71d3b65729a71caf157555bc6bba88eb3c3656e1..62c53acdb5f9c98fb7eade00802de2946f5c600c 100644 +index cbe4b734b1c0cc88683c8bc27a4e89d7a1583b22..b2fcaa091924606da5604d194dcb7e445fa736b3 100644 --- a/src/env-inl.h +++ b/src/env-inl.h -@@ -672,6 +672,10 @@ inline bool Environment::no_global_search_paths() const { +@@ -671,6 +671,10 @@ inline bool Environment::no_global_search_paths() const { !options_->global_search_paths; } @@ -18,21 +18,21 @@ index 71d3b65729a71caf157555bc6bba88eb3c3656e1..62c53acdb5f9c98fb7eade00802de294 + return (flags_ & EnvironmentFlags::kNoStartDebugSignalHandler) == 0; +} + - bool Environment::filehandle_close_warning() const { - return emit_filehandle_warning_; - } + inline bool Environment::no_browser_globals() const { + // configure --no-browser-globals + #ifdef NODE_NO_BROWSER_GLOBALS diff --git a/src/env.h b/src/env.h -index ae234a99eb2d5f4f8f953b077f6261c8052f6346..6b18b6efd231d986c391a16966fdbc82a5d99eda 100644 +index 59dd7c8d9e172493d79be21079598a08629be128..417f0b3657cb068e7708cbeb787f8cb116501876 100644 --- a/src/env.h +++ b/src/env.h -@@ -1203,6 +1203,7 @@ class Environment : public MemoryRetainer { +@@ -1233,6 +1233,7 @@ class Environment : public MemoryRetainer { inline bool tracks_unmanaged_fds() const; inline bool hide_console_windows() const; inline bool no_global_search_paths() const; + inline bool should_start_debug_signal_handler() const; + inline bool no_browser_globals() const; inline uint64_t thread_id() const; inline worker::Worker* worker_context() const; - Environment* worker_parent_env() const; diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index 34bb11e7d7122cd2c659d45834be6889abec4ac1..f708933d8bd6a6dc6741d6af22665b37c56e333a 100644 --- a/src/inspector_agent.cc @@ -51,10 +51,10 @@ index 34bb11e7d7122cd2c659d45834be6889abec4ac1..f708933d8bd6a6dc6741d6af22665b37 parent_env_->AddCleanupHook([](void* data) { Environment* env = static_cast(data); diff --git a/src/node.h b/src/node.h -index 4eee4e96349ee49423d53819dd90a213f6a6e042..b6a26f8adf11959f94a00de0cbf9016fcc8707cb 100644 +index a6407dd1e78c8fa86dfc2a6c40813b1b4d6a6829..4966df8d4dd0726ba0777b5b8f2f1bfc3071d951 100644 --- a/src/node.h +++ b/src/node.h -@@ -455,7 +455,11 @@ enum Flags : uint64_t { +@@ -458,7 +458,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 df54d3dbe80dd2..5c2da28fa7ebf5 100644 --- a/patches/node/feat_initialize_asar_support.patch +++ b/patches/node/feat_initialize_asar_support.patch @@ -5,11 +5,32 @@ Subject: feat: initialize asar support This patch initializes asar support in Node.js. -diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js -index 337b95133bc94e395229211c9a00a055b279fcc9..25a8464e4833ff4655db2fe37f4bd482dc147865 100644 ---- a/lib/internal/bootstrap/pre_execution.js -+++ b/lib/internal/bootstrap/pre_execution.js -@@ -94,6 +94,7 @@ function prepareMainThreadExecution(expandArgv1 = false, +diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js +index f7ead4084ed4ed6a682bc62e7ad6fc350381d3b9..cd9ca227b9cac4ff021ce1643000ea4b45163df6 100644 +--- a/lib/internal/main/worker_thread.js ++++ b/lib/internal/main/worker_thread.js +@@ -31,6 +31,7 @@ const { + initializeReport, + initializeSourceMapsHandlers, + loadPreloadModules, ++ setupAsarSupport, + setupTraceCategoryState, + markBootstrapComplete + } = require('internal/process/pre_execution'); +@@ -164,6 +165,8 @@ port.on('message', (message) => { + }; + workerIo.sharedCwdCounter = cwdCounter; + ++ setupAsarSupport(); ++ + const CJSLoader = require('internal/modules/cjs/loader'); + assert(!CJSLoader.hasLoadedAnyUserCJSModule); + loadPreloadModules(); +diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js +index 23d4dbcf6cd8e1e3e4a509672e203323d81e736c..db8bf724af5f113c7c86350a210d5eee82879d13 100644 +--- a/lib/internal/process/pre_execution.js ++++ b/lib/internal/process/pre_execution.js +@@ -103,12 +103,17 @@ function prepareMainThreadExecution(expandArgv1 = false, assert(!CJSLoader.hasLoadedAnyUserCJSModule); loadPreloadModules(); initializeFrozenIntrinsics(); @@ -17,14 +38,21 @@ index 337b95133bc94e395229211c9a00a055b279fcc9..25a8464e4833ff4655db2fe37f4bd482 } function refreshRuntimeOptions() { -@@ -584,6 +585,10 @@ function loadPreloadModules() { - } + refreshOptions(); } +function setupAsarSupport() { + process._linkedBinding('electron_common_asar').initAsarSupport(require); +} + - module.exports = { - refreshRuntimeOptions, - patchProcessObject, + function patchProcessObject(expandArgv1) { + const binding = internalBinding('process_methods'); + binding.patchProcessObject(process); +@@ -620,6 +625,7 @@ module.exports = { + loadPreloadModules, + setupTraceCategoryState, + setupInspectorHooks, ++ setupAsarSupport, + initializeReport, + initializeCJSLoader, + initializeWASI, 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 270a83e7420dd4..e41109231dabc4 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,10 +7,10 @@ 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 d68a4c9eafacfa37baf0c3e1a5eb40c70113cb54..fcd55b95b44050e4d88eeb0d3100ba6e6a5d5e78 100644 +index 3f708d89b1ef384e01726101263728367b6f4355..e58cc4b4fb4ba28f23133530dc3d908c4cb68426 100644 --- a/common.gypi +++ b/common.gypi -@@ -84,6 +84,23 @@ +@@ -80,6 +80,23 @@ ##### end V8 defaults ##### 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 523b1c6ee802dd..d47e1405858f20 100644 --- a/patches/node/fix_crypto_tests_to_run_with_bssl.patch +++ b/patches/node/fix_crypto_tests_to_run_with_bssl.patch @@ -538,11 +538,11 @@ index af2146982c7a3bf7bd7527f44e4b17a3b605026e..f6b91f675cfea367c608892dee078b56 // Non-XOF hash functions should accept valid outputLength options as well. assert.strictEqual(crypto.createHash('sha224', { outputLength: 28 }) diff --git a/test/parallel/test-crypto-hkdf.js b/test/parallel/test-crypto-hkdf.js -index 2d6689a486ddb6e42e53df2b1551af72dc5bc903..3b1a71e1396875c74e28ecbc058981c3c9d10a1f 100644 +index ff3abdf291efcd076b36e755de4147b0aad0b345..d29854cf0c0ce89f84c912def672e7c4e11427a3 100644 --- a/test/parallel/test-crypto-hkdf.js +++ b/test/parallel/test-crypto-hkdf.js -@@ -122,8 +122,6 @@ const algorithms = [ - ['sha256', 'secret', 'salt', 'info', 10], +@@ -124,8 +124,6 @@ const algorithms = [ + ['sha256', '', 'salt', '', 10], ['sha512', 'secret', 'salt', '', 15], ]; -if (!common.hasOpenSSL3) @@ -632,7 +632,7 @@ index 9afcb38616dafd6da1ab7b5843d68f4f796ca9a6..00d3381056a5a40c549f06d74c130149 } +*/ diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js -index b2c14b1efcd68bd20e9c946106f1ab5fb58627c5..eef0bfe638b641c68fdadd95226a74df044921cb 100644 +index 74c0ff53eb18b749d4018b50d654df943403245b..aab253ca5d4504c445c88cd9519f8385a7b39b91 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js @@ -29,6 +29,7 @@ const keySize = 2048; @@ -715,7 +715,7 @@ index 008ab129f0e019c659eecf5a76b7eb412c947fe3..6688f5d916f50e1e4fcfff1619c8634a cipher.end('Papaya!'); // Should not cause an unhandled exception. diff --git a/test/parallel/test-crypto-x509.js b/test/parallel/test-crypto-x509.js -index d1782359277dc52d7a60830a6dd958544d610e6b..4c781f062bc505b860b821773070551f4cd80067 100644 +index 03f7c209679d9c0c7da4b82bddc45767945b596f..de2e088865743202db322b00f443771121ff6643 100644 --- a/test/parallel/test-crypto-x509.js +++ b/test/parallel/test-crypto-x509.js @@ -110,7 +110,7 @@ const der = Buffer.from( @@ -739,11 +739,11 @@ index d1782359277dc52d7a60830a6dd958544d610e6b..4c781f062bc505b860b821773070551f + // Verify that legacy encoding works const legacyObjectCheck = { - subject: 'C=US\n' + -@@ -219,11 +225,7 @@ const der = Buffer.from( - 'CA Issuers - URI:http://ca.nodejs.org/ca.cert' : - 'OCSP - URI:http://ocsp.nodejs.org/\n' + - 'CA Issuers - URI:http://ca.nodejs.org/ca.cert\n', + subject: Object.assign(Object.create(null), { +@@ -220,11 +226,7 @@ const der = Buffer.from( + 'OCSP - URI': ['http://ocsp.nodejs.org/'], + 'CA Issuers - URI': ['http://ca.nodejs.org/ca.cert'] + }), - modulus: 'EF5440701637E28ABB038E5641F828D834C342A9D25EDBB86A2BF' + - '6FBD809CB8E037A98B71708E001242E4DEB54C6164885F599DD87' + - 'A23215745955BE20417E33C4D0D1B80C9DA3DE419A2607195D2FB' + @@ -753,7 +753,7 @@ index d1782359277dc52d7a60830a6dd958544d610e6b..4c781f062bc505b860b821773070551f bits: 1024, exponent: '0x10001', valid_from: 'Nov 16 18:42:21 2018 GMT', -@@ -237,7 +239,7 @@ const der = Buffer.from( +@@ -238,7 +240,7 @@ const der = Buffer.from( 'D0:39:97:54:B6:D0:B4:46:5B:DE:13:5B:68:86:B6:F2:A8:' + '95:22:D5:6E:8B:35:DA:89:29:CA:A3:06:C5:CE:43:C1:7F:' + '2D:7E:5F:44:A5:EE:A3:CB:97:05:A3:E3:68', @@ -762,23 +762,24 @@ index d1782359277dc52d7a60830a6dd958544d610e6b..4c781f062bc505b860b821773070551f }; const legacyObject = x509.toLegacyObject(); -@@ -246,7 +248,7 @@ const der = Buffer.from( - assert.strictEqual(legacyObject.subject, legacyObjectCheck.subject); - assert.strictEqual(legacyObject.issuer, legacyObjectCheck.issuer); - assert.strictEqual(legacyObject.infoAccess, legacyObjectCheck.infoAccess); +@@ -247,7 +249,7 @@ const der = Buffer.from( + assert.deepStrictEqual(legacyObject.subject, legacyObjectCheck.subject); + assert.deepStrictEqual(legacyObject.issuer, legacyObjectCheck.issuer); + assert.deepStrictEqual(legacyObject.infoAccess, legacyObjectCheck.infoAccess); - assert.strictEqual(legacyObject.modulus, legacyObjectCheck.modulus); + assert.match(legacyObject.modulus, legacyObjectCheck.modulusPattern); assert.strictEqual(legacyObject.bits, legacyObjectCheck.bits); assert.strictEqual(legacyObject.exponent, legacyObjectCheck.exponent); assert.strictEqual(legacyObject.valid_from, legacyObjectCheck.valid_from); -@@ -255,7 +257,5 @@ const der = Buffer.from( +@@ -256,7 +258,7 @@ const der = Buffer.from( assert.strictEqual( legacyObject.fingerprint256, legacyObjectCheck.fingerprint256); - assert.strictEqual( -- legacyObject.serialNumber, ++ assert.match( + legacyObject.serialNumber, - legacyObjectCheck.serialNumber); -+ assert.match(legacyObject.serialNumber, legacyObjectCheck.serialNumberPattern); ++ legacyObjectCheck.serialNumberPattern); } diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js index a8ceb169de2b3de73f062083c42292babc673e73..a3bb574d0e5dc85b4ba3fb0b3bd8782fbb8c8700 100644 @@ -1013,19 +1014,6 @@ index f8eb996000ec899abafbfd558f4f49bad2c69c9a..0bf5c7811eeccff6194d8df41887df0a test('X448').then(common.mustCall()); } +*/ -diff --git a/test/parallel/test-webcrypto-encrypt-decrypt-rsa.js b/test/parallel/test-webcrypto-encrypt-decrypt-rsa.js -index 151eebd36c9765df086a020ba42920b2442b1b77..efe97ff2499cba909ac5500d827364fa389a0469 100644 ---- a/test/parallel/test-webcrypto-encrypt-decrypt-rsa.js -+++ b/test/parallel/test-webcrypto-encrypt-decrypt-rsa.js -@@ -127,7 +127,7 @@ async function testEncryptionLongPlaintext({ algorithm, - - return assert.rejects( - subtle.encrypt(algorithm, publicKey, newplaintext), { -- message: /data too large/ -+ message: /data too large|DATA_TOO_LARGE_FOR_KEY_SIZE/ - }); - } - diff --git a/test/parallel/test-webcrypto-sign-verify.js b/test/parallel/test-webcrypto-sign-verify.js index 6c6b15781549a4b37781bf0b8014054dc5d8c746..142d41b169c836201660d78c19383f3ffc469407 100644 --- a/test/parallel/test-webcrypto-sign-verify.js @@ -1076,15 +1064,10 @@ index 1094845c73e14313860ad476fb7baba2a11b5af4..51972b4b34b191ac59145889dbf2da5c function generateWrappingKeys() { diff --git a/test/parallel/test-x509-escaping.js b/test/parallel/test-x509-escaping.js -index 99418e4c0bf21c26d5ba0ad9d617419abc625593..fc129b26ea13895353d6ede26bb2d91695c94ba4 100644 +index c31a6d21351dc97054daf6276454e2cd98263e26..e339fcc3f9af9c55a9000bb1b836b553ef1bf795 100644 --- a/test/parallel/test-x509-escaping.js +++ b/test/parallel/test-x509-escaping.js -@@ -425,11 +425,11 @@ const { hasOpenSSL3 } = common; - assert.strictEqual(certX509.subjectAltName, 'DNS:evil.example.com'); - - // The newer X509Certificate API allows customizing this behavior: -- assert.strictEqual(certX509.checkHost(servername), servername); -+ assert.strictEqual(certX509.checkHost(servername), undefined); +@@ -447,7 +447,7 @@ const { hasOpenSSL3 } = common; assert.strictEqual(certX509.checkHost(servername, { subject: 'default' }), undefined); assert.strictEqual(certX509.checkHost(servername, { subject: 'always' }), @@ -1093,7 +1076,7 @@ index 99418e4c0bf21c26d5ba0ad9d617419abc625593..fc129b26ea13895353d6ede26bb2d916 assert.strictEqual(certX509.checkHost(servername, { subject: 'never' }), undefined); -@@ -464,11 +464,11 @@ const { hasOpenSSL3 } = common; +@@ -482,11 +482,11 @@ const { hasOpenSSL3 } = common; assert.strictEqual(certX509.subjectAltName, 'IP Address:1.2.3.4'); // The newer X509Certificate API allows customizing this behavior: diff --git a/patches/node/fix_expose_lookupandcompile_with_parameters.patch b/patches/node/fix_expose_lookupandcompile_with_parameters.patch new file mode 100644 index 00000000000000..af6074e1edac99 --- /dev/null +++ b/patches/node/fix_expose_lookupandcompile_with_parameters.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Thu, 13 Oct 2022 17:10:01 +0200 +Subject: fix: expose LookupAndCompile with parameters + +Node.js removed custom parameters from the public version of LookupAndCompile, +which we use in Electron. This patch re-exposes a wrapper to allow custom +parameters. + +This should be upstreamed. + +diff --git a/src/node_builtins.cc b/src/node_builtins.cc +index 3bc9d113b6b818dcda332966f09f17248b421263..549339b5b677fa242a7b60ae716789c2a11ab18d 100644 +--- a/src/node_builtins.cc ++++ b/src/node_builtins.cc +@@ -397,6 +397,22 @@ MaybeLocal BuiltinLoader::LookupAndCompile( + return maybe; + } + ++MaybeLocal BuiltinLoader::LookupAndCompile( ++ Local context, ++ const char* id, ++ std::vector>* parameters, ++ Environment* optional_env) { ++ Result result; ++ Isolate* isolate = context->GetIsolate(); ++ ++ MaybeLocal maybe = GetInstance()->LookupAndCompileInternal( ++ context, id, parameters, &result); ++ if (optional_env != nullptr) { ++ RecordResult(id, result, optional_env); ++ } ++ return maybe; ++} ++ + bool BuiltinLoader::CompileAllBuiltins(Local context) { + BuiltinLoader* loader = GetInstance(); + std::vector ids = loader->GetBuiltinIds(); +diff --git a/src/node_builtins.h b/src/node_builtins.h +index 7f0a25af306ffefbc51ac43689ed208d4cd94f0b..a32a7a990082ea3dad73511f91a9c70c72f6fe31 100644 +--- a/src/node_builtins.h ++++ b/src/node_builtins.h +@@ -49,6 +49,11 @@ class NODE_EXTERN_PRIVATE BuiltinLoader { + v8::Local context, + const char* id, + Environment* optional_env); ++ static v8::MaybeLocal LookupAndCompile( ++ v8::Local context, ++ const char* id, ++ std::vector>* parameters, ++ Environment* optional_env); + + static v8::Local GetSourceObject(v8::Local context); + // Returns config.gypi as a JSON string 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 e70d970682d465..118ed655801839 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 5ae0e17dcfb5e24a1a117c33c4d42891686e693f..619fe6cef3b02eb575410225f41d3e7d51f37b93 100644 +index a7329d279bb07542d3f4027e0c8e2b035d493e5b..5cff70923b4ea7a4df918b2d3d1fbc7106159218 100644 --- a/lib/internal/modules/esm/get_format.js +++ b/lib/internal/modules/esm/get_format.js -@@ -31,6 +31,7 @@ const protocolHandlers = ObjectAssign(ObjectCreate(null), { +@@ -30,6 +30,7 @@ const protocolHandlers = { 'http:': getHttpProtocolModuleFormat, 'https:': getHttpProtocolModuleFormat, 'node:'() { return 'builtin'; }, + 'electron:'() { return 'commonjs'; }, - }); + }; - function getDataProtocolModuleFormat(parsed) { + /** diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js -index fc5dcd6863dc358102a74bd2cc723d54436fae64..97eea17d815967671a2a0fc2a9c95a9bb85947ac 100644 +index bfee280212fc4d85b2b0a92ac79d898de3cb5ab3..a79cec8d82b439202ecf40b3d55b75706d3aaf29 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js -@@ -883,6 +883,8 @@ function parsePackageName(specifier, base) { +@@ -795,6 +795,8 @@ function parsePackageName(specifier, base) { return { packageName, packageSubpath, isScoped }; } @@ -30,7 +30,7 @@ index fc5dcd6863dc358102a74bd2cc723d54436fae64..97eea17d815967671a2a0fc2a9c95a9b /** * @param {string} specifier * @param {string | URL | undefined} base -@@ -895,6 +897,10 @@ function packageResolve(specifier, base, conditions) { +@@ -807,6 +809,10 @@ function packageResolve(specifier, base, conditions) { return new URL('node:' + specifier); } @@ -41,7 +41,7 @@ index fc5dcd6863dc358102a74bd2cc723d54436fae64..97eea17d815967671a2a0fc2a9c95a9b const { packageName, packageSubpath, isScoped } = parsePackageName(specifier, base); -@@ -1095,7 +1101,7 @@ function checkIfDisallowedImport(specifier, parsed, parsedParentURL) { +@@ -1005,7 +1011,7 @@ function checkIfDisallowedImport(specifier, parsed, parsedParentURL) { function throwIfUnsupportedURLProtocol(url) { if (url.protocol !== 'file:' && url.protocol !== 'data:' && @@ -51,10 +51,10 @@ index fc5dcd6863dc358102a74bd2cc723d54436fae64..97eea17d815967671a2a0fc2a9c95a9b } } diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js -index 8fb3c96f8dc4c535c3898755f7846ae24d9867c4..bda3ca0797e8f1b1d69295c2276c0f841cae99f2 100644 +index 6f25b2e67ab77613c6ed63c227bb875d5461f45f..d1527b859bbea15fdf30622fc8f2700bde5b4591 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js -@@ -155,7 +155,7 @@ translators.set('commonjs', async function commonjsStrategy(url, source, +@@ -154,7 +154,7 @@ translators.set('commonjs', async function commonjsStrategy(url, source, if (!cjsParse) await initCJSParse(); const { module, exportNames } = cjsPreparseModuleExports(filename); @@ -63,7 +63,7 @@ index 8fb3c96f8dc4c535c3898755f7846ae24d9867c4..bda3ca0797e8f1b1d69295c2276c0f84 [...exportNames] : ['default', ...exportNames]; return new ModuleWrap(url, undefined, namesWithDefault, function() { -@@ -174,7 +174,7 @@ translators.set('commonjs', async function commonjsStrategy(url, source, +@@ -173,7 +173,7 @@ translators.set('commonjs', async function commonjsStrategy(url, source, } } @@ -73,10 +73,10 @@ index 8fb3c96f8dc4c535c3898755f7846ae24d9867c4..bda3ca0797e8f1b1d69295c2276c0f84 exportName === 'default') continue; diff --git a/lib/internal/url.js b/lib/internal/url.js -index 22bff28595f6f5b109ae47c79aa1f5ac463ec6c3..d4eb2e044cc1152f48c92d0503f9216e3aad5f4b 100644 +index 2a4ffefe2450708af61e09d7a9530bec1c15d922..9a1c49df14e8b3cef7e66789242a625c6afb3ca9 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js -@@ -1432,6 +1432,8 @@ function fileURLToPath(path) { +@@ -1483,6 +1483,8 @@ function fileURLToPath(path) { path = new URL(path); else if (!isURLInstance(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 d42e0b2c5cd761..07dbe2aceabcbb 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 5df88a9dbabf78b4e14b4124bdd466d5451ad0f6..9d33ebdc35516f65a977f7c1125453b0c99bee28 100644 +index 315e5c1d03a59dbb1eed5a79ec013a0815e3f5fe..8a7ad50b818448fa14eb4707c1dcec2a1339d2db 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -467,6 +467,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) { +@@ -474,6 +474,10 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) { return env->platform(); } @@ -22,10 +22,10 @@ index 5df88a9dbabf78b4e14b4124bdd466d5451ad0f6..9d33ebdc35516f65a977f7c1125453b0 int thread_pool_size, node::tracing::TracingController* tracing_controller) { diff --git a/src/node.h b/src/node.h -index 4be002ac18f7c33f0242e1a660525133bf25d752..be619162d17728c1eb2ddf740947067913d6a348 100644 +index e8c72092c72b547946a09ec8e1f6cd7ece156235..a6407dd1e78c8fa86dfc2a6c40813b1b4d6a6829 100644 --- a/src/node.h +++ b/src/node.h -@@ -128,6 +128,7 @@ namespace node { +@@ -129,6 +129,7 @@ namespace node { namespace tracing { @@ -33,7 +33,7 @@ index 4be002ac18f7c33f0242e1a660525133bf25d752..be619162d17728c1eb2ddf7409470679 class TracingController; } -@@ -533,6 +534,8 @@ NODE_EXTERN v8::MaybeLocal PrepareStackTraceCallback( +@@ -564,6 +565,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_failing_node_js_test_on_outdated.patch b/patches/node/fix_failing_node_js_test_on_outdated.patch deleted file mode 100644 index 2a850f7c62c13a..00000000000000 --- a/patches/node/fix_failing_node_js_test_on_outdated.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Wed, 16 Feb 2022 13:33:41 +0100 -Subject: fix: failing Node.js test on outdated - CurrentValueSerializerFormatVersion - -Corrects for a test that started failing as of https://chromium-review.googlesource.com/c/v8/v8/+/3417189 -becuase V8 updated the return value of CurrentValueSerializerFormatVersion() -from 14 to 15, and Node.js still expected 14 (0x0e). - -This patch can be removed as soon as Node.js updates to a version of V8 -containing the above CL. - -diff --git a/test/parallel/test-v8-serdes.js b/test/parallel/test-v8-serdes.js -index 12f20ed1c9d386122dd20fdd84a7a0c9b9079ee1..14552eeb493e8eb5b7c05c531b9628d8bcb13aae 100644 ---- a/test/parallel/test-v8-serdes.js -+++ b/test/parallel/test-v8-serdes.js -@@ -163,7 +163,7 @@ const hostObject = new (internalBinding('js_stream').JSStream)(); - } - - { -- const buf = Buffer.from('ff0e6f2203666f6f5e007b01', 'hex'); -+ const buf = Buffer.from('ff0f6f2203666f6f5e007b01', 'hex'); - - const des = new v8.DefaultDeserializer(buf); - des.readHeader(); -@@ -174,7 +174,7 @@ const hostObject = new (internalBinding('js_stream').JSStream)(); - ser.writeValue(des.readValue()); - - assert.deepStrictEqual(buf, ser.releaseBuffer()); -- assert.strictEqual(des.getWireFormatVersion(), 0x0e); -+ assert.strictEqual(des.getWireFormatVersion(), 0x0f); - } - - { diff --git a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch index 5e1d0fafeee87e..251511ee8db598 100644 --- a/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch +++ b/patches/node/fix_handle_boringssl_and_openssl_incompatibilities.patch @@ -17,10 +17,10 @@ Upstreams: - https://github.com/nodejs/node/pull/39136 diff --git a/src/crypto/crypto_cipher.cc b/src/crypto/crypto_cipher.cc -index 6c663a2b21d0a29708700d0e19b8e30fa696a1d0..1e4ff83faec60887e8169e612ac1a956130d7e4a 100644 +index a6ce4de49d9bf6962faddc99a3c5ed84046f0a13..678627d4ce460fc1519cd486a46eba1f78828a31 100644 --- a/src/crypto/crypto_cipher.cc +++ b/src/crypto/crypto_cipher.cc -@@ -25,7 +25,8 @@ using v8::Value; +@@ -27,7 +27,8 @@ using v8::Value; namespace crypto { namespace { bool IsSupportedAuthenticatedMode(const EVP_CIPHER* cipher) { @@ -31,10 +31,10 @@ index 6c663a2b21d0a29708700d0e19b8e30fa696a1d0..1e4ff83faec60887e8169e612ac1a956 case EVP_CIPH_GCM_MODE: #ifndef OPENSSL_NO_OCB diff --git a/src/crypto/crypto_common.cc b/src/crypto/crypto_common.cc -index ed1aea868d8385b6411103c614f4d12688c8cb30..4864d7cd6a310f31bfdda399996bd2c47977667a 100644 +index 3bf480f8f0c77d440324cf8847f4a214521f8162..40b6e311a14f5e824f8f0aff3121221eac94fd8a 100644 --- a/src/crypto/crypto_common.cc +++ b/src/crypto/crypto_common.cc -@@ -166,7 +166,7 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { +@@ -164,7 +164,7 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { const unsigned char* buf; size_t len; size_t rem; @@ -43,7 +43,7 @@ index ed1aea868d8385b6411103c614f4d12688c8cb30..4864d7cd6a310f31bfdda399996bd2c4 if (!SSL_client_hello_get0_ext( ssl.get(), TLSEXT_TYPE_application_layer_protocol_negotiation, -@@ -179,13 +179,15 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { +@@ -177,13 +177,15 @@ const char* GetClientHelloALPN(const SSLPointer& ssl) { len = (buf[0] << 8) | buf[1]; if (len + 2 != rem) return nullptr; return reinterpret_cast(buf + 3); @@ -60,7 +60,7 @@ index ed1aea868d8385b6411103c614f4d12688c8cb30..4864d7cd6a310f31bfdda399996bd2c4 if (!SSL_client_hello_get0_ext( ssl.get(), TLSEXT_TYPE_server_name, -@@ -207,15 +209,20 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) { +@@ -205,15 +207,20 @@ const char* GetClientHelloServerName(const SSLPointer& ssl) { if (len + 2 > rem) return nullptr; return reinterpret_cast(buf + 5); @@ -84,7 +84,7 @@ index ed1aea868d8385b6411103c614f4d12688c8cb30..4864d7cd6a310f31bfdda399996bd2c4 const char* X509ErrorCode(long err) { // NOLINT(runtime/int) const char* code = "UNSPECIFIED"; -@@ -1103,14 +1110,14 @@ MaybeLocal GetClientHelloCiphers( +@@ -1045,14 +1052,14 @@ MaybeLocal GetClientHelloCiphers( Environment* env, const SSLPointer& ssl) { EscapableHandleScope scope(env->isolate()); @@ -104,10 +104,10 @@ index ed1aea868d8385b6411103c614f4d12688c8cb30..4864d7cd6a310f31bfdda399996bd2c4 if (!Set(env->context(), obj, diff --git a/src/crypto/crypto_dh.cc b/src/crypto/crypto_dh.cc -index c02e22bb542ff529e4d4fa32de63a07704b02b8e..38220d2e0d1a695f67bf7b9cb79a73fa199abeae 100644 +index dd69323b80076d7333b80453c9cc9ef5b680ce27..6431b768c83fa27b2287588e936f93ae00169ad5 100644 --- a/src/crypto/crypto_dh.cc +++ b/src/crypto/crypto_dh.cc -@@ -139,13 +139,11 @@ void DiffieHellman::MemoryInfo(MemoryTracker* tracker) const { +@@ -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) { @@ -123,7 +123,7 @@ index c02e22bb542ff529e4d4fa32de63a07704b02b8e..38220d2e0d1a695f67bf7b9cb79a73fa return false; } BIGNUM* bn_p = -@@ -163,21 +161,18 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) { +@@ -178,21 +176,18 @@ bool DiffieHellman::Init(const char* p, int p_len, int g) { bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) { dh_.reset(DH_new()); if (p_len <= 0) { @@ -148,40 +148,48 @@ index c02e22bb542ff529e4d4fa32de63a07704b02b8e..38220d2e0d1a695f67bf7b9cb79a73fa return false; } BIGNUM* bn_p = -@@ -527,16 +522,20 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { - if (!BN_set_word(bn_g.get(), params->params.generator) || - !DH_set0_pqg(dh.get(), prime, nullptr, bn_g.get())) +@@ -219,8 +214,10 @@ typedef BignumPointer (*StandardizedGroupInstantiator)(); + inline StandardizedGroupInstantiator FindDiffieHellmanGroup(const char* name) { + #define V(n, p) \ + if (StringEqualNoCase(name, n)) return InstantiateStandardizedGroup

++#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); + V("modp15", BN_get_rfc3526_prime_3072); +@@ -559,15 +556,20 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { return EVPKeyCtxPointer(); -- + } + +#ifndef OPENSSL_IS_BORINGSSL - params->params.prime_fixed_value.release(); + prime_fixed_value->release(); bn_g.release(); key_params = EVPKeyPointer(EVP_PKEY_new()); CHECK(key_params); - EVP_PKEY_assign_DH(key_params.get(), dh.release()); + CHECK_EQ(EVP_PKEY_assign_DH(key_params.get(), dh.release()), 1); +#else + return EVPKeyCtxPointer(); +#endif - } else { + } else if (int* prime_size = std::get_if(¶ms->params.prime)) { EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_DH, nullptr)); EVP_PKEY* raw_params = nullptr; +#ifndef OPENSSL_IS_BORINGSSL if (!param_ctx || EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 || EVP_PKEY_CTX_set_dh_paramgen_prime_len( -@@ -548,8 +547,10 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { - EVP_PKEY_paramgen(param_ctx.get(), &raw_params) <= 0) { - return EVPKeyCtxPointer(); +@@ -581,6 +583,9 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(DhKeyPairGenConfig* params) { } -- + key_params = EVPKeyPointer(raw_params); +#else + return EVPKeyCtxPointer(); +#endif + } else { + UNREACHABLE(); } - - EVPKeyCtxPointer ctx(EVP_PKEY_CTX_new(key_params.get(), nullptr)); diff --git a/src/crypto/crypto_dsa.cc b/src/crypto/crypto_dsa.cc index c7894baf00ee9ce4684f4c752f1c7c9b98163741..655895dbff8b88daa53c7b40a5feca42a461b689 100644 --- a/src/crypto/crypto_dsa.cc @@ -207,7 +215,7 @@ index c7894baf00ee9ce4684f4c752f1c7c9b98163741..655895dbff8b88daa53c7b40a5feca42 return EVPKeyCtxPointer(); diff --git a/src/crypto/crypto_random.cc b/src/crypto/crypto_random.cc -index 1459e410453da6850157444affa48b4a215edb03..2cf5861a110a2579329b9b0327d7b4296d0fb2c1 100644 +index 2f9e9aacb1e652202d72c69b46f8e76d6c5405a8..5f19c38a78e37d3e8d92bcc20ae1357f20349ad4 100644 --- a/src/crypto/crypto_random.cc +++ b/src/crypto/crypto_random.cc @@ -146,7 +146,7 @@ Maybe RandomPrimeTraits::AdditionalConfig( @@ -220,10 +228,10 @@ index 1459e410453da6850157444affa48b4a215edb03..2cf5861a110a2579329b9b0327d7b429 THROW_ERR_CRYPTO_OPERATION_FAILED(env, "could not generate prime"); return Nothing(); diff --git a/src/crypto/crypto_rsa.cc b/src/crypto/crypto_rsa.cc -index bd732a70a8ffe6212e06dddb352ca75cb45b50d3..cd025663f58d386e3b7c47823a7d6cf1a230e6a8 100644 +index ec339e5635d419db76f78974941493e32e968e84..e4a842b66994d4599d513296dff7d1891a9264a8 100644 --- a/src/crypto/crypto_rsa.cc +++ b/src/crypto/crypto_rsa.cc -@@ -626,10 +626,11 @@ Maybe GetRsaKeyDetail( +@@ -621,10 +621,11 @@ Maybe GetRsaKeyDetail( } if (params->saltLength != nullptr) { @@ -240,10 +248,10 @@ index bd732a70a8ffe6212e06dddb352ca75cb45b50d3..cd025663f58d386e3b7c47823a7d6cf1 if (target diff --git a/src/crypto/crypto_util.cc b/src/crypto/crypto_util.cc -index 652f6e0b12e2d56f33b1c18b80ec211b9c6bd5e9..840fe824617b951d4f4421155c5e1ce79c28525e 100644 +index e878c5ea15d58fb5eb096197209bc7122a504ca9..51973d7cb15f0650f3e94a7b8c9811c550ee9b0f 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc -@@ -522,24 +522,15 @@ Maybe Decorate(Environment* env, Local obj, +@@ -495,24 +495,15 @@ Maybe Decorate(Environment* env, Local obj, V(BIO) \ V(PKCS7) \ V(X509V3) \ @@ -269,16 +277,16 @@ index 652f6e0b12e2d56f33b1c18b80ec211b9c6bd5e9..840fe824617b951d4f4421155c5e1ce7 V(USER) \ #define V(name) case ERR_LIB_##name: lib = #name "_"; break; -@@ -698,7 +689,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -671,7 +662,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { CHECK(args[0]->IsUint32()); Environment* env = Environment::GetCurrent(args); uint32_t len = args[0].As()->Value(); -- char* data = static_cast(OPENSSL_secure_malloc(len)); -+ char* data = static_cast(OPENSSL_malloc(len)); +- void* data = OPENSSL_secure_zalloc(len); ++ void* data = OPENSSL_malloc(len); if (data == nullptr) { // There's no memory available for the allocation. // Return nothing. -@@ -710,7 +701,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -682,7 +673,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { data, len, [](void* data, size_t len, void* deleter_data) { @@ -287,7 +295,7 @@ index 652f6e0b12e2d56f33b1c18b80ec211b9c6bd5e9..840fe824617b951d4f4421155c5e1ce7 }, data); Local buffer = ArrayBuffer::New(env->isolate(), store); -@@ -718,10 +709,12 @@ void SecureBuffer(const FunctionCallbackInfo& args) { +@@ -690,10 +681,12 @@ void SecureBuffer(const FunctionCallbackInfo& args) { } void SecureHeapUsed(const FunctionCallbackInfo& args) { @@ -301,7 +309,7 @@ index 652f6e0b12e2d56f33b1c18b80ec211b9c6bd5e9..840fe824617b951d4f4421155c5e1ce7 } // namespace diff --git a/src/node_metadata.cc b/src/node_metadata.cc -index 46d9be0dfcfdcf778ebaf0337517b7da3f68bc9b..435762f7df47459dc4e6e73a7c3d2376184bebcf 100644 +index a221dcde050ad7b64cf25df1e1b3a3063a6f37e5..acf95e74882dbd65c65de75c933795c597817894 100644 --- a/src/node_metadata.cc +++ b/src/node_metadata.cc @@ -9,7 +9,7 @@ @@ -311,10 +319,10 @@ index 46d9be0dfcfdcf778ebaf0337517b7da3f68bc9b..435762f7df47459dc4e6e73a7c3d2376 -#if HAVE_OPENSSL +#if HAVE_OPENSSL && !defined(OPENSSL_IS_BORINGSSL) #include - #endif // HAVE_OPENSSL - + #if NODE_OPENSSL_HAS_QUIC + #include diff --git a/src/node_metadata.h b/src/node_metadata.h -index 4486d5af2c1622c7c8f44401dc3ebb986d8e3c2e..db1769f1b3f1617ed8dbbea57b5e324183b42be2 100644 +index b7cacae4c3d430c888fa7b5c66d8ed822e18f59d..d3b2ba33b06e1ebe140a30c777907f2bdffa098c 100644 --- a/src/node_metadata.h +++ b/src/node_metadata.h @@ -6,7 +6,7 @@ @@ -324,10 +332,10 @@ index 4486d5af2c1622c7c8f44401dc3ebb986d8e3c2e..db1769f1b3f1617ed8dbbea57b5e3241 -#if HAVE_OPENSSL +#if 0 #include - #endif // HAVE_OPENSSL - + #if NODE_OPENSSL_HAS_QUIC + #include diff --git a/src/node_options.cc b/src/node_options.cc -index b82100b6907891063a37023e6ad21f79fffade1e..d78005d41bebff4e8729400cf08ab67d27098448 100644 +index bd4ad2f6408ca8127fa7f03b73f441884af81aa2..0e59521ed5a43189a175417eab89fd9daee000be 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -5,7 +5,7 @@ @@ -340,7 +348,7 @@ index b82100b6907891063a37023e6ad21f79fffade1e..d78005d41bebff4e8729400cf08ab67d #endif diff --git a/src/node_options.h b/src/node_options.h -index 32e68086502f3eebe2dbe232b198d663db951125..cb4b6215ffbace04ecd4ad694ae00493847a7324 100644 +index b20cfae141956a9817076e7a1fc7218a9ead6f0c..d7a0c84dd6de4811a371ef6615f3be470d39725c 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -11,7 +11,7 @@ diff --git a/patches/node/fix_override_createjob_in_node_platform.patch b/patches/node/fix_override_createjob_in_node_platform.patch index 252cf947f4bc4b..db1b20be50cd63 100644 --- a/patches/node/fix_override_createjob_in_node_platform.patch +++ b/patches/node/fix_override_createjob_in_node_platform.patch @@ -9,10 +9,10 @@ This patch adds an override for NodePlatform::CreateJob, using the same parameters as PostJob. diff --git a/src/node_platform.cc b/src/node_platform.cc -index 5be79694fef65c9290f1b46d2657581dea16f543..e10caa9f6e39ec5b255acd9bc6b7f8efc77221d9 100644 +index b87413bcb9cfcbc8a51036edc5f6fd95e0906a96..389813fae96db76e385d88ad351b4bf4743298a5 100644 --- a/src/node_platform.cc +++ b/src/node_platform.cc -@@ -523,6 +523,12 @@ std::unique_ptr NodePlatform::PostJob(v8::TaskPriority priority, +@@ -525,6 +525,12 @@ std::unique_ptr NodePlatform::PostJob(v8::TaskPriority priority, this, priority, std::move(job_task), NumberOfWorkerThreads()); } diff --git a/patches/node/fix_parallel_test-v8-stats.patch b/patches/node/fix_parallel_test-v8-stats.patch index 6aab7511d2ed44..ced725413e2561 100644 --- a/patches/node/fix_parallel_test-v8-stats.patch +++ b/patches/node/fix_parallel_test-v8-stats.patch @@ -8,10 +8,10 @@ match. node should eventually have this too once they roll up the newer v8. diff --git a/test/parallel/test-v8-stats.js b/test/parallel/test-v8-stats.js -index 7503a08c5a67fa4bead4f768242b47f418ebfc85..98ad11f11f9b9bf5699801814f8234e84dfaf638 100644 +index 2eaa3c5b0609149271afb85d7ecc33272e0ada2e..3af7ea1e4a4598dc4125ff78e426d6dc6a025c66 100644 --- a/test/parallel/test-v8-stats.js +++ b/test/parallel/test-v8-stats.js -@@ -46,6 +46,8 @@ const expectedHeapSpaces = [ +@@ -47,6 +47,8 @@ const expectedHeapSpaces = [ 'new_space', 'old_space', 'read_only_space', diff --git a/patches/node/fix_preserve_proper_method_names_as-is_in_error_stack.patch b/patches/node/fix_preserve_proper_method_names_as-is_in_error_stack.patch deleted file mode 100644 index bcd1c3ae56b559..00000000000000 --- a/patches/node/fix_preserve_proper_method_names_as-is_in_error_stack.patch +++ /dev/null @@ -1,471 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shelley Vohr -Date: Thu, 7 Apr 2022 11:07:10 +0200 -Subject: fix: preserve "proper method names" as-is in error.stack - -Refs https://chromium-review.googlesource.com/c/v8/v8/+/3565724. - -This patch can be removed when Node.js updates to V8 10.2.60 or higher, -which includes the above CL. - -The above CL removes prepended Function. and Object. from -stack traces, and so we need to remove them from the comparison output. - -diff --git a/test/message/async_error_nexttick_main.out b/test/message/async_error_nexttick_main.out -index 8d11dea63d4191d4e492d42cad499e9e6f277bd4..9669e9b5102ff9ce8dfffbc45dadc60dab578458 100644 ---- a/test/message/async_error_nexttick_main.out -+++ b/test/message/async_error_nexttick_main.out -@@ -1,7 +1,7 @@ - Error: test - at one (*fixtures*async-error.js:4:9) - at two (*fixtures*async-error.js:17:9) -- at processTicksAndRejections (node:internal/process/task_queues:*:*) -+ at process.processTicksAndRejections (node:internal/process/task_queues:*:*) - at async three (*fixtures*async-error.js:20:3) - at async four (*fixtures*async-error.js:24:3) - at async main (*message*async_error_nexttick_main.js:7:5) -diff --git a/test/message/core_line_numbers.out b/test/message/core_line_numbers.out -index 97b017f66e2395ca90fc7562b9043579911ddc62..1d21462c8cf63ddbbf9e3b785b553a3104710132 100644 ---- a/test/message/core_line_numbers.out -+++ b/test/message/core_line_numbers.out -@@ -7,8 +7,8 @@ RangeError: Invalid input - at Object.decode (node:punycode:*:*) - at Object. (*test*message*core_line_numbers.js:*:*) - at Module._compile (node:internal/modules/cjs/loader:*:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*:*) - at Module.load (node:internal/modules/cjs/loader:*:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*:*) -+ at Module._load (node:internal/modules/cjs/loader:*:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*) - at node:internal/main/run_main_module:*:* -diff --git a/test/message/error_aggregateTwoErrors.out b/test/message/error_aggregateTwoErrors.out -index 02e8738d47f57af4c457c15a0c3acfe0a1783078..d82704d95c2df6df36261c1494625b73c6507293 100644 ---- a/test/message/error_aggregateTwoErrors.out -+++ b/test/message/error_aggregateTwoErrors.out -@@ -4,9 +4,9 @@ throw aggregateTwoErrors(err, originalError); - AggregateError: original - at Object. (*test*message*error_aggregateTwoErrors.js:*:*) - at Module._compile (node:internal/modules/cjs/loader:*:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*:*) - at Module.load (node:internal/modules/cjs/loader:*:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*:*) -+ at Module._load (node:internal/modules/cjs/loader:*:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*) - at node:internal/main/run_main_module:*:* { - code: 'ERR0', -@@ -14,9 +14,9 @@ AggregateError: original - Error: original - at Object. (*test*message*error_aggregateTwoErrors.js:*:*) - at Module._compile (node:internal/modules/cjs/loader:*:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*:*) - at Module.load (node:internal/modules/cjs/loader:*:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*:*) -+ at Module._load (node:internal/modules/cjs/loader:*:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*) - at node:internal/main/run_main_module:*:* { - code: 'ERR0' -@@ -24,9 +24,9 @@ AggregateError: original - Error: second error - at Object. (*test*message*error_aggregateTwoErrors.js:*:*) - at Module._compile (node:internal/modules/cjs/loader:*:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*:*) - at Module.load (node:internal/modules/cjs/loader:*:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*:*) -+ at Module._load (node:internal/modules/cjs/loader:*:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*) - at node:internal/main/run_main_module:*:* { - code: 'ERR1' -diff --git a/test/message/error_exit.out b/test/message/error_exit.out -index 2ef95b535dafe7b0a918b8d6a844e4c4a617818d..dc5e6e7d28cef3a23ca7ba2cfb1435cad55e2aeb 100644 ---- a/test/message/error_exit.out -+++ b/test/message/error_exit.out -@@ -9,9 +9,9 @@ AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: - - at Object. (*test*message*error_exit.js:*:*) - at Module._compile (node:internal/modules/cjs/loader:*:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*:*) - at Module.load (node:internal/modules/cjs/loader:*:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*:*) -+ at Module._load (node:internal/modules/cjs/loader:*:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*) - at node:internal/main/run_main_module:*:* { - generatedMessage: true, -diff --git a/test/message/error_with_nul.out b/test/message/error_with_nul.out -index 7fbb33f08e8dc342b9efc899e66f5e3350e9489b..a359999420fa76bd09b401a732acb7dcdfaa2198 100644 -GIT binary patch -delta 13 -VcmdnUvXEuMi;3^+Czmts0st)*2A2Q; - -delta 31 -ncmZ3;vXN!N3wHmctkmQZy@@aCIo(S0l1no4^YkXCGwuQa$o~w9 - -diff --git a/test/message/events_unhandled_error_common_trace.out b/test/message/events_unhandled_error_common_trace.out -index 19e89869ba74fae3f447e299904939da5a683280..2bdbe3df1b4c7e13ba33f099ae89f88365e6b690 100644 ---- a/test/message/events_unhandled_error_common_trace.out -+++ b/test/message/events_unhandled_error_common_trace.out -@@ -7,9 +7,9 @@ Error: foo:bar - at foo (*events_unhandled_error_common_trace.js:*:*) - at Object. (*events_unhandled_error_common_trace.js:*:*) - at Module._compile (node:internal/modules/cjs/loader:*:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*:*) - at Module.load (node:internal/modules/cjs/loader:*:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*:*) -+ at Module._load (node:internal/modules/cjs/loader:*:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*) - at node:internal/main/run_main_module:*:* - Emitted 'error' event at: -diff --git a/test/message/events_unhandled_error_nexttick.out b/test/message/events_unhandled_error_nexttick.out -index 3e0d4697504e49eaae5ce1807a3794cccbcd6eec..87bb2fbb91a66e6dde9dfc61427682cba90f529c 100644 ---- a/test/message/events_unhandled_error_nexttick.out -+++ b/test/message/events_unhandled_error_nexttick.out -@@ -5,11 +5,11 @@ node:events:* - Error - at Object. (*events_unhandled_error_nexttick.js:*:*) - at Module._compile (node:internal/modules/cjs/loader:*:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*:*) - at Module.load (node:internal/modules/cjs/loader:*:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*:*) -+ at Module._load (node:internal/modules/cjs/loader:*:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*) - at node:internal/main/run_main_module:*:* - Emitted 'error' event at: - at *events_unhandled_error_nexttick.js:*:* -- at processTicksAndRejections (node:internal/process/task_queues:*:*) -+ at process.processTicksAndRejections (node:internal/process/task_queues:*:*) -diff --git a/test/message/events_unhandled_error_sameline.out b/test/message/events_unhandled_error_sameline.out -index c027275033941df96d6ab24c1647f110a0436d9a..872556a3b393e737adb4ed3b613f2c0cf20b1d2c 100644 ---- a/test/message/events_unhandled_error_sameline.out -+++ b/test/message/events_unhandled_error_sameline.out -@@ -5,9 +5,9 @@ node:events:* - Error - at Object. (*events_unhandled_error_sameline.js:*:*) - at Module._compile (node:internal/modules/cjs/loader:*:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*:*) - at Module.load (node:internal/modules/cjs/loader:*:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*:*) -+ at Module._load (node:internal/modules/cjs/loader:*:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*) - at node:internal/main/run_main_module:*:* - Emitted 'error' event at: -diff --git a/test/message/events_unhandled_error_subclass.out b/test/message/events_unhandled_error_subclass.out -index 5b8131970d50d50971184ccad0e2159c52fb0afd..073ab348a96f2e24efc2a661009287e4b7acda77 100644 ---- a/test/message/events_unhandled_error_subclass.out -+++ b/test/message/events_unhandled_error_subclass.out -@@ -5,9 +5,9 @@ node:events:* - Error - at Object. (*events_unhandled_error_subclass.js:*:*) - at Module._compile (node:internal/modules/cjs/loader:*:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*:*) - at Module.load (node:internal/modules/cjs/loader:*:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*:*) -+ at Module._load (node:internal/modules/cjs/loader:*:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*) - at node:internal/main/run_main_module:*:* - Emitted 'error' event on Foo instance at: -diff --git a/test/message/if-error-has-good-stack.out b/test/message/if-error-has-good-stack.out -index d87581cd7675346d51261efa4e0e28c57f9652eb..c5188137124d38f48989d6774a177795617b4974 100644 ---- a/test/message/if-error-has-good-stack.out -+++ b/test/message/if-error-has-good-stack.out -@@ -12,9 +12,9 @@ AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error - at a (*if-error-has-good-stack.js:*:*) - at Object. (*if-error-has-good-stack.js:*:*) - at Module._compile (node:internal/modules/cjs/loader:*:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*:*) - at Module.load (node:internal/modules/cjs/loader:*:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*:*) -+ at Module._load (node:internal/modules/cjs/loader:*:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*) - at node:internal/main/run_main_module:*:* { - generatedMessage: false, -@@ -25,9 +25,9 @@ AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error - at a (*if-error-has-good-stack.js:*:*) - at Object. (*if-error-has-good-stack.js:*:*) - at Module._compile (node:internal/modules/cjs/loader:*:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*:*) - at Module.load (node:internal/modules/cjs/loader:*:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*:*) -+ at Module._load (node:internal/modules/cjs/loader:*:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*) - at node:internal/main/run_main_module:*:* - expected: null, -diff --git a/test/message/nexttick_throw.out b/test/message/nexttick_throw.out -index 955bcda6a26da019c9954c80ef9db24ea3094bef..3180f9a7de5df66f30c9dcee697ddfbb97df3725 100644 ---- a/test/message/nexttick_throw.out -+++ b/test/message/nexttick_throw.out -@@ -4,4 +4,4 @@ - ^ - ReferenceError: undefined_reference_error_maker is not defined - at *test*message*nexttick_throw.js:*:* -- at processTicksAndRejections (node:internal/process/task_queues:*:*) -+ at process.processTicksAndRejections (node:internal/process/task_queues:*:*) -diff --git a/test/message/source_map_disabled_by_api.out b/test/message/source_map_disabled_by_api.out -index d2cca7da5297e3772ae1acf7b8901eada6c21112..bbe017b05a20edd736ea13e2b501f8d9fdc7d0e6 100644 ---- a/test/message/source_map_disabled_by_api.out -+++ b/test/message/source_map_disabled_by_api.out -@@ -5,9 +5,9 @@ Error: an error! - at functionA (*enclosing-call-site-min.js:1:26) - at Object. (*enclosing-call-site-min.js:1:199) - at Module._compile (node:internal/modules/cjs/loader:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*) - at Module.load (node:internal/modules/cjs/loader:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*) -+ at Module._load (node:internal/modules/cjs/loader:*) - at Module.require (node:internal/modules/cjs/loader:*) - *enclosing-call-site.js:16 - throw new Error('an error!') -@@ -20,7 +20,7 @@ Error: an error! - at functionA (*enclosing-call-site.js:2:3) - at Object. (*enclosing-call-site.js:24:3) - at Module._compile (node:internal/modules/cjs/loader:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*) - at Module.load (node:internal/modules/cjs/loader:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*) -+ at Module._load (node:internal/modules/cjs/loader:*) - at Module.require (node:internal/modules/cjs/loader:*) -diff --git a/test/message/source_map_enabled_by_api.out b/test/message/source_map_enabled_by_api.out -index 525ceccec12e4bdb8a08964ade461692ee99beca..e85ecee7f14a8ba1a599aeaf1d9f5f4855c42c5d 100644 ---- a/test/message/source_map_enabled_by_api.out -+++ b/test/message/source_map_enabled_by_api.out -@@ -9,9 +9,9 @@ Error: an error! - at functionA (*enclosing-call-site.js:2:3) - at Object. (*enclosing-call-site.js:24:3) - at Module._compile (node:internal/modules/cjs/loader:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*) - at Module.load (node:internal/modules/cjs/loader:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*) -+ at Module._load (node:internal/modules/cjs/loader:*) - at Module.require (node:internal/modules/cjs/loader:*) - *enclosing-call-site-min.js:1 - var functionA=function(){functionB()};function functionB(){functionC()}var functionC=function(){functionD()},functionD=function(){if(0 (*enclosing-call-site-min.js:1:199) - at Module._compile (node:internal/modules/cjs/loader:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*) - at Module.load (node:internal/modules/cjs/loader:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*) -+ at Module._load (node:internal/modules/cjs/loader:*) - at Module.require (node:internal/modules/cjs/loader:*) -diff --git a/test/message/source_map_enclosing_function.out b/test/message/source_map_enclosing_function.out -index 3eb76ecbbef31cd224e27001b825bce210f4e170..1babe95e398c61cdd3a4e1fd82fe418e4fbcd238 100644 ---- a/test/message/source_map_enclosing_function.out -+++ b/test/message/source_map_enclosing_function.out -@@ -9,7 +9,7 @@ Error: an error! - at functionA (*enclosing-call-site.js:2:3) - at Object. (*enclosing-call-site.js:24:3) - at Module._compile (node:internal/modules/cjs/loader:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*) - at Module.load (node:internal/modules/cjs/loader:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*) -+ at Module._load (node:internal/modules/cjs/loader:*) - at Module.require (node:internal/modules/cjs/loader:*) -diff --git a/test/message/source_map_eval.out b/test/message/source_map_eval.out -index 7cfd7c84fe65793cf01ee374506e18978774d730..533dbc6efc179c2d4cea844335e2863bf5741ad3 100644 ---- a/test/message/source_map_eval.out -+++ b/test/message/source_map_eval.out -@@ -3,8 +3,8 @@ ReferenceError: alert is not defined - at eval (*tabs.coffee:1:14) - at Object. (*source_map_eval.js:8:1) - at Module._compile (node:internal/modules/cjs/loader:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*) - at Module.load (node:internal/modules/cjs/loader:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*) -+ at Module._load (node:internal/modules/cjs/loader:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*) - at node:internal/main/run_main_module:* -diff --git a/test/message/source_map_reference_error_tabs.out b/test/message/source_map_reference_error_tabs.out -index bce1b5f8911d4b34d3165d7a4bc5195cbe29211d..d56ef13b20bf9ca333e8806e3905059583c1f991 100644 ---- a/test/message/source_map_reference_error_tabs.out -+++ b/test/message/source_map_reference_error_tabs.out -@@ -6,9 +6,9 @@ ReferenceError: alert is not defined - at *tabs.coffee:26:2* - at *tabs.coffee:1:14* - at Module._compile (node:internal/modules/cjs/loader:* -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:* -+ at Module._extensions..js (node:internal/modules/cjs/loader:* - at Module.load (node:internal/modules/cjs/loader:* -- at Function.Module._load (node:internal/modules/cjs/loader:* -+ at Module._load (node:internal/modules/cjs/loader:* - at Module.require (node:internal/modules/cjs/loader:* - at require (node:internal/modules/cjs/helpers:* - at Object. (*source_map_reference_error_tabs.js:* -diff --git a/test/message/source_map_throw_catch.out b/test/message/source_map_throw_catch.out -index 95bba5eee3e9dc6415ab44b7c842fc05b5d5dec2..9a98aa59e767592c04153c2a6d349710d7f28a2e 100644 ---- a/test/message/source_map_throw_catch.out -+++ b/test/message/source_map_throw_catch.out -@@ -6,9 +6,9 @@ Error: an exception - at *typescript-throw.ts:18:11* - at *typescript-throw.ts:24:1* - at Module._compile (node:internal/modules/cjs/loader:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*) - at Module.load (node:internal/modules/cjs/loader:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*) -+ at Module._load (node:internal/modules/cjs/loader:*) - at Module.require (node:internal/modules/cjs/loader:*) - at require (node:internal/modules/cjs/helpers:*) - at Object. (*source_map_throw_catch.js:6:3) -diff --git a/test/message/source_map_throw_first_tick.out b/test/message/source_map_throw_first_tick.out -index efa97a1d9f56ddbaf87422fa14d1f14f07a33061..1d76129d0c3506824d22be17711b1351285af937 100644 ---- a/test/message/source_map_throw_first_tick.out -+++ b/test/message/source_map_throw_first_tick.out -@@ -6,9 +6,9 @@ Error: an exception - at *typescript-throw.ts:18:11* - at *typescript-throw.ts:24:1* - at Module._compile (node:internal/modules/cjs/loader:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*) - at Module.load (node:internal/modules/cjs/loader:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*) -+ at Module._load (node:internal/modules/cjs/loader:*) - at Module.require (node:internal/modules/cjs/loader:*) - at require (node:internal/modules/cjs/helpers:*) - at Object. (*source_map_throw_first_tick.js:5:1) -diff --git a/test/message/source_map_throw_icu.out b/test/message/source_map_throw_icu.out -index 78482d73ddf0376de2443321c426fc6c84a1c29a..c5f699f80a9be862772ae5af8884d85bec72ebe3 100644 ---- a/test/message/source_map_throw_icu.out -+++ b/test/message/source_map_throw_icu.out -@@ -6,9 +6,9 @@ Error: an error - at *icu.jsx:3:23* - at *icu.jsx:9:5* - at Module._compile (node:internal/modules/cjs/loader:* -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:* -+ at Module._extensions..js (node:internal/modules/cjs/loader:* - at Module.load (node:internal/modules/cjs/loader:* -- at Function.Module._load (node:internal/modules/cjs/loader:* -+ at Module._load (node:internal/modules/cjs/loader:* - at Module.require (node:internal/modules/cjs/loader:* - at require (node:internal/modules/cjs/helpers:* - at Object. (*source_map_throw_icu.js:* -diff --git a/test/message/source_map_throw_set_immediate.out b/test/message/source_map_throw_set_immediate.out -index c735e23cb955c5cb733ae766bd019848764b7ff1..21349d4c4598c0abac50b2b90e3bbf9b439257f5 100644 ---- a/test/message/source_map_throw_set_immediate.out -+++ b/test/message/source_map_throw_set_immediate.out -@@ -5,4 +5,4 @@ - Error: goodbye - at Hello *uglify-throw-original.js:5:9* - at *uglify-throw-original.js:9:3* -- at processImmediate (node:internal/timers:*) -+ at process.processImmediate (node:internal/timers:*) -diff --git a/test/message/timeout_throw.out b/test/message/timeout_throw.out -index 66e495eb84d0bda0c3f6b5f085aa2061f0e1b59a..968a5e4e4117713e4bf347e56ff84001ec86bb31 100644 ---- a/test/message/timeout_throw.out -+++ b/test/message/timeout_throw.out -@@ -4,4 +4,4 @@ - ReferenceError: undefined_reference_error_maker is not defined - at Timeout._onTimeout (*test*message*timeout_throw.js:*:*) - at listOnTimeout (node:internal/timers:*:*) -- at processTimers (node:internal/timers:*:*) -+ at process.processTimers (node:internal/timers:*:*) -diff --git a/test/message/undefined_reference_in_new_context.out b/test/message/undefined_reference_in_new_context.out -index 61dee9f6d4fba3696b91333c5fbdc20cf8e819fe..b06dc02a4861bd0eae89c682db0dce426b7409f3 100644 ---- a/test/message/undefined_reference_in_new_context.out -+++ b/test/message/undefined_reference_in_new_context.out -@@ -12,5 +12,5 @@ ReferenceError: foo is not defined - at Module._compile (node:internal/modules/cjs/loader:*) - at *..js (node:internal/modules/cjs/loader:*) - at Module.load (node:internal/modules/cjs/loader:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*:*) -+ at Module._load (node:internal/modules/cjs/loader:*:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*) -diff --git a/test/message/vm_display_runtime_error.out b/test/message/vm_display_runtime_error.out -index 8f1e9c37967f253071ad20c5a4f2b81f7b65b8cc..d7a39915f999101d4f2bfcc5f7bc9ba77eab8f0d 100644 ---- a/test/message/vm_display_runtime_error.out -+++ b/test/message/vm_display_runtime_error.out -@@ -9,9 +9,9 @@ Error: boo! - at Object.runInThisContext (node:vm:*) - at Object. (*test*message*vm_display_runtime_error.js:*) - at Module._compile (node:internal/modules/cjs/loader:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*) - at Module.load (node:internal/modules/cjs/loader:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*) -+ at Module._load (node:internal/modules/cjs/loader:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*) - at node:internal/main/run_main_module:*:* - test.vm:1 -@@ -24,8 +24,8 @@ Error: spooky! - at Object.runInThisContext (node:vm:*) - at Object. (*test*message*vm_display_runtime_error.js:*) - at Module._compile (node:internal/modules/cjs/loader:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*) - at Module.load (node:internal/modules/cjs/loader:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*) -+ at Module._load (node:internal/modules/cjs/loader:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*) - at node:internal/main/run_main_module:*:* -diff --git a/test/message/vm_display_syntax_error.out b/test/message/vm_display_syntax_error.out -index b0b70fcd75966825e0ff1893ff984a3e20edc926..ce82fb366e0375eeea8ced2320a3662584411160 100644 ---- a/test/message/vm_display_syntax_error.out -+++ b/test/message/vm_display_syntax_error.out -@@ -8,9 +8,9 @@ SyntaxError: Unexpected number - at Object.runInThisContext (node:vm:*) - at Object. (*test*message*vm_display_syntax_error.js:*) - at Module._compile (node:internal/modules/cjs/loader:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*) - at Module.load (node:internal/modules/cjs/loader:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*) -+ at Module._load (node:internal/modules/cjs/loader:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*) - at node:internal/main/run_main_module:*:* - test.vm:1 -@@ -22,8 +22,8 @@ SyntaxError: Unexpected number - at Object.runInThisContext (node:vm:*) - at Object. (*test*message*vm_display_syntax_error.js:*) - at Module._compile (node:internal/modules/cjs/loader:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*) - at Module.load (node:internal/modules/cjs/loader:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*) -+ at Module._load (node:internal/modules/cjs/loader:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*) - at node:internal/main/run_main_module:*:* -diff --git a/test/message/vm_dont_display_runtime_error.out b/test/message/vm_dont_display_runtime_error.out -index 2ff2e8355ab90c8d9d00aaa6bf743c4f3b7d0de0..72ef73d628e10f600e5e3e90691587f2f63b1a69 100644 ---- a/test/message/vm_dont_display_runtime_error.out -+++ b/test/message/vm_dont_display_runtime_error.out -@@ -10,8 +10,8 @@ Error: boo! - at Object.runInThisContext (node:vm:*) - at Object. (*test*message*vm_dont_display_runtime_error.js:*) - at Module._compile (node:internal/modules/cjs/loader:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*) - at Module.load (node:internal/modules/cjs/loader:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*) -+ at Module._load (node:internal/modules/cjs/loader:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*) - at node:internal/main/run_main_module:*:* -diff --git a/test/message/vm_dont_display_syntax_error.out b/test/message/vm_dont_display_syntax_error.out -index d46dce2993f863622d2764d816adda548e568121..2ce14fe4013df2aa37c0339880294ba804c4f0c3 100644 ---- a/test/message/vm_dont_display_syntax_error.out -+++ b/test/message/vm_dont_display_syntax_error.out -@@ -10,8 +10,8 @@ SyntaxError: Unexpected number - at Object.runInThisContext (node:vm:*) - at Object. (*test*message*vm_dont_display_syntax_error.js:*) - at Module._compile (node:internal/modules/cjs/loader:*) -- at Object.Module._extensions..js (node:internal/modules/cjs/loader:*) -+ at Module._extensions..js (node:internal/modules/cjs/loader:*) - at Module.load (node:internal/modules/cjs/loader:*) -- at Function.Module._load (node:internal/modules/cjs/loader:*) -+ at Module._load (node:internal/modules/cjs/loader:*) - at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*) - at node:internal/main/run_main_module:*:* diff --git a/patches/node/fix_prevent_changing_functiontemplateinfo_after_publish.patch b/patches/node/fix_prevent_changing_functiontemplateinfo_after_publish.patch new file mode 100644 index 00000000000000..ac44e23703663b --- /dev/null +++ b/patches/node/fix_prevent_changing_functiontemplateinfo_after_publish.patch @@ -0,0 +1,61 @@ +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 f88270fc75de91610a973c0649e1bc699c3e014d..e47f7a597a6ca0cfd71fec1e42f0fbb75cb539c7 100644 +--- a/src/node_messaging.cc ++++ b/src/node_messaging.cc +@@ -1467,13 +1467,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_serdes_test.patch b/patches/node/fix_serdes_test.patch index 84190f55f70c8b..a49ad55630c3ce 100644 --- a/patches/node/fix_serdes_test.patch +++ b/patches/node/fix_serdes_test.patch @@ -6,26 +6,24 @@ Subject: fix serdes test The V8 wire format version changed. diff --git a/test/parallel/test-v8-serdes.js b/test/parallel/test-v8-serdes.js -index ef9ef5945dba3b0748d5d0671f87eb20984de3c4..12f20ed1c9d386122dd20fdd84a7a0c9b9079ee1 100644 +index 1b6638ac1a90bdcec618b6c7b2a51c21fe6b548e..5ce5668925f0defb685d77063212f42eb524b3ad 100644 --- a/test/parallel/test-v8-serdes.js +++ b/test/parallel/test-v8-serdes.js -@@ -163,7 +163,7 @@ const hostObject = new (internalBinding('js_stream').JSStream)(); - } +@@ -164,11 +164,11 @@ const hostObject = new (internalBinding('js_stream').JSStream)(); { + // Test that an old serialized value can still be deserialized. - const buf = Buffer.from('ff0d6f2203666f6f5e007b01', 'hex'); -+ const buf = Buffer.from('ff0e6f2203666f6f5e007b01', 'hex'); ++ const buf = Buffer.from('ff0f6f2203666f6f5e007b01', 'hex'); const des = new v8.DefaultDeserializer(buf); des.readHeader(); -@@ -174,13 +174,13 @@ const hostObject = new (internalBinding('js_stream').JSStream)(); - ser.writeValue(des.readValue()); - - assert.deepStrictEqual(buf, ser.releaseBuffer()); - assert.strictEqual(des.getWireFormatVersion(), 0x0d); -+ assert.strictEqual(des.getWireFormatVersion(), 0x0e); - } ++ assert.strictEqual(des.getWireFormatVersion(), 0x0f); + const value = des.readValue(); + assert.strictEqual(value, value.foo); +@@ -203,7 +203,7 @@ const hostObject = new (internalBinding('js_stream').JSStream)(); { // Unaligned Uint16Array read, with padding in the underlying array buffer. let buf = Buffer.alloc(32 + 9); diff --git a/patches/node/fixup_for_wc_98-compat-extra-semi.patch b/patches/node/fixup_for_wc_98-compat-extra-semi.patch index d0da196ba89486..59286b5160b9ef 100644 --- a/patches/node/fixup_for_wc_98-compat-extra-semi.patch +++ b/patches/node/fixup_for_wc_98-compat-extra-semi.patch @@ -7,7 +7,7 @@ Wc++98-compat-extra-semi is turned on for Electron so this patch fixes that error in node. diff --git a/src/node_serdes.cc b/src/node_serdes.cc -index 92d5020f293c98c81d3891a82f7320629bf9f926..2e815154ddbbd687e9c823cb7d42f11b7cb48000 100644 +index 0cd76078218433b46c17f350e3ba6073987438cf..ba13061b6aa7fd8f877aa456db9d352a847e682a 100644 --- a/src/node_serdes.cc +++ b/src/node_serdes.cc @@ -32,7 +32,7 @@ namespace serdes { diff --git a/patches/node/heap_remove_allocationspace_map_space_enum_constant.patch b/patches/node/heap_remove_allocationspace_map_space_enum_constant.patch index fb20fdd2e751f4..d8045bceb88a3d 100644 --- a/patches/node/heap_remove_allocationspace_map_space_enum_constant.patch +++ b/patches/node/heap_remove_allocationspace_map_space_enum_constant.patch @@ -7,10 +7,10 @@ This was removed in: https://chromium-review.googlesource.com/c/v8/v8/+/3967841 diff --git a/test/parallel/test-v8-stats.js b/test/parallel/test-v8-stats.js -index 98ad11f11f9b9bf5699801814f8234e84dfaf638..678cb7626bc82bea17129ce2f8a4590350bf0983 100644 +index 3af7ea1e4a4598dc4125ff78e426d6dc6a025c66..83b375bd3c5b5dbd5189d48ad560580883ac91f6 100644 --- a/test/parallel/test-v8-stats.js +++ b/test/parallel/test-v8-stats.js -@@ -41,7 +41,6 @@ const expectedHeapSpaces = [ +@@ -42,7 +42,6 @@ const expectedHeapSpaces = [ 'code_large_object_space', 'code_space', 'large_object_space', diff --git a/patches/node/pass_all_globals_through_require.patch b/patches/node/pass_all_globals_through_require.patch index cf7be469508239..3cd86f92ab5fa3 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 f1971c40a447b251f524717b906a5435bf0a0556..a65094ec21b0f40ab562608a9eeb36c5626cda31 100644 +index 67133b4926763429f4324c4f751d20c3c50a9155..ca83fa412f1979c0037254253939fd6dff6b5010 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -127,6 +127,13 @@ const { +@@ -133,6 +133,13 @@ const { CHAR_COLON } = require('internal/constants'); @@ -23,7 +23,7 @@ index f1971c40a447b251f524717b906a5435bf0a0556..a65094ec21b0f40ab562608a9eeb36c5 const { isProxy } = require('internal/util/types'); -@@ -1121,10 +1128,12 @@ Module.prototype._compile = function(content, filename) { +@@ -1144,10 +1151,12 @@ Module.prototype._compile = function(content, filename) { if (requireDepth === 0) statCache = new SafeMap(); if (inspectorWrapper) { result = inspectorWrapper(compiledWrapper, thisValue, exports, diff --git a/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch b/patches/node/refactor_allow_embedder_overriding_of_internal_fs_calls.patch index 33dabeac8720ff..b92ff9c350eb3f 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,25 +7,25 @@ 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 67cbdb9db09ca78f859032696c86f128bad64c46..376680f015d09a2cf3ce62de1fdeb9c5ed4c300b 100644 +index d2b82e7b699cd70ca300f4b036b88033e135910e..f2da9d4a1293d9879b0bb0867e68f7196f667dc6 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js -@@ -66,6 +66,10 @@ setupBuffer(); - process.domain = null; +@@ -88,6 +88,10 @@ process.domain = null; + } process._exiting = false; +// NOTE: Electron deletes this references before user code runs so that -+// internalBinding is not leaked to user code ++// internalBinding is not leaked to user code. +process.internalBinding = internalBinding; + // process.config is serialized config.gypi - const nativeModule = internalBinding('native_module'); + const nativeModule = internalBinding('builtins'); diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js -index a65094ec21b0f40ab562608a9eeb36c5626cda31..3a536aab1bdeea6829d76d6af48fdefe0e08908d 100644 +index ca83fa412f1979c0037254253939fd6dff6b5010..4b592b0f7d9d481ee746b4e6db07620a27284f17 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js -@@ -86,7 +86,7 @@ const fs = require('fs'); +@@ -92,7 +92,7 @@ const fs = require('fs'); const internalFS = require('internal/fs/utils'); const path = require('path'); const { sep } = path; @@ -34,7 +34,7 @@ index a65094ec21b0f40ab562608a9eeb36c5626cda31..3a536aab1bdeea6829d76d6af48fdefe const packageJsonReader = require('internal/modules/package_json_reader'); const { safeGetenv } = internalBinding('credentials'); const { -@@ -161,7 +161,7 @@ function stat(filename) { +@@ -167,7 +167,7 @@ function stat(filename) { const result = statCache.get(filename); if (result !== undefined) return result; } 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 14da2c59673a1f..913f75736762b2 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,13 +7,14 @@ 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 77b9ff35ff6ea780121aa1f4bb71850b9245965a..2a91c4820bebf55068c4d54a2e1133176de77a6d 100644 +index 6ce21363e1ee6acdd2e48763d0637ef1983e5264..f448bde2a570480a4390daf5392dc9d9b0f52df3 100644 --- a/lib/child_process.js +++ b/lib/child_process.js -@@ -161,6 +161,15 @@ function fork(modulePath, args = [], options) { - throw new ERR_CHILD_PROCESS_IPC_REQUIRED('options.stdio'); +@@ -136,6 +136,16 @@ function fork(modulePath, args = [], options) { + validateObject(options, 'options'); } - + options = { ...options, shell: false }; ++ + // When forking a child script, we setup a special environment to make + // the electron binary run like upstream Node.js + options.env = Object.create(options.env || process.env) @@ -24,5 +25,5 @@ index 77b9ff35ff6ea780121aa1f4bb71850b9245965a..2a91c4820bebf55068c4d54a2e113317 + } + options.execPath = options.execPath || process.execPath; - options.shell = false; + // Prepare arguments for fork: diff --git a/patches/node/repl_fix_crash_when_sharedarraybuffer_disabled.patch b/patches/node/repl_fix_crash_when_sharedarraybuffer_disabled.patch index cef8d21ccc373a..1eb1e9bd2045e6 100644 --- a/patches/node/repl_fix_crash_when_sharedarraybuffer_disabled.patch +++ b/patches/node/repl_fix_crash_when_sharedarraybuffer_disabled.patch @@ -25,28 +25,27 @@ index a771b1813731edf4f0dd60f3505799e389f1d876..b9461677e2d7d1df192e752496e62cca bench.start(); for (let i = 0; i < n; i++) diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js -index e21c1b1fe2cc7f55d3782419913568f51f1a87ea..1b6a8242bbd9eeb901950f1b9016bc2b85af5951 100644 +index cd9ca227b9cac4ff021ce1643000ea4b45163df6..0846afec28ab5fb507eb5f3eb211f635d61dca17 100644 --- a/lib/internal/main/worker_thread.js +++ b/lib/internal/main/worker_thread.js -@@ -9,7 +9,7 @@ const { - ArrayPrototypeSplice, +@@ -10,7 +10,7 @@ const { ObjectDefineProperty, - PromisePrototypeCatch, + PromisePrototypeThen, + RegExpPrototypeExec, - globalThis: { Atomics }, + globalThis: { Atomics, SharedArrayBuffer }, } = primordials; const { -@@ -150,6 +150,9 @@ port.on('message', (message) => { - const originalCwd = process.cwd; +@@ -157,6 +157,8 @@ port.on('message', (message) => { process.cwd = function() { + const currentCounter = Atomics.load(cwdCounter, 0); + // SharedArrayBuffers can be disabled with --no-harmony-sharedarraybuffer. + if (typeof SharedArrayBuffer === 'undefined') return originalCwd(); -+ - const currentCounter = Atomics.load(cwdCounter, 0); if (currentCounter === lastCounter) return cachedCwd; + lastCounter = currentCounter; diff --git a/lib/internal/worker.js b/lib/internal/worker.js index 8e396195209b83dff572792a78ee75d12d1f6610..4bb09b6ab5c31206a622814cbcd793c434b885d4 100644 --- a/lib/internal/worker.js diff --git a/patches/node/src_allow_embedders_to_provide_a_custom_pageallocator_to.patch b/patches/node/src_allow_embedders_to_provide_a_custom_pageallocator_to.patch deleted file mode 100644 index 646869cfd211bd..00000000000000 --- a/patches/node/src_allow_embedders_to_provide_a_custom_pageallocator_to.patch +++ /dev/null @@ -1,128 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Samuel Attard -Date: Tue, 3 Nov 2020 16:17:38 -0800 -Subject: src: allow embedders to provide a custom PageAllocator to - NodePlatform - -For certain embedder use cases there are more complex memory allocation requirements that -the default V8 page allocator does not handle, for example using MAP_JIT when running under -a hardened runtime environment on macOS. This allows such embedders to provide their own -allocator that does handle these cases. - -Upstreamed in https://github.com/nodejs/node/pull/38362. - -diff --git a/src/api/environment.cc b/src/api/environment.cc -index 9d33ebdc35516f65a977f7c1125453b0c99bee28..9cbe99596b1b8c148ac076acf8a9623d6989d505 100644 ---- a/src/api/environment.cc -+++ b/src/api/environment.cc -@@ -481,8 +481,9 @@ MultiIsolatePlatform* CreatePlatform( - - MultiIsolatePlatform* CreatePlatform( - int thread_pool_size, -- v8::TracingController* tracing_controller) { -- return MultiIsolatePlatform::Create(thread_pool_size, tracing_controller) -+ v8::TracingController* tracing_controller, -+ v8::PageAllocator* page_allocator) { -+ return MultiIsolatePlatform::Create(thread_pool_size, tracing_controller, page_allocator) - .release(); - } - -@@ -492,8 +493,9 @@ void FreePlatform(MultiIsolatePlatform* platform) { - - std::unique_ptr MultiIsolatePlatform::Create( - int thread_pool_size, -- v8::TracingController* tracing_controller) { -- return std::make_unique(thread_pool_size, tracing_controller); -+ v8::TracingController* tracing_controller, -+ v8::PageAllocator* page_allocator) { -+ return std::make_unique(thread_pool_size, tracing_controller, page_allocator); - } - - MaybeLocal GetPerContextExports(Local context) { -diff --git a/src/node.h b/src/node.h -index be619162d17728c1eb2ddf740947067913d6a348..4eee4e96349ee49423d53819dd90a213f6a6e042 100644 ---- a/src/node.h -+++ b/src/node.h -@@ -342,7 +342,8 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform { - - static std::unique_ptr Create( - int thread_pool_size, -- v8::TracingController* tracing_controller = nullptr); -+ v8::TracingController* tracing_controller = nullptr, -+ v8::PageAllocator* page_allocator = nullptr); - }; - - enum IsolateSettingsFlags { -@@ -539,7 +540,8 @@ NODE_EXTERN node::tracing::Agent* CreateAgent(); - NODE_DEPRECATED("Use MultiIsolatePlatform::Create() instead", - NODE_EXTERN MultiIsolatePlatform* CreatePlatform( - int thread_pool_size, -- v8::TracingController* tracing_controller)); -+ v8::TracingController* tracing_controller, -+ v8::PageAllocator* = nullptr)); - NODE_DEPRECATED("Use MultiIsolatePlatform::Create() instead", - NODE_EXTERN void FreePlatform(MultiIsolatePlatform* platform)); - -diff --git a/src/node_platform.cc b/src/node_platform.cc -index eb918bdd559c404a0e311e0dd92cfee8940491bc..5be79694fef65c9290f1b46d2657581dea16f543 100644 ---- a/src/node_platform.cc -+++ b/src/node_platform.cc -@@ -324,12 +324,16 @@ void PerIsolatePlatformData::DecreaseHandleCount() { - } - - NodePlatform::NodePlatform(int thread_pool_size, -- v8::TracingController* tracing_controller) { -+ v8::TracingController* tracing_controller, -+ v8::PageAllocator* page_allocator) { - if (tracing_controller != nullptr) { - tracing_controller_ = tracing_controller; - } else { - tracing_controller_ = new v8::TracingController(); - } -+ // This being nullptr is acceptable as V8 will default to its built -+ // in allocator if none is provided -+ page_allocator_ = page_allocator; - // TODO(addaleax): It's a bit icky that we use global state here, but we can't - // really do anything about it unless V8 starts exposing a way to access the - // current v8::Platform instance. -@@ -550,6 +554,10 @@ Platform::StackTracePrinter NodePlatform::GetStackTracePrinter() { - }; - } - -+v8::PageAllocator* NodePlatform::GetPageAllocator() { -+ return page_allocator_; -+} -+ - template - TaskQueue::TaskQueue() - : lock_(), tasks_available_(), tasks_drained_(), -diff --git a/src/node_platform.h b/src/node_platform.h -index a7139ebdcc28d24087fb49697a0973331e0387a6..4a05f3bba58c8e875d0ab67f292589edbb3b812b 100644 ---- a/src/node_platform.h -+++ b/src/node_platform.h -@@ -138,7 +138,8 @@ class WorkerThreadsTaskRunner { - class NodePlatform : public MultiIsolatePlatform { - public: - NodePlatform(int thread_pool_size, -- v8::TracingController* tracing_controller); -+ v8::TracingController* tracing_controller, -+ v8::PageAllocator* page_allocator = nullptr); - ~NodePlatform() override; - - void DrainTasks(v8::Isolate* isolate) override; -@@ -170,6 +171,7 @@ class NodePlatform : public MultiIsolatePlatform { - v8::Isolate* isolate) override; - - Platform::StackTracePrinter GetStackTracePrinter() override; -+ v8::PageAllocator* GetPageAllocator() override; - - private: - IsolatePlatformDelegate* ForIsolate(v8::Isolate* isolate); -@@ -181,6 +183,7 @@ class NodePlatform : public MultiIsolatePlatform { - std::unordered_map per_isolate_; - - v8::TracingController* tracing_controller_; -+ v8::PageAllocator* page_allocator_; - std::shared_ptr worker_thread_task_runner_; - bool has_shut_down_ = false; - }; diff --git a/patches/node/src_fix_ssize_t_error_from_nghttp2_h.patch b/patches/node/src_fix_ssize_t_error_from_nghttp2_h.patch deleted file mode 100644 index 71f5d6cf43bc20..00000000000000 --- a/patches/node/src_fix_ssize_t_error_from_nghttp2_h.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Darshan Sen -Date: Thu, 25 Aug 2022 18:08:10 +0530 -Subject: src: fix ssize_t error from nghttp2.h - -The "node_http2.h" include reordering enforced by clang-format broke Electron's -Node.js upgrade on Windows. ssize_t is a part of the POSIX standard and it's not -available on Windows, so the fix for this is to typedef it on Windows like in -https://github.com/nodejs/node/blob/bb4dff783ddb3b20c67041f7ccef796c335c2407/src/node.h#L212-L220. - -Refs: https://github.com/electron/electron/pull/35350#discussion_r954890551 -Signed-off-by: Darshan Sen - -diff --git a/src/node_http2.h b/src/node_http2.h -index 5bd715da8a269799ce8e6746a98184411dd859e0..6f3b93943b90e5984502f5d521b81bafad164fc7 100644 ---- a/src/node_http2.h -+++ b/src/node_http2.h -@@ -5,6 +5,9 @@ - - // FIXME(joyeecheung): nghttp2.h needs stdint.h to compile on Windows - #include -+// clang-format off -+#include "node.h" // nghttp2.h needs ssize_t -+// clang-format on - #include "nghttp2/nghttp2.h" - - #include "env.h" diff --git a/patches/node/src_iwyu_in_cleanup_queue_cc.patch b/patches/node/src_iwyu_in_cleanup_queue_cc.patch new file mode 100644 index 00000000000000..2554390c32c5a6 --- /dev/null +++ b/patches/node/src_iwyu_in_cleanup_queue_cc.patch @@ -0,0 +1,17 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Shelley Vohr +Date: Wed, 12 Oct 2022 21:28:57 +0200 +Subject: src: iwyu in cleanup_queue.cc + +Upstreamed in https://github.com/nodejs/node/pull/44983. + +diff --git a/src/cleanup_queue.cc b/src/cleanup_queue.cc +index 5235513f16c2574a88675d5a2f19d9cae3c417ac..6290b6796c532702fb5e7549ff0c3ad14d2b89d8 100644 +--- a/src/cleanup_queue.cc ++++ b/src/cleanup_queue.cc +@@ -1,4 +1,5 @@ + #include "cleanup_queue.h" // NOLINT(build/include_inline) ++#include + #include + #include "cleanup_queue-inl.h" + diff --git a/patches/node/src_update_importmoduledynamically.patch b/patches/node/src_update_importmoduledynamically.patch deleted file mode 100644 index 70ccfd281afdf0..00000000000000 --- a/patches/node/src_update_importmoduledynamically.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Camillo Bruni -Date: Mon, 15 Nov 2021 15:34:38 +0100 -Subject: src: update ImportModuleDynamically - -PR-URL: https://github.com/nodejs/node/pull/41610 -Reviewed-By: Jiawen Geng -Reviewed-By: Antoine du Hamel -Reviewed-By: Darshan Sen -Reviewed-By: Colin Ihrig - -diff --git a/src/module_wrap.cc b/src/module_wrap.cc -index b4b70ec1afd3eaa2489075156e7ccd7682ddd307..50ce8d510cb1a4299f3c161198ee6ed63fabc05f 100644 ---- a/src/module_wrap.cc -+++ b/src/module_wrap.cc -@@ -46,7 +46,6 @@ using v8::PrimitiveArray; - using v8::Promise; - using v8::ScriptCompiler; - using v8::ScriptOrigin; --using v8::ScriptOrModule; - using v8::String; - using v8::UnboundModuleScript; - using v8::Undefined; -@@ -553,7 +552,8 @@ MaybeLocal ModuleWrap::ResolveModuleCallback( - - static MaybeLocal ImportModuleDynamically( - Local context, -- Local referrer, -+ Local host_defined_options, -+ Local resource_name, - Local specifier, - Local import_assertions) { - Isolate* isolate = context->GetIsolate(); -@@ -568,7 +568,7 @@ static MaybeLocal ImportModuleDynamically( - Local import_callback = - env->host_import_module_dynamically_callback(); - -- Local options = referrer->GetHostDefinedOptions(); -+ Local options = host_defined_options.As(); - if (options->Length() != HostDefinedOptions::kLength) { - Local resolver; - if (!Promise::Resolver::New(context).ToLocal(&resolver)) return {}; -@@ -582,11 +582,11 @@ static MaybeLocal ImportModuleDynamically( - - Local object; - -- int type = options->Get(isolate, HostDefinedOptions::kType) -+ int type = options->Get(context, HostDefinedOptions::kType) - .As() - ->Int32Value(context) - .ToChecked(); -- uint32_t id = options->Get(isolate, HostDefinedOptions::kID) -+ uint32_t id = options->Get(context, HostDefinedOptions::kID) - .As() - ->Uint32Value(context) - .ToChecked(); diff --git a/patches/node/support_v8_sandboxed_pointers.patch b/patches/node/support_v8_sandboxed_pointers.patch index 9c78499e61cd42..3e501f8e05560c 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 9cbe99596b1b8c148ac076acf8a9623d6989d505..93d85d46dc6b3b30795b88ffa8070253f62e51bd 100644 +index 8a7ad50b818448fa14eb4707c1dcec2a1339d2db..b6981c37d5b286e22f24d11751eb05f72ca27619 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc -@@ -80,6 +80,14 @@ MaybeLocal PrepareStackTraceCallback(Local context, +@@ -82,6 +82,14 @@ MaybeLocal PrepareStackTraceCallback(Local context, return result; } @@ -26,10 +26,10 @@ index 9cbe99596b1b8c148ac076acf8a9623d6989d505..93d85d46dc6b3b30795b88ffa8070253 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 840fe824617b951d4f4421155c5e1ce79c28525e..b1ae378993723d7a0a71bfe36fc5be94a899082a 100644 +index 51973d7cb15f0650f3e94a7b8c9811c550ee9b0f..1ab08092e8b8ad8a989eaa18f8e573b5948d295f 100644 --- a/src/crypto/crypto_util.cc +++ b/src/crypto/crypto_util.cc -@@ -332,10 +332,35 @@ ByteSource& ByteSource::operator=(ByteSource&& other) noexcept { +@@ -326,10 +326,35 @@ ByteSource& ByteSource::operator=(ByteSource&& other) noexcept { return *this; } @@ -66,7 +66,7 @@ index 840fe824617b951d4f4421155c5e1ce79c28525e..b1ae378993723d7a0a71bfe36fc5be94 std::unique_ptr ptr = ArrayBuffer::NewBackingStore( allocated_data_, size(), -@@ -347,10 +372,11 @@ std::unique_ptr ByteSource::ReleaseToBackingStore() { +@@ -341,10 +366,11 @@ std::unique_ptr ByteSource::ReleaseToBackingStore() { data_ = nullptr; size_ = 0; return ptr; @@ -79,10 +79,10 @@ index 840fe824617b951d4f4421155c5e1ce79c28525e..b1ae378993723d7a0a71bfe36fc5be94 return ArrayBuffer::New(env->isolate(), std::move(store)); } -@@ -680,6 +706,16 @@ CryptoJobMode GetCryptoJobMode(v8::Local args) { - } - - namespace { +@@ -658,6 +684,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. +#if defined(V8_ENABLE_SANDBOX) +// When V8 sandboxed pointers are enabled, the secure heap cannot be used as +// all ArrayBuffers must be allocated inside the V8 memory cage. @@ -93,10 +93,10 @@ index 840fe824617b951d4f4421155c5e1ce79c28525e..b1ae378993723d7a0a71bfe36fc5be94 + args.GetReturnValue().Set(Uint8Array::New(buffer, 0, len)); +} +#else - // SecureBuffer uses openssl to allocate a Uint8Array using - // OPENSSL_secure_malloc. Because we do not yet actually - // make use of secure heap, this has the same semantics as -@@ -707,6 +743,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { + void SecureBuffer(const FunctionCallbackInfo& args) { + CHECK(args[0]->IsUint32()); + Environment* env = Environment::GetCurrent(args); +@@ -679,6 +715,7 @@ void SecureBuffer(const FunctionCallbackInfo& args) { Local buffer = ArrayBuffer::New(env->isolate(), store); args.GetReturnValue().Set(Uint8Array::New(buffer, 0, len)); } @@ -105,10 +105,10 @@ index 840fe824617b951d4f4421155c5e1ce79c28525e..b1ae378993723d7a0a71bfe36fc5be94 void SecureHeapUsed(const FunctionCallbackInfo& args) { #ifndef OPENSSL_IS_BORINGSSL diff --git a/src/crypto/crypto_util.h b/src/crypto/crypto_util.h -index f26422ee106ab7a816750ee717cb18ea454b5b62..5e5798e7e55dbb2df93ef4a8ab6f40aeb85616b4 100644 +index dc3bb15cfb48a8fdca471ac87840a8de30437920..f54555ae83e0bc2a4fc1bd1c6da08b30dfc1c6e4 100644 --- a/src/crypto/crypto_util.h +++ b/src/crypto/crypto_util.h -@@ -241,7 +241,7 @@ class ByteSource { +@@ -279,7 +279,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. @@ -118,7 +118,7 @@ index f26422ee106ab7a816750ee717cb18ea454b5b62..5e5798e7e55dbb2df93ef4a8ab6f40ae v8::Local ToArrayBuffer(Environment* env); diff --git a/src/node_i18n.cc b/src/node_i18n.cc -index c537a247f55ff070da1988fc8b7309b5692b5c18..59bfb597849cd5a94800d6c83b238ef77245243e 100644 +index 581d52a7d05738133e5c3fad33cb73b7c575ef0b..6a4f24aa1d6853826e7ab5c729918c9048284128 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -104,7 +104,7 @@ namespace { @@ -131,10 +131,10 @@ index c537a247f55ff070da1988fc8b7309b5692b5c18..59bfb597849cd5a94800d6c83b238ef7 return ret; diff --git a/src/node_internals.h b/src/node_internals.h -index f7314c906e580664be445a8912030e17a3ac2fa4..99258ad0aa1e15ea1ba139fd0e83111e1436cc40 100644 +index 1449d2acd327b9cbbe32286ec6b7f6b412e693a2..d626d86c8dd8be78b3035be77867903fa0be68d7 100644 --- a/src/node_internals.h +++ b/src/node_internals.h -@@ -97,7 +97,9 @@ bool InitializePrimordials(v8::Local context); +@@ -99,7 +99,9 @@ v8::Maybe InitializePrimordials(v8::Local context); class NodeArrayBufferAllocator : public ArrayBufferAllocator { public: @@ -145,7 +145,7 @@ index f7314c906e580664be445a8912030e17a3ac2fa4..99258ad0aa1e15ea1ba139fd0e83111e void* Allocate(size_t size) override; // Defined in src/node.cc void* AllocateUninitialized(size_t size) override; -@@ -116,7 +118,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator { +@@ -118,7 +120,7 @@ class NodeArrayBufferAllocator : public ArrayBufferAllocator { } private: @@ -155,7 +155,7 @@ index f7314c906e580664be445a8912030e17a3ac2fa4..99258ad0aa1e15ea1ba139fd0e83111e // Delegate to V8's allocator for compatibility with the V8 memory cage. diff --git a/src/node_serdes.cc b/src/node_serdes.cc -index f6f0034bc24d09e3ad65491c7d6be0b9c9db1581..92d5020f293c98c81d3891a82f7320629bf9f926 100644 +index 45a16d9de43703c2115dde85c9faae3a04be2a88..0cd76078218433b46c17f350e3ba6073987438cf 100644 --- a/src/node_serdes.cc +++ b/src/node_serdes.cc @@ -29,6 +29,11 @@ using v8::ValueSerializer; diff --git a/patches/node/worker_thread_add_asar_support.patch b/patches/node/worker_thread_add_asar_support.patch deleted file mode 100644 index ec2526ecbd39ca..00000000000000 --- a/patches/node/worker_thread_add_asar_support.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Fedor Indutny -Date: Wed, 9 Mar 2022 17:52:32 -0800 -Subject: worker_thread: add asar support - -This patch initializes asar support in workers threads in -Node.js. - -diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js -index 4b1f1b05b6c67f206f87618792fa528deb238d8d..8993197ebd9eb54ec918767e16d665caebbf3554 100644 ---- a/lib/internal/bootstrap/pre_execution.js -+++ b/lib/internal/bootstrap/pre_execution.js -@@ -609,6 +609,7 @@ module.exports = { - loadPreloadModules, - setupTraceCategoryState, - setupInspectorHooks, -+ setupAsarSupport, - initializeReport, - initializeCJSLoader, - initializeWASI -diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js -index 1b6a8242bbd9eeb901950f1b9016bc2b85af5951..af32601bc4bf0c7c61ee3ca0500bf26255081458 100644 ---- a/lib/internal/main/worker_thread.js -+++ b/lib/internal/main/worker_thread.js -@@ -30,6 +30,7 @@ const { - initializeReport, - initializeSourceMapsHandlers, - loadPreloadModules, -+ setupAsarSupport, - setupTraceCategoryState - } = require('internal/bootstrap/pre_execution'); - -@@ -162,6 +163,8 @@ port.on('message', (message) => { - }; - workerIo.sharedCwdCounter = cwdCounter; - -+ setupAsarSupport(); -+ - const CJSLoader = require('internal/modules/cjs/loader'); - assert(!CJSLoader.hasLoadedAnyUserCJSModule); - loadPreloadModules(); diff --git a/script/node-disabled-tests.json b/script/node-disabled-tests.json index 9aed5c7f0ebe24..2477f1dc51778d 100644 --- a/script/node-disabled-tests.json +++ b/script/node-disabled-tests.json @@ -11,6 +11,9 @@ "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", @@ -36,6 +39,16 @@ "parallel/test-process-versions", "parallel/test-repl", "parallel/test-repl-underscore", + "parallel/test-snapshot-api", + "parallel/test-snapshot-basic", + "parallel/test-snapshot-console", + "parallel/test-snapshot-cjs-main", + "parallel/test-snapshot-error", + "parallel/test-snapshot-gzip", + "parallel/test-snapshot-umd", + "parallel/test-snapshot-eval", + "parallel/test-snapshot-warning", + "parallel/test-snapshot-typescript", "parallel/test-stdout-close-catch", "parallel/test-tls-cert-chains-concat", "parallel/test-tls-cert-chains-in-ca", @@ -93,7 +106,9 @@ "parallel/test-trace-events-dynamic-enable-workers-disabled", "parallel/test-trace-events-environment", "parallel/test-trace-events-file-pattern", + "parallel/test-trace-events-fs-async", "parallel/test-trace-events-fs-sync", + "parallel/test-trace-events-http", "parallel/test-trace-events-metadata", "parallel/test-trace-events-net", "parallel/test-trace-events-none", @@ -102,24 +117,23 @@ "parallel/test-trace-events-v8", "parallel/test-trace-events-vm", "parallel/test-trace-events-worker-metadata", - "parallel/test-v8-untrusted-code-mitigations", - "parallel/test-webcrypto-derivebits-node-dh", + "parallel/test-wasm-web-api", "parallel/test-webcrypto-derivebits-cfrg", "parallel/test-webcrypto-derivekey-cfrg", - "parallel/test-webcrypto-ed25519-ed448", "parallel/test-webcrypto-encrypt-decrypt", "parallel/test-webcrypto-encrypt-decrypt-aes", "parallel/test-webcrypto-encrypt-decrypt-rsa", "parallel/test-webcrypto-export-import-cfrg", "parallel/test-webcrypto-keygen", - "parallel/test-webcrypto-rsa-pss-params", - "parallel/test-webcrypto-sign-verify-node-dsa", "parallel/test-webcrypto-sign-verify-eddsa", "parallel/test-worker-debug", "parallel/test-worker-stdio", "parallel/test-v8-serialize-leak", "parallel/test-zlib-unused-weak", - "report/test-report-fatal-error", + "report/test-report-fatalerror-oomerror-set", + "report/test-report-fatalerror-oomerror-directory", + "report/test-report-fatalerror-oomerror-filename", + "report/test-report-fatalerror-oomerror-compact", "report/test-report-getreport", "report/test-report-signal", "report/test-report-uncaught-exception", diff --git a/shell/browser/javascript_environment.cc b/shell/browser/javascript_environment.cc index c1fab43482c0b5..0e674a72c57787 100644 --- a/shell/browser/javascript_environment.cc +++ b/shell/browser/javascript_environment.cc @@ -262,11 +262,11 @@ v8::Isolate* JavascriptEnvironment::Initialize(uv_loop_t* event_loop) { auto* tracing_agent = node::CreateAgent(); auto* tracing_controller = new TracingControllerImpl(); node::tracing::TraceEventHelper::SetAgent(tracing_agent); - platform_ = node::CreatePlatform( + platform_ = node::MultiIsolatePlatform::Create( base::RecommendedMaxNumberOfThreadsInThreadGroup(3, 8, 0.1, 0), tracing_controller, gin::V8Platform::PageAllocator()); - v8::V8::InitializePlatform(platform_); + v8::V8::InitializePlatform(platform_.get()); gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, gin::ArrayBufferAllocator::SharedInstance(), nullptr /* external_reference_table */, diff --git a/shell/browser/javascript_environment.h b/shell/browser/javascript_environment.h index d8f91525b4cf22..de9cbf409efefc 100644 --- a/shell/browser/javascript_environment.h +++ b/shell/browser/javascript_environment.h @@ -32,7 +32,7 @@ class JavascriptEnvironment { void CreateMicrotasksRunner(); void DestroyMicrotasksRunner(); - node::MultiIsolatePlatform* platform() const { return platform_; } + node::MultiIsolatePlatform* platform() const { return platform_.get(); } v8::Isolate* isolate() const { return isolate_; } v8::Local context() const { return v8::Local::New(isolate_, context_); @@ -42,8 +42,7 @@ class JavascriptEnvironment { private: v8::Isolate* Initialize(uv_loop_t* event_loop); - // Leaked on exit. - node::MultiIsolatePlatform* platform_; + std::unique_ptr platform_; v8::Isolate* isolate_; gin::IsolateHolder isolate_holder_; diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc index c291875556cb66..5e4ab461c2c4dd 100644 --- a/shell/common/node_bindings.cc +++ b/shell/common/node_bindings.cc @@ -210,46 +210,6 @@ GetAllowedDebugOptions() { return {}; } -// Initialize Node.js cli options to pass to Node.js -// See https://nodejs.org/api/cli.html#cli_options -void SetNodeCliFlags() { - const std::unordered_set allowed = - GetAllowedDebugOptions(); - - const auto argv = base::CommandLine::ForCurrentProcess()->argv(); - std::vector args; - - // TODO(codebytere): We need to set the first entry in args to the - // process name owing to src/node_options-inl.h#L286-L290 but this is - // redundant and so should be refactored upstream. - args.reserve(argv.size() + 1); - args.emplace_back("electron"); - - for (const auto& arg : argv) { -#if BUILDFLAG(IS_WIN) - const auto& option = base::WideToUTF8(arg); -#else - const auto& option = arg; -#endif - const auto stripped = base::StringPiece(option).substr(0, option.find('=')); - - // Only allow in no-op (--) option or DebugOptions - if (allowed.count(stripped) != 0 || stripped == "--") - args.push_back(option); - } - - std::vector errors; - const int exit_code = ProcessGlobalArgs(&args, nullptr, &errors, - node::kDisallowedInEnvironment); - - const std::string err_str = "Error parsing Node.js cli flags "; - if (exit_code != 0) { - LOG(ERROR) << err_str; - } else if (!errors.empty()) { - LOG(ERROR) << err_str << base::JoinString(errors, " "); - } -} - // Initialize NODE_OPTIONS to pass to Node.js // See https://nodejs.org/api/cli.html#cli_node_options_options void SetNodeOptions(base::Environment* env) { @@ -370,6 +330,53 @@ bool NodeBindings::IsInitialized() { return g_is_initialized; } +// Initialize Node.js cli options to pass to Node.js +// See https://nodejs.org/api/cli.html#cli_options +void NodeBindings::SetNodeCliFlags() { + const std::unordered_set allowed = + GetAllowedDebugOptions(); + + const auto argv = base::CommandLine::ForCurrentProcess()->argv(); + std::vector args; + + // TODO(codebytere): We need to set the first entry in args to the + // process name owing to src/node_options-inl.h#L286-L290 but this is + // redundant and so should be refactored upstream. + args.reserve(argv.size() + 1); + args.emplace_back("electron"); + + for (const auto& arg : argv) { +#if BUILDFLAG(IS_WIN) + const auto& option = base::WideToUTF8(arg); +#else + const auto& option = arg; +#endif + const auto stripped = base::StringPiece(option).substr(0, option.find('=')); + + // Only allow in no-op (--) option or DebugOptions + if (allowed.count(stripped) != 0 || stripped == "--") + args.push_back(option); + } + + // We need to disable Node.js' fetch implementation to prevent + // conflict with Blink's in renderer and worker processes. + if (browser_env_ == BrowserEnvironment::kRenderer || + browser_env_ == BrowserEnvironment::kWorker) { + args.push_back("--no-experimental-fetch"); + } + + std::vector errors; + const int exit_code = ProcessGlobalArgs(&args, nullptr, &errors, + node::kDisallowedInEnvironment); + + const std::string err_str = "Error parsing Node.js cli flags "; + if (exit_code != 0) { + LOG(ERROR) << err_str; + } else if (!errors.empty()) { + LOG(ERROR) << err_str << base::JoinString(errors, " "); + } +} + void NodeBindings::Initialize() { TRACE_EVENT0("electron", "NodeBindings::Initialize"); // Open node's error reporting system for browser process. @@ -445,14 +452,6 @@ node::Environment* NodeBindings::CreateEnvironment( v8::Isolate* isolate = context->GetIsolate(); gin_helper::Dictionary global(isolate, context->Global()); - // Avoids overriding globals like setImmediate, clearImmediate - // queueMicrotask etc during the bootstrap phase of Node.js - // for processes that already have these defined by DOM. - // Check //third_party/electron_node/lib/internal/bootstrap/node.js - // for the list of overrides on globalThis. - if (browser_env_ == BrowserEnvironment::kRenderer || - browser_env_ == BrowserEnvironment::kWorker) - global.Set("_noBrowserGlobals", true); if (browser_env_ == BrowserEnvironment::kBrowser) { const std::vector search_paths = {"app.asar", "app", @@ -487,7 +486,13 @@ node::Environment* NodeBindings::CreateEnvironment( // Only one ESM loader can be registered per isolate - // in renderer processes this should be blink. We need to tell Node.js // not to register its handler (overriding blinks) in non-browser processes. + // We also avoid overriding globals like setImmediate, clearImmediate + // queueMicrotask etc during the bootstrap phase of Node.js + // for processes that already have these defined by DOM. + // Check //third_party/electron_node/lib/internal/bootstrap/node.js + // for the list of overrides on globalThis. flags |= node::EnvironmentFlags::kNoRegisterESMLoader | + node::EnvironmentFlags::kNoBrowserGlobals | node::EnvironmentFlags::kNoCreateInspector; } @@ -517,15 +522,6 @@ node::Environment* NodeBindings::CreateEnvironment( DCHECK(env); - // Clean up the global _noBrowserGlobals that we unironically injected into - // the global scope - if (browser_env_ == BrowserEnvironment::kRenderer || - browser_env_ == BrowserEnvironment::kWorker) { - // We need to bootstrap the env in non-browser processes so that - // _noBrowserGlobals is read correctly before we remove it - global.Delete("_noBrowserGlobals"); - } - node::IsolateSettings is; // Use a custom fatal error callback to allow us to add diff --git a/shell/common/node_bindings.h b/shell/common/node_bindings.h index c56e1aecd51ff8..efd33fc62cda14 100644 --- a/shell/common/node_bindings.h +++ b/shell/common/node_bindings.h @@ -87,6 +87,8 @@ class NodeBindings { // Setup V8, libuv. void Initialize(); + void SetNodeCliFlags(); + // Create the environment and load node.js. node::Environment* CreateEnvironment(v8::Handle context, node::MultiIsolatePlatform* platform, diff --git a/shell/common/node_includes.h b/shell/common/node_includes.h index c6787693243491..104d73520e2d75 100644 --- a/shell/common/node_includes.h +++ b/shell/common/node_includes.h @@ -20,9 +20,9 @@ #include "env.h" #include "node.h" #include "node_buffer.h" +#include "node_builtins.h" #include "node_errors.h" #include "node_internals.h" -#include "node_native_module_env.h" #include "node_object_wrap.h" #include "node_options-inl.h" #include "node_options.h" diff --git a/shell/common/node_util.cc b/shell/common/node_util.cc index 7cee76b7c4fa8a..bfa98d8c267bd0 100644 --- a/shell/common/node_util.cc +++ b/shell/common/node_util.cc @@ -18,8 +18,8 @@ v8::MaybeLocal CompileAndCall( v8::Isolate* isolate = context->GetIsolate(); v8::TryCatch try_catch(isolate); v8::MaybeLocal compiled = - node::native_module::NativeModuleEnv::LookupAndCompile( - context, id, parameters, optional_env); + node::builtins::BuiltinLoader::LookupAndCompile(context, id, parameters, + optional_env); if (compiled.IsEmpty()) { return v8::MaybeLocal(); } diff --git a/shell/renderer/electron_renderer_client.cc b/shell/renderer/electron_renderer_client.cc index c3884cb6ba1911..66cadfbcbed6fe 100644 --- a/shell/renderer/electron_renderer_client.cc +++ b/shell/renderer/electron_renderer_client.cc @@ -85,8 +85,8 @@ void ElectronRendererClient::DidCreateScriptContext( node::tracing::TraceEventHelper::SetAgent(node::CreateAgent()); // Setup node environment for each window. - bool initialized = node::InitializeContext(renderer_context); - CHECK(initialized); + v8::Maybe initialized = node::InitializeContext(renderer_context); + CHECK(!initialized.IsNothing() && initialized.FromJust()); node::Environment* env = node_bindings_->CreateEnvironment(renderer_context, nullptr); diff --git a/shell/renderer/web_worker_observer.cc b/shell/renderer/web_worker_observer.cc index ea5f60daba4261..0eb07182fad944 100644 --- a/shell/renderer/web_worker_observer.cc +++ b/shell/renderer/web_worker_observer.cc @@ -63,8 +63,8 @@ void WebWorkerObserver::WorkerScriptReadyForEvaluation( node::tracing::TraceEventHelper::SetAgent(node::CreateAgent()); // Setup node environment for each window. - bool initialized = node::InitializeContext(worker_context); - CHECK(initialized); + v8::Maybe initialized = node::InitializeContext(worker_context); + CHECK(!initialized.IsNothing() && initialized.FromJust()); node::Environment* env = node_bindings_->CreateEnvironment(worker_context, nullptr); diff --git a/spec/api-net-spec.ts b/spec/api-net-spec.ts index fc70135fa38ed2..97f7e5ca90c441 100644 --- a/spec/api-net-spec.ts +++ b/spec/api-net-spec.ts @@ -1,4 +1,5 @@ import { expect } from 'chai'; +import * as dns from 'dns'; import { net, session, ClientRequest, BrowserWindow, ClientRequestConstructorOptions } from 'electron/main'; import * as http from 'http'; import * as url from 'url'; @@ -6,6 +7,9 @@ import { AddressInfo, Socket } from 'net'; import { emittedOnce } from './events-helpers'; import { defer, delay } from './spec-helpers'; +// See https://github.com/nodejs/node/issues/40702. +dns.setDefaultResultOrder('ipv4first'); + const kOneKiloByte = 1024; const kOneMegaByte = kOneKiloByte * kOneKiloByte;