1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 05:47:34 +00:00

LibJS+LibWeb+WebContent: Stop using ThrowableStringBuilder

This commit is contained in:
Timothy Flynn 2023-09-06 08:29:01 -04:00 committed by Tim Flynn
parent 54d1f4e234
commit 573cbb5ca0
6 changed files with 43 additions and 46 deletions

View file

@ -4,10 +4,10 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/StringBuilder.h>
#include <LibJS/Heap/MarkedVector.h>
#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/Realm.h>
#include <LibJS/Runtime/ThrowableStringBuilder.h>
#include <LibJS/Runtime/VM.h>
#include <LibWeb/HTML/WorkerDebugConsoleClient.h>
@ -40,12 +40,12 @@ JS::ThrowCompletionOr<JS::Value> WorkerDebugConsoleClient::printer(JS::Console::
if (log_level == JS::Console::LogLevel::Trace) {
auto trace = arguments.get<JS::Console::Trace>();
JS::ThrowableStringBuilder builder(vm);
StringBuilder builder;
if (!trace.label.is_empty())
MUST_OR_THROW_OOM(builder.appendff("{}\033[36;1m{}\033[0m\n", indent, trace.label));
builder.appendff("{}\033[36;1m{}\033[0m\n", indent, trace.label);
for (auto& function_name : trace.stack)
MUST_OR_THROW_OOM(builder.appendff("{}-> {}\n", indent, function_name));
builder.appendff("{}-> {}\n", indent, function_name);
dbgln("{}", builder.string_view());
return JS::js_undefined();

View file

@ -7,6 +7,7 @@
#include <AK/MemoryStream.h>
#include <AK/ScopeGuard.h>
#include <AK/StringBuilder.h>
#include <LibJS/Runtime/Array.h>
#include <LibJS/Runtime/ArrayBuffer.h>
#include <LibJS/Runtime/BigInt.h>
@ -15,7 +16,6 @@
#include <LibJS/Runtime/NativeFunction.h>
#include <LibJS/Runtime/Object.h>
#include <LibJS/Runtime/Promise.h>
#include <LibJS/Runtime/ThrowableStringBuilder.h>
#include <LibJS/Runtime/TypedArray.h>
#include <LibJS/Runtime/VM.h>
#include <LibWasm/AbstractMachine/Validator.h>
@ -283,10 +283,10 @@ JS::ThrowCompletionOr<size_t> instantiate_module(JS::VM& vm, Wasm::Module const&
auto link_result = linker.finish();
if (link_result.is_error()) {
// FIXME: Throw a LinkError.
JS::ThrowableStringBuilder builder(vm);
MUST_OR_THROW_OOM(builder.append("LinkError: Missing "sv));
MUST_OR_THROW_OOM(builder.join(' ', link_result.error().missing_imports));
return vm.throw_completion<JS::TypeError>(MUST_OR_THROW_OOM(builder.to_string()));
StringBuilder builder;
builder.append("LinkError: Missing "sv);
builder.join(' ', link_result.error().missing_imports);
return vm.throw_completion<JS::TypeError>(MUST(builder.to_string()));
}
auto instance_result = s_abstract_machine.instantiate(module, link_result.release_value());