mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 01:59:31 +00:00
LibJS: Implement stage 3 proposal FinalizationRegistry changes
Specifically the 'Symbol as WeakMap Keys Proposal'.
This commit is contained in:
parent
53ed8decaf
commit
a79796ea4a
Notes:
sideshowbarker
2024-07-18 08:59:31 +09:00
Author: https://github.com/IdanHo
Commit: a79796ea4a
Pull-request: https://github.com/SerenityOS/serenity/pull/14361
Reviewed-by: https://github.com/alimpfard ✅
Reviewed-by: https://github.com/linusg ✅
5 changed files with 48 additions and 27 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
|
||||
* Copyright (c) 2021-2022, Idan Horowitz <idan.horowitz@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -17,13 +17,13 @@ FinalizationRegistry::FinalizationRegistry(Realm& realm, JobCallback cleanup_cal
|
|||
{
|
||||
}
|
||||
|
||||
void FinalizationRegistry::add_finalization_record(Cell& target, Value held_value, Object* unregister_token)
|
||||
void FinalizationRegistry::add_finalization_record(Cell& target, Value held_value, Cell* unregister_token)
|
||||
{
|
||||
VERIFY(!held_value.is_empty());
|
||||
m_records.append({ &target, held_value, unregister_token });
|
||||
}
|
||||
|
||||
bool FinalizationRegistry::remove_by_token(Object& unregister_token)
|
||||
bool FinalizationRegistry::remove_by_token(Cell& unregister_token)
|
||||
{
|
||||
auto removed = false;
|
||||
for (auto it = m_records.begin(); it != m_records.end(); ++it) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue