From 07992c8da68c29893864bc5160ebb14a8cb8c9f9 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Wed, 16 Jun 2021 13:13:01 +0300 Subject: [PATCH] LibJS: Throw when delete-ing a non-configurable property in strict mode --- Userland/Libraries/LibJS/Runtime/Object.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index 50f13d7776..d63224e665 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.cpp +++ b/Userland/Libraries/LibJS/Runtime/Object.cpp @@ -781,8 +781,11 @@ bool Object::delete_property(const PropertyName& property_name) auto metadata = shape().lookup(property_name.to_string_or_symbol()); if (!metadata.has_value()) return true; - if (!metadata.value().attributes.is_configurable()) + if (!metadata.value().attributes.is_configurable()) { + if (vm().in_strict_mode()) + vm().throw_exception(global_object(), ErrorType::DescChangeNonConfigurable, property_name.to_string_or_symbol().to_display_string()); return false; + } size_t deleted_offset = metadata.value().offset;