1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:37:46 +00:00

AK: Make "foo"_string infallible

Stop worrying about tiny OOMs.

Work towards #20405.
This commit is contained in:
Andreas Kling 2023-08-07 11:12:38 +02:00
parent db2a8725c6
commit 34344120f2
181 changed files with 626 additions and 630 deletions

View file

@ -142,7 +142,7 @@ ThrowCompletionOr<Value> Console::trace()
for (ssize_t i = execution_context_stack.size() - 2; i >= 0; --i) {
auto const& function_name = execution_context_stack[i]->function_name;
trace.stack.append(function_name.is_empty()
? TRY_OR_THROW_OOM(vm, "<anonymous>"_string)
? "<anonymous>"_string
: TRY_OR_THROW_OOM(vm, String::from_deprecated_string(function_name)));
}
@ -259,8 +259,6 @@ ThrowCompletionOr<Value> Console::count_reset()
// 1.3.1. group(...data), https://console.spec.whatwg.org/#group
ThrowCompletionOr<Value> Console::group()
{
auto& vm = realm().vm();
// 1. Let group be a new group.
Group group;
@ -273,7 +271,7 @@ ThrowCompletionOr<Value> Console::group()
}
// ... Otherwise, let groupLabel be an implementation-chosen label representing a group.
else {
group_label = TRY_OR_THROW_OOM(vm, "Group"_string);
group_label = "Group"_string;
}
// 3. Incorporate groupLabel as a label for group.
@ -295,8 +293,6 @@ ThrowCompletionOr<Value> Console::group()
// 1.3.2. groupCollapsed(...data), https://console.spec.whatwg.org/#groupcollapsed
ThrowCompletionOr<Value> Console::group_collapsed()
{
auto& vm = realm().vm();
// 1. Let group be a new group.
Group group;
@ -309,7 +305,7 @@ ThrowCompletionOr<Value> Console::group_collapsed()
}
// ... Otherwise, let groupLabel be an implementation-chosen label representing a group.
else {
group_label = TRY_OR_THROW_OOM(vm, "Group"_string);
group_label = "Group"_string;
}
// 3. Incorporate groupLabel as a label for group.