mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-01 13:49:05 +00: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: 50f33bb98e
Pull-request: https://github.com/SerenityOS/serenity/pull/8127
1 changed files with 3 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue