1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:07:34 +00:00

LibJS: Disallow changing the prototype of non-extensible objects

Object::set_prototype() now returns a boolean indicating success.
Setting the prototype to an identical object is always considered
successful, even if the object is non-extensible.
This commit is contained in:
Linus Groh 2020-06-02 12:32:54 +01:00 committed by Andreas Kling
parent 8cf1ded478
commit b958e4f573
4 changed files with 22 additions and 6 deletions

View file

@ -95,7 +95,7 @@ public:
Object* prototype();
const Object* prototype() const;
void set_prototype(Object*);
bool set_prototype(Object* prototype);
bool has_prototype(const Object* prototype) const;
bool is_extensible() const { return m_is_extensible; }