Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
chore: upgrade to Node.js v18 (electron#35999)
Browse files Browse the repository at this point in the history
* chore: update to Node.js v18

* child_process: improve argument validation

nodejs/node#41305

* bootstrap: support configure-time user-land snapshot

nodejs/node#42466

* chore: update GN patch

* src: disambiguate terms used to refer to builtins and addons

nodejs/node#44135

* src: use a typed array internally for process._exiting

nodejs/node#43883

* chore: lib/internal/bootstrap -> lib/internal/process

* src: disambiguate terms used to refer to builtins and addons

nodejs/node#44135

* chore: remove redudant browserGlobals patch

* chore: update BoringSSL patch

* src: allow embedder-provided PageAllocator in NodePlatform

nodejs/node#38362

* chore: fixup Node.js crypto tests

- nodejs/node#44171
- nodejs/node#41600

* lib: add Promise methods to avoid-prototype-pollution lint rule

nodejs/node#43849

* deps: update V8 to 10.1

nodejs/node#42657

* src: add kNoBrowserGlobals flag for Environment

nodejs/node#40532

* chore: consolidate asar initialization patches

* deps: update V8 to 10.1

nodejs/node#42657

* deps: update V8 to 9.8

nodejs/node#41610

* src,crypto: remove AllocatedBuffers from crypto_spkac

nodejs/node#40752

* build: enable V8's shared read-only heap

nodejs/node#42809

* src: fix ssize_t error from nghttp2.h

nodejs/node#44393

* chore: fixup ESM patch

* chore: fixup patch indices

* src: merge NativeModuleEnv into NativeModuleLoader

nodejs/node#43824

* [API] Pass OOMDetails to OOMErrorCallback

https://chromium-review.googlesource.com/c/v8/v8/+/3647827

* src: iwyu in cleanup_queue.cc

* src: return Maybe from a couple of functions

nodejs/node#39603

* src: clean up embedder API

nodejs/node#35897

* src: refactor DH groups to delete crypto_groups.h

nodejs/node#43896

* deps,src: use SIMD for normal base64 encoding

nodejs/node#39775

* chore: remove deleted source file

* chore: update patches

* chore: remove deleted source file

* lib: add fetch

nodejs/node#41749

* chore: remove nonexistent node specs

* test: split report OOM tests

nodejs/node#44389

* src: trace fs async api

nodejs/node#44057

* http: trace http request / response

nodejs/node#44102

* test: split test-crypto-dh.js

nodejs/node#40451

* crypto: introduce X509Certificate API

nodejs/node#36804

* src: split property helpers from node::Environment

nodejs/node#44056

* nodejs/node#38905

bootstrap: implement run-time user-land snapshots via --build-snapshot and --snapshot-blob

* lib,src: implement WebAssembly Web API

nodejs/node#42701

* fixup! deps,src: use SIMD for normal base64 encoding

* fixup! src: refactor DH groups to delete crypto_groups.h

* chore: fixup base64 GN file

* fix: check that node::InitializeContext() returns true

* chore: delete _noBrowserGlobals usage

* chore: disable fetch in renderer procceses

* dns: default to verbatim=true in dns.lookup()

nodejs/node#39987

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and khalwa committed Feb 22, 2023
1 parent 3c76b0f commit b19d67a
Show file tree
Hide file tree
Showing 50 changed files with 791 additions and 1,133 deletions.
2 changes: 1 addition & 1 deletion DEPS
Expand Up @@ -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':
Expand Down
11 changes: 4 additions & 7 deletions patches/node/.patches
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
39 changes: 39 additions & 0 deletions patches/node/api_pass_oomdetails_to_oomerrorcallback.patch
@@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
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.
8 changes: 4 additions & 4 deletions patches/node/be_compatible_with_cppgc.patch
Expand Up @@ -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;
Expand All @@ -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();
}

Expand All @@ -84,7 +84,7 @@ index 22be69ec30a5b8466caacc698c791494891e5dee..cc44d578df9e146aa72f8273c1271d6a
object->SetAlignedPointerInInternalField(BaseObject::kSlot,
static_cast<void*>(this));
env->AddCleanupHook(DeleteMe, static_cast<void*>(this));
@@ -2177,7 +2186,8 @@ void BaseObject::MakeWeak() {
@@ -2071,7 +2080,8 @@ void BaseObject::MakeWeak() {
void BaseObject::LazilyInitializedJSTemplateConstructor(
const FunctionCallbackInfo<Value>& args) {
DCHECK(args.IsConstructCall());
Expand Down

0 comments on commit b19d67a

Please sign in to comment.