summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Runtime/Object.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-28 19:48:12 +0100
committerAndreas Kling <kling@serenityos.org>2020-03-28 19:48:12 +0100
commit82ca7ae1f806d03efbba49c4c1c8404b7863f558 (patch)
treee1bb3818cb62b91007570a461568a32ce2187d43 /Libraries/LibJS/Runtime/Object.h
parente5ebdb9bca3588b2fb01891127771b03dae09ad9 (diff)
downloadserenity-82ca7ae1f806d03efbba49c4c1c8404b7863f558.zip
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! :^)
Diffstat (limited to 'Libraries/LibJS/Runtime/Object.h')
-rw-r--r--Libraries/LibJS/Runtime/Object.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/Libraries/LibJS/Runtime/Object.h b/Libraries/LibJS/Runtime/Object.h
index 041ea089ba..aa2d887cbe 100644
--- a/Libraries/LibJS/Runtime/Object.h
+++ b/Libraries/LibJS/Runtime/Object.h
@@ -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 {