Skip to content

test: WPT for Wasm jsapi including new ESM Integration tests - #59034

Closed
guybedford wants to merge 10 commits into
nodejs:mainfrom
guybedford:wpt-wasm-jsapi
Closed

guybedford wants to merge 10 commits into
nodejs:mainfrom
guybedford:wpt-wasm-jsapi

Conversation

@guybedford

Copy link
Copy Markdown
Contributor

This adds the jsapi test suite for WebAssembly including the new ESM Integration jsapi tests from WebAssembly/esm-integration#110 with upstream PR in web-platform-tests/wpt#53718.

Tests for string builtins and namespaceInstance are pending #59020 and #59024 respectively.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/web-standards

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to Node.js core tests and test infrastructure. labels Jul 11, 2025
@codecov

codecov Bot commented Jul 11, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.69%. Comparing base (0474a27) to head (0be51d5).
⚠️ Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #59034      +/-   ##
==========================================
- Coverage   91.54%   89.69%   -1.86%     
==========================================
  Files         351      692     +341     
  Lines      147748   214167   +66419     
  Branches    23240    41109   +17869     
==========================================
+ Hits       135258   192087   +56829     
- Misses      12236    14145    +1909     
- Partials      254     7935    +7681     

see 463 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.

Comment thread test/wpt/status/wasm/jsapi.json Resolved
@legendecas legendecas added the commit-queue-squash PRs the Commit Queue should land as one squashed commit. label Mar 23, 2026
@panva

panva commented Mar 23, 2026 •

Copy link
Copy Markdown
Member
out/Release/node --experimental-wasm-modules /repo/node/test/wpt/test-wasm-jsapi.mjs
(node:83231) Warning: Failed to load the ES module: /repo/node/test/fixtures/es-modules/globals.js. Make sure to set "type": "module" in the nearest package.json file or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
node:internal/modules/run_main:107
    triggerUncaughtException(
    ^

AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  ok(e instanceof WebAssembly.CompileError)

    at file:///repo/node/test/wpt/test-wasm-jsapi.mjs:13:3 {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '==',
  diff: 'simple'
}
/repo/node/test/fixtures/es-modules/globals.js:5
export { i32_value as '🚀i32_value' }
^^^^^^

SyntaxError: Unexpected token 'export'
    at wrapSafe (node:internal/modules/cjs/loader:1762:18)
    at Module._compile (node:internal/modules/cjs/loader:1803:20)
    at Module._extensions..js (node:internal/modules/cjs/loader:1969:10)
    at Module.load (node:internal/modules/cjs/loader:1552:32)
    at Module._load (node:internal/modules/cjs/loader:1354:12)
    at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
    at loadCJSModuleWithModuleLoad (node:internal/modules/esm/translators:325:3)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:230:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:639:26)

@nodejs-github-bot

This comment was marked as outdated.

@richardlau

Copy link
Copy Markdown
Member

@miladfarca FYI it looks like some of these tests are failing on Linux s390x.

@guybedford

Copy link
Copy Markdown
Contributor Author

So, it seems it this is for round-tripping v128:

  [UNEXPECTED_FAILURE][FAIL] v128 globals should work correctly in WebAssembly-to-WebAssembly imports
  assert_equals: expected 1 but got 67108864
      at Test.<anonymous> (/home/iojs/build/workspace/node-test-commit-linuxone/test/fixtures/wpt/wasm/jsapi/esm-integration/mutable-global-sharing.tentative.any.js:52:3)
      at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
  Command: /home/iojs/build/workspace/node-test-commit-linuxone/out/Release/node --experimental-wasm-modules undefined 'esm-integration/mutable-global-sharing.tentative.any.js'

The value returned is consistent with big endian handling of the SIMD path, which formally speaking is a V8 bug since Wasm is supposed to have little endian behaviours.

There is a SIMD test for this in V8, but V8 only runs x390x simulator assuming VECTOR_ENHANCE_FACILITY_2, which might not be available on our hardware?

I've pushed a temporary commit which replicates the internal simd test suite case in question, to see if that also fails on the hardware. If so, then this is a V8 bug on s390x separate to the WPT work here.

