Skip to content

Conversation

@legendecas
Copy link
Member

@legendecas legendecas commented Jun 12, 2025

deps: V8: cherry-pick e3df60f3f5ab

Original commit message:

[objects] allow host defined serializer of JSError Allow host defined serializer and deserializer of JSError in ValueSerializer API. This allows hosts that implement DOMException in JS to support `Error.isError` proposal and `structuredClone`. Refs: https://github.com/nodejs/node/pull/58691 Change-Id: I022821c9abd659970c4d449b3c69c5fb54d0618a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6637876 Reviewed-by: Camillo Bruni <cbruni@chromium.org> Commit-Queue: Chengzhong Wu <cwu631@bloomberg.net> Cr-Commit-Position: refs/heads/main@{#100894} 

Refs: v8/v8@e3df60f

lib: make domexception a native error

isolate->SetJSApiWrapperNativeErrorCallback(IsNodeError) can not be used because V8 only invokes the callback for native objects:

IsJSErrorMap(obj_map) ||
(IsJSApiWrapperObjectMap(obj_map) &&
isolate->IsJSApiWrapperNativeError(Cast<JSReceiver>(obj))));

Setting this callback also requires embedders like electron to decide if they need to override blink's callback. So it is simpler to implement this in JS only.

Refs: #58138
Fixes: #56497

@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Jun 12, 2025

Review requested:

  • @nodejs/web-standards
  • @nodejs/v8-update
  • @nodejs/gyp
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Jun 12, 2025
@legendecas legendecas marked this pull request as draft June 12, 2025 10:51
@codecov
Copy link

codecov bot commented Jun 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.10%. Comparing base (5584cc5) to head (27dfaaa).
⚠️ Report is 636 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@ ## main #58691 +/- ## ========================================== - Coverage 90.13% 90.10% -0.04%  ========================================== Files 639 639 Lines 188192 188209 +17 Branches 36916 36906 -10 ========================================== - Hits 169633 169580 -53  - Misses 11324 11369 +45  - Partials 7235 7260 +25 
Files with missing lines Coverage Δ
lib/internal/per_context/domexception.js 82.43% <100.00%> (+1.58%) ⬆️

... and 41 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.
@legendecas
Copy link
Member Author

@legendecas legendecas force-pushed the dom-exception-iserror branch 2 times, most recently from 40c22d3 to b8d3f25 Compare June 12, 2025 16:46
hubot pushed a commit to v8/v8 that referenced this pull request Jun 18, 2025
Allow host defined serializer and deserializer of JSError in ValueSerializer API. This allows hosts that implement DOMException in JS to support `Error.isError` proposal and `structuredClone`. Refs: nodejs/node#58691 Change-Id: I022821c9abd659970c4d449b3c69c5fb54d0618a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6637876 Reviewed-by: Camillo Bruni <cbruni@chromium.org> Commit-Queue: Chengzhong Wu <cwu631@bloomberg.net> Cr-Commit-Position: refs/heads/main@{#100894}
legendecas and others added 2 commits June 19, 2025 11:54
Original commit message: [objects] allow host defined serializer of JSError Allow host defined serializer and deserializer of JSError in ValueSerializer API. This allows hosts that implement DOMException in JS to support `Error.isError` proposal and `structuredClone`. Refs: nodejs#58691 Change-Id: I022821c9abd659970c4d449b3c69c5fb54d0618a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6637876 Reviewed-by: Camillo Bruni <cbruni@chromium.org> Commit-Queue: Chengzhong Wu <cwu631@bloomberg.net> Cr-Commit-Position: refs/heads/main@{#100894} Refs: v8/v8@e3df60f
Co-Authored-By: Kenta Moriuchi <moriken@kimamass.com>
@legendecas legendecas force-pushed the dom-exception-iserror branch from b8d3f25 to 27dfaaa Compare June 19, 2025 10:57
@legendecas legendecas marked this pull request as ready for review June 19, 2025 10:57
Copy link
Member

@jazelly jazelly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was following this. lgtm

@legendecas legendecas added commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Jun 20, 2025
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@legendecas legendecas added the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 21, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 21, 2025
@nodejs-github-bot
Copy link
Collaborator

Landed in 11222f1...e679e38

nodejs-github-bot pushed a commit that referenced this pull request Jun 21, 2025
Original commit message: [objects] allow host defined serializer of JSError Allow host defined serializer and deserializer of JSError in ValueSerializer API. This allows hosts that implement DOMException in JS to support `Error.isError` proposal and `structuredClone`. Refs: #58691 Change-Id: I022821c9abd659970c4d449b3c69c5fb54d0618a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6637876 Reviewed-by: Camillo Bruni <cbruni@chromium.org> Commit-Queue: Chengzhong Wu <cwu631@bloomberg.net> Cr-Commit-Position: refs/heads/main@{#100894} Refs: v8/v8@e3df60f PR-URL: #58691 Fixes: #56497 Refs: #58138 Reviewed-By: Jason Zhang <xzha4350@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: James M Snell <jasnell@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Jun 21, 2025
Co-Authored-By: Kenta Moriuchi <moriken@kimamass.com> PR-URL: #58691 Fixes: #56497 Refs: v8/v8@e3df60f Refs: #58138 Reviewed-By: Jason Zhang <xzha4350@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: James M Snell <jasnell@gmail.com>
@legendecas legendecas deleted the dom-exception-iserror branch June 21, 2025 10:53
@alexsch01
Copy link
Contributor

alexsch01 commented Jun 21, 2025

Would this qualify for a backport in NodeJS 24?

