Commit graph

3 commits

Author SHA1 Message Date
Timothy Flynn
4d10911f96 LibJS: Pre-allocate the out-of-memory error string on the VM
If we are out of memory, we can't try to allocate a string that could
fail as well. When Error is converted to String, this would result in an
endless OOM-throwing loop. Instead, pre-allocate the string on the VM,
and use it to construct the Error.

Note that as of this commit, the OOM string is still a DeprecatedString.
This is just preporatory for Error's conversion to String.
2023-02-17 09:14:23 -05:00
Timothy Flynn
79e81e8a15 LibJS: Add ThrowableStringBuilder::to_string to create a new String
This wraps around the base class method to throw an OOM completion.
2023-01-15 01:00:20 +00:00
Timothy Flynn
76b9d06b19 LibJS: Add and begin using a completion-compatible string builder
ThrowableStringBuilder is a thin wrapper around StringBuilder to map
results from the try_* methods to a throw completion. This will let us
try to throw on OOM conditions rather than just blowing up.
2023-01-05 22:07:44 +01:00