1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:58:11 +00:00

LibJS: Oops, "instanceof" was backwards!

Fix the "instanceof" operator to check if the constructor's prototype
property occurs anywhere in the prototype chain of the instance object.

This patch also adds Object.setPrototypeOf() to make it possible to
create a test for this bug.

Thanks to DexesTTP for pointing this out! :^)
This commit is contained in:
Andreas Kling 2020-03-28 19:48:12 +01:00
parent e5ebdb9bca
commit 82ca7ae1f8
5 changed files with 53 additions and 17 deletions

View file

@ -62,6 +62,7 @@ public:
Object* prototype() { return m_prototype; }
const Object* prototype() const { return m_prototype; }
void set_prototype(Object* prototype) { m_prototype = prototype; }
bool has_prototype(const Object* prototype) const;
bool has_own_property(const FlyString& property_name) const;
enum class PreferredType {