Skip to content

build: remove six obsolete Node.js patches - #53524

Merged
codebytere merged 6 commits into
mainfrom
chore/drop-redundant-node-patches
Sep 4, 2026
Merged

codebytere merged 6 commits into
mainfrom
chore/drop-redundant-node-patches

Conversation

@codebytere

@codebytere codebytere commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Description of Change

Removes six Node.js patches whose reason for existing has gone away on v24.20.0. The one behavior any of them still carried - keeping V8's source phase imports off - now comes from Electron passing --no-js-source-phase-imports to Node rather than from editing Node's default.

  • fix_add_default_values_for_variables_in_common_gypi - llvm_version and build_v8_with_gn are no longer read anywhere in common.gypi, and enable_lto comes from the config.gypi Electron ships (node.h already #errors without it).
  • ci_ensure_node_tests_set_electron_run_as_node - upstream stopped clobbering env in the test-runner fixtures this patched (nodejs/node@cb08703c804), so the rebased patch was re-adding the clobbering it was written to undo.
  • fix_remove_deprecated_errno_constants - libc++ reverted the deprecation of the ENODATA / ENOSR / ENOSTR / ETIME macros ([libc++] Undeprecate POSIX STREAM macros. llvm/llvm-project#88296); only the std::errc enumerators stay deprecated, which Node and libuv don't use. os.constants.errno and uv get the four entries back.
  • fix_cppgc_initializing_twice - NodeBindings passes kNoInitializeCppgc, and in node_main.cc Node's process init runs before V8::Initialize(), which itself skips cppgc::InitializeProcess() when already initialized. The added !cppgc::IsInitialized() guard could not change the outcome on either path.
  • feat_disable_js_source_phase_imports_by_default - src: allow disabling JS source phase imports nodejs/node#60364 is in v24.20.0, so Node honors --no-js-source-phase-imports; NodeBindings::ParseNodeCliFlags() and node_main.cc now pass it (kept out of process.execArgv in run-as-node so fork() doesn't accumulate it), and node_mksnapshot is run with it so the builtins code cache it embeds keeps the same V8 flags hash as the browser isolate. Renderers need it because Blink sets that V8 flag before Node runs and V8 flags are frozen by then.
  • fix_avoid_external_memory_leak_on_invalid_tls_protocol_versions - fixed upstream by tls: fix leak on invalid protocol method nodejs/node#60427 (v24.12.0), which guards the Decrease() in SecureContext::Reset() on ctx_. Our patch removed that guard on rebase, so a tls.createSecureContext() that throws in Init() decremented 1024 bytes of external memory that were never added: a amount_of_external_memory_ >= size DCHECK in testing builds (parallel/test-tls-no-sslv23, re-enabled here) and a skewed counter in release.

Checklist

Release Notes

Notes: none

Pass --no-js-source-phase-imports from NodeBindings and node_main instead of
patching Node's default, and drop five patches whose upstream reason is gone
(common.gypi defaults, test-runner env clobbering, libc++ errno deprecation,
cppgc double-init guard, TLS external-memory accounting now fixed upstream).
@codebytere
codebytere requested a review from a team as a code owner September 4, 2026 13:31
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Sep 4, 2026
@codebytere codebytere added target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. labels Sep 4, 2026
…-as-node

fork() propagates execArgv, so the inserted flag accumulated in children
(parallel/test-child-process-fork-exec-argv).
node_mksnapshot runs Node's argument processing, which now turns the V8 flag
on by default; the builtins code cache it embeds is keyed on V8's flags hash
and was rejected in the browser process, where Electron keeps the flag off
(spec/api-js2c-code-cache-spec.ts).
…node-patches

# Conflicts:
#	patches/node/build_perfetto-sdk.patch
#	patches/node/build_restore_clang_as_default_compiler_on_macos.patch
#	patches/node/build_restore_macos_deployment_target_to_13_0.patch
#	patches/node/v8_propagate_v8_cppgc_microtask_queue_flag_to_common_gypi.patch
@MarshallOfSound MarshallOfSound removed the target/44-x-y PR should also be added to the "44-x-y" branch. label Sep 4, 2026
It failed on the external-memory DCHECK the dropped TLS patch caused.
@codebytere codebytere changed the title chore: remove six obsolete Node.js patches build: remove six obsolete Node.js patches Sep 4, 2026
@codebytere
codebytere enabled auto-merge (squash) September 4, 2026 20:28
@codebytere codebytere removed the new-pr 🌱 PR opened recently label Sep 4, 2026
@codebytere
codebytere merged commit 8615baa into main Sep 4, 2026
82 checks passed
@codebytere
codebytere deleted the chore/drop-redundant-node-patches branch September 4, 2026 21:09
@release-clerk

release-clerk Bot commented Sep 4, 2026

Copy link
Copy Markdown

No Release Notes

@trop

trop Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "45-x-y", please check out #53549

@trop trop Bot added in-flight/45-x-y merged/45-x-y PR was merged to the "45-x-y" branch. and removed target/45-x-y PR should also be added to the "45-x-y" branch. in-flight/45-x-y labels Sep 4, 2026
MarshallOfSound added a commit that referenced this pull request Oct 15, 2026
Upstream moved the SecureContext external-memory Increase() into Init()
and guards the Decrease() on ctx_, so the leak this patch fixed is gone.
The patch's removal of that guard now double-decrements when v24.22.0's
TLSSocket closes a single-use context before the wrapper is destroyed,
tripping V8's ExternalMemoryAccounter DCHECK in every TLS test. Already
dropped on main in #53524.
MarshallOfSound added a commit that referenced this pull request Oct 15, 2026
Upstream moved the SecureContext external-memory Increase() into Init()
and guards the Decrease() on ctx_, so the leak this patch fixed is gone.
The patch's removal of that guard now double-decrements when v24.22.0's
TLSSocket closes a single-use context before the wrapper is destroyed,
tripping V8's ExternalMemoryAccounter DCHECK in every TLS test. Already
dropped on main in #53524.
MarshallOfSound added a commit that referenced this pull request Oct 15, 2026
* chore: bump node in DEPS to v24.22.0

* fix(patch): enable the V8 sandbox in shared-cage builds

Upstream now enables the V8 sandbox only for shared-cage builds. Keep
Electron's behaviour of enabling it whenever pointer compression is on,
matching Chromium's V8. The unofficial.gni x86 hunk landed upstream.

Ref: nodejs/node#62237
Ref: nodejs/node#65491

* fix(patch): use names for asymmetric key algorithms

Upstream dropped the BoringSSL guard in DhKeyGenTraits::Setup(), removed
ReadASN1Element() from ncrypto, and no longer includes <openssl/evp.h>
from env.h, so those hunks are no longer needed.

Ref: nodejs/node#65966
Ref: nodejs/node#66108
Ref: nodejs/node#65484

* fix(patch): skip RSA-PSS keygen deprecation tests with BoringSSL

The skip is now upstream.

Ref: nodejs/node#65808

* fix(patch): detach cppgc wrappers from their Realm before it is freed

Upstream's CppgcWrapperList::Cleanup() now pops nodes itself and the
wrapper owns and frees its list node, so the local PopFront/delete hunk
is dropped.

Ref: nodejs/node#65778

* fix(patch): gate jspi flag on V8_ENABLE_WEBASSEMBLY

Ref: nodejs/node#66082

* chore: remove upstreamed patches

- nodejs/node#63985
- nodejs/node#65630
- nodejs/node#64453
- nodejs/node#65778

* chore: update patches (trivial only)

* chore: update filenames.auto.gni

* fix(patch): discover hashes from OpenSSL providers

ncrypto's DigestCache::aliases() now has a function-local static, so
ncrypto needs the no_exit_time_destructors config too.

Ref: nodejs/node#65484

* fix(patch): read the peer certificate chain without consuming it

sk_X509_num() returns size_t in BoringSSL.

Ref: nodejs/node#65602

* fix(patch): fix shared buffer growability validation

Ref: nodejs/node#65845

* chore: update patches (trivial only)

* node#65820: src: fix null pointer call when running without a startup snapshot

SnapshotData::AsEmbedderWrapper() was removed. Both call sites wrap the
embedded snapshot, so use EmbedderSnapshotData::BuiltinSnapshotData().

Ref: nodejs/node#65820

* node#65407: src: apply IsolateSettings when using a snapshot

node::CreateEnvironment() no longer installs the per-isolate message
listener when it builds the environment from a snapshot, so stop
compensating for that and let SetIsolateUpForNode() add it.

Ref: nodejs/node#65407

* test: drop removed wasm rab integration flag from webidl buffer source test

Chromium's V8 removed --experimental-wasm-rab-integration after shipping
it; the new test-internal-webidl-buffer-source.js passes it.

Ref: nodejs/node#65845
Ref: https://chromium-review.googlesource.com/c/v8/v8/+/7708297

* chore: remove obsolete TLS external-memory accounting patch

Upstream moved the SecureContext external-memory Increase() into Init()
and guards the Decrease() on ctx_, so the leak this patch fixed is gone.
The patch's removal of that guard now double-decrements when v24.22.0's
TLSSocket closes a single-use context before the wrapper is destroyed,
tripping V8's ExternalMemoryAccounter DCHECK in every TLS test. Already
dropped on main in #53524.

* test: skip new rmSync permission error test when the Node suite runs as root

test-fs-rmSync-special-char-additional-error.js is new in v24.22.0 and
relies on a read-only directory blocking removal, which root bypasses;
the Linux Node.js test job runs as root.

Ref: nodejs/node#64453

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Sam Attard <[email protected]>
MarshallOfSound added a commit that referenced this pull request Oct 15, 2026
* chore: bump node in DEPS to v24.22.0

* fix(patch): enable the V8 sandbox in shared-cage builds

Upstream now enables the V8 sandbox only for shared-cage builds. Keep
Electron's behaviour of enabling it whenever pointer compression is on,
matching Chromium's V8. The unofficial.gni x86 hunk landed upstream.

Ref: nodejs/node#62237
Ref: nodejs/node#65491

* fix(patch): use names for asymmetric key algorithms

Upstream dropped the BoringSSL guard in DhKeyGenTraits::Setup(), removed
ReadASN1Element() from ncrypto, and no longer includes <openssl/evp.h>
from env.h, so those hunks are no longer needed.

Ref: nodejs/node#65966
Ref: nodejs/node#66108
Ref: nodejs/node#65484

* fix(patch): skip RSA-PSS keygen deprecation tests with BoringSSL

The skip is now upstream.

Ref: nodejs/node#65808

* fix(patch): detach cppgc wrappers from their Realm before it is freed

Upstream's CppgcWrapperList::Cleanup() now pops nodes itself and the
wrapper owns and frees its list node, so the local PopFront/delete hunk
is dropped.

Ref: nodejs/node#65778

* fix(patch): gate jspi flag on V8_ENABLE_WEBASSEMBLY

Ref: nodejs/node#66082

* chore: remove upstreamed patches

- nodejs/node#63985
- nodejs/node#65630
- nodejs/node#64453
- nodejs/node#65778

* chore: update patches (trivial only)

* chore: update filenames.auto.gni

* fix(patch): discover hashes from OpenSSL providers

ncrypto's DigestCache::aliases() now has a function-local static, so
ncrypto needs the no_exit_time_destructors config too.

Ref: nodejs/node#65484

* fix(patch): read the peer certificate chain without consuming it

sk_X509_num() returns size_t in BoringSSL.

Ref: nodejs/node#65602

* chore: update patches (trivial only)

* node#65820: src: fix null pointer call when running without a startup snapshot

SnapshotData::AsEmbedderWrapper() was removed. Both call sites wrap the
embedded snapshot, so use EmbedderSnapshotData::BuiltinSnapshotData().

Ref: nodejs/node#65820

* node#65407: src: apply IsolateSettings when using a snapshot

node::CreateEnvironment() no longer installs the per-isolate message
listener when it builds the environment from a snapshot, so stop
compensating for that and let SetIsolateUpForNode() add it.

Ref: nodejs/node#65407

* test: drop removed wasm rab integration flag from webidl buffer source test

Chromium's V8 removed --experimental-wasm-rab-integration after shipping
it; the new test-internal-webidl-buffer-source.js passes it.

Ref: nodejs/node#65845
Ref: https://chromium-review.googlesource.com/c/v8/v8/+/7708297

* chore: remove obsolete TLS external-memory accounting patch

Upstream moved the SecureContext external-memory Increase() into Init()
and guards the Decrease() on ctx_, so the leak this patch fixed is gone.
The patch's removal of that guard now double-decrements when v24.22.0's
TLSSocket closes a single-use context before the wrapper is destroyed,
tripping V8's ExternalMemoryAccounter DCHECK in every TLS test. Already
dropped on main in #53524.

* test: skip new rmSync permission error test when the Node suite runs as root

test-fs-rmSync-special-char-additional-error.js is new in v24.22.0 and
relies on a read-only directory blocking removal, which root bypasses;
the Linux Node.js test job runs as root.

Ref: nodejs/node#64453

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Sam Attard <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

46-x-y merged/45-x-y PR was merged to the "45-x-y" branch. semver/none

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants