From f63ef4f19616ec3125e91931c25f25b314ee8966 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Thu, 10 Jun 2021 02:34:32 +0300 Subject: [PATCH] LibJS: Stop asserting in {Set,Test}IntegrityLevel on missing descriptor As per the specification (7.3.15 SetIntegrityLevel): i. Let currentDesc be ? O.[[GetOwnProperty]](k). ii. If currentDesc is not undefined, then... --- Userland/Libraries/LibJS/Runtime/Object.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index a40d3566f9..6ce6a92d4a 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.cpp +++ b/Userland/Libraries/LibJS/Runtime/Object.cpp @@ -209,7 +209,8 @@ bool Object::set_integrity_level(IntegrityLevel level) property_name = property_index; } auto property_descriptor = get_own_property_descriptor(property_name); - VERIFY(property_descriptor.has_value()); + if (!property_descriptor.has_value()) + continue; u8 attributes = property_descriptor->is_accessor_descriptor() ? ~Attribute::Configurable : ~Attribute::Configurable & ~Attribute::Writable; @@ -239,7 +240,8 @@ bool Object::test_integrity_level(IntegrityLevel level) for (auto& key : keys) { auto property_name = PropertyName::from_value(global_object(), key); auto property_descriptor = get_own_property_descriptor(property_name); - VERIFY(property_descriptor.has_value()); + if (!property_descriptor.has_value()) + continue; if (property_descriptor->attributes.is_configurable()) return false; if (level == IntegrityLevel::Frozen && property_descriptor->is_data_descriptor()) {