mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 05:47:34 +00:00
LibJS: Fix toFixed throwing on undefined, null and NaN fractionDigits
It was checking the original fractionDigits argument was a finite number instead of the coerced fraction_digits.
This commit is contained in:
parent
dfb994f62d
commit
2d26a50d28
2 changed files with 6 additions and 2 deletions
|
@ -65,7 +65,7 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_fixed)
|
|||
{
|
||||
auto number_value = TRY(this_number_value(global_object, vm.this_value(global_object)));
|
||||
auto fraction_digits = TRY(vm.argument(0).to_integer_or_infinity(global_object));
|
||||
if (!vm.argument(0).is_finite_number())
|
||||
if (!Value(fraction_digits).is_finite_number())
|
||||
return vm.throw_completion<RangeError>(global_object, ErrorType::InvalidFractionDigits);
|
||||
|
||||
if (fraction_digits < 0 || fraction_digits > 100)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue