You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement ES2021 FinalizationRegistry with cleanupSome
This PR implements the ES2021 FinalizationRegistry constructor and prototype,
allowing JavaScript code to register cleanup callbacks that are called when
objects are garbage collected.
## Features
- Complete ES2021 FinalizationRegistry implementation
- All three required methods: register(), unregister(), and cleanupSome()
- ES2023 symbols-as-weakmap-keys support (unregistered symbols can be held weakly)
- Thread-safe implementation using ConcurrentHashMap and ReferenceQueue
- Comprehensive test suite with 40+ tests
## Implementation Notes
- Uses Java's ReferenceQueue for garbage collection detection
- Follows the same validation patterns as NativeWeakMap for consistency
- Implements using the LambdaConstructor pattern
- Properly validates targets according to the CanBeHeldWeakly specification
- cleanupSome() method supports optional callback parameter per spec
Closes#2057
0 commit comments