@nodejs-github-bot

This comment was marked as outdated.

@guybedford

Copy link
Copy Markdown
Contributor Author

I can confirm the same failure, so this is a v8 bug for Wasm SIMD on s390x - https://ci.nodejs.org/job/node-test-commit-aix/61569/nodes=aix72-power9/testReport/junit/(root)/parallel/test_wasm_simd_global/.

I've added a specific skip for this environment to resolve the issue, given this is not a Node.js or WPT issue.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@richardlau

Copy link
Copy Markdown
Member

I can confirm the same failure, so this is a v8 bug for Wasm SIMD on s390x - https://ci.nodejs.org/job/node-test-commit-aix/61569/nodes=aix72-power9/testReport/junit/(root)/parallel/test_wasm_simd_global/.

FWIW AIX is not Linux s390x, but both are big endian platforms.

@miladfarca

Copy link
Copy Markdown
Contributor

This patch should fix the issue on big endian (which includes s390x): http://crrev.com/c/7704213

hubot pushed a commit to v8/v8 that referenced this pull request Mar 26, 2026
Since http://crrev.com/c/2944437 globals are no longer little endian
enforced.

S128Const handling in the initializer needs to take this into account
and byte reverse values which are hard coded in little endian order.

This is currently causing failures on Node.js upstream:
nodejs/node#59034 (comment)

Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
Cr-Commit-Position: refs/heads/main@{#106082}
@nodejs-github-bot

This comment was marked as outdated.

@guybedford

Copy link
Copy Markdown
Contributor Author

Unfortunately it seems like that patch did not fix the error in the CI here. Let me know if I should bring back the skip or if we should wait for a further follow-on.

@guybedford

Copy link
Copy Markdown
Contributor Author

Oh nvm I misread the commit being shown on this PR as being included here... sorry for confusion will continue with the final CI here further based on the skipped test, to be corrected later.

richardlau pushed a commit to richardlau/node-1 that referenced this pull request Mar 26, 2026
Original commit message:

    [wasm] Fix S128Const on big endian

    Since http://crrev.com/c/2944437 globals are no longer little endian
    enforced.

    S128Const handling in the initializer needs to take this into account
    and byte reverse values which are hard coded in little endian order.

    This is currently causing failures on Node.js upstream:
    nodejs#59034 (comment)

    Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
    Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
    Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#106082}

Refs: v8/v8@cf1bce4
@richardlau

Copy link
Copy Markdown
Member

This patch should fix the issue on big endian (which includes s390x): http://crrev.com/c/7704213

#62449

nodejs-github-bot pushed a commit that referenced this pull request Mar 28, 2026
Original commit message:

    [wasm] Fix S128Const on big endian

    Since http://crrev.com/c/2944437 globals are no longer little endian
    enforced.

    S128Const handling in the initializer needs to take this into account
    and byte reverse values which are hard coded in little endian order.

    This is currently causing failures on Node.js upstream:
    #59034 (comment)

    Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
    Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
    Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#106082}

Refs: v8/v8@cf1bce4
PR-URL: #62449
Refs: v8/v8@cf1bce4
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
targos pushed a commit to targos/node that referenced this pull request Apr 3, 2026
Original commit message:

    [wasm] Fix S128Const on big endian

    Since http://crrev.com/c/2944437 globals are no longer little endian
    enforced.

    S128Const handling in the initializer needs to take this into account
    and byte reverse values which are hard coded in little endian order.

    This is currently causing failures on Node.js upstream:
    nodejs#59034 (comment)

    Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
    Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
    Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#106082}

Refs: v8/v8@cf1bce4
PR-URL: nodejs#62449
Refs: v8/v8@cf1bce4
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@targos targos mentioned this pull request Apr 3, 2026
aduh95 pushed a commit that referenced this pull request Apr 4, 2026
Original commit message:

    [wasm] Fix S128Const on big endian

    Since http://crrev.com/c/2944437 globals are no longer little endian
    enforced.

    S128Const handling in the initializer needs to take this into account
    and byte reverse values which are hard coded in little endian order.

    This is currently causing failures on Node.js upstream:
    #59034 (comment)

    Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
    Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
    Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#106082}

Refs: v8/v8@cf1bce4
PR-URL: #62449
Refs: v8/v8@cf1bce4
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Apr 5, 2026
Original commit message:

    [wasm] Fix S128Const on big endian

    Since http://crrev.com/c/2944437 globals are no longer little endian
    enforced.

    S128Const handling in the initializer needs to take this into account
    and byte reverse values which are hard coded in little endian order.

    This is currently causing failures on Node.js upstream:
    #59034 (comment)

    Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
    Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
    Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#106082}

Refs: v8/v8@cf1bce4
PR-URL: #62449
Refs: v8/v8@cf1bce4
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Apr 6, 2026
Original commit message:

    [wasm] Fix S128Const on big endian

    Since http://crrev.com/c/2944437 globals are no longer little endian
    enforced.

    S128Const handling in the initializer needs to take this into account
    and byte reverse values which are hard coded in little endian order.

    This is currently causing failures on Node.js upstream:
    #59034 (comment)

    Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
    Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
    Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#106082}

Refs: v8/v8@cf1bce4
PR-URL: #62449
Refs: v8/v8@cf1bce4
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Apr 8, 2026
Original commit message:

    [wasm] Fix S128Const on big endian

    Since http://crrev.com/c/2944437 globals are no longer little endian
    enforced.

    S128Const handling in the initializer needs to take this into account
    and byte reverse values which are hard coded in little endian order.

    This is currently causing failures on Node.js upstream:
    #59034 (comment)

    Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
    Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
    Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#106082}

Refs: v8/v8@cf1bce4
PR-URL: #62449
Refs: v8/v8@cf1bce4
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
aduh95 pushed a commit that referenced this pull request Apr 10, 2026
Original commit message:

    [wasm] Fix S128Const on big endian

    Since http://crrev.com/c/2944437 globals are no longer little endian
    enforced.

    S128Const handling in the initializer needs to take this into account
    and byte reverse values which are hard coded in little endian order.

    This is currently causing failures on Node.js upstream:
    #59034 (comment)

    Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
    Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
    Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#106082}

Refs: v8/v8@cf1bce4
PR-URL: #62449
Refs: v8/v8@cf1bce4
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Renegade334 pushed a commit to Renegade334/node that referenced this pull request Apr 11, 2026
Original commit message:

    [wasm] Fix S128Const on big endian

    Since http://crrev.com/c/2944437 globals are no longer little endian
    enforced.

    S128Const handling in the initializer needs to take this into account
    and byte reverse values which are hard coded in little endian order.

    This is currently causing failures on Node.js upstream:
    nodejs#59034 (comment)

    Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
    Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
    Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#106082}

Refs: v8/v8@cf1bce4
PR-URL: nodejs#62449
Refs: v8/v8@cf1bce4
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
targos pushed a commit to targos/node that referenced this pull request Apr 17, 2026
Original commit message:

    [wasm] Fix S128Const on big endian

    Since http://crrev.com/c/2944437 globals are no longer little endian
    enforced.

    S128Const handling in the initializer needs to take this into account
    and byte reverse values which are hard coded in little endian order.

    This is currently causing failures on Node.js upstream:
    nodejs#59034 (comment)

    Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
    Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
    Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#106082}

Refs: v8/v8@cf1bce4
PR-URL: nodejs#62449
Refs: v8/v8@cf1bce4
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
targos pushed a commit to targos/node that referenced this pull request Apr 24, 2026
Original commit message:

    [wasm] Fix S128Const on big endian

    Since http://crrev.com/c/2944437 globals are no longer little endian
    enforced.

    S128Const handling in the initializer needs to take this into account
    and byte reverse values which are hard coded in little endian order.

    This is currently causing failures on Node.js upstream:
    nodejs#59034 (comment)

    Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
    Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
    Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#106082}

Refs: v8/v8@cf1bce4
PR-URL: nodejs#62449
Refs: v8/v8@cf1bce4
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
targos pushed a commit that referenced this pull request Apr 24, 2026
Original commit message:

    [wasm] Fix S128Const on big endian

    Since http://crrev.com/c/2944437 globals are no longer little endian
    enforced.

    S128Const handling in the initializer needs to take this into account
    and byte reverse values which are hard coded in little endian order.

    This is currently causing failures on Node.js upstream:
    #59034 (comment)

    Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
    Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
    Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#106082}

Refs: v8/v8@cf1bce4
Refs: v8/v8@cf1bce4
PR-URL: #61898
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Apr 27, 2026
Original commit message:

    [wasm] Fix S128Const on big endian

    Since http://crrev.com/c/2944437 globals are no longer little endian
    enforced.

    S128Const handling in the initializer needs to take this into account
    and byte reverse values which are hard coded in little endian order.

    This is currently causing failures on Node.js upstream:
    #59034 (comment)

    Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
    Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
    Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#106082}

Refs: v8/v8@cf1bce4
Refs: v8/v8@cf1bce4
PR-URL: #61898
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
(cherry picked from commit cc5a331)
@aduh95 aduh95 added the backport-requested-v24.x PRs awaiting manual backport to the v24.x-staging branch. label May 7, 2026
@aduh95

aduh95 commented May 7, 2026

Copy link
Copy Markdown
Contributor

Tests are failing on v24.x-staging with this change, it would require a manual backport PR if we want it on Node.js 24

juanarbol pushed a commit to juanarbol/node that referenced this pull request Jul 16, 2026
Original commit message:

    [wasm] Fix S128Const on big endian

    Since http://crrev.com/c/2944437 globals are no longer little endian
    enforced.

    S128Const handling in the initializer needs to take this into account
    and byte reverse values which are hard coded in little endian order.

    This is currently causing failures on Node.js upstream:
    nodejs#59034 (comment)

    Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
    Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
    Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#106082}

Refs: v8/v8@cf1bce4
PR-URL: nodejs#62449
Refs: v8/v8@cf1bce4
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
juanarbol pushed a commit that referenced this pull request Jul 17, 2026
Original commit message:

    [wasm] Fix S128Const on big endian

    Since http://crrev.com/c/2944437 globals are no longer little endian
    enforced.

    S128Const handling in the initializer needs to take this into account
    and byte reverse values which are hard coded in little endian order.

    This is currently causing failures on Node.js upstream:
    #59034 (comment)

    Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
    Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
    Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#106082}

Refs: v8/v8@cf1bce4
PR-URL: #62449
Refs: v8/v8@cf1bce4
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
juanarbol pushed a commit that referenced this pull request Jul 19, 2026
Original commit message:

    [wasm] Fix S128Const on big endian

    Since http://crrev.com/c/2944437 globals are no longer little endian
    enforced.

    S128Const handling in the initializer needs to take this into account
    and byte reverse values which are hard coded in little endian order.

    This is currently causing failures on Node.js upstream:
    #59034 (comment)

    Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
    Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
    Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#106082}

Refs: v8/v8@cf1bce4
PR-URL: #62449
Refs: v8/v8@cf1bce4
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
marco-ippolito pushed a commit that referenced this pull request Jul 29, 2026
Original commit message:

    [wasm] Fix S128Const on big endian

    Since http://crrev.com/c/2944437 globals are no longer little endian
    enforced.

    S128Const handling in the initializer needs to take this into account
    and byte reverse values which are hard coded in little endian order.

    This is currently causing failures on Node.js upstream:
    #59034 (comment)

    Change-Id: Ifcc9ade93ee51565ab19b16e9dadf0ff5752f7a6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/7704213
    Commit-Queue: Milad Farazmand <mfarazma@ibm.com>
    Reviewed-by: Manos Koukoutos <manoskouk@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#106082}

Refs: v8/v8@cf1bce4
PR-URL: #62449
Refs: v8/v8@cf1bce4
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
jkleinsc pushed a commit to electron/electron that referenced this pull request Oct 29, 2026
…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
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

backport-requested-v24.x PRs awaiting manual backport to the v24.x-staging branch. commit-queue-squash PRs the Commit Queue should land as one squashed commit. needs-ci PRs that need a full CI run. test Issues and PRs related to Node.js core tests and test infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants