1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:07:46 +00:00

LibJS: Remove the non-standard put helper and replace it's usages

This removes all usages of the non-standard put helper method and
replaces all of it's usages with the specification required alternative
or with define_direct_property where appropriate.
This commit is contained in:
Idan Horowitz 2021-07-06 01:15:50 +03:00 committed by Linus Groh
parent 53f70e5208
commit e3ef241108
15 changed files with 40 additions and 49 deletions

View file

@ -89,9 +89,8 @@ Optional<JS::Value> DebuggerGlobalJSObject::debugger_to_js(const Debug::DebugInf
auto member_value = debugger_to_js(member);
if (!member_value.has_value())
continue;
object->put(member.name, member_value.value(), {});
object->define_direct_property(member.name, member_value.value(), JS::default_attributes);
}
object->finish_writing_properties();
return JS::Value(object);
}

View file

@ -29,11 +29,8 @@ DebuggerVariableJSObject::~DebuggerVariableJSObject()
{
}
bool DebuggerVariableJSObject::internal_set(const JS::PropertyName& property_name, JS::Value value, JS::Value receiver)
bool DebuggerVariableJSObject::internal_set(const JS::PropertyName& property_name, JS::Value value, JS::Value)
{
if (m_is_writing_properties)
return Base::internal_set(property_name, value, receiver);
if (!property_name.is_string()) {
vm().throw_exception<JS::TypeError>(global_object(), String::formatted("Invalid variable name {}", property_name.to_string()));
return false;

View file

@ -25,13 +25,11 @@ public:
virtual const char* class_name() const override { return m_variable_info.type_name.characters(); }
bool internal_set(JS::PropertyName const&, JS::Value value, JS::Value receiver) override;
void finish_writing_properties() { m_is_writing_properties = false; }
private:
DebuggerGlobalJSObject& debugger_object() const;
const Debug::DebugInfo::VariableInfo& m_variable_info;
bool m_is_writing_properties { true };
};
}