Skip to content

Commit ab4f5a2

Browse files
committed
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
1 parent fce6929 commit ab4f5a2

File tree

5 files changed

+812
-2
lines changed

5 files changed

+812
-2
lines changed

0 commit comments

Comments
 (0)