The callback passed to `FinalizationRegistry` may be a Proxy or BoundFunction, which lack a `[[Realm]]` internal slot. Dereferencing the callback realm directly returned null and led to a crash in `HostEnqueueFinalizationRegistryCleanupJob`. We now use the `GetFunctionRealm` AO to unwrap these exotic objects and find the underlying realm.
12 lines
260 B
HTML
12 lines
260 B
HTML
<!DOCTYPE html>
|
|
<script src="../../Text/input/include.js"></script>
|
|
<script>
|
|
const callback = new Proxy(function() {}, {});
|
|
const registry = new FinalizationRegistry(callback);
|
|
|
|
(function() {
|
|
registry.register({}, "held");
|
|
})();
|
|
|
|
internals.gc();
|
|
</script>
|