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

LibJS: Check if class extends value has a valid prototype

If we have a function as class extends value, we still cannot assume
that it has a prototype property and that property has a function or
null as its value - blindly calling to_object() on it may fail.

Fixes #5075.
This commit is contained in:
Linus Groh 2021-01-23 23:49:04 +01:00 committed by Andreas Kling
parent 397f432aed
commit 766f30f593
3 changed files with 27 additions and 3 deletions

View file

@ -36,8 +36,9 @@
M(BigIntIntArgument, "BigInt argument must be an integer") \
M(BigIntInvalidValue, "Invalid value for BigInt: {}") \
M(ClassConstructorWithoutNew, "Class constructor {} must be called with 'new'") \
M(ClassExtendsValueNotAConstructorOrNull, "Class extends value {} is not a constructor or null") \
M(ClassExtendsValueInvalidPrototype, "Class extends value has an invalid prototype {}") \
M(ClassIsAbstract, "Abstract class {} cannot be constructed directly") \
M(ClassDoesNotExtendAConstructorOrNull, "Class extends value {} is not a constructor or null") \
M(ConstructorWithoutNew, "{} constructor must be called with 'new'") \
M(Convert, "Cannot convert {} to {}") \
M(ConvertUndefinedToObject, "Cannot convert undefined to object") \