LibJS: Propagate the OOM error from setting the String length property

This commit is contained in:
Timothy Flynn 2023-01-28 13:40:56 -05:00 committed by Linus Groh
commit 8414734a2d
Notes: sideshowbarker 2024-07-17 06:28:38 +09:00
4 changed files with 6 additions and 7 deletions

View file

@ -63,7 +63,7 @@ ThrowCompletionOr<NonnullGCPtr<Object>> StringConstructor::construct(FunctionObj
else
primitive_string = TRY(vm.argument(0).to_primitive_string(vm));
auto* prototype = TRY(get_prototype_from_constructor(vm, new_target, &Intrinsics::string_prototype));
return StringObject::create(realm, *primitive_string, *prototype);
return MUST_OR_THROW_OOM(StringObject::create(realm, *primitive_string, *prototype));
}
// 22.1.2.4 String.raw ( template, ...substitutions ), https://tc39.es/ecma262/#sec-string.raw