mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
LibJS: Throw an exception in NumberFormat.prototype.format for BigInts
Rather than crashing in the call to as_double(), throw an exception for now.
This commit is contained in:
parent
c65dea64bd
commit
40973814e9
Notes:
sideshowbarker
2024-07-18 01:10:58 +09:00
Author: https://github.com/trflynn89
Commit: 40973814e9
Pull-request: https://github.com/SerenityOS/serenity/pull/10908
Reviewed-by: https://github.com/linusg ✅
2 changed files with 14 additions and 0 deletions
|
@ -41,6 +41,10 @@ ThrowCompletionOr<Value> NumberFormatFunction::call()
|
|||
// 4. Let x be ? ToNumeric(value).
|
||||
value = TRY(value.to_numeric(global_object));
|
||||
|
||||
// FIXME: Support BigInt number formatting.
|
||||
if (value.is_bigint())
|
||||
return vm.throw_completion<InternalError>(global_object, ErrorType::NotImplemented, "BigInt number formatting");
|
||||
|
||||
// 5. Return ? FormatNumeric(nf, x).
|
||||
// Note: Our implementation of FormatNumeric does not throw.
|
||||
auto formatted = format_numeric(m_number_format, value.as_double());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue