Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions jerry-core/ecma/operations/ecma-proxy-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -1443,12 +1443,15 @@ ecma_proxy_object_delete_property (ecma_object_t *obj_p, /**< proxy object */
{
ret_value = ecma_raise_type_error (ECMA_ERR_TRAP_TRUISH_PROPERTY_NON_CONFIGURABLE);
}
/* ES11: 13-14 */
ecma_value_t extensible_target = ecma_builtin_object_object_is_extensible (target_obj_p);

if (!ecma_is_value_true (extensible_target))
else
{
ret_value = ecma_raise_type_error (ECMA_ERR_TRAP_TRUISH_TARGET_NOT_EXTENSIBLE);
/* ES11: 13-14 */
ecma_value_t extensible_target = ecma_builtin_object_object_is_extensible (target_obj_p);

if (!ecma_is_value_true (extensible_target))
{
ret_value = ecma_raise_type_error (ECMA_ERR_TRAP_TRUISH_TARGET_NOT_EXTENSIBLE);
}
}

ecma_free_property_descriptor (&target_desc);
Expand Down
22 changes: 22 additions & 0 deletions tests/jerry/proxy_delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,25 @@ try {
}

assert (trapCalls == 1);

// deleting a non-configurable property on a non-extensible target must raise a
// single TypeError, without attempting to raise a second pending exception
var target = {};
Object.defineProperty(target, "foo", {
configurable: false,
value: "foo"
});
Object.preventExtensions(target);

var proxy = new Proxy(target, {
deleteProperty(obj, prop) {
return true;
}
});

try {
delete proxy.foo;
assert(false);
} catch (e) {
assert(e instanceof TypeError);
}