LibJS: Allow converting a reference to an object to fail in delete

This is (part of) a normative change in the ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/d09532c

We recently implemented other parts of that commit in LibJS, but missed
this change:
442ca4f9b4
2b19d1b5ab
This commit is contained in:
Timothy Flynn 2023-07-06 16:48:48 -04:00 committed by Andreas Kling
parent 888af08638
commit a2e245fa97

View file

@ -170,8 +170,8 @@ ThrowCompletionOr<bool> Reference::delete_(VM& vm)
if (is_super_reference())
return vm.throw_completion<ReferenceError>(ErrorType::UnsupportedDeleteSuperProperty);
// c. Let baseObj be ! ToObject(ref.[[Base]]).
auto base_obj = MUST(m_base_value.to_object(vm));
// c. Let baseObj be ? ToObject(ref.[[Base]]).
auto base_obj = TRY(m_base_value.to_object(vm));
// d. Let deleteStatus be ? baseObj.[[Delete]](ref.[[ReferencedName]]).
bool delete_status = TRY(base_obj->internal_delete(m_name));