Skip to content

Commit

Permalink
Normative: Use HostJobCallbacks for FinalizationRegistry callbacks (#…
Browse files Browse the repository at this point in the history
…2316)

This aligns FinalizationRegistry callbacks with Promise callbacks in
allowing web browsers to perform additional steps to save and restore
the correct incumbent settings object.
syg authored and ljharb committed Mar 17, 2021
1 parent 3cd00d7 commit 0635793
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spec.html
Original file line number Diff line number Diff line change
@@ -10171,7 +10171,7 @@ <h1>CleanupFinalizationRegistry ( _finalizationRegistry_ )</h1>
1. While _finalizationRegistry_.[[Cells]] contains a Record _cell_ such that _cell_.[[WeakRefTarget]] is ~empty~, an implementation may perform the following steps:
1. Choose any such _cell_.
1. Remove _cell_ from _finalizationRegistry_.[[Cells]].
1. Perform ? Call(_callback_, *undefined*, &laquo; _cell_.[[HeldValue]] &raquo;).
1. Perform ? HostCallJobCallback(_callback_, *undefined*, &laquo; _cell_.[[HeldValue]] &raquo;).
1. Return NormalCompletion(*undefined*).
</emu-alg>
</emu-clause>
@@ -37054,7 +37054,7 @@ <h1>FinalizationRegistry ( _cleanupCallback_ )</h1>
1. Let _finalizationRegistry_ be ? OrdinaryCreateFromConstructor(NewTarget, *"%FinalizationRegistry.prototype%"*, &laquo; [[Realm]], [[CleanupCallback]], [[Cells]] &raquo;).
1. Let _fn_ be the active function object.
1. Set _finalizationRegistry_.[[Realm]] to _fn_.[[Realm]].
1. Set _finalizationRegistry_.[[CleanupCallback]] to _cleanupCallback_.
1. Set _finalizationRegistry_.[[CleanupCallback]] to HostMakeJobCallback(_cleanupCallback_).
1. Set _finalizationRegistry_.[[Cells]] to a new empty List.
1. Return _finalizationRegistry_.
</emu-alg>

0 comments on commit 0635793

Please sign in to comment.