RafaelGSS pushed a commit that referenced this pull request Jun 23, 2025
Original commit message: [objects] allow host defined serializer of JSError Allow host defined serializer and deserializer of JSError in ValueSerializer API. This allows hosts that implement DOMException in JS to support `Error.isError` proposal and `structuredClone`. Refs: #58691 Change-Id: I022821c9abd659970c4d449b3c69c5fb54d0618a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6637876 Reviewed-by: Camillo Bruni <cbruni@chromium.org> Commit-Queue: Chengzhong Wu <cwu631@bloomberg.net> Cr-Commit-Position: refs/heads/main@{#100894} Refs: v8/v8@e3df60f PR-URL: #58691 Fixes: #56497 Refs: #58138 Reviewed-By: Jason Zhang <xzha4350@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: James M Snell <jasnell@gmail.com>
RafaelGSS pushed a commit that referenced this pull request Jun 23, 2025
Co-Authored-By: Kenta Moriuchi <moriken@kimamass.com> PR-URL: #58691 Fixes: #56497 Refs: v8/v8@e3df60f Refs: #58138 Reviewed-By: Jason Zhang <xzha4350@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: James M Snell <jasnell@gmail.com>
zloirock added a commit to zloirock/core-js that referenced this pull request Jun 25, 2025
@aduh95 aduh95 added the backport-requested-v22.x PRs awaiting manual backport to the v22.x-staging branch. label Jul 21, 2025
@aduh95
Copy link
Contributor

aduh95 commented Jul 21, 2025

We're getting a test failure with this change on v22.x-staging:

=== release test-structuredClone-domexception === Path: parallel/test-structuredClone-domexception node:assert:95 throw new AssertionError(obj); ^ AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: false !== true at assertDOMException (…/test/parallel/test-structuredClone-domexception.js:7:10) at Object.<anonymous> (…/test/parallel/test-structuredClone-domexception.js:19:3) at Module._compile (node:internal/modules/cjs/loader:1688:14) 

assert.strictEqual(actual instanceof DOMException, true);

Renegade334 pushed a commit to Renegade334/node that referenced this pull request Sep 20, 2025
Co-Authored-By: Kenta Moriuchi <moriken@kimamass.com> PR-URL: nodejs#58691 Fixes: nodejs#56497 Refs: v8/v8@e3df60f Refs: nodejs#58138 Reviewed-By: Jason Zhang <xzha4350@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: James M Snell <jasnell@gmail.com>
Renegade334 pushed a commit to Renegade334/node that referenced this pull request Sep 21, 2025
Original commit message: [objects] allow host defined serializer of JSError Allow host defined serializer and deserializer of JSError in ValueSerializer API. This allows hosts that implement DOMException in JS to support `Error.isError` proposal and `structuredClone`. Refs: nodejs#58691 Change-Id: I022821c9abd659970c4d449b3c69c5fb54d0618a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6637876 Reviewed-by: Camillo Bruni <cbruni@chromium.org> Commit-Queue: Chengzhong Wu <cwu631@bloomberg.net> Cr-Commit-Position: refs/heads/main@{#100894} Refs: v8/v8@e3df60f PR-URL: nodejs#58691 Backport-PR-URL: nodejs#59957 Fixes: nodejs#56497 Refs: nodejs#58138 Reviewed-By: Jason Zhang <xzha4350@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: James M Snell <jasnell@gmail.com>
Renegade334 pushed a commit to Renegade334/node that referenced this pull request Sep 21, 2025
Co-Authored-By: Kenta Moriuchi <moriken@kimamass.com> PR-URL: nodejs#58691 Backport-PR-URL: nodejs#59957 Fixes: nodejs#56497 Refs: v8/v8@e3df60f Refs: nodejs#58138 Reviewed-By: Jason Zhang <xzha4350@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: James M Snell <jasnell@gmail.com>
@legendecas legendecas added backport-open-v22.x Indicate that the PR has an open backport and removed backport-requested-v22.x PRs awaiting manual backport to the v22.x-staging branch. labels Sep 21, 2025
@legendecas
Copy link
Member Author

Backport open at #59957.

richardlau pushed a commit that referenced this pull request Sep 22, 2025
Original commit message: [objects] allow host defined serializer of JSError Allow host defined serializer and deserializer of JSError in ValueSerializer API. This allows hosts that implement DOMException in JS to support `Error.isError` proposal and `structuredClone`. Refs: #58691 Change-Id: I022821c9abd659970c4d449b3c69c5fb54d0618a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6637876 Reviewed-by: Camillo Bruni <cbruni@chromium.org> Commit-Queue: Chengzhong Wu <cwu631@bloomberg.net> Cr-Commit-Position: refs/heads/main@{#100894} Refs: v8/v8@e3df60f PR-URL: #58691 Backport-PR-URL: #59957 Fixes: #56497 Refs: #58138 Reviewed-By: Jason Zhang <xzha4350@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: James M Snell <jasnell@gmail.com>
richardlau pushed a commit that referenced this pull request Sep 22, 2025
Co-Authored-By: Kenta Moriuchi <moriken@kimamass.com> PR-URL: #58691 Backport-PR-URL: #59957 Fixes: #56497 Refs: v8/v8@e3df60f Refs: #58138 Reviewed-By: Jason Zhang <xzha4350@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: James M Snell <jasnell@gmail.com>
@richardlau richardlau added backported-to-v22.x PRs backported to the v22.x-staging branch. and removed backport-open-v22.x Indicate that the PR has an open backport labels Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. backported-to-v22.x PRs backported to the v22.x-staging branch. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. needs-ci PRs that need a full CI run.