mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-07 01:21:57 +00:00
LibJS: Implement WeakMap changes from 'Symbol as WeakMap Keys Proposal'
This commit is contained in:
parent
22a78e8a2c
commit
a80d3fdf49
Notes:
sideshowbarker
2024-07-17 11:30:05 +09:00
Author: https://github.com/IdanHo
Commit: a80d3fdf49
Pull-request: https://github.com/SerenityOS/serenity/pull/14361
Reviewed-by: https://github.com/alimpfard ✅
Reviewed-by: https://github.com/linusg ✅
8 changed files with 39 additions and 18 deletions
|
@ -68,10 +68,10 @@ TESTJS_GLOBAL_FUNCTION(mark_as_garbage, markAsGarbage)
|
|||
|
||||
auto value = TRY(reference.get_value(global_object));
|
||||
|
||||
if (!value.is_object())
|
||||
return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObject, String::formatted("Variable with name {}", variable_name.string()));
|
||||
if (!can_be_held_weakly(value))
|
||||
return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::CannotBeHeldWeakly, String::formatted("Variable with name {}", variable_name.string()));
|
||||
|
||||
vm.heap().uproot_cell(&value.as_object());
|
||||
vm.heap().uproot_cell(&value.as_cell());
|
||||
TRY(reference.delete_(global_object));
|
||||
|
||||
return JS::js_undefined();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue