lib: make domexception a native error
isolate->SetJSApiWrapperNativeErrorCallback(IsNodeError) can not be used because V8 only invokes the callback for native objects:
https://github.com/nodejs/node/blob/708477bd8d68f3571b02bb311dccc3d892e447d1/deps/v8/src/builtins/builtins-error.cc#L72-L74
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: https://github.com/nodejs/node/pull/58138 Fixes: https://github.com/nodejs/node/issues/56497
Review requested:
- [ ] @nodejs/web-standards
- [ ] @nodejs/v8-update
- [ ] @nodejs/gyp
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 90.10%. Comparing base (5584cc5) to head (27dfaaa).
:warning: 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%) |
:arrow_up: |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
Fixing structuredClone support in https://chromium-review.googlesource.com/c/v8/v8/+/6637876.
CI: https://ci.nodejs.org/job/node-test-pull-request/67528/
V8 CI: https://ci.nodejs.org/job/node-test-commit-v8-linux/nodes=benchmark-ubuntu2204-intel-64,v8test=v8test/6618/
V8 CI: https://ci.nodejs.org/job/node-test-commit-v8-linux/nodes=rhel8-ppc64le,v8test=v8test/6618/
V8 CI: https://ci.nodejs.org/job/node-test-commit-v8-linux/nodes=rhel8-s390x,v8test=v8test/6618/
CI: https://ci.nodejs.org/job/node-test-pull-request/67542/
CI: https://ci.nodejs.org/job/node-test-pull-request/67560/
CI: https://ci.nodejs.org/job/node-test-pull-request/67566/
CI: https://ci.nodejs.org/job/node-test-pull-request/67572/
Landed in 11222f1a272b9b2ab000e75cbe3e09942bd2d877...e679e38b252ee5203ef583392f77fd532e2b4a67
Would this qualify for a backport in NodeJS 24?
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)
https://github.com/nodejs/node/blob/54574432109f353dcb936343d732f406584bce51/test/parallel/test-structuredClone-domexception.js#L7
Backport open at https://github.com/nodejs/node/pull/59957.