mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:04:59 +00:00
LibJS: Mark infallible operations that may throw only due to OOM
This commit is contained in:
parent
52b76060f9
commit
95d1678553
18 changed files with 48 additions and 69 deletions
|
@ -231,8 +231,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::parse_float)
|
|||
auto input_string = TRY(vm.argument(0).to_deprecated_string(vm));
|
||||
|
||||
// 2. Let trimmedString be ! TrimString(inputString, start).
|
||||
// NOTE: We TRY this operation only to propagate OOM errors.
|
||||
auto trimmed_string = TRY(trim_string(vm, PrimitiveString::create(vm, input_string), TrimMode::Left));
|
||||
auto trimmed_string = MUST_OR_THROW_OOM(trim_string(vm, PrimitiveString::create(vm, input_string), TrimMode::Left));
|
||||
if (trimmed_string.is_empty())
|
||||
return js_nan();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue