mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:27:45 +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
1 changed files with 3 additions and 0 deletions
|
@ -846,6 +846,9 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::to_json)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
auto time_value = Value(this_object).to_primitive(global_object, Value::PreferredType::Number);
|
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())
|
if (time_value.is_number() && !time_value.is_finite_number())
|
||||||
return js_null();
|
return js_null();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue