Skip to content

wasm: Revert enable JSPI as already enabled - #60014

Closed
guybedford wants to merge 1 commit into
nodejs:mainfrom
guybedford:disable-jspi
Closed

guybedford wants to merge 1 commit into
nodejs:mainfrom
guybedford:disable-jspi

Conversation

@guybedford

Copy link
Copy Markdown
Contributor

This reverts #59941, while keeping the test for good measure.

It turns out JSPI is already enabled on latest V8, I was just not carefully testing this between different versions.

#59941 should be considered fully reverted and backed out with this change.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/startup

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Sep 25, 2025
@codecov

codecov Bot commented Sep 25, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.46%. Comparing base (3312e4e) to head (c273e58).
⚠️ Report is 92 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #60014      +/-   ##
==========================================
- Coverage   88.47%   88.46%   -0.02%     
==========================================
  Files         703      703              
  Lines      207546   207545       -1     
  Branches    40006    40015       +9     
==========================================
- Hits       183631   183601      -30     
- Misses      15907    15946      +39     
+ Partials     8008     7998      -10     
Files with missing lines Coverage Δ
src/node.cc 75.77% <ø> (-0.04%) ⬇️

... and 31 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

guybedford added a commit that referenced this pull request Oct 1, 2025
PR-URL: #60014
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@guybedford

Copy link
Copy Markdown
Contributor Author

Landed in 23b8340.

@guybedford guybedford closed this Oct 1, 2025
@targos targos added dont-land-on-v20.x dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. dont-land-on-v24.x PRs that should not land on the v24.x-staging branch and should not be released in v24.x. labels Oct 6, 2025
@RafaelGSS RafaelGSS mentioned this pull request Oct 13, 2025
9 tasks done
jkleinsc pushed a commit to electron/electron that referenced this pull request Oct 29, 2026
* support_v8_sandboxed_pointers.patch
  Ref: nodejs/node#62237
* refactor_attach_cppgc_heap_on_v8_isolate_creation.patch
  Ref: nodejs/node#58070
* test_accomodate_v8_thenable_stack_trace_change_in_snapshot.patch
  Ref: nodejs/node#59805
* api_remove_deprecated_getisolate.patch
  Ref: nodejs/node#59805
  Ref: nodejs/node#60223
* api_delete_deprecated_fields_on_v8_isolate.patch
  Ref: nodejs/node#60488
* api_promote_deprecation_of_v8_context_and_v8_object_api_methods.patch
  Ref: nodejs/node#60602
* src_refactor_module_wrap_cc_to_update_fixedarray_get_params.patch
  Ref: nodejs/node#61898
* src_refactor_wasmstreaming_finish_to_accept_a_callback.patch
  Ref: nodejs/node#61898
* src_stop_using_v8_propertycallbackinfo_t_this.patch
  Ref: nodejs/node#61898
* fix_add_externalpointertypetag_to_v8_external_api_calls.patch
  Ref: nodejs/node#61898
* src_stop_using_removed_v8_promise_reject_events.patch
  Ref: nodejs/node#62336
* src_backport_the_perfetto_trace_agent.patch
  Ref: nodejs/node#64565
  Ref: nodejs/node#64721
* test_account_for_libc_rm_error_on_electron_linux.patch
  Ref: nodejs/node#66065
* fix_do_not_pass_removed_jspi_v8_flag.patch
  Ref: nodejs/node#60014
* test_drop_removed_wasm_rab_integration_flag.patch
  The v26 version of nodejs/node#65845 never
  added the flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU
MarshallOfSound pushed a commit to electron/electron that referenced this pull request Oct 30, 2026
* chore: bump node in DEPS to v26.12.1

* chore: bump node in DEPS to v26.13.0

* fix(patch): build: add simdutf dir to include path in GN build

Keep upstream's simdutf include dir in the node_js2c include_dirs and
add "tools" next to it. The patch's FixedArray::Get(context, i) change
in node_builtins.cc is no longer needed: upstream made the same change
in nodejs/node#61898.

Ref: nodejs/node#65382

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix(patch): vfs: integrate with CJS and ESM module loaders

Upstream moved the native legacyMainResolve call from esm/resolve.js
into the loaderMethods table in internal/modules/helpers.js, so pass the
asar-aware fileExists callback from there instead.

Ref: nodejs/node#63653

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix(patch): src: let embedders supply a builtin code cache without a snapshot

