summaryrefslogtreecommitdiff
path: root/Tests/LibJS/test-js.cpp
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-06-22 23:08:12 +0300
committerIdan Horowitz <idan.horowitz@gmail.com>2022-06-23 10:57:52 +0300
commita80d3fdf491af03e3edbea0243b97edc615fc10c (patch)
tree8269be59b930e3861f8ee75ee1a724005cd8713c /Tests/LibJS/test-js.cpp
parent22a78e8a2ccc25752b96097b3b8d258964bbbb46 (diff)
downloadserenity-a80d3fdf491af03e3edbea0243b97edc615fc10c.zip
LibJS: Implement WeakMap changes from 'Symbol as WeakMap Keys Proposal'
Diffstat (limited to 'Tests/LibJS/test-js.cpp')
-rw-r--r--Tests/LibJS/test-js.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Tests/LibJS/test-js.cpp b/Tests/LibJS/test-js.cpp
index aeffa8515b..7bfc47754a 100644
--- a/Tests/LibJS/test-js.cpp
+++ b/Tests/LibJS/test-js.cpp
@@ -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();