Skip to content

Implement FinalizationRegistry#5101

Open
jedel1043 wants to merge 5 commits intoboa-dev:mainfrom
jedel1043:finalization-registry
Open

Implement FinalizationRegistry#5101
jedel1043 wants to merge 5 commits intoboa-dev:mainfrom
jedel1043:finalization-registry

Conversation

@jedel1043
Copy link
Member

@jedel1043 jedel1043 commented Mar 15, 2026

Depends on #5107 merged

Funny GC with its funny semantics

anyways, this implements the last big feature we were missing from the spec. It uses the same pattern from Atomics.waitAsync of (ab)using async jobs to enqueue a cleanup task on a later point in time.

@github-actions github-actions bot added Waiting On Review Waiting on reviews from the maintainers C-Dependencies Pull requests that update a dependency file C-CLI Issues and PRs related to the Boa command line interface. C-Tests Issues and PRs related to the tests. C-Builtins PRs and Issues related to builtins/intrinsics C-GC Issue related to garbage collection and removed Waiting On Review Waiting on reviews from the maintainers labels Mar 15, 2026
@github-actions github-actions bot added this to the v1.0.0 milestone Mar 15, 2026
@github-actions github-actions bot added the Waiting On Review Waiting on reviews from the maintainers label Mar 15, 2026
@github-actions
Copy link

github-actions bot commented Mar 15, 2026

Test262 conformance changes

Test result main count PR count difference
Total 52,963 52,963 0
Passed 50,073 50,120 +47
Ignored 2,072 2,025 -47
Failed 818 818 0
Panics 0 0 0
Conformance 94.54% 94.63% +0.09%
Fixed tests (47):
test/built-ins/Object/seal/seal-finalizationregistry.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype-from-newtarget-abrupt.js (previously Ignored)
test/built-ins/FinalizationRegistry/length.js (previously Ignored)
test/built-ins/FinalizationRegistry/undefined-newtarget-throws.js (previously Ignored)
test/built-ins/FinalizationRegistry/is-a-constructor.js (previously Ignored)
test/built-ins/FinalizationRegistry/constructor.js (previously Ignored)
test/built-ins/FinalizationRegistry/returns-new-object-from-constructor.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype-from-newtarget.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype-from-newtarget-custom.js (previously Ignored)
test/built-ins/FinalizationRegistry/target-not-callable-throws.js (previously Ignored)
test/built-ins/FinalizationRegistry/proto.js (previously Ignored)
test/built-ins/FinalizationRegistry/name.js (previously Ignored)
test/built-ins/FinalizationRegistry/proto-from-ctor-realm.js (previously Ignored)
test/built-ins/FinalizationRegistry/unnaffected-by-poisoned-cleanupCallback.js (previously Ignored)
test/built-ins/FinalizationRegistry/prop-desc.js (previously Ignored)
test/built-ins/FinalizationRegistry/instance-extensible.js (previously Ignored)
test/built-ins/FinalizationRegistry/newtarget-prototype-is-not-object.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/constructor.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/Symbol.toStringTag.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/proto.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/prop-desc.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/unregister/length.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/unregister/throws-when-unregisterToken-cannot-be-held-weakly.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/unregister/custom-this.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/unregister/this-not-object-throws.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/unregister/unregister-object-token.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/unregister/this-does-not-have-internal-cells-throws.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/unregister/name.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/unregister/not-a-constructor.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/unregister/prop-desc.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/register/throws-when-unregisterToken-not-undefined-and-cannot-be-held-weakly.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/register/return-undefined-register-itself.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/register/length.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/register/throws-when-target-cannot-be-held-weakly.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/register/unregisterToken-same-as-target.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/register/unregisterToken-same-as-holdings.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/register/heldValue-same-as-target.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/register/custom-this.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/register/unregisterToken-same-as-holdings-and-target.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/register/this-not-object-throws.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/register/holdings-any-value-type.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/register/name.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/register/return-undefined-register-object.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/register/not-a-constructor.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/register/this-does-not-have-internal-target-throws.js (previously Ignored)
test/built-ins/FinalizationRegistry/prototype/register/prop-desc.js (previously Ignored)
test/built-ins/WeakRef/prototype/deref/this-does-not-have-internal-target-throws.js (previously Ignored)

Tested main commit: 197b736bb87523a14b41834c078adbec3059d237
Tested PR commit: 8342ddb0fd771c6f622ab2a59d970ae8be5cf2a7
Compare commits: 197b736...8342ddb

@codecov
Copy link

codecov bot commented Mar 15, 2026

Codecov Report

❌ Patch coverage is 70.88608% with 46 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.32%. Comparing base (6ddc2b4) to head (8342ddb).
⚠️ Report is 874 commits behind head on main.

Files with missing lines Patch % Lines
...e/engine/src/builtins/finalization_registry/mod.rs 82.75% 20 Missing ⚠️
...ine/src/object/builtins/jsfinalization_registry.rs 0.00% 12 Missing ⚠️
cli/src/executor.rs 0.00% 10 Missing ⚠️
core/engine/src/job.rs 72.72% 3 Missing ⚠️
cli/src/main.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5101       +/-   ##
===========================================
+ Coverage   47.24%   59.32%   +12.08%     
===========================================
  Files         476      565       +89     
  Lines       46892    62945    +16053     
===========================================
+ Hits        22154    37345    +15191     
- Misses      24738    25600      +862     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@jedel1043 jedel1043 force-pushed the finalization-registry branch 2 times, most recently from da5e282 to 48c81c2 Compare March 16, 2026 16:44
@jedel1043 jedel1043 marked this pull request as ready for review March 16, 2026 17:51
@jedel1043 jedel1043 requested a review from a team as a code owner March 16, 2026 17:51
@jedel1043 jedel1043 added the A-Enhancement New feature or request label Mar 17, 2026
@jedel1043 jedel1043 force-pushed the finalization-registry branch from 47e3577 to 8342ddb Compare March 17, 2026 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Enhancement New feature or request C-Builtins PRs and Issues related to builtins/intrinsics C-CLI Issues and PRs related to the Boa command line interface. C-Dependencies Pull requests that update a dependency file C-GC Issue related to garbage collection C-Tests Issues and PRs related to the tests. Waiting On Review Waiting on reviews from the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant