mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
LibJS: Add missing exception check in Date.prototype.toJSON
It was missing an exception check on the call to to_primitive. This fixes test/built-ins/Date/prototype/toJSON/called-as-function.js from test262 crashing, but does not fix the test itself.
This commit is contained in:
parent
35e7c44dd4
commit
50f33bb98e
Notes:
sideshowbarker
2024-07-18 12:06:02 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/commit/50f33bb98ef Pull-request: https://github.com/SerenityOS/serenity/pull/8127
@ -846,6 +846,9 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_json)
|
||||
return {};
|
||||
|
||||
auto time_value = Value(this_object).to_primitive(global_object, Value::PreferredType::Number);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
|
||||
if (time_value.is_number() && !time_value.is_finite_number())
|
||||
return js_null();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user