mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 04:27:12 +02:00
LibJS: Handle getter exception in JSONObject::serialize_json_property()
In the case of an exception in a property getter function we would not return early, and a subsequent attempt to call the replacer function would crash the interpreter due to call_internal() asserting. Fixes #3548.
This commit is contained in:
committed by
Andreas Kling
parent
e1965a5a8e
commit
c0e4353bde
Notes:
sideshowbarker
2024-07-19 02:20:17 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/c0e4353bde8 Pull-request: https://github.com/SerenityOS/serenity/pull/3551 Issue: https://github.com/SerenityOS/serenity/issues/3548
@@ -150,6 +150,8 @@ JS_DEFINE_NATIVE_FUNCTION(JSONObject::stringify)
|
||||
String JSONObject::serialize_json_property(Interpreter& interpreter, StringifyState& state, const PropertyName& key, Object* holder)
|
||||
{
|
||||
auto value = holder->get(key);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
if (value.is_object()) {
|
||||
auto to_json = value.as_object().get("toJSON");
|
||||
if (interpreter.exception())
|
||||
|
||||
Reference in New Issue
Block a user