BuiltinLoader::RefreshCodeCache() now merges with insert_or_assign
upstream, so drop that hunk from the patch.

Ref: nodejs/node#65352

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix(patch): src: move import.meta initializer to native land

PathHelpersLazyGetter moved from node_modules.cc to module_wrap.cc and
gained a sibling ImportMetaResolveLazyGetter; switch both to Holder().
Also follow the DatabaseSyncLimits -> DatabaseLimits rename in
node_sqlite.cc (nodejs/node#65988) and the
Null(isolate) cleanup in node_constants.cc
(nodejs/node#59805).

Ref: nodejs/node#60603

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix(patch): src: fix usage of deprecated V8 API

Upstream switched to Get/SetContinuationPreservedEmbedderDataV2(), which
Chromium's V8 marks deprecated in favor of the unsuffixed names. Use the
unsuffixed getter and setter.

Ref: nodejs/node#60174

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix(patch): src: rename legacy trace event headers

The TRACING_CATEGORY_NODE* macros moved from node_internals.h to
tracing/trace_event.h, so define NODE_TRACE_CATEGORY_ENABLED there.
Agent::CreateDefault() picks the legacy agent again when V8_USE_PERFETTO
is unset (nodejs/node#64053), so only the
Perfetto branch is gated on NODE_USE_PERFETTO_SDK.

node.gyp now lists the Perfetto sources in
node_tracing_perfetto_sources. Add them, with V8's tracing target and
config, to the GN libnode target. The removed perfetto backport patch
used to carry that wiring.

Ref: nodejs/node#64565

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix(patch): src: let embedders exempt linked bindings from the addon permission

Upstream added EnvironmentFlags::kNoAddonPermissionForLinkedBindings
around the same check. Keep the electron_* exemption alongside it and
note in the patch description that the patch can be dropped once
Electron sets the new flag.

Ref: nodejs/node#66067

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* chore: remove upstreamed patches

* support_v8_sandboxed_pointers.patch
  Ref: nodejs/node#62237
* refactor_attach_cppgc_heap_on_v8_isolate_creation.patch
  Ref: nodejs/node#58070
* test_accomodate_v8_thenable_stack_trace_change_in_snapshot.patch
  Ref: nodejs/node#59805
* api_remove_deprecated_getisolate.patch
  Ref: nodejs/node#59805
  Ref: nodejs/node#60223
* api_delete_deprecated_fields_on_v8_isolate.patch
  Ref: nodejs/node#60488
* api_promote_deprecation_of_v8_context_and_v8_object_api_methods.patch
  Ref: nodejs/node#60602
* src_refactor_module_wrap_cc_to_update_fixedarray_get_params.patch
  Ref: nodejs/node#61898
* src_refactor_wasmstreaming_finish_to_accept_a_callback.patch
  Ref: nodejs/node#61898
* src_stop_using_v8_propertycallbackinfo_t_this.patch
  Ref: nodejs/node#61898
* fix_add_externalpointertypetag_to_v8_external_api_calls.patch
  Ref: nodejs/node#61898
* src_stop_using_removed_v8_promise_reject_events.patch
  Ref: nodejs/node#62336
* src_backport_the_perfetto_trace_agent.patch
  Ref: nodejs/node#64565
  Ref: nodejs/node#64721
* test_account_for_libc_rm_error_on_electron_linux.patch
  Ref: nodejs/node#66065
* fix_do_not_pass_removed_jspi_v8_flag.patch
  Ref: nodejs/node#60014
* test_drop_removed_wasm_rab_integration_flag.patch
  The v26 version of nodejs/node#65845 never
  added the flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* chore: update patches (trivial only)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* chore: bump @types/node to v26

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* chore: update filenames.auto.gni

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* chore: remove deleted specs

Upstream deleted parallel/test-promise-swallowed-event and
parallel/test-warn-multipleResolves when the multipleResolves event
reached end-of-life.

Ref: nodejs/node#58707

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* test: clear crash dumps with fs.rmSync instead of recursive rmdir

Node.js v25 moved the fs.rmdir recursive option to end-of-life, so
fs.rmdirSync(dir, { recursive: true }) now throws and @types/node v26
no longer accepts the option.

Ref: nodejs/node#58616

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* test: listen on IncomingMessage unions through EventEmitter

With @types/node v26, http.IncomingMessage declares typed `on`
overloads that do not unify with Electron.IncomingMessage's, so
collectStreamBodyBuffer() no longer type-checks when calling `on` on
the union.

Ref: Unable to locate reference

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix: pass an ArrayBuffer-backed view to subtle.digest in asar wrapper

@types/node v26 types webcrypto's BufferSource as views over an
ArrayBuffer only, so a Uint8Array<ArrayBufferLike> no longer
type-checks. Archive reads never use a SharedArrayBuffer, so narrow the
type at the call site.

Ref: Unable to locate reference

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* node#64565: src: rename legacy trace event headers

Node.js renamed src/tracing/trace_event_common.h to trace_event_legacy.h
and moved the legacy trace macros out of trace_event.h into
trace_event_legacy_inl.h, so feed both to electron_generate_node_defines
instead of the removed header. The generated push/undef set matches the
previous one apart from header guards, NODE_TRACE_CATEGORY_ENABLED and
INTERNAL_DECLARE_SET_TRACE_VALUE_INT, which Node.js no longer defines.

Ref: nodejs/node#64565

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix(patch): src: add perfetto trace agent

Upstream's trace_event_perfetto.h includes the amalgamated "perfetto.h"
SDK header, which Chromium's Perfetto does not provide, so libnode fails
to compile. Include the Perfetto public headers Chromium ships instead
(as the removed backport patch did), add the tracing/trace_config
includes agent_perfetto.h relied on, and skip Node's TrackEvent category
definitions when Chromium's built-in categories are already in scope.

Ref: nodejs/node#64565

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix(patch): src: handle indexed properties in `process.env`

Upstream added indexed interceptors for process.env. Migrate the new
EnvSetterIndexed and EnvDefinerIndexed callbacks to
PropertyCallbackInfo<Boolean> like their named counterparts, since
Chromium's V8 only accepts the Boolean-returning indexed setter and
definer callbacks.

Ref: nodejs/node#60826

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* test: read the whole heap snapshot stream

Since Node.js 26, readable.read() returns one buffered chunk at a time
instead of concatenating everything buffered, so takeHeapSnapshot()
parsed only the first 64 KiB of the snapshot. Read readableLength bytes,
as upstream test/common/heap.js now does.

Ref: nodejs/node#60441

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* test: use --trace-warnings in the node-options-parsing crash case

Node.js 26 throws ERR_MISSING_OPTION('--permission') when a boolean
permission flag such as --allow-addons is set without --permission
(previously only the fs flags were checked), so the utility process in
this fixture exited before reaching options.js. Repeat --trace-warnings
instead; the case still checks that disallowed NODE_OPTIONS are stripped
from a list with repeated options.

Ref: nodejs/node#62072

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix(patch): restore user timing trace events

The usertiming.js hunk that emits node.perf.usertiming trace events for
performance.mark() and performance.measure() lived in the perfetto
backport patch, which was removed as upstreamed. Upstream Node.js never
had it (Electron added it in #50591), so carry it in
fix_use_embedder_perfetto_client_when_available.patch.

Ref: #50591

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* test: trigger the V8 sandbox fatal error from V8 directly

Since Node.js 26, node::Buffer::New() copies memory allocated outside
the V8 sandbox into it instead of handing it to
v8::ArrayBuffer::NewBackingStore(), so the external-ab addon no longer
crashed the utility process and "emits 'error' when fatal error is
triggered from V8" timed out. Call NewBackingStore() from the addon so
the same v8_ArrayBuffer_NewBackingStore fatal error is still raised.

Ref: nodejs/node#62237

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* test: delete directories with rm instead of recursive rmdir

Node.js 26 removed the recursive option of fs.rmdir(), fs.rmdirSync()
and fsPromises.rmdir() (DEP0147), so they now throw
ERR_INVALID_ARG_VALUE. Use rmSync() and promises.rm(), and put an
archive in the directory so the tests delete what their titles say.

Ref: nodejs/node#58616

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* node#64894: worker: add support for Web Workers

Node.js 26 adds a Web Worker API and its pre-execution deletes
globalThis.Worker unless --experimental-web-worker is set, without
checking noBrowserGlobals, so renderers and web workers with Node
integration lost Blink's Worker. Pass the flag in those processes, as
is already done for --experimental-eventsource; Node's own Worker is not
installed under kNoBrowserGlobals.

Ref: nodejs/node#64894

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* node#61803: module: remove --experimental-transform-types

Node.js 26 removed the flag, so passing it now fails with "bad option"
(exit code 9). Stop forwarding it to Node.js, drop it from the
command-line switch docs, document the removal as a 46.0 breaking
change, and remove the spec and fixture that exercised it. The spec
that checks TypeScript-only syntax is not transformed stays.

Ref: nodejs/node#61803

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* node#65589: src: disable V8 external memory reasonable size check

Node.js now passes --external-memory-max-reasonable-size=0 to V8 in
every process that initializes it, which changes FlagList::Hash() and
so the code-cache key. Add the flag to the build-time js2c code cache
flavors that initialize Node.js and to electron_xcache's default flags,
so their caches keep being accepted (xcache.spec.ts failed on the flag
hash).

Ref: nodejs/node#65589

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix: route Node.js 26's one-shot fs jobs through the asar wrapper

Node.js 26 writes files (fs.writeFile, fs.appendFile and their
fsPromises versions) with a native WriteFileJob, and copies directory
trees for fs.cp() / fsPromises.cp() with a native CpDirJob, instead of
going through binding.open() and the fs.promises walk the asar wrapper
already handles. Writes into archives therefore failed with ENOTDIR
instead of EACCES (and missed unpacked entries), and fs.cp() of an
archive directory failed with ENOTDIR.

Give binding.WriteFileJob the same archive checks as open(), wrap
fs.writeFile() for archive paths since lib/fs.js captured the native
job at startup, and copy archive trees for CpDirJob with the walk
cpSync() already uses, which now also stamps directories with
preserveTimestamps like the native walk.

Ref: nodejs/node#65489
Ref: nodejs/node#65488

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix(patch): do not leak NodePlatform's default TracingController

The NodePlatform hunk that owns the v8::TracingController it creates
when the embedder passes none lived in the perfetto backport patch,
which was removed as upstreamed, but upstream still allocates it with a
bare new. With the perfetto agent, ELECTRON_RUN_AS_NODE passes no
controller, so LeakSanitizer failed every run-as-node spec on ASan
builds. Carry the hunk in
fix_use_embedder_perfetto_client_when_available.patch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix: keep fsPromises.stat() and lstat() native outside archives

The asar wrapper replaced fsPromises.stat() and fsPromises.lstat() with
promisified callback versions for every path, so they ran as callback
requests (FSREQCALLBACK) instead of fsPromises' own. Node.js 26's
fsPromises.cp() checks its paths with them before handing the copy to a
native job, and parallel/test-fs-cp-async-destination-appears-late
tells the two apart. Use the wrapper only for paths inside archives.

Ref: nodejs/node#65488

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix: match Node.js 26 recursive readdir in the asar wrapper

Node.js 26 accepts Buffer paths for recursive readdir, keeps parentPath
a Buffer for them and for the 'buffer' encoding, and walks the tree
breadth-first, following links to directories without stat()ing every
entry. The asar wrapper's own walks (which also descend into archives)
broke on Buffer paths and differed in order and parentPath, failing the
new parallel/test-fs-readdir-recursive-* tests. Replace the three walks
with one breadth-first walk shaped like Node's, which still lists and
descends into archives as directories, and lets errors from any
directory reach the caller.

Ref: nodejs/node#65487

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* node#66138: src: add --process-timeout=N

Node.js starts the --process-timeout watchdog in
NodeMainInstance::Run(), which ELECTRON_RUN_AS_NODE does not use, so
the option was accepted but never applied: parallel/test-process-timeout-*
failed, and the fixtures that block the main thread hung the Node.js
test job until it was cancelled. Start and stop the watchdog around the
event loop in NodeMain() the same way.

Ref: nodejs/node#66138

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* test: close the FileHandle in the stale asar descriptor spec

Node.js 26 made closing a FileHandle on garbage collection an error
(DEP0137 end-of-life). The 'handle' variant of "does not capture a
descriptor number that was closed behind its back" dropped its
FileHandle, so the renderer running the asar specs later died with an
uncaught ERR_INVALID_STATE and every remaining asar spec failed with
"Render frame was disposed". Close the handle like the other variants
close their descriptors.

Ref: nodejs/node#58536

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix: allow ArrayBuffers above 2 GiB in Node.js-enabled isolates

Node.js 26 allocates Buffer.allocUnsafe(), Buffer.allocUnsafeSlow() and
the copies made by AdoptIntoBackingStore() through the isolate's
ArrayBuffer::Allocator (nodejs/node#61480, nodejs/node#62237). Electron's
sandboxed-pointers patch for Node.js 24 sent those through
ArrayBuffer::Allocator::NewDefaultAllocator() instead, which reaches
Electron's in-sandbox allocator, and that serves requests beyond
PartitionAlloc's single-allocation cap (2 GiB - 2 MiB) from sandbox
pages. The isolates of the browser process, the utility-process node
service and ELECTRON_RUN_AS_NODE use gin's ArrayBufferAllocator, which
has no such fallback, so with Node.js 26 a Buffer.allocUnsafe() of more
than 2 GiB - 2 MiB in those processes failed with
ERR_MEMORY_ALLOCATION_FAILED, where Electron 45 and 46 allowed up to
32 GiB - 1 (parallel/test-fs-write-buffer-large).

Give those isolates an allocator that delegates to gin's partition up to
the cap and serves larger requests from sandbox pages, sharing the page
bookkeeping with the in-sandbox allocator. Buffer.alloc() and
new ArrayBuffer() above the cap now work there as well. The page map is
only locked while a page allocation is live. Renderers are unaffected:
Blink's isolate allocator already allows giga allocations.

Ref: nodejs/node#61480

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix: include node_watchdog.h only where --process-timeout is wired

node_watchdog.h chooses between its POSIX and Windows members with
Node's __POSIX__ define, which Node's own targets set but Electron's do
not, so including it from node_includes.h broke every electron_lib
source on Linux ("unknown type name 'BOOL'"). Include it in node_main.cc
alone, with __POSIX__ set around it on POSIX so the class matches Node's
own build.

Ref: nodejs/node#66138

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix: let Node.js 26's virtual file system answer recursive readdir

Node.js 26 adds an experimental virtual file system that fs functions
consult (vfsState.handlers) before the real one. The asar wrapper walks
recursive readdir itself and never asked it, so with a VFS mounted
fs.readdir(..., { recursive: true }) and its sync and promise forms
listed the real path behind the mount (parallel/test-vfs-reserved-root,
parallel/test-vfs-zip-provider-readdir-recursive failed with ENOTDIR).
Ask the VFS first, as Node does.

Ref: nodejs/node#63537

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix: do not log terminated Electron init scripts as errors

CompileAndCall() logged an error whenever running one of Electron's
bundled init scripts threw, including when execution was terminated
because the environment was being torn down. A Worker that is stopped,
or whose process exits, while it is still bootstrapping is not an
error. On Node.js 26 the unref()'d Worker spawned by
module-hooks/test-async-loader-hooks-with-worker-permission-allowed
reaches that point while node_init runs, and the log line broke the
test's empty-stderr check. Only log real exceptions.

Ref: Unable to locate reference

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix(patch): expect the Wasm Global setter WPT to pass with Chromium V8

Chromium's V8 passes "Calling setter without argument" in the Wasm
jsapi WPT global/value-get-set.any.js, which Node's own V8 still fails
and lists as an expected failure, so the run failed on an unexpected
pass.

Ref: Unable to locate reference

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix: honor --no-node-snapshot under ELECTRON_RUN_AS_NODE

ELECTRON_RUN_AS_NODE accepted --no-node-snapshot but always created its
isolate from the embedded Node startup snapshot, and Node worker
threads inherit that snapshot from their parent. Since Node.js 26 a
worker deserializes the whole bootstrapped context from it, so
parallel/test-worker-nearheaplimit-deadlock, which passes
--no-node-snapshot so that its 0 MB-heap worker does not run out of
memory during that deserialization, crashed with SIGSEGV. Skip the
snapshot when Node's options turn it off, as node::Start() does; the
process then boots from the V8 context snapshot like a build without a
Node snapshot. The browser process and the node service parse Node's
options only after creating their isolate, so they are unaffected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* build: fetch Perfetto trace_processor_shell for the Node.js tests

nodejs/node#66068 (test: enable trace_events tests with perfetto) moved
the trace_events tests from test/parallel into a new test/trace_events
suite. When Node.js is built with Perfetto (process.config.variables
.v8_use_perfetto, which Electron's build sets), those tests write binary
.pftrace files and convert them back to JSON with Perfetto's
trace_processor_shell, through test/common/trace_events.js. Without the
tool, all 17 trace_events/* tests in nn-test fail with
"trace_processor_shell is missing".

The same PR added tools/perfetto/get_trace_processor, which upstream's
Makefile and CI use to fetch it. Run that script in the Node.js test job.
It downloads the Perfetto release matching the vendored
deps/perfetto/VERSION (v58.2) from Perfetto's GitHub releases to
tools/perfetto/trace_processor_shell, which is the default path the test
helper resolves, so TRACE_PROCESSOR_SHELL_PATH is not needed. Cache the
binary keyed on that VERSION file. Upstream pins only the version, not a
checksum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* test: disable Node.js source phase import and process-timeout report tests

Electron always passes --no-js-source-phase-imports. In renderers Blink
owns that V8 flag and freezes it before Node.js starts, and the other
process types match it, so the flag is consistent across processes and
the embedded code cache, which is keyed on V8's flag hash, stays valid.
nodejs/node#60364 made Node.js honour that opt-out instead of always
enabling the flag. The es-module/test-esm-wasm-*source-phase* tests are
already disabled for the same reason. Node.js 26 brings more tests that
need source phase imports:

- es-module/test-esm-wasm-jitless (nodejs/node#66533) calls
  import.source() and fails with "SyntaxError: Unexpected identifier
  'source'".
- The wasm/jsapi WPT suite, test/wpt/test-wasm-jsapi.mjs
  (nodejs/node#59034), is new to Electron with this upgrade. Its
  esm-integration/source-phase*.tentative cases use import.source() and
  fail with the same SyntaxError. Its module/moduleSource.tentative cases
  expect the %AbstractModuleSource% intrinsic, which V8 only installs
  when the flag is on. Each case runs as an .any.html and an .any.worker.html
  variant, so that is 8 entries.

nodejs/node#66138 added --process-timeout and
report/test-report-process-timeout. nodejs/node#66428 split out
report/test-report-process-timeout-worker. Both validate the generated
report with test/common/report.js, which expects
header.componentVersions to equal process.versions. In Electron,
process.versions also has chrome and electron, so the comparison fails.
The other report tests that use this helper are already disabled for
the same reason. The process timeout itself works, and both tests get
as far as the report check.

The WPT cases are listed as wpt/<test file>/<case id>, which is how
tools/test.py names them and matches --skip-tests. Teach
--validateDisabled to check the test file for these entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* test: resolve V8's NewBackingStore by Electron's export name on Windows

The external-ab addon now calls v8::ArrayBuffer::NewBackingStore()
itself, but on Windows it is built with MSVC's standard library while
Electron is built with Chromium's libc++, and MSVC mangles return types
into symbol names. electron.exe exports the function as returning
std::__Cr::unique_ptr, so the addon's import of the std::unique_ptr
variant never resolved, the utility process died without a V8 fatal
error and "emits 'error' when fatal error is triggered from V8" timed
out on windows-x64. Look the function up by Electron's exported name
there instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* test: only reference std-free V8 exports from the external-ab addon

On macOS and Linux the addon is built against a different libc++ ABI
namespace than Electron's std::__Cr, so v8::ArrayBuffer::New(isolate,
std::shared_ptr<BackingStore>) is an import that cannot bind. It only
went unnoticed because NewBackingStore() raises the fatal error first.
Stop after NewBackingStore(), whose mangled name has no standard
library types, and throw if it ever returns, as on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* Revert "build: fetch Perfetto trace_processor_shell for the Node.js tests"

This reverts commit 8920a7c.

Node.js uses trace_processor_shell only to read back the trace file that
a process started with --trace-event-categories writes. Electron never
writes that file: Chromium owns tracing, and Electron does not start
Node.js's file-based tracing agent. Every trace_events/* test fails
before it reaches trace_processor_shell, because no trace file exists
or, in test-trace-events-api, because getEnabledCategories() is
undefined in the child. Those tests are disabled again in the next
commit, so no Node.js test needs trace_processor_shell, and downloading
it would only add a network fetch to the job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* test: disable the Node.js trace_events tests in their new directory

nodejs/node#66068 (test: enable trace_events tests with perfetto) moved
17 test-trace-events-* tests out of test/parallel into a new
test/trace_events suite. That took them out from under Electron's
"parallel/test-trace-events" entry, which --skip-tests matches as a
substring. Electron has never run these tests. They were disabled one by
one when Electron started running the Node.js tests (1d06f67) and
folded into the parallel/ prefix in #49467.

They start Node.js with --trace-event-categories and read back the trace
file it writes. Electron does not start Node.js's file-based tracing
agent, because Chromium owns tracing, so no trace file is ever written.
In nn-test, all 17 fail on a missing trace file, and
test-trace-events-api also finds getEnabledCategories() undefined in its
child.

Add the matching "trace_events/test-trace-events" prefix. It covers all
17 files in test/trace_events. Keep the parallel/ entry, which still
matches the 13 test-trace-events-* tests that stayed in test/parallel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix: copy directory trees out of archives without blocking fs.cp()

nodejs/node#65488 (fs: copy directory trees for fs.cp() on the thread
pool) made fs.cp() and fsPromises.cp() copy a new destination directory
with a native CpDirJob. The job walks the tree on the thread pool and
calls ondone once. Electron's override for archive sources ran the
synchronous fs.cpSync() walk in a single process.nextTick, so an
asynchronous cp of a directory out of an archive blocked the event loop
until the whole tree had been copied.

Give the job an asynchronous version of the walk. It goes through the
fs.promises overrides, so packed files use the existing asynchronous
copyFile path, and it keeps the same ordering, force/errorOnExist,
symlink and preserveTimestamps handling and errors as the sync walk.
The job still reports through ondone exactly once. fs.cpSync() keeps
the synchronous walk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* test: trigger the utility process V8 fatal error from the testing binding

The utilityProcess 'error' event from #43774 reports any V8 fatal error.
Its spec raised one with the external-ab native addon, which handed V8
memory from outside the sandbox. Node.js 26 makes every Buffer site
sandbox compatible, so that no longer happens through Node.js APIs. The
earlier commits on this branch made the addon call V8 directly, and
that needed ABI workarounds on Windows and for libc++.

As Deepak suggested in review, drop the addon and its workspace entries.
Add triggerV8FatalError() to the electron_common_testing binding, which
is only built when DCHECKs are on. It fails a V8 API check by setting an
internal field on a plain object, so it does not depend on the V8
sandbox. The spec keeps #43774's checks on the event type, location and
report trigger, also checks the report's event message, and now runs
wherever the testing binding exists, including Windows on Arm.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* test: wait for the utility process exit only after its 'error' event

events.once(emitter, 'exit') also listens for 'error' and rejects with
its first argument. The previous commit started waiting for 'exit'
before the 'error' event arrived, so the utility process's
'FatalError' rejected that promise and the spec failed with
"Unknown Error: FatalError". Wait for 'exit' after 'error' has been
received, as the spec from #43774 did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* refactor: use one d8-style PartitionAlloc allocator inside the V8 sandbox

Following Deepak's review, replace the sandbox-page fallback added for
nodejs/node#61480 and the older InSandboxAllocator with a single
PAInSandboxAllocator, modelled on d8's.

nodejs/node#61480 moved Buffer.allocUnsafe() onto the isolate's
ArrayBuffer allocator. gin's partition caps a single allocation at
partition_alloc::MaxAllocationSize() (2 GiB - 2 MiB), so Buffers above
that size failed. The previous fix served those requests from whole
sandbox pages and tracked them in a separate map.

PAInSandboxAllocator owns a PartitionAlloc partition in the configurable
pool, which gin::V8Initializer::Initialize() places inside the V8
sandbox. The partition is created lazily, after the pool exists. It has
allow_giga_allocations set and allocates with kAllowGigaAllocations,
along with kNoOverrideHooks and kNoMemoryToolOverride, as gin does. A
single ArrayBuffer can therefore reach MaxGigaAllocationSize()
(16 GiB - 2 MiB on 64-bit) without the page fallback. It is both the
ArrayBuffer allocator for JavascriptEnvironment isolates and V8's
in-sandbox allocator, so Node.js worker_threads isolates use it through
NewDefaultAllocator(). Builds without the V8 sandbox keep gin's
allocator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

* fix: reject instead of throwing in asar fs.promises.stat/lstat wrappers

The new fs.promises.stat/lstat wrappers call splitPath() before deciding
whether to use fsPromises' own implementation. For a URL, splitPath()
runs getValidatedPath(), which throws for a non-file: URL, so the error
escaped synchronously instead of rejecting the returned promise as it did
with util.promisify(fs.stat) on main and as Node's fsPromises does. Make
the wrappers async so every input error rejects, and add a spec for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vf2yMuJ7XxvNktpKuiMPzU

---------

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

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. dont-land-on-v22.x PRs that should not land on the v22.x-staging branch and should not be released in v22.x. dont-land-on-v24.x PRs that should not land on the v24.x-staging branch and should not be released in v24.x. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants