From dcb55db99bcbf3855b0d7eadf79a0d9d356f4d2f Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Thu, 17 Jun 2021 03:12:41 +0300 Subject: [PATCH] LibJS: Replace boolean without_side_effects parameters with an enum --- .../Spreadsheet/JSIntegration.cpp | 4 +-- .../Applications/Spreadsheet/JSIntegration.h | 2 +- .../Debugger/DebuggerGlobalJSObject.cpp | 6 ++-- .../Debugger/DebuggerGlobalJSObject.h | 2 +- Userland/Libraries/LibJS/Forward.h | 5 +++ .../LibJS/Runtime/IndexedProperties.cpp | 12 +++---- .../LibJS/Runtime/IndexedProperties.h | 8 ++--- Userland/Libraries/LibJS/Runtime/Object.cpp | 32 +++++++++---------- Userland/Libraries/LibJS/Runtime/Object.h | 6 ++-- .../Libraries/LibJS/Runtime/ProxyObject.cpp | 4 +-- .../Libraries/LibJS/Runtime/ProxyObject.h | 2 +- .../LibJS/Runtime/StringPrototype.cpp | 4 +-- Userland/Libraries/LibJS/Runtime/TypedArray.h | 2 +- .../CSSStyleDeclarationWrapperCustom.cpp | 4 +-- .../Bindings/HTMLCollectionWrapperCustom.cpp | 10 +++--- .../CodeGenerators/WrapperGenerator.cpp | 4 +-- 16 files changed, 56 insertions(+), 51 deletions(-) diff --git a/Userland/Applications/Spreadsheet/JSIntegration.cpp b/Userland/Applications/Spreadsheet/JSIntegration.cpp index e13cc28c2e..ab5a61a068 100644 --- a/Userland/Applications/Spreadsheet/JSIntegration.cpp +++ b/Userland/Applications/Spreadsheet/JSIntegration.cpp @@ -101,7 +101,7 @@ SheetGlobalObject::~SheetGlobalObject() { } -JS::Value SheetGlobalObject::get(const JS::PropertyName& name, JS::Value receiver, bool without_side_effects) const +JS::Value SheetGlobalObject::get(const JS::PropertyName& name, JS::Value receiver, JS::AllowSideEffects allow_side_effects) const { if (name.is_string()) { if (name.as_string() == "value") { @@ -117,7 +117,7 @@ JS::Value SheetGlobalObject::get(const JS::PropertyName& name, JS::Value receive } } - return GlobalObject::get(name, receiver, without_side_effects); + return GlobalObject::get(name, receiver, allow_side_effects); } bool SheetGlobalObject::put(const JS::PropertyName& name, JS::Value value, JS::Value receiver) diff --git a/Userland/Applications/Spreadsheet/JSIntegration.h b/Userland/Applications/Spreadsheet/JSIntegration.h index 090f8b6baf..b6a2bf322f 100644 --- a/Userland/Applications/Spreadsheet/JSIntegration.h +++ b/Userland/Applications/Spreadsheet/JSIntegration.h @@ -26,7 +26,7 @@ public: virtual ~SheetGlobalObject() override; - virtual JS::Value get(const JS::PropertyName&, JS::Value receiver = {}, bool without_side_effects = false) const override; + virtual JS::Value get(const JS::PropertyName&, JS::Value receiver = {}, JS::AllowSideEffects = JS::AllowSideEffects::Yes) const override; virtual bool put(const JS::PropertyName&, JS::Value value, JS::Value receiver = {}) override; virtual void initialize_global_object() override; diff --git a/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.cpp b/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.cpp index 5b1ba7e1b4..965c1d4e69 100644 --- a/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.cpp +++ b/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.cpp @@ -21,16 +21,16 @@ DebuggerGlobalJSObject::DebuggerGlobalJSObject() m_variables = lib->debug_info->get_variables_in_current_scope(regs); } -JS::Value DebuggerGlobalJSObject::get(const JS::PropertyName& name, JS::Value receiver, bool without_side_effects) const +JS::Value DebuggerGlobalJSObject::get(const JS::PropertyName& name, JS::Value receiver, JS::AllowSideEffects allow_side_effects) const { if (m_variables.is_empty() || !name.is_string()) - return JS::Object::get(name, receiver, without_side_effects); + return JS::Object::get(name, receiver, allow_side_effects); auto it = m_variables.find_if([&](auto& variable) { return variable->name == name.as_string(); }); if (it.is_end()) - return JS::Object::get(name, receiver, without_side_effects); + return JS::Object::get(name, receiver, allow_side_effects); auto& target_variable = **it; auto js_value = debugger_to_js(target_variable); if (js_value.has_value()) diff --git a/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.h b/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.h index 5c551d5091..df958b8ba6 100644 --- a/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.h +++ b/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.h @@ -20,7 +20,7 @@ class DebuggerGlobalJSObject final public: DebuggerGlobalJSObject(); - JS::Value get(const JS::PropertyName& name, JS::Value receiver, bool without_side_effects) const override; + JS::Value get(const JS::PropertyName& name, JS::Value receiver, JS::AllowSideEffects = JS::AllowSideEffects::Yes) const override; bool put(const JS::PropertyName& name, JS::Value value, JS::Value receiver) override; Optional debugger_to_js(const Debug::DebugInfo::VariableInfo&) const; diff --git a/Userland/Libraries/LibJS/Forward.h b/Userland/Libraries/LibJS/Forward.h index fd82ce0510..4a4dd1eb7a 100644 --- a/Userland/Libraries/LibJS/Forward.h +++ b/Userland/Libraries/LibJS/Forward.h @@ -165,6 +165,11 @@ class TypedArrayPrototype; // Tag type used to differentiate between u8 as used by Uint8Array and u8 as used by Uint8ClampedArray. struct ClampedU8; +enum class AllowSideEffects { + Yes, + No +}; + #define __JS_ENUMERATE(ClassName, snake_name, ConstructorName, PrototypeName, ArrayType) \ class ClassName; \ class ConstructorName; \ diff --git a/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp b/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp index 81b30df8ba..a8d50882d0 100644 --- a/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp +++ b/Userland/Libraries/LibJS/Runtime/IndexedProperties.cpp @@ -207,10 +207,10 @@ bool IndexedPropertyIterator::operator!=(const IndexedPropertyIterator& other) c return m_index != other.m_index; } -ValueAndAttributes IndexedPropertyIterator::value_and_attributes(Object* this_object, bool evaluate_accessors) +ValueAndAttributes IndexedPropertyIterator::value_and_attributes(Object* this_object, AllowSideEffects allow_side_effects) { if (m_index < m_indexed_properties.array_like_size()) - return m_indexed_properties.get(this_object, m_index, evaluate_accessors).value_or({}); + return m_indexed_properties.get(this_object, m_index, allow_side_effects).value_or({}); return {}; } @@ -226,10 +226,10 @@ void IndexedPropertyIterator::skip_empty_indices() m_index = m_indexed_properties.array_like_size(); } -Optional IndexedProperties::get(Object* this_object, u32 index, bool evaluate_accessors) const +Optional IndexedProperties::get(Object* this_object, u32 index, AllowSideEffects allow_side_effects) const { auto result = m_storage->get(index); - if (!evaluate_accessors) + if (allow_side_effects == AllowSideEffects::No) return result; if (!result.has_value()) return {}; @@ -242,13 +242,13 @@ Optional IndexedProperties::get(Object* this_object, u32 ind return result; } -void IndexedProperties::put(Object* this_object, u32 index, Value value, PropertyAttributes attributes, bool evaluate_accessors) +void IndexedProperties::put(Object* this_object, u32 index, Value value, PropertyAttributes attributes, AllowSideEffects allow_side_effects) { if (m_storage->is_simple_storage() && (attributes != default_attributes || index > (array_like_size() + SPARSE_ARRAY_HOLE_THRESHOLD))) { switch_to_generic_storage(); } - if (m_storage->is_simple_storage() || !evaluate_accessors) { + if (m_storage->is_simple_storage() || allow_side_effects == AllowSideEffects::No) { m_storage->put(index, value, attributes); return; } diff --git a/Userland/Libraries/LibJS/Runtime/IndexedProperties.h b/Userland/Libraries/LibJS/Runtime/IndexedProperties.h index a9e54f6d8d..88466fc3a2 100644 --- a/Userland/Libraries/LibJS/Runtime/IndexedProperties.h +++ b/Userland/Libraries/LibJS/Runtime/IndexedProperties.h @@ -104,7 +104,7 @@ public: bool operator!=(const IndexedPropertyIterator&) const; u32 index() const { return m_index; }; - ValueAndAttributes value_and_attributes(Object* this_object, bool evaluate_accessors = true); + ValueAndAttributes value_and_attributes(Object* this_object, AllowSideEffects = AllowSideEffects::Yes); private: void skip_empty_indices(); @@ -124,15 +124,15 @@ public: } bool has_index(u32 index) const { return m_storage->has_index(index); } - Optional get(Object* this_object, u32 index, bool evaluate_accessors = true) const; - void put(Object* this_object, u32 index, Value value, PropertyAttributes attributes = default_attributes, bool evaluate_accessors = true); + Optional get(Object* this_object, u32 index, AllowSideEffects = AllowSideEffects::Yes) const; + void put(Object* this_object, u32 index, Value value, PropertyAttributes attributes = default_attributes, AllowSideEffects allow_side_effects = AllowSideEffects::Yes); bool remove(u32 index); void insert(u32 index, Value value, PropertyAttributes attributes = default_attributes); ValueAndAttributes take_first(Object* this_object); ValueAndAttributes take_last(Object* this_object); - void append(Value value, PropertyAttributes attributes = default_attributes) { put(nullptr, array_like_size(), value, attributes, false); } + void append(Value value, PropertyAttributes attributes = default_attributes) { put(nullptr, array_like_size(), value, attributes, AllowSideEffects::No); } IndexedPropertyIterator begin(bool skip_empty = true) const { return IndexedPropertyIterator(*this, 0, skip_empty); }; IndexedPropertyIterator end() const { return IndexedPropertyIterator(*this, array_like_size(), false); }; diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index bd4a4f37a9..a6e6562ac7 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.cpp +++ b/Userland/Libraries/LibJS/Runtime/Object.cpp @@ -169,10 +169,10 @@ bool Object::set_integrity_level(IntegrityLevel level) // FIXME: This feels clunky and should get nicer abstractions. auto update_property = [this](auto& property_name, auto new_attributes) { if (property_name.is_number()) { - auto value_and_attributes = m_indexed_properties.get(nullptr, property_name.as_number(), false).value(); + auto value_and_attributes = m_indexed_properties.get(nullptr, property_name.as_number(), AllowSideEffects::No).value(); auto value = value_and_attributes.value; auto attributes = value_and_attributes.attributes.bits() & new_attributes; - m_indexed_properties.put(nullptr, property_name.as_number(), value, attributes, false); + m_indexed_properties.put(nullptr, property_name.as_number(), value, attributes, AllowSideEffects::No); } else { auto metadata = shape().lookup(property_name.to_string_or_symbol()).value(); auto attributes = metadata.attributes.bits() & new_attributes; @@ -248,7 +248,7 @@ bool Object::test_integrity_level(IntegrityLevel level) return true; } -Value Object::get_own_property(const PropertyName& property_name, Value receiver, bool without_side_effects) const +Value Object::get_own_property(const PropertyName& property_name, Value receiver, AllowSideEffects allow_side_effects) const { VERIFY(property_name.is_valid()); VERIFY(!receiver.is_empty()); @@ -256,7 +256,7 @@ Value Object::get_own_property(const PropertyName& property_name, Value receiver Value value_here; if (property_name.is_number()) { - auto existing_property = m_indexed_properties.get(nullptr, property_name.as_number(), false); + auto existing_property = m_indexed_properties.get(nullptr, property_name.as_number(), AllowSideEffects::No); if (!existing_property.has_value()) return {}; value_here = existing_property.value().value.value_or(js_undefined()); @@ -268,7 +268,7 @@ Value Object::get_own_property(const PropertyName& property_name, Value receiver } VERIFY(!value_here.is_empty()); - if (!without_side_effects) { + if (allow_side_effects == AllowSideEffects::Yes) { if (value_here.is_accessor()) return value_here.as_accessor().call_getter(receiver); if (value_here.is_native_property()) @@ -379,7 +379,7 @@ Optional Object::get_own_property_descriptor(const PropertyN PropertyAttributes attributes; if (property_name.is_number()) { - auto existing_value = m_indexed_properties.get(nullptr, property_name.as_number(), false); + auto existing_value = m_indexed_properties.get(nullptr, property_name.as_number(), AllowSideEffects::No); if (!existing_value.has_value()) return {}; value = existing_value.value().value; @@ -579,7 +579,7 @@ bool Object::define_accessor(const PropertyName& property_name, Function* getter { VERIFY(property_name.is_valid()); - auto existing_property = get_own_property(property_name, this, true); + auto existing_property = get_own_property(property_name, this, AllowSideEffects::No); auto* accessor = existing_property.is_accessor() ? &existing_property.as_accessor() : nullptr; if (!accessor) { accessor = Accessor::create(vm(), getter, setter); @@ -712,7 +712,7 @@ bool Object::put_own_property_by_index(u32 property_index, Value value, Property { VERIFY(!(mode == PutOwnPropertyMode::Put && value.is_accessor())); - auto existing_property = m_indexed_properties.get(nullptr, property_index, false); + auto existing_property = m_indexed_properties.get(nullptr, property_index, AllowSideEffects::No); auto new_property = !existing_property.has_value(); if (!is_extensible() && new_property) { @@ -751,7 +751,7 @@ bool Object::put_own_property_by_index(u32 property_index, Value value, Property if (value_here.is_native_property()) { call_native_property_setter(value_here.as_native_property(), this, value); } else { - m_indexed_properties.put(this, property_index, value, attributes, mode == PutOwnPropertyMode::Put); + m_indexed_properties.put(this, property_index, value, attributes, mode == PutOwnPropertyMode::Put ? AllowSideEffects::Yes : AllowSideEffects::No); } return true; } @@ -789,7 +789,7 @@ void Object::ensure_shape_is_unique() m_shape = m_shape->create_unique_clone(); } -Value Object::get_by_index(u32 property_index, bool without_side_effects) const +Value Object::get_by_index(u32 property_index, AllowSideEffects allow_side_effects) const { const Object* object = this; while (object) { @@ -798,7 +798,7 @@ Value Object::get_by_index(u32 property_index, bool without_side_effects) const if (property_index < string.length()) return js_string(heap(), string.substring(property_index, 1)); } else if (static_cast(property_index) < object->m_indexed_properties.array_like_size()) { - auto result = object->m_indexed_properties.get(const_cast(this), property_index, !without_side_effects); + auto result = object->m_indexed_properties.get(const_cast(this), property_index, allow_side_effects); if (vm().exception()) return {}; if (result.has_value() && !result.value().value.is_empty()) @@ -811,19 +811,19 @@ Value Object::get_by_index(u32 property_index, bool without_side_effects) const return {}; } -Value Object::get(const PropertyName& property_name, Value receiver, bool without_side_effects) const +Value Object::get(const PropertyName& property_name, Value receiver, AllowSideEffects allow_side_effects) const { VERIFY(property_name.is_valid()); if (property_name.is_number()) - return get_by_index(property_name.as_number(), without_side_effects); + return get_by_index(property_name.as_number(), allow_side_effects); if (receiver.is_empty()) receiver = Value(this); const Object* object = this; while (object) { - auto value = object->get_own_property(property_name, receiver, without_side_effects); + auto value = object->get_own_property(property_name, receiver, allow_side_effects); if (vm().exception()) return {}; if (!value.is_empty()) @@ -838,7 +838,7 @@ Value Object::get(const PropertyName& property_name, Value receiver, bool withou Value Object::get_without_side_effects(const PropertyName& property_name) const { TemporaryClearException clear_exception(vm()); - return get(property_name, {}, true); + return get(property_name, {}, AllowSideEffects::No); } bool Object::put_by_index(u32 property_index, Value value) @@ -849,7 +849,7 @@ bool Object::put_by_index(u32 property_index, Value value) // Otherwise, it goes in the own property storage. Object* object = this; while (object) { - auto existing_value = object->m_indexed_properties.get(nullptr, property_index, false); + auto existing_value = object->m_indexed_properties.get(nullptr, property_index, AllowSideEffects::No); if (existing_value.has_value()) { auto value_here = existing_value.value(); if (value_here.value.is_accessor()) { diff --git a/Userland/Libraries/LibJS/Runtime/Object.h b/Userland/Libraries/LibJS/Runtime/Object.h index 2628f3096c..215ae7d4d3 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.h +++ b/Userland/Libraries/LibJS/Runtime/Object.h @@ -74,7 +74,7 @@ public: GlobalObject& global_object() const { return *shape().global_object(); } - virtual Value get(const PropertyName&, Value receiver = {}, bool without_side_effects = false) const; + virtual Value get(const PropertyName&, Value receiver = {}, AllowSideEffects = AllowSideEffects::Yes) const; Value get_without_side_effects(const PropertyName&) const; virtual bool has_property(const PropertyName&) const; @@ -82,7 +82,7 @@ public: virtual bool put(const PropertyName&, Value, Value receiver = {}); - Value get_own_property(const PropertyName&, Value receiver, bool without_side_effects = false) const; + Value get_own_property(const PropertyName&, Value receiver, AllowSideEffects = AllowSideEffects::Yes) const; MarkedValueList get_own_properties(PropertyKind, bool only_enumerable_properties = false, GetOwnPropertyReturnType = GetOwnPropertyReturnType::All) const; MarkedValueList get_enumerable_own_property_names(PropertyKind) const; virtual Optional get_own_property_descriptor(const PropertyName&) const; @@ -163,7 +163,7 @@ protected: explicit Object(GlobalObjectTag); Object(ConstructWithoutPrototypeTag, GlobalObject&); - virtual Value get_by_index(u32 property_index, bool without_side_effects = false) const; + virtual Value get_by_index(u32 property_index, AllowSideEffects = AllowSideEffects::Yes) const; virtual bool put_by_index(u32 property_index, Value); private: diff --git a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp index e767b41f55..01844a072b 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp @@ -305,10 +305,10 @@ bool ProxyObject::has_property(const PropertyName& name) const return trap_result.to_boolean(); } -Value ProxyObject::get(const PropertyName& name, Value receiver, bool without_side_effects) const +Value ProxyObject::get(const PropertyName& name, Value receiver, AllowSideEffects allow_side_effects) const { auto& vm = this->vm(); - if (without_side_effects) { + if (allow_side_effects == AllowSideEffects::No) { // Sorry, we're not going to call anything on this proxy. return js_string(vm, ""); } diff --git a/Userland/Libraries/LibJS/Runtime/ProxyObject.h b/Userland/Libraries/LibJS/Runtime/ProxyObject.h index f540a429d7..f11a54f311 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyObject.h +++ b/Userland/Libraries/LibJS/Runtime/ProxyObject.h @@ -35,7 +35,7 @@ public: virtual Optional get_own_property_descriptor(const PropertyName&) const override; virtual bool define_property(const StringOrSymbol& property_name, const Object& descriptor, bool throw_exceptions = true) override; virtual bool has_property(const PropertyName& name) const override; - virtual Value get(const PropertyName& name, Value receiver, bool without_side_effects = false) const override; + virtual Value get(const PropertyName& name, Value receiver, AllowSideEffects = AllowSideEffects::Yes) const override; virtual bool put(const PropertyName& name, Value value, Value receiver) override; virtual bool delete_property(const PropertyName& name) override; diff --git a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp index 5dc50cbcc5..4166cd0356 100644 --- a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp @@ -67,9 +67,9 @@ void StringPrototype::initialize(GlobalObject& global_object) define_native_function(vm.names.padEnd, pad_end, 1, attr); define_native_function(vm.names.trim, trim, 0, attr); define_native_function(vm.names.trimStart, trim_start, 0, attr); - define_property(vm.names.trimLeft, get(vm.names.trimStart, {}, true), attr); + define_property(vm.names.trimLeft, get_without_side_effects(vm.names.trimStart), attr); define_native_function(vm.names.trimEnd, trim_end, 0, attr); - define_property(vm.names.trimRight, get(vm.names.trimEnd, {}, true), attr); + define_property(vm.names.trimRight, get_without_side_effects(vm.names.trimEnd), attr); define_native_function(vm.names.concat, concat, 1, attr); define_native_function(vm.names.substr, substr, 2, attr); define_native_function(vm.names.substring, substring, 2, attr); diff --git a/Userland/Libraries/LibJS/Runtime/TypedArray.h b/Userland/Libraries/LibJS/Runtime/TypedArray.h index 18b076d361..855299317c 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArray.h +++ b/Userland/Libraries/LibJS/Runtime/TypedArray.h @@ -80,7 +80,7 @@ public: } // 10.4.5.10 IntegerIndexedElementGet ( O, index ), https://tc39.es/ecma262/#sec-integerindexedelementget - virtual Value get_by_index(u32 property_index, [[maybe_unused]] bool without_side_effects = false) const override + virtual Value get_by_index(u32 property_index, AllowSideEffects = AllowSideEffects::Yes) const override { if (!is_valid_integer_index(property_index)) return js_undefined(); diff --git a/Userland/Libraries/LibWeb/Bindings/CSSStyleDeclarationWrapperCustom.cpp b/Userland/Libraries/LibWeb/Bindings/CSSStyleDeclarationWrapperCustom.cpp index b4d5caebba..7115b0ba34 100644 --- a/Userland/Libraries/LibWeb/Bindings/CSSStyleDeclarationWrapperCustom.cpp +++ b/Userland/Libraries/LibWeb/Bindings/CSSStyleDeclarationWrapperCustom.cpp @@ -11,12 +11,12 @@ namespace Web::Bindings { -JS::Value CSSStyleDeclarationWrapper::get(const JS::PropertyName& name, JS::Value receiver, bool without_side_effects) const +JS::Value CSSStyleDeclarationWrapper::get(const JS::PropertyName& name, JS::Value receiver, JS::AllowSideEffects allow_side_effects) const { // FIXME: These should actually use camelCase versions of the property names! auto property_id = CSS::property_id_from_string(name.to_string()); if (property_id == CSS::PropertyID::Invalid) - return Base::get(name, receiver, without_side_effects); + return Base::get(name, receiver, allow_side_effects); for (auto& property : impl().properties()) { if (property.property_id == property_id) return js_string(vm(), property.value->to_string()); diff --git a/Userland/Libraries/LibWeb/Bindings/HTMLCollectionWrapperCustom.cpp b/Userland/Libraries/LibWeb/Bindings/HTMLCollectionWrapperCustom.cpp index 2a2b5493c8..950ddb1d06 100644 --- a/Userland/Libraries/LibWeb/Bindings/HTMLCollectionWrapperCustom.cpp +++ b/Userland/Libraries/LibWeb/Bindings/HTMLCollectionWrapperCustom.cpp @@ -12,21 +12,21 @@ namespace Web::Bindings { -JS::Value HTMLCollectionWrapper::get(JS::PropertyName const& name, JS::Value receiver, bool without_side_effects) const +JS::Value HTMLCollectionWrapper::get(JS::PropertyName const& name, JS::Value receiver, JS::AllowSideEffects allow_side_effects) const { if (!name.is_string()) - return Base::get(name, receiver, without_side_effects); + return Base::get(name, receiver, allow_side_effects); auto* item = const_cast(impl()).named_item(name.to_string()); if (!item) - return Base::get(name, receiver, without_side_effects); + return Base::get(name, receiver, allow_side_effects); return JS::Value { wrap(global_object(), *item) }; } -JS::Value HTMLCollectionWrapper::get_by_index(u32 property_index, bool without_side_effects) const +JS::Value HTMLCollectionWrapper::get_by_index(u32 property_index, JS::AllowSideEffects allow_side_effects) const { auto* item = const_cast(impl()).item(property_index); if (!item) - return Base::get_by_index(property_index, without_side_effects); + return Base::get_by_index(property_index, allow_side_effects); return wrap(global_object(), *item); } diff --git a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp index c6f7895367..7180d2e299 100644 --- a/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp +++ b/Userland/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp @@ -786,12 +786,12 @@ public: if (interface.extended_attributes.contains("CustomGet")) { generator.append(R"~~~( - virtual JS::Value get(const JS::PropertyName&, JS::Value receiver = {}, bool without_side_effects = false) const override; + virtual JS::Value get(const JS::PropertyName&, JS::Value receiver = {}, JS::AllowSideEffects = JS::AllowSideEffects::Yes) const override; )~~~"); } if (interface.extended_attributes.contains("CustomGetByIndex")) { generator.append(R"~~~( - virtual JS::Value get_by_index(u32 property_index, bool without_side_effects = false) const override; + virtual JS::Value get_by_index(u32 property_index, JS::AllowSideEffects = JS::AllowSideEffects::Yes) const override; )~~~"); } if (interface.extended_attributes.contains("CustomPut")) {