mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 16:19:23 +00:00
LibJS: Add interpreter exception checks
This commit is contained in:
parent
f306ddb78b
commit
4e33fbdb67
Notes:
sideshowbarker
2024-07-19 05:45:16 +09:00
Author: https://github.com/mattco98
Commit: 4e33fbdb67
Pull-request: https://github.com/SerenityOS/serenity/pull/2522
11 changed files with 137 additions and 36 deletions
|
@ -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()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue