Skip to content

Conversation

Renegade334
Copy link
Contributor

ES2021 altered the behaviour of default constructors for derived classes, such that constructor calls no longer use array spreading when passing arguments to the parent constructor.

The following used to fail, but passes as of v22.0.0:

Reflect.getPrototypeOf(Array.prototype[Symbol.iterator]()).next = function next() {
  throw new Error('%ArrayIteratorPrototype%.next called!');
}
new class Derived extends Object {} ();

Previously, internal derived classes were given manually-defined "pass-through" constructors in order to avoid exposure to prototype pollution. These are no longer required, and can be safely removed.

cc: @aduh95

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/crypto
  • @nodejs/loaders

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Aug 27, 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

should this have some do-not-backport labels?

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 27, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 27, 2025
@nodejs-github-bot
Copy link
Collaborator

@marco-ippolito marco-ippolito added the dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. label Aug 27, 2025
Copy link

codecov bot commented Aug 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.91%. Comparing base (83c955d) to head (22f9cd6).
⚠️ Report is 21 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #59650      +/-   ##
==========================================
+ Coverage   89.89%   89.91%   +0.01%     
==========================================
  Files         667      667              
  Lines      196579   196552      -27     
  Branches    38592    38586       -6     
==========================================
+ Hits       176710   176725      +15     
+ Misses      12320    12286      -34     
+ Partials     7549     7541       -8     
Files with missing lines Coverage Δ
lib/inspector/promises.js 100.00% <100.00%> (ø)
lib/internal/buffer.js 98.30% <100.00%> (-0.28%) ⬇️
lib/internal/crypto/keys.js 95.19% <ø> (-0.03%) ⬇️
lib/internal/fs/glob.js 91.97% <ø> (-0.02%) ⬇️
lib/internal/modules/esm/module_map.js 98.47% <ø> (-0.04%) ⬇️
lib/internal/per_context/primordials.js 99.17% <100.00%> (-0.03%) ⬇️
lib/internal/readline/interface.js 97.13% <ø> (-0.01%) ⬇️
lib/internal/repl/utils.js 96.47% <ø> (+0.07%) ⬆️
lib/readline/promises.js 100.00% <ø> (ø)

... and 38 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.

@aduh95 aduh95 added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. labels Aug 30, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 30, 2025
@nodejs-github-bot nodejs-github-bot merged commit 196f546 into nodejs:main Aug 30, 2025
77 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 196f546

@Renegade334 Renegade334 deleted the lib-use-default-constructors branch August 30, 2025 14:46
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. dont-land-on-v20.x PRs that should not land on the v20.x-staging branch and should not be released in v20.x. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants