LibJS: Add interpreter exception checks

This commit is contained in:
Matthew Olsson
2020-06-07 10:53:14 -07:00
committed by Andreas Kling
parent f306ddb78b
commit 4e33fbdb67
11 changed files with 137 additions and 36 deletions

View File

@@ -675,11 +675,13 @@ Value in(Interpreter& interpreter, Value lhs, Value rhs)
return Value(rhs.as_object().has_property(lhs_string));
}
Value instance_of(Interpreter&, Value lhs, Value rhs)
Value instance_of(Interpreter& interpreter, Value lhs, Value rhs)
{
if (!lhs.is_object() || !rhs.is_object())
return Value(false);
auto constructor_prototype_property = rhs.as_object().get("prototype");
if (interpreter.exception())
return {};
if (!constructor_prototype_property.is_object())
return Value(false);
return Value(lhs.as_object().has_prototype(&constructor_prototype_property.as_object()));