diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index b94c597824f..dc4e2afd01b 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -426,7 +426,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter @cpp_type@* @cpp_name@ = nullptr; if (!@js_name@@js_suffix@.is_nullish()) { if (!@js_name@@js_suffix@.is_object()) - return vm.throw_completion(JS::ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, @js_name@@js_suffix@.to_string_without_side_effects())); + return vm.throw_completion(JS::ErrorType::NotAnObject, @js_name@@js_suffix@.to_string_without_side_effects()); auto callback_type = vm.heap().allocate_without_realm(@js_name@@js_suffix@.as_object(), HTML::incumbent_settings_object()); @cpp_name@ = TRY(throw_dom_exception_if_needed(vm, [&] { return @cpp_type@::create(realm, *callback_type); })); @@ -435,7 +435,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter } else { scoped_generator.append(R"~~~( if (!@js_name@@js_suffix@.is_object()) - return vm.throw_completion(JS::ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, @js_name@@js_suffix@.to_string_without_side_effects())); + return vm.throw_completion(JS::ErrorType::NotAnObject, @js_name@@js_suffix@.to_string_without_side_effects()); auto callback_type = vm.heap().allocate_without_realm(@js_name@@js_suffix@.as_object(), HTML::incumbent_settings_object()); auto @cpp_name@ = adopt_ref(*new @cpp_type@(callback_type)); @@ -846,7 +846,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter if (!callback_function.is_legacy_treat_non_object_as_null) { callback_function_generator.append(R"~~~( if (!@js_name@@js_suffix@.is_function()) - return vm.throw_completion(JS::ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, @js_name@@js_suffix@.to_string_without_side_effects())); + return vm.throw_completion(JS::ErrorType::NotAFunction, @js_name@@js_suffix@.to_string_without_side_effects()); )~~~"); } // 2. Return the IDL callback function type value that represents a reference to the same object that V represents, with the incumbent settings object as the callback context. @@ -911,11 +911,11 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter sequence_generator.append(R"~~~( if (!@js_name@@js_suffix@.is_object()) - return vm.throw_completion(JS::ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, @js_name@@js_suffix@.to_string_without_side_effects())); + return vm.throw_completion(JS::ErrorType::NotAnObject, @js_name@@js_suffix@.to_string_without_side_effects()); auto iterator_method@recursion_depth@ = TRY(@js_name@@js_suffix@.get_method(vm, vm.well_known_symbol_iterator())); if (!iterator_method@recursion_depth@) - return vm.throw_completion(JS::ErrorType::NotIterable, TRY_OR_THROW_OOM(vm, @js_name@@js_suffix@.to_string_without_side_effects())); + return vm.throw_completion(JS::ErrorType::NotIterable, @js_name@@js_suffix@.to_string_without_side_effects()); )~~~"); parameterized_type.generate_sequence_from_iterable(sequence_generator, DeprecatedString::formatted("{}{}", acceptable_cpp_name, optional ? "_non_optional" : ""), DeprecatedString::formatted("{}{}", js_name, js_suffix), DeprecatedString::formatted("iterator_method{}", recursion_depth), interface, recursion_depth + 1); @@ -960,7 +960,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter if (recursion_depth == 0) { record_generator.append(R"~~~( if (!@js_name@@js_suffix@.is_object()) - return vm.throw_completion(JS::ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, @js_name@@js_suffix@.to_string_without_side_effects())); + return vm.throw_completion(JS::ErrorType::NotAnObject, @js_name@@js_suffix@.to_string_without_side_effects()); auto& @js_name@@js_suffix@_object = @js_name@@js_suffix@.as_object(); )~~~"); @@ -3000,7 +3000,7 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::for_each) auto callback = vm.argument(0); if (!callback.is_function()) - return vm.throw_completion(JS::ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, callback.to_string_without_side_effects())); + return vm.throw_completion(JS::ErrorType::NotAFunction, callback.to_string_without_side_effects()); auto this_value = vm.this_value(); TRY(impl->for_each([&](auto key, auto value) -> JS::ThrowCompletionOr { diff --git a/Tests/LibJS/test-js.cpp b/Tests/LibJS/test-js.cpp index 5b4b7f84ddd..7b4243d53e7 100644 --- a/Tests/LibJS/test-js.cpp +++ b/Tests/LibJS/test-js.cpp @@ -59,7 +59,7 @@ TESTJS_GLOBAL_FUNCTION(mark_as_garbage, markAsGarbage) { auto argument = vm.argument(0); if (!argument.is_string()) - return vm.throw_completion(JS::ErrorType::NotAString, TRY_OR_THROW_OOM(vm, argument.to_string_without_side_effects())); + return vm.throw_completion(JS::ErrorType::NotAString, argument.to_string_without_side_effects()); auto& variable_name = argument.as_string(); diff --git a/Tests/LibJS/test262-runner.cpp b/Tests/LibJS/test262-runner.cpp index 3942f1c1bee..9477a78801e 100644 --- a/Tests/LibJS/test262-runner.cpp +++ b/Tests/LibJS/test262-runner.cpp @@ -90,22 +90,22 @@ static Result run_program(InterpreterT& interpreter, ScriptOrMo auto name = object.get_without_side_effects("name"); if (!name.is_empty() && !name.is_accessor()) { - error.type = name.to_string_without_side_effects().release_value_but_fixme_should_propagate_errors().to_deprecated_string(); + error.type = name.to_string_without_side_effects().to_deprecated_string(); } else { auto constructor = object.get_without_side_effects("constructor"); if (constructor.is_object()) { name = constructor.as_object().get_without_side_effects("name"); if (!name.is_undefined()) - error.type = name.to_string_without_side_effects().release_value_but_fixme_should_propagate_errors().to_deprecated_string(); + error.type = name.to_string_without_side_effects().to_deprecated_string(); } } auto message = object.get_without_side_effects("message"); if (!message.is_empty() && !message.is_accessor()) - error.details = message.to_string_without_side_effects().release_value_but_fixme_should_propagate_errors().to_deprecated_string(); + error.details = message.to_string_without_side_effects().to_deprecated_string(); } if (error.type.is_empty()) - error.type = error_value.to_string_without_side_effects().release_value_but_fixme_should_propagate_errors().to_deprecated_string(); + error.type = error_value.to_string_without_side_effects().to_deprecated_string(); return error; } return {}; diff --git a/Userland/Applications/Assistant/Providers.cpp b/Userland/Applications/Assistant/Providers.cpp index ede4e674687..98e34199c01 100644 --- a/Userland/Applications/Assistant/Providers.cpp +++ b/Userland/Applications/Assistant/Providers.cpp @@ -113,7 +113,7 @@ void CalculatorProvider::query(DeprecatedString const& query, Function> results; diff --git a/Userland/Applications/Spreadsheet/Cell.cpp b/Userland/Applications/Spreadsheet/Cell.cpp index eb1c3b7823a..2ec8c36c6c9 100644 --- a/Userland/Applications/Spreadsheet/Cell.cpp +++ b/Userland/Applications/Spreadsheet/Cell.cpp @@ -41,7 +41,7 @@ void Cell::set_data(JS::Value new_data) StringBuilder builder; - builder.append(new_data.to_string_without_side_effects().release_value_but_fixme_should_propagate_errors()); + builder.append(new_data.to_string_without_side_effects()); m_data = builder.to_deprecated_string(); m_evaluated_data = move(new_data); diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.cpp b/Userland/Applications/Spreadsheet/Spreadsheet.cpp index f643c44a936..44e09e1424d 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp +++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp @@ -68,7 +68,7 @@ Sheet::Sheet(Workbook& workbook) if (result.is_error()) { warnln("Spreadsheet: Failed to run runtime code:"); auto thrown_value = *result.throw_completion().value(); - warn("Threw: {}", MUST(thrown_value.to_string_without_side_effects())); + warn("Threw: {}", thrown_value.to_string_without_side_effects()); if (thrown_value.is_object() && is(thrown_value.as_object())) { auto& error = static_cast(thrown_value.as_object()); warnln(" with message '{}'", error.get_without_side_effects(vm.names.message)); @@ -560,7 +560,7 @@ JsonObject Sheet::to_json() const auto json = realm().global_object().get_without_side_effects("JSON"); auto stringified_or_error = JS::call(vm(), json.as_object().get_without_side_effects("stringify").as_function(), json, it.value->evaluated_data()); VERIFY(!stringified_or_error.is_error()); - data.set("value", stringified_or_error.release_value().to_string_without_side_effects().release_value_but_fixme_should_propagate_errors().to_deprecated_string()); + data.set("value", stringified_or_error.release_value().to_string_without_side_effects().to_deprecated_string()); } else { data.set("value", it.value->data()); } @@ -691,7 +691,7 @@ JsonObject Sheet::gather_documentation() const if (!doc.is_string()) return; - JsonParser parser(doc.to_string_without_side_effects().release_value_but_fixme_should_propagate_errors()); + JsonParser parser(doc.to_string_without_side_effects()); auto doc_object = parser.parse(); if (!doc_object.is_error()) diff --git a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp index aaf34daa0d0..2caa1e31ece 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp @@ -33,7 +33,7 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) auto message = object.get_without_side_effects("message"); auto error = message.to_deprecated_string(vm); if (error.is_throw_completion()) - builder.append(message.to_string_without_side_effects().release_value_but_fixme_should_propagate_errors()); + builder.append(message.to_string_without_side_effects()); else builder.append(error.release_value()); return builder.to_deprecated_string(); @@ -120,7 +120,7 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) auto& error = static_cast(object); auto const& trace = error.traceback(); StringBuilder builder; - builder.appendff("{}\n", error.get_without_side_effects(object.vm().names.message).to_string_without_side_effects().release_value_but_fixme_should_propagate_errors()); + builder.appendff("{}\n", error.get_without_side_effects(object.vm().names.message).to_string_without_side_effects()); for (auto const& frame : trace.in_reverse()) { if (frame.source_range().filename().contains("runtime.js"sv)) { if (frame.function_name == "") diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp index 6f9e9cdaedf..f3f80c37411 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/Userland/Libraries/LibJS/AST.cpp @@ -316,11 +316,11 @@ ThrowCompletionOr ClassExpression::create_class_const if (super_class.is_null()) { proto_parent = nullptr; } else if (!super_class.is_constructor()) { - return vm.throw_completion(ErrorType::ClassExtendsValueNotAConstructorOrNull, TRY_OR_THROW_OOM(vm, super_class.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::ClassExtendsValueNotAConstructorOrNull, super_class.to_string_without_side_effects()); } else { auto super_class_prototype = TRY(super_class.get(vm, vm.names.prototype)); if (!super_class_prototype.is_null() && !super_class_prototype.is_object()) - return vm.throw_completion(ErrorType::ClassExtendsValueInvalidPrototype, TRY_OR_THROW_OOM(vm, super_class_prototype.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::ClassExtendsValueInvalidPrototype, super_class_prototype.to_string_without_side_effects()); if (super_class_prototype.is_null()) proto_parent = nullptr; diff --git a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp index 6e2faf2e767..b8ce6fa6a66 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -289,7 +289,7 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Realm& realm, Execu if (registers()[i].is_empty()) value_string = "(empty)"_string; else - value_string = MUST(registers()[i].to_string_without_side_effects()); + value_string = registers()[i].to_string_without_side_effects(); dbgln("[{:3}] {}", i, value_string); } } diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index 8e396a3742d..10e371824ae 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -73,7 +73,7 @@ static ThrowCompletionOr put_by_property_key(VM& vm, Value base, Value thi case PropertyKind::KeyValue: { bool succeeded = TRY(object->internal_set(name, value, this_value)); if (!succeeded && vm.in_strict_mode()) - return vm.throw_completion(ErrorType::ReferenceNullishSetProperty, name, TRY_OR_THROW_OOM(vm, base.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::ReferenceNullishSetProperty, name, base.to_string_without_side_effects()); break; } case PropertyKind::DirectKeyValue: @@ -860,7 +860,7 @@ static MarkedVector argument_list_evaluation(Bytecode::Interpreter& inter auto arguments = interpreter.accumulator(); if (!(arguments.is_object() && is(arguments.as_object()))) { - dbgln("[{}] Call arguments are not an array, but: {}", interpreter.debug_position(), MUST(arguments.to_string_without_side_effects())); + dbgln("[{}] Call arguments are not an array, but: {}", interpreter.debug_position(), arguments.to_string_without_side_effects()); interpreter.current_executable().dump(); VERIFY_NOT_REACHED(); } @@ -885,9 +885,9 @@ static Completion throw_type_error_for_callee(Bytecode::Interpreter& interpreter auto callee = interpreter.reg(call.callee()); if (call.expression_string().has_value()) - return vm.throw_completion(ErrorType::IsNotAEvaluatedFrom, TRY_OR_THROW_OOM(vm, callee.to_string_without_side_effects()), callee_type, interpreter.current_executable().get_string(call.expression_string()->value())); + return vm.throw_completion(ErrorType::IsNotAEvaluatedFrom, callee.to_string_without_side_effects(), callee_type, interpreter.current_executable().get_string(call.expression_string()->value())); - return vm.throw_completion(ErrorType::IsNotA, TRY_OR_THROW_OOM(vm, callee.to_string_without_side_effects()), callee_type); + return vm.throw_completion(ErrorType::IsNotA, callee.to_string_without_side_effects(), callee_type); } static ThrowCompletionOr throw_if_needed_for_call(Interpreter& interpreter, auto& call, Value callee) @@ -1054,7 +1054,7 @@ ThrowCompletionOr ThrowIfNotObject::execute_impl(Bytecode::Interpreter& in { auto& vm = interpreter.vm(); if (!interpreter.accumulator().is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, interpreter.accumulator().to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, interpreter.accumulator().to_string_without_side_effects()); return {}; } @@ -1063,7 +1063,7 @@ ThrowCompletionOr ThrowIfNullish::execute_impl(Bytecode::Interpreter& inte auto& vm = interpreter.vm(); auto value = interpreter.accumulator(); if (value.is_nullish()) - return vm.throw_completion(ErrorType::NotObjectCoercible, TRY_OR_THROW_OOM(vm, value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotObjectCoercible, value.to_string_without_side_effects()); return {}; } @@ -1888,7 +1888,7 @@ DeprecatedString IteratorClose::to_deprecated_string_impl(Bytecode::Executable c if (!m_completion_value.has_value()) return DeprecatedString::formatted("IteratorClose completion_type={} completion_value=", to_underlying(m_completion_type)); - auto completion_value_string = m_completion_value->to_string_without_side_effects().release_value_but_fixme_should_propagate_errors(); + auto completion_value_string = m_completion_value->to_string_without_side_effects(); return DeprecatedString::formatted("IteratorClose completion_type={} completion_value={}", to_underlying(m_completion_type), completion_value_string); } @@ -1897,7 +1897,7 @@ DeprecatedString AsyncIteratorClose::to_deprecated_string_impl(Bytecode::Executa if (!m_completion_value.has_value()) return DeprecatedString::formatted("AsyncIteratorClose completion_type={} completion_value=", to_underlying(m_completion_type)); - auto completion_value_string = m_completion_value->to_string_without_side_effects().release_value_but_fixme_should_propagate_errors(); + auto completion_value_string = m_completion_value->to_string_without_side_effects(); return DeprecatedString::formatted("AsyncIteratorClose completion_type={} completion_value={}", to_underlying(m_completion_type), completion_value_string); } diff --git a/Userland/Libraries/LibJS/MarkupGenerator.cpp b/Userland/Libraries/LibJS/MarkupGenerator.cpp index 87586b8be8a..554782d4346 100644 --- a/Userland/Libraries/LibJS/MarkupGenerator.cpp +++ b/Userland/Libraries/LibJS/MarkupGenerator.cpp @@ -82,7 +82,7 @@ ErrorOr MarkupGenerator::value_to_html(Value value, StringBuilder& output_ if (value.is_string()) TRY(output_html.try_append('"')); - TRY(output_html.try_append(escape_html_entities(TRY(value.to_string_without_side_effects())))); + TRY(output_html.try_append(escape_html_entities(value.to_string_without_side_effects()))); if (value.is_string()) TRY(output_html.try_append('"')); @@ -168,8 +168,8 @@ ErrorOr MarkupGenerator::error_to_html(Error const& error, StringBuilder& auto& vm = error.vm(); auto name = error.get_without_side_effects(vm.names.name).value_or(js_undefined()); auto message = error.get_without_side_effects(vm.names.message).value_or(js_undefined()); - auto name_string = TRY(name.to_string_without_side_effects()); - auto message_string = TRY(message.to_string_without_side_effects()); + auto name_string = name.to_string_without_side_effects(); + auto message_string = message.to_string_without_side_effects(); auto uncaught_message = TRY(String::formatted("Uncaught {}[{}]: ", in_promise ? "(in promise) " : "", name_string)); TRY(html_output.try_append(TRY(wrap_string_in_style(uncaught_message, StyleType::Invalid)).bytes_as_string_view())); diff --git a/Userland/Libraries/LibJS/Print.cpp b/Userland/Libraries/LibJS/Print.cpp index cabda11d4e2..be4b8907dcd 100644 --- a/Userland/Libraries/LibJS/Print.cpp +++ b/Userland/Libraries/LibJS/Print.cpp @@ -274,8 +274,8 @@ ErrorOr print_error(JS::PrintContext& print_context, JS::Object const& obj if (name.is_accessor() || message.is_accessor()) { TRY(print_value(print_context, &object, seen_objects)); } else { - auto name_string = TRY(name.to_string_without_side_effects()); - auto message_string = TRY(message.to_string_without_side_effects()); + auto name_string = name.to_string_without_side_effects(); + auto message_string = message.to_string_without_side_effects(); TRY(print_type(print_context, name_string)); if (!message_string.is_empty()) TRY(js_out(print_context, " \033[31;1m{}\033[0m", message_string)); @@ -1069,7 +1069,7 @@ ErrorOr print_value(JS::PrintContext& print_context, JS::Value value, Hash else if (value.is_negative_zero()) TRY(js_out(print_context, "-")); - auto contents = TRY(value.to_string_without_side_effects()); + auto contents = value.to_string_without_side_effects(); if (value.is_string()) TRY(js_out(print_context, "{}", TRY(escape_for_string_literal(contents)))); else diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp index 67a656f3c56..7bc12fea665 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp @@ -41,7 +41,7 @@ namespace JS { ThrowCompletionOr require_object_coercible(VM& vm, Value value) { if (value.is_nullish()) - return vm.throw_completion(ErrorType::NotObjectCoercible, TRY_OR_THROW_OOM(vm, value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotObjectCoercible, value.to_string_without_side_effects()); return value; } @@ -54,7 +54,7 @@ ThrowCompletionOr call_impl(VM& vm, Value function, Value this_value, Opt // 2. If IsCallable(F) is false, throw a TypeError exception. if (!function.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, function.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, function.to_string_without_side_effects()); // 3. Return ? F.[[Call]](V, argumentsList). return function.as_function().internal_call(this_value, move(*arguments_list)); @@ -102,7 +102,7 @@ ThrowCompletionOr> create_list_from_array_like(VM& vm, Value // 2. If Type(obj) is not Object, throw a TypeError exception. if (!value.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, value.to_string_without_side_effects()); auto& array_like = value.as_object(); @@ -146,7 +146,7 @@ ThrowCompletionOr species_constructor(VM& vm, Object const& obj // 3. If Type(C) is not Object, throw a TypeError exception. if (!constructor.is_object()) - return vm.throw_completion(ErrorType::NotAConstructor, TRY_OR_THROW_OOM(vm, constructor.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAConstructor, constructor.to_string_without_side_effects()); // 4. Let S be ? Get(C, @@species). auto species = TRY(constructor.as_object().get(vm.well_known_symbol_species())); @@ -160,7 +160,7 @@ ThrowCompletionOr species_constructor(VM& vm, Object const& obj return &species.as_function(); // 7. Throw a TypeError exception. - return vm.throw_completion(ErrorType::NotAConstructor, TRY_OR_THROW_OOM(vm, species.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAConstructor, species.to_string_without_side_effects()); } // 7.3.25 GetFunctionRealm ( obj ), https://tc39.es/ecma262/#sec-getfunctionrealm @@ -1331,7 +1331,7 @@ ThrowCompletionOr add_disposable_resource(VM& vm, Vector(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, value.to_string_without_side_effects()); // c. Let resource be ? CreateDisposableResource(V, hint). resource = TRY(create_disposable_resource(vm, value, hint)); @@ -1347,7 +1347,7 @@ ThrowCompletionOr add_disposable_resource(VM& vm, Vector(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, value.to_string_without_side_effects()); // ii. Let resource be ? CreateDisposableResource(V, hint, method). resource = TRY(create_disposable_resource(vm, value, hint, method)); @@ -1376,7 +1376,7 @@ ThrowCompletionOr create_disposable_resource(VM& vm, Value v // c. If method is undefined, throw a TypeError exception. if (!method) - return vm.throw_completion(ErrorType::NoDisposeMethod, TRY_OR_THROW_OOM(vm, value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NoDisposeMethod, value.to_string_without_side_effects()); } // 2. Else, // a. If IsCallable(method) is false, throw a TypeError exception. diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.h b/Userland/Libraries/LibJS/Runtime/AbstractOperations.h index 0e48f1c32db..2146fb4e02d 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.h +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.h @@ -220,7 +220,7 @@ ThrowCompletionOr group_by(VM& vm, Value items, Value callback_funct // 2. If IsCallable(callbackfn) is false, throw a TypeError exception. if (!callback_function.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, callback_function.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_string_without_side_effects()); // 3. Let groups be a new empty List. GroupsType groups; diff --git a/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp index e5086237fce..688b3f4f674 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp @@ -153,7 +153,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::from) if (!mapfn_value.is_undefined()) { // a. If IsCallable(mapfn) is false, throw a TypeError exception. if (!mapfn_value.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, mapfn_value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, mapfn_value.to_string_without_side_effects()); // b. Let mapping be true. mapfn = &mapfn_value.as_function(); @@ -318,7 +318,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::from_async) else { // i. If IsCallable(mapfn) is false, throw a TypeError exception. if (!mapfn.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, mapfn.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, mapfn.to_string_without_side_effects()); // ii. Let mapping be true. mapping = true; diff --git a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp index d36542680ea..04647227b58 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp @@ -137,7 +137,7 @@ static ThrowCompletionOr array_species_create(VM& vm, Object& original_ return TRY(Array::create(realm, length)).ptr(); if (!constructor.is_constructor()) - return vm.throw_completion(ErrorType::NotAConstructor, TRY_OR_THROW_OOM(vm, constructor.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAConstructor, constructor.to_string_without_side_effects()); return TRY(construct(vm, constructor.as_function(), Value(length))).ptr(); } @@ -310,7 +310,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::every) // 3. If IsCallable(callbackfn) is false, throw a TypeError exception. if (!callback_function.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, callback_function.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_string_without_side_effects()); // 4. Let k be 0. // 5. Repeat, while k < len, @@ -396,7 +396,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::filter) // 3. If IsCallable(callbackfn) is false, throw a TypeError exception. if (!callback_function.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, callback_function.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_string_without_side_effects()); // 4. Let A be ? ArraySpeciesCreate(O, 0). auto* array = TRY(array_species_create(vm, object, 0)); @@ -454,7 +454,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find) // 3. If IsCallable(predicate) is false, throw a TypeError exception. if (!predicate.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, predicate.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, predicate.to_string_without_side_effects()); // 4. Let k be 0. // 5. Repeat, while k < len, @@ -493,7 +493,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find_index) // 3. If IsCallable(predicate) is false, throw a TypeError exception. if (!predicate.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, predicate.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, predicate.to_string_without_side_effects()); // 4. Let k be 0. // 5. Repeat, while k < len, @@ -532,7 +532,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find_last) // 3. If IsCallable(predicate) is false, throw a TypeError exception. if (!predicate.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, predicate.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, predicate.to_string_without_side_effects()); // 4. Let k be len - 1. // 5. Repeat, while k ≥ 0, @@ -571,7 +571,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::find_last_index) // 3. If IsCallable(predicate) is false, throw a TypeError exception. if (!predicate.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, predicate.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, predicate.to_string_without_side_effects()); // 4. Let k be len - 1. // 5. Repeat, while k ≥ 0, @@ -663,7 +663,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::flat_map) // 3. If IsCallable(mapperFunction) is false, throw a TypeError exception. if (!mapper_function.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, mapper_function.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, mapper_function.to_string_without_side_effects()); // 4. Let A be ? ArraySpeciesCreate(O, 0). auto* array = TRY(array_species_create(vm, object, 0)); @@ -689,7 +689,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::for_each) // 3. If IsCallable(callbackfn) is false, throw a TypeError exception. if (!callback_function.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, callback_function.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_string_without_side_effects()); // 4. Let k be 0. // 5. Repeat, while k < len, @@ -944,7 +944,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::map) // 3. If IsCallable(callbackfn) is false, throw a TypeError exception. if (!callback_function.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, callback_function.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_string_without_side_effects()); // 4. Let A be ? ArraySpeciesCreate(O, len). auto* array = TRY(array_species_create(vm, object, length)); @@ -1023,7 +1023,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce) // 3. If IsCallable(callbackfn) is false, throw a TypeError exception. if (!callback_function.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, callback_function.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_string_without_side_effects()); // 4. If len = 0 and initialValue is not present, throw a TypeError exception. if (length == 0 && vm.argument_count() <= 1) @@ -1105,7 +1105,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reduce_right) // 3. If IsCallable(callbackfn) is false, throw a TypeError exception. if (!callback_function.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, callback_function.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_string_without_side_effects()); // 4. If len = 0 and initialValue is not present, throw a TypeError exception. if (length == 0 && vm.argument_count() <= 1) @@ -1305,7 +1305,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::some) // 3. If IsCallable(callbackfn) is false, throw a TypeError exception. if (!callback_function.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, callback_function.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_string_without_side_effects()); // 4. Let k be 0. // 5. Repeat, while k < len, @@ -1398,7 +1398,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::sort) // 1. If comparefn is not undefined and IsCallable(comparefn) is false, throw a TypeError exception. auto comparefn = vm.argument(0); if (!comparefn.is_undefined() && !comparefn.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, comparefn.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, comparefn.to_string_without_side_effects()); // 2. Let obj be ? ToObject(this value). auto object = TRY(vm.this_value().to_object(vm)); diff --git a/Userland/Libraries/LibJS/Runtime/DataViewConstructor.cpp b/Userland/Libraries/LibJS/Runtime/DataViewConstructor.cpp index dec14a85431..176faf2a58c 100644 --- a/Userland/Libraries/LibJS/Runtime/DataViewConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/DataViewConstructor.cpp @@ -50,7 +50,7 @@ ThrowCompletionOr> DataViewConstructor::construct(FunctionO // 2. Perform ? RequireInternalSlot(buffer, [[ArrayBufferData]]). if (!buffer.is_object() || !is(buffer.as_object())) - return vm.throw_completion(ErrorType::IsNotAn, TRY_OR_THROW_OOM(vm, buffer.to_string_without_side_effects()), vm.names.ArrayBuffer); + return vm.throw_completion(ErrorType::IsNotAn, buffer.to_string_without_side_effects(), vm.names.ArrayBuffer); auto& array_buffer = static_cast(buffer.as_object()); diff --git a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp index f265432d7a7..5c398beedb1 100644 --- a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp @@ -1243,10 +1243,10 @@ JS_DEFINE_NATIVE_FUNCTION(DatePrototype::symbol_to_primitive) { auto this_value = vm.this_value(); if (!this_value.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, this_value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, this_value.to_string_without_side_effects()); auto hint_value = vm.argument(0); if (!hint_value.is_string()) - return vm.throw_completion(ErrorType::InvalidHint, TRY_OR_THROW_OOM(vm, hint_value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::InvalidHint, hint_value.to_string_without_side_effects()); auto hint = hint_value.as_string().deprecated_string(); Value::PreferredType try_first; if (hint == "string" || hint == "default") diff --git a/Userland/Libraries/LibJS/Runtime/DisposableStackPrototype.cpp b/Userland/Libraries/LibJS/Runtime/DisposableStackPrototype.cpp index a13d84bb6bd..15e0896926d 100644 --- a/Userland/Libraries/LibJS/Runtime/DisposableStackPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DisposableStackPrototype.cpp @@ -87,7 +87,7 @@ JS_DEFINE_NATIVE_FUNCTION(DisposableStackPrototype::use) if (!value.is_nullish()) { // a. If Type(value) is not Object, throw a TypeError exception. if (!value.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, value.to_string_without_side_effects()); // FIXME: This should be TRY in the spec // b. Let method be GetDisposeMethod(value, sync-dispose). @@ -96,7 +96,7 @@ JS_DEFINE_NATIVE_FUNCTION(DisposableStackPrototype::use) // c. If method is undefined, then if (!method.ptr()) { // i. Throw a TypeError exception. - return vm.throw_completion(ErrorType::NoDisposeMethod, TRY_OR_THROW_OOM(vm, value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NoDisposeMethod, value.to_string_without_side_effects()); } // d. Else, // i. Perform ? AddDisposableResource(disposableStack, value, sync-dispose, method). @@ -126,7 +126,7 @@ JS_DEFINE_NATIVE_FUNCTION(DisposableStackPrototype::adopt) // 4. If IsCallable(onDispose) is false, throw a TypeError exception. if (!on_dispose.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, on_dispose.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, on_dispose.to_string_without_side_effects()); // 5. Let F be a new built-in function object as defined in 11.3.3.4.1. // 6. Set F.[[Argument]] to value. @@ -167,7 +167,7 @@ JS_DEFINE_NATIVE_FUNCTION(DisposableStackPrototype::defer) // 4. If IsCallable(onDispose) is false, throw a TypeError exception. if (!on_dispose.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, on_dispose.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, on_dispose.to_string_without_side_effects()); // 5. Perform ? AddDisposableResource(disposableStack, undefined, sync-dispose, onDispose). TRY(add_disposable_resource(vm, disposable_stack->disposable_resource_stack(), js_undefined(), Environment::InitializeBindingHint::SyncDispose, &on_dispose.as_function())); diff --git a/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp index b3a62a77ce9..6d8c197e13d 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp @@ -109,7 +109,7 @@ JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::stack_setter) // 2. If ! Type(E) is not Object, throw a TypeError exception. if (!this_value.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, this_value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, this_value.to_string_without_side_effects()); auto& this_object = this_value.as_object(); diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp index 0350ae625d5..f3beec5b002 100644 --- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp @@ -46,7 +46,7 @@ ThrowCompletionOr> FinalizationRegistryConstructor::constru // 2. If IsCallable(cleanupCallback) is false, throw a TypeError exception. auto cleanup_callback = vm.argument(0); if (!cleanup_callback.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, cleanup_callback.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, cleanup_callback.to_string_without_side_effects()); // 3. Let finalizationRegistry be ? OrdinaryCreateFromConstructor(NewTarget, "%FinalizationRegistry.prototype%", « [[Realm]], [[CleanupCallback]], [[Cells]] »). // 4. Let fn be the active function object. diff --git a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp index dc6f727d178..5b78571f200 100644 --- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp @@ -40,7 +40,7 @@ JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::cleanup_some) // 3. If callback is present and IsCallable(callback) is false, throw a TypeError exception. if (vm.argument_count() > 0 && !callback.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, callback.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, callback.to_string_without_side_effects()); // IMPLEMENTATION DEFINED: The specification for this function hasn't been updated to accommodate for JobCallback records. // This just follows how the constructor immediately converts the callback to a JobCallback using HostMakeJobCallback. @@ -64,7 +64,7 @@ JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::register_) // 3. If target is not an Object, throw a TypeError exception. if (!can_be_held_weakly(target)) - return vm.throw_completion(ErrorType::CannotBeHeldWeakly, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::CannotBeHeldWeakly, target.to_string_without_side_effects()); // 4. If SameValue(target, heldValue) is true, throw a TypeError exception. if (same_value(target, held_value)) @@ -74,7 +74,7 @@ JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::register_) // a. If unregisterToken is not undefined, throw a TypeError exception. // b. Set unregisterToken to empty. if (!can_be_held_weakly(unregister_token) && !unregister_token.is_undefined()) - return vm.throw_completion(ErrorType::CannotBeHeldWeakly, TRY_OR_THROW_OOM(vm, unregister_token.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::CannotBeHeldWeakly, unregister_token.to_string_without_side_effects()); // 6. Let cell be the Record { [[WeakRefTarget]]: target, [[HeldValue]]: heldValue, [[UnregisterToken]]: unregisterToken }. // 7. Append cell to finalizationRegistry.[[Cells]]. @@ -95,7 +95,7 @@ JS_DEFINE_NATIVE_FUNCTION(FinalizationRegistryPrototype::unregister) // 3. If unregisterToken is not an Object, throw a TypeError exception. if (!can_be_held_weakly(unregister_token)) - return vm.throw_completion(ErrorType::CannotBeHeldWeakly, TRY_OR_THROW_OOM(vm, unregister_token.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::CannotBeHeldWeakly, unregister_token.to_string_without_side_effects()); // 4-6. return Value(finalization_registry->remove_by_token(unregister_token.as_cell())); diff --git a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp index 0398cc30ac5..f8d35f69ff9 100644 --- a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp @@ -53,7 +53,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::apply) // 2. If IsCallable(func) is false, throw a TypeError exception. if (!function_value.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, function_value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, function_value.to_string_without_side_effects()); auto& function = static_cast(function_value.as_object()); @@ -90,7 +90,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::bind) // 2. If IsCallable(Target) is false, throw a TypeError exception. if (!target_value.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, target_value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, target_value.to_string_without_side_effects()); auto& target = static_cast(target_value.as_object()); @@ -121,7 +121,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::call) // 2. If IsCallable(func) is false, throw a TypeError exception. if (!function_value.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, function_value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, function_value.to_string_without_side_effects()); auto& function = static_cast(function_value.as_object()); diff --git a/Userland/Libraries/LibJS/Runtime/Iterator.cpp b/Userland/Libraries/LibJS/Runtime/Iterator.cpp index f33b6090a74..2cb4447c25f 100644 --- a/Userland/Libraries/LibJS/Runtime/Iterator.cpp +++ b/Userland/Libraries/LibJS/Runtime/Iterator.cpp @@ -39,7 +39,7 @@ ThrowCompletionOr get_iterator_from_method(VM& vm, Value object, // 2. If iterator is not an Object, throw a TypeError exception. if (!iterator.is_object()) - return vm.throw_completion(ErrorType::NotIterable, TRY_OR_THROW_OOM(vm, object.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotIterable, object.to_string_without_side_effects()); // 3. Let nextMethod be ? Get(iterator, "next"). auto next_method = TRY(iterator.get(vm, vm.names.next)); @@ -68,7 +68,7 @@ ThrowCompletionOr get_iterator(VM& vm, Value object, IteratorHin // ii. If syncMethod is undefined, throw a TypeError exception. if (!sync_method) - return vm.throw_completion(ErrorType::NotIterable, TRY_OR_THROW_OOM(vm, object.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotIterable, object.to_string_without_side_effects()); // iii. Let syncIteratorRecord be ? GetIteratorFromMethod(obj, syncMethod). auto sync_iterator_record = TRY(get_iterator_from_method(vm, object, *sync_method)); @@ -85,7 +85,7 @@ ThrowCompletionOr get_iterator(VM& vm, Value object, IteratorHin // 3. If method is undefined, throw a TypeError exception. if (!method) - return vm.throw_completion(ErrorType::NotIterable, TRY_OR_THROW_OOM(vm, object.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotIterable, object.to_string_without_side_effects()); // 4. Return ? GetIteratorFromMethod(obj, method). return TRY(get_iterator_from_method(vm, object, *method)); @@ -111,7 +111,7 @@ ThrowCompletionOr get_iterator_flattenable(VM& vm, Value object, if (!object.is_object()) { // a. If stringHandling is reject-strings or obj is not a String, throw a TypeError exception. if (string_handling == StringHandling::RejectStrings || !object.is_string()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, object.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, object.to_string_without_side_effects()); } // 2. Let method be ? GetMethod(obj, @@iterator). @@ -132,7 +132,7 @@ ThrowCompletionOr get_iterator_flattenable(VM& vm, Value object, // 5. If iterator is not an Object, throw a TypeError exception. if (!iterator.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, iterator.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, iterator.to_string_without_side_effects()); // 6. Return ? GetIteratorDirect(iterator). return TRY(get_iterator_direct(vm, iterator.as_object())); diff --git a/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp b/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp index 3ceb432e9a1..ec2f6e69844 100644 --- a/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp @@ -58,7 +58,7 @@ ThrowCompletionOr> MapConstructor::construct(FunctionObject (void)TRY(get_iterator_values(vm, vm.argument(0), [&](Value iterator_value) -> Optional { if (!iterator_value.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, DeprecatedString::formatted("Iterator value {}", TRY_OR_THROW_OOM(vm, iterator_value.to_string_without_side_effects()))); + return vm.throw_completion(ErrorType::NotAnObject, DeprecatedString::formatted("Iterator value {}", iterator_value.to_string_without_side_effects())); auto key = TRY(iterator_value.as_object().get(0)); auto value = TRY(iterator_value.as_object().get(1)); diff --git a/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp b/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp index 8258d950b0d..96c9d5f5fa9 100644 --- a/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp @@ -97,7 +97,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::for_each) // 3. If IsCallable(callbackfn) is false, throw a TypeError exception. if (!callbackfn.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, callbackfn.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, callbackfn.to_string_without_side_effects()); // 4. Let entries be M.[[MapData]]. // 5. Let numEntries be the number of elements in entries. diff --git a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp index 74cd6c56c2d..c2cae1e24a9 100644 --- a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp @@ -206,7 +206,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::define_property) { // 1. If O is not an Object, throw a TypeError exception. if (!vm.argument(0).is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, vm.argument(0).to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, vm.argument(0).to_string_without_side_effects()); auto object = MUST(vm.argument(0).to_object(vm)); @@ -276,7 +276,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::from_entries) // 6. Return ? AddEntriesFromIterable(obj, iterable, adder). (void)TRY(get_iterator_values(vm, iterable, [&](Value iterator_value) -> Optional { if (!iterator_value.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, DeprecatedString::formatted("Iterator value {}", TRY_OR_THROW_OOM(vm, iterator_value.to_string_without_side_effects()))); + return vm.throw_completion(ErrorType::NotAnObject, DeprecatedString::formatted("Iterator value {}", iterator_value.to_string_without_side_effects())); auto key = TRY(iterator_value.as_object().get(0)); auto value = TRY(iterator_value.as_object().get(1)); diff --git a/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp index 9a2b635074f..6031539d8e0 100644 --- a/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp @@ -251,7 +251,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::define_getter) // 2. If IsCallable(getter) is false, throw a TypeError exception. if (!getter.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, getter.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, getter.to_string_without_side_effects()); // 3. Let desc be PropertyDescriptor { [[Get]]: getter, [[Enumerable]]: true, [[Configurable]]: true }. auto descriptor = PropertyDescriptor { .get = &getter.as_function(), .enumerable = true, .configurable = true }; @@ -277,7 +277,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::define_setter) // 2. If IsCallable(setter) is false, throw a TypeError exception. if (!setter.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, setter.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, setter.to_string_without_side_effects()); // 3. Let desc be PropertyDescriptor { [[Set]]: setter, [[Enumerable]]: true, [[Configurable]]: true }. auto descriptor = PropertyDescriptor { .set = &setter.as_function(), .enumerable = true, .configurable = true }; diff --git a/Userland/Libraries/LibJS/Runtime/PromiseCapability.cpp b/Userland/Libraries/LibJS/Runtime/PromiseCapability.cpp index dc82e2d894b..427442771a0 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseCapability.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseCapability.cpp @@ -54,7 +54,7 @@ ThrowCompletionOr> new_promise_capability(VM& vm // 1. If IsConstructor(C) is false, throw a TypeError exception. if (!constructor.is_constructor()) - return vm.throw_completion(ErrorType::NotAConstructor, TRY_OR_THROW_OOM(vm, constructor.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAConstructor, constructor.to_string_without_side_effects()); // 2. NOTE: C is assumed to be a constructor function that supports the parameter conventions of the Promise constructor (see 27.2.3.1). diff --git a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp index 781b20235f2..0dda6cec31d 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp @@ -29,7 +29,7 @@ static ThrowCompletionOr get_promise_resolve(VM& vm, Value constructor) // 2. If IsCallable(promiseResolve) is false, throw a TypeError exception. if (!promise_resolve.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, promise_resolve.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, promise_resolve.to_string_without_side_effects()); // 3. Return promiseResolve. return promise_resolve; @@ -472,7 +472,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromiseConstructor::resolve) // 2. If Type(C) is not Object, throw a TypeError exception. if (!constructor.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, constructor.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, constructor.to_string_without_side_effects()); // 3. Return ? PromiseResolve(C, x). return TRY(promise_resolve(vm, constructor.as_object(), value)); diff --git a/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp b/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp index 5bd3f61681c..6d8359cbfd2 100644 --- a/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp @@ -80,7 +80,7 @@ JS_DEFINE_NATIVE_FUNCTION(PromisePrototype::finally) // 2. If Type(promise) is not Object, throw a TypeError exception. if (!promise.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, promise.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, promise.to_string_without_side_effects()); // 3. Let C be ? SpeciesConstructor(promise, %Promise%). auto* constructor = TRY(species_constructor(vm, promise.as_object(), realm.intrinsics().promise_constructor())); diff --git a/Userland/Libraries/LibJS/Runtime/PropertyDescriptor.cpp b/Userland/Libraries/LibJS/Runtime/PropertyDescriptor.cpp index ed5f0d4770d..198a5efb90e 100644 --- a/Userland/Libraries/LibJS/Runtime/PropertyDescriptor.cpp +++ b/Userland/Libraries/LibJS/Runtime/PropertyDescriptor.cpp @@ -92,7 +92,7 @@ ThrowCompletionOr to_property_descriptor(VM& vm, Value argum { // 1. If Type(Obj) is not Object, throw a TypeError exception. if (!argument.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, argument.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, argument.to_string_without_side_effects()); auto& object = argument.as_object(); diff --git a/Userland/Libraries/LibJS/Runtime/PropertyDescriptor.h b/Userland/Libraries/LibJS/Runtime/PropertyDescriptor.h index a3cc985eb9b..d8888ce628f 100644 --- a/Userland/Libraries/LibJS/Runtime/PropertyDescriptor.h +++ b/Userland/Libraries/LibJS/Runtime/PropertyDescriptor.h @@ -54,7 +54,7 @@ struct Formatter : Formatter { { Vector parts; if (property_descriptor.value.has_value()) - TRY(parts.try_append(TRY(String::formatted("[[Value]]: {}", TRY(property_descriptor.value->to_string_without_side_effects()))))); + TRY(parts.try_append(TRY(String::formatted("[[Value]]: {}", property_descriptor.value->to_string_without_side_effects())))); if (property_descriptor.get.has_value()) TRY(parts.try_append(TRY(String::formatted("[[Get]]: JS::Function* @ {:p}", property_descriptor.get->ptr())))); if (property_descriptor.set.has_value()) diff --git a/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp index d40a50bfa6a..b24335bfb19 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp @@ -20,11 +20,11 @@ static ThrowCompletionOr proxy_create(VM& vm, Value target, Value // 1. If target is not an Object, throw a TypeError exception. if (!target.is_object()) - return vm.throw_completion(ErrorType::ProxyConstructorBadType, "target", TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::ProxyConstructorBadType, "target", target.to_string_without_side_effects()); // 2. If handler is not an Object, throw a TypeError exception. if (!handler.is_object()) - return vm.throw_completion(ErrorType::ProxyConstructorBadType, "handler", TRY_OR_THROW_OOM(vm, handler.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::ProxyConstructorBadType, "handler", handler.to_string_without_side_effects()); // 3. Let P be MakeBasicObject(« [[ProxyHandler]], [[ProxyTarget]] »). // 4. Set P's essential internal methods, except for [[Call]] and [[Construct]], to the definitions specified in 10.5. diff --git a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp index 1f4b232f8db..e3f270fcd2a 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp @@ -738,7 +738,7 @@ ThrowCompletionOr> ProxyObject::internal_own_property_keys() for (auto& key : target_nonconfigurable_keys) { // a. If key is not an element of uncheckedResultKeys, throw a TypeError exception. if (!unchecked_result_keys.contains_slow(key)) - return vm.throw_completion(ErrorType::ProxyOwnPropertyKeysSkippedNonconfigurableProperty, TRY_OR_THROW_OOM(vm, key.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::ProxyOwnPropertyKeysSkippedNonconfigurableProperty, key.to_string_without_side_effects()); // b. Remove key from uncheckedResultKeys. unchecked_result_keys.remove_first_matching([&](auto& value) { @@ -754,7 +754,7 @@ ThrowCompletionOr> ProxyObject::internal_own_property_keys() for (auto& key : target_configurable_keys) { // a. If key is not an element of uncheckedResultKeys, throw a TypeError exception. if (!unchecked_result_keys.contains_slow(key)) - return vm.throw_completion(ErrorType::ProxyOwnPropertyKeysNonExtensibleSkippedProperty, TRY_OR_THROW_OOM(vm, key.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::ProxyOwnPropertyKeysNonExtensibleSkippedProperty, key.to_string_without_side_effects()); // b. Remove key from uncheckedResultKeys. unchecked_result_keys.remove_first_matching([&](auto& value) { @@ -764,7 +764,7 @@ ThrowCompletionOr> ProxyObject::internal_own_property_keys() // 22. If uncheckedResultKeys is not empty, throw a TypeError exception. if (!unchecked_result_keys.is_empty()) - return vm.throw_completion(ErrorType::ProxyOwnPropertyKeysNonExtensibleNewProperty, TRY_OR_THROW_OOM(vm, unchecked_result_keys[0].to_string_without_side_effects())); + return vm.throw_completion(ErrorType::ProxyOwnPropertyKeysNonExtensibleNewProperty, unchecked_result_keys[0].to_string_without_side_effects()); // 23. Return trapResult. return { move(trap_result) }; diff --git a/Userland/Libraries/LibJS/Runtime/Reference.cpp b/Userland/Libraries/LibJS/Runtime/Reference.cpp index bf7114e7b41..688eafc7ca6 100644 --- a/Userland/Libraries/LibJS/Runtime/Reference.cpp +++ b/Userland/Libraries/LibJS/Runtime/Reference.cpp @@ -53,7 +53,7 @@ ThrowCompletionOr Reference::put_value(VM& vm, Value value) // d. If succeeded is false and V.[[Strict]] is true, throw a TypeError exception. if (!succeeded && m_strict) - return vm.throw_completion(ErrorType::ReferenceNullishSetProperty, m_name, TRY_OR_THROW_OOM(vm, m_base_value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::ReferenceNullishSetProperty, m_name, m_base_value.to_string_without_side_effects()); // e. Return unused. return {}; @@ -178,7 +178,7 @@ ThrowCompletionOr Reference::delete_(VM& vm) // e. If deleteStatus is false and ref.[[Strict]] is true, throw a TypeError exception. if (!delete_status && m_strict) - return vm.throw_completion(ErrorType::ReferenceNullishDeleteProperty, m_name, TRY_OR_THROW_OOM(vm, m_base_value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::ReferenceNullishDeleteProperty, m_name, m_base_value.to_string_without_side_effects()); // f. Return deleteStatus. return delete_status; diff --git a/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp b/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp index f7875c69d15..fa8222d504b 100644 --- a/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp @@ -52,7 +52,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::apply) // 1. If IsCallable(target) is false, throw a TypeError exception. if (!target.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, target.to_string_without_side_effects()); // 2. Let args be ? CreateListFromArrayLike(argumentsList). auto args = TRY(create_list_from_array_like(vm, arguments_list)); @@ -71,14 +71,14 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::construct) // 1. If IsConstructor(target) is false, throw a TypeError exception. if (!target.is_constructor()) - return vm.throw_completion(ErrorType::NotAConstructor, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAConstructor, target.to_string_without_side_effects()); // 2. If newTarget is not present, set newTarget to target. if (vm.argument_count() < 3) new_target = target; // 3. Else if IsConstructor(newTarget) is false, throw a TypeError exception. else if (!new_target.is_constructor()) - return vm.throw_completion(ErrorType::NotAConstructor, TRY_OR_THROW_OOM(vm, new_target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAConstructor, new_target.to_string_without_side_effects()); // 4. Let args be ? CreateListFromArrayLike(argumentsList). auto args = TRY(create_list_from_array_like(vm, arguments_list)); @@ -96,7 +96,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::define_property) // 1. If Type(target) is not Object, throw a TypeError exception. if (!target.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, target.to_string_without_side_effects()); // 2. Let key be ? ToPropertyKey(propertyKey). auto key = TRY(property_key.to_property_key(vm)); @@ -116,7 +116,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::delete_property) // 1. If Type(target) is not Object, throw a TypeError exception. if (!target.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, target.to_string_without_side_effects()); // 2. Let key be ? ToPropertyKey(propertyKey). auto key = TRY(property_key.to_property_key(vm)); @@ -134,7 +134,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::get) // 1. If Type(target) is not Object, throw a TypeError exception. if (!target.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, target.to_string_without_side_effects()); // 2. Let key be ? ToPropertyKey(propertyKey). auto key = TRY(property_key.to_property_key(vm)); @@ -157,7 +157,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::get_own_property_descriptor) // 1. If Type(target) is not Object, throw a TypeError exception. if (!target.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, target.to_string_without_side_effects()); // 2. Let key be ? ToPropertyKey(propertyKey). auto key = TRY(property_key.to_property_key(vm)); @@ -176,7 +176,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::get_prototype_of) // 1. If Type(target) is not Object, throw a TypeError exception. if (!target.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, target.to_string_without_side_effects()); // 2. Return ? target.[[GetPrototypeOf]](). return TRY(target.as_object().internal_get_prototype_of()); @@ -190,7 +190,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::has) // 1. If Type(target) is not Object, throw a TypeError exception. if (!target.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, target.to_string_without_side_effects()); // 2. Let key be ? ToPropertyKey(propertyKey). auto key = TRY(property_key.to_property_key(vm)); @@ -206,7 +206,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::is_extensible) // 1. If Type(target) is not Object, throw a TypeError exception. if (!target.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, target.to_string_without_side_effects()); // 2. Return ? target.[[IsExtensible]](). return Value(TRY(target.as_object().internal_is_extensible())); @@ -221,7 +221,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::own_keys) // 1. If Type(target) is not Object, throw a TypeError exception. if (!target.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, target.to_string_without_side_effects()); // 2. Let keys be ? target.[[OwnPropertyKeys]](). auto keys = TRY(target.as_object().internal_own_property_keys()); @@ -237,7 +237,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::prevent_extensions) // 1. If Type(target) is not Object, throw a TypeError exception. if (!target.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, target.to_string_without_side_effects()); // 2. Return ? target.[[PreventExtensions]](). return Value(TRY(target.as_object().internal_prevent_extensions())); @@ -253,7 +253,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::set) // 1. If Type(target) is not Object, throw a TypeError exception. if (!target.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, target.to_string_without_side_effects()); // 2. Let key be ? ToPropertyKey(propertyKey). auto key = TRY(property_key.to_property_key(vm)); @@ -276,7 +276,7 @@ JS_DEFINE_NATIVE_FUNCTION(ReflectObject::set_prototype_of) // 1. If Type(target) is not Object, throw a TypeError exception. if (!target.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, target.to_string_without_side_effects()); // 2. If Type(proto) is not Object and proto is not null, throw a TypeError exception. if (!proto.is_object() && !proto.is_null()) diff --git a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp index dbe87f3acbd..bf24d39a6ca 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp @@ -395,7 +395,7 @@ ThrowCompletionOr regexp_exec(VM& vm, Object& regexp_object, Utf16String // b. If Type(result) is neither Object nor Null, throw a TypeError exception. if (!result.is_object() && !result.is_null()) - return vm.throw_completion(ErrorType::NotAnObjectOrNull, TRY_OR_THROW_OOM(vm, result.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObjectOrNull, result.to_string_without_side_effects()); // c. Return result. return result; @@ -1103,7 +1103,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::compile) if (pattern.is_object() && is(pattern.as_object())) { // a. If flags is not undefined, throw a TypeError exception. if (!flags.is_undefined()) - return vm.throw_completion(ErrorType::NotUndefined, TRY_OR_THROW_OOM(vm, flags.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotUndefined, flags.to_string_without_side_effects()); auto& regexp_pattern = static_cast(pattern.as_object()); diff --git a/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp b/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp index 93f72bc174f..ef6f4564ef7 100644 --- a/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp @@ -129,7 +129,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetPrototype::for_each) // 3. If IsCallable(callbackfn) is false, throw a TypeError exception. if (!callback_fn.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, vm.argument(0).to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, vm.argument(0).to_string_without_side_effects()); // 4. Let entries be S.[[SetData]]. // 5. Let numEntries be the number of elements in entries. @@ -210,7 +210,7 @@ static ThrowCompletionOr get_set_record(VM& vm, Value value) { // 1. If obj is not an Object, throw a TypeError exception. if (!value.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, value.to_string_without_side_effects()); auto const& object = value.as_object(); // 2. Let rawSize be ? Get(obj, "size"). @@ -236,14 +236,14 @@ static ThrowCompletionOr get_set_record(VM& vm, Value value) // 9. If IsCallable(has) is false, throw a TypeError exception. if (!has.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, has.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, has.to_string_without_side_effects()); // 10. Let keys be ? Get(obj, "keys"). auto keys = TRY(object.get(vm.names.keys)); // 11. If IsCallable(keys) is false, throw a TypeError exception. if (!keys.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, keys.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, keys.to_string_without_side_effects()); // 12. Return a new Set Record { [[Set]]: obj, [[Size]]: intSize, [[Has]]: has, [[Keys]]: keys }. return SetRecord { .set = object, .size = integer_size, .has = has.as_function(), .keys = keys.as_function() }; diff --git a/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp index 81faa9756e3..c62a2d2b13b 100644 --- a/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp @@ -67,7 +67,7 @@ JS_DEFINE_NATIVE_FUNCTION(ShadowRealmPrototype::import_value) // 4. If Type(exportName) is not String, throw a TypeError exception. if (!export_name.is_string()) - return vm.throw_completion(ErrorType::NotAString, TRY_OR_THROW_OOM(vm, export_name.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAString, export_name.to_string_without_side_effects()); // 5. Let callerRealm be the current Realm Record. auto* caller_realm = vm.current_realm(); diff --git a/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp b/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp index 2172c64340e..65c9e96baea 100644 --- a/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp @@ -117,13 +117,13 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::from_code_point) // b. If IsIntegralNumber(nextCP) is false, throw a RangeError exception. if (!next_code_point.is_integral_number()) - return vm.throw_completion(ErrorType::InvalidCodePoint, TRY_OR_THROW_OOM(vm, next_code_point.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::InvalidCodePoint, next_code_point.to_string_without_side_effects()); auto code_point = MUST(next_code_point.to_i32(vm)); // c. If ℝ(nextCP) < 0 or ℝ(nextCP) > 0x10FFFF, throw a RangeError exception. if (code_point < 0 || code_point > 0x10FFFF) - return vm.throw_completion(ErrorType::InvalidCodePoint, TRY_OR_THROW_OOM(vm, next_code_point.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::InvalidCodePoint, next_code_point.to_string_without_side_effects()); // d. Set result to the string-concatenation of result and UTF16EncodeCodePoint(ℝ(nextCP)). TRY_OR_THROW_OOM(vm, code_point_to_utf16(string, static_cast(code_point))); diff --git a/Userland/Libraries/LibJS/Runtime/SymbolConstructor.cpp b/Userland/Libraries/LibJS/Runtime/SymbolConstructor.cpp index cac5121ca9c..8dd63702cd6 100644 --- a/Userland/Libraries/LibJS/Runtime/SymbolConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/SymbolConstructor.cpp @@ -92,7 +92,7 @@ JS_DEFINE_NATIVE_FUNCTION(SymbolConstructor::key_for) // 1. If sym is not a Symbol, throw a TypeError exception. if (!argument.is_symbol()) - return vm.throw_completion(ErrorType::NotASymbol, TRY_OR_THROW_OOM(vm, argument.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotASymbol, argument.to_string_without_side_effects()); // 2. Return KeyForSymbol(sym). auto key = argument.as_symbol().key(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index 85b6bf9854b..8080d8f47bb 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp @@ -62,7 +62,7 @@ ThrowCompletionOr> iterable_to_list_of_type(VM& vm, Value it // ii. If Type(nextValue) is not an element of elementTypes, then if (auto type = to_option_type(next_value); !type.has_value() || !element_types.contains_slow(*type)) { // 1. Let completion be ThrowCompletion(a newly created TypeError object). - auto completion = vm.throw_completion(ErrorType::IterableToListOfTypeInvalidValue, TRY_OR_THROW_OOM(vm, next_value.to_string_without_side_effects())); + auto completion = vm.throw_completion(ErrorType::IterableToListOfTypeInvalidValue, next_value.to_string_without_side_effects()); // 2. Return ? IteratorClose(iteratorRecord, completion). return iterator_close(vm, iterator_record, move(completion)); } diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp index 95e4260a3c8..bc4b7748ae5 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp @@ -152,7 +152,7 @@ ThrowCompletionOr calendar_merge_fields(VM& vm, Object& calendar, Objec // 4. If Type(result) is not Object, throw a TypeError exception. if (!result.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, result.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, result.to_string_without_side_effects()); // 5. Return result. return &result.as_object(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp index ef0173bf392..fe8ab34f610 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp @@ -92,7 +92,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::date_from_fields) // 4. If Type(fields) is not Object, throw a TypeError exception. auto fields = vm.argument(0); if (!fields.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, fields.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, fields.to_string_without_side_effects()); // 5. Set options to ? GetOptionsObject(options). auto const* options = TRY(get_options_object(vm, vm.argument(1))); @@ -118,7 +118,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::year_month_from_fields) // 4. If Type(fields) is not Object, throw a TypeError exception. auto fields = vm.argument(0); if (!fields.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, fields.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, fields.to_string_without_side_effects()); // 5. Set options to ? GetOptionsObject(options). auto const* options = TRY(get_options_object(vm, vm.argument(1))); @@ -144,7 +144,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::month_day_from_fields) // 4. If Type(fields) is not Object, throw a TypeError exception. auto fields = vm.argument(0); if (!fields.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, fields.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, fields.to_string_without_side_effects()); // 5. Set options to ? GetOptionsObject(options). auto const* options = TRY(get_options_object(vm, vm.argument(1))); @@ -553,7 +553,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::fields) // ii. If Type(nextValue) is not String, then if (!next_value.is_string()) { // 1. Let completion be ThrowCompletion(a newly created TypeError object). - auto completion = vm.throw_completion(ErrorType::TemporalInvalidCalendarFieldValue, TRY_OR_THROW_OOM(vm, next_value.to_string_without_side_effects())); + auto completion = vm.throw_completion(ErrorType::TemporalInvalidCalendarFieldValue, next_value.to_string_without_side_effects()); // 2. Return ? IteratorClose(iteratorRecord, completion). return *TRY(iterator_close(vm, iterator_record, move(completion))); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp index bb612bb3020..bbe65673994 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Duration.cpp @@ -305,7 +305,7 @@ ThrowCompletionOr to_temporal_partial_duration_record(VM& // 1. If Type(temporalDurationLike) is not Object, then if (!temporal_duration_like.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, temporal_duration_like.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, temporal_duration_like.to_string_without_side_effects()); } // 2. Let result be a new partial Duration Record with each field set to undefined. diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp index 5ee381c6a4b..12d6d45d240 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp @@ -408,7 +408,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDatePrototype::with) // 3. If Type(temporalDateLike) is not Object, then if (!temporal_date_like.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, temporal_date_like.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, temporal_date_like.to_string_without_side_effects()); } // 4. Perform ? RejectObjectWithCalendarOrTimeZone(temporalDateLike). diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp index a0fa3efdcee..91078543b8a 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp @@ -380,7 +380,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainDateTimePrototype::with) // 3. If Type(temporalDateTimeLike) is not Object, then if (!temporal_date_time_like.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, temporal_date_time_like.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, temporal_date_time_like.to_string_without_side_effects()); } // 4. Perform ? RejectObjectWithCalendarOrTimeZone(temporalDateTimeLike). diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp index 5a61ed0bd64..f748b4e58d0 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp @@ -95,7 +95,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainMonthDayPrototype::with) // 3. If Type(temporalMonthDayLike) is not Object, then if (!temporal_month_day_like.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, temporal_month_day_like.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, temporal_month_day_like.to_string_without_side_effects()); } // 4. Perform ? RejectObjectWithCalendarOrTimeZone(temporalMonthDayLike). diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp index 124a4064d67..9ac4fbdb89a 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp @@ -174,7 +174,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainTimePrototype::with) // 3. If Type(temporalTimeLike) is not Object, then if (!temporal_time_like_argument.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, temporal_time_like_argument.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, temporal_time_like_argument.to_string_without_side_effects()); } auto& temporal_time_like = temporal_time_like_argument.as_object(); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp index 42c4abb0344..851725db129 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp @@ -206,7 +206,7 @@ JS_DEFINE_NATIVE_FUNCTION(PlainYearMonthPrototype::with) // 3. If Type(temporalYearMonthLike) is not Object, then if (!temporal_year_month_like.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, temporal_year_month_like.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, temporal_year_month_like.to_string_without_side_effects()); } // 4. Perform ? RejectObjectWithCalendarOrTimeZone(temporalYearMonthLike). diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp index ad698d9b2c9..6c12387de3f 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp @@ -754,7 +754,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with) // 3. If Type(temporalZonedDateTimeLike) is not Object, then if (!temporal_zoned_date_time_like.is_object()) { // a. Throw a TypeError exception. - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, temporal_zoned_date_time_like.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, temporal_zoned_date_time_like.to_string_without_side_effects()); } // 4. Perform ? RejectObjectWithCalendarOrTimeZone(temporalZonedDateTimeLike). diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp index c87e463d67c..47b7b1c97b0 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp @@ -63,7 +63,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::from) // 2. If IsConstructor(C) is false, throw a TypeError exception. if (!constructor.is_constructor()) - return vm.throw_completion(ErrorType::NotAConstructor, TRY_OR_THROW_OOM(vm, constructor.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAConstructor, constructor.to_string_without_side_effects()); // 3. If mapfn is undefined, let mapping be false. GCPtr map_fn; @@ -72,7 +72,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::from) if (!map_fn_value.is_undefined()) { // a. If IsCallable(mapfn) is false, throw a TypeError exception. if (!map_fn_value.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, map_fn_value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, map_fn_value.to_string_without_side_effects()); // b. Let mapping be true. map_fn = &map_fn_value.as_function(); @@ -183,7 +183,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::of) // 3. If IsConstructor(C) is false, throw a TypeError exception. if (!constructor.is_constructor()) - return vm.throw_completion(ErrorType::NotAConstructor, TRY_OR_THROW_OOM(vm, constructor.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAConstructor, constructor.to_string_without_side_effects()); // 4. Let newObj be ? TypedArrayCreate(C, « 𝔽(len) »). MarkedVector arguments(vm.heap()); diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp index f34d7576e6b..e8af099fe31 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp @@ -93,7 +93,7 @@ static ThrowCompletionOr callback_from_args(VM& vm, DeprecatedS return vm.throw_completion(ErrorType::TypedArrayPrototypeOneArg, name); auto callback = vm.argument(0); if (!callback.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, callback.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, callback.to_string_without_side_effects()); return &callback.as_function(); } @@ -1492,7 +1492,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::sort) // 1. If comparefn is not undefined and IsCallable(comparefn) is false, throw a TypeError exception. auto compare_fn = vm.argument(0); if (!compare_fn.is_undefined() && !compare_fn.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, compare_fn.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, compare_fn.to_string_without_side_effects()); // 2. Let obj be the this value. // 3. Perform ? ValidateTypedArray(obj). diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index ecbfa17b179..b6cab1da150 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -353,7 +353,7 @@ StringView Value::typeof() const } } -ErrorOr Value::to_string_without_side_effects() const +String Value::to_string_without_side_effects() const { if (is_double()) return number_to_string(m_value.as_double); @@ -366,15 +366,15 @@ ErrorOr Value::to_string_without_side_effects() const case BOOLEAN_TAG: return as_bool() ? "true"_string : "false"_string; case INT32_TAG: - return String::number(as_i32()); + return String::number(as_i32()).release_value(); case STRING_TAG: return as_string().utf8_string(); case SYMBOL_TAG: - return as_symbol().descriptive_string(); + return as_symbol().descriptive_string().release_value(); case BIGINT_TAG: - return as_bigint().to_string(); + return as_bigint().to_string().release_value(); case OBJECT_TAG: - return String::formatted("[object {}]", as_object().class_name()); + return String::formatted("[object {}]", as_object().class_name()).release_value(); case ACCESSOR_TAG: return ""_string; case EMPTY_TAG: @@ -525,7 +525,7 @@ ThrowCompletionOr Value::to_primitive(VM& vm, PreferredType preferred_typ return result; // vi. Throw a TypeError exception. - return vm.throw_completion(ErrorType::ToPrimitiveReturnedObject, TRY_OR_THROW_OOM(vm, to_string_without_side_effects()), hint); + return vm.throw_completion(ErrorType::ToPrimitiveReturnedObject, to_string_without_side_effects(), hint); } // c. If preferredType is not present, let preferredType be number. @@ -1229,7 +1229,7 @@ ThrowCompletionOr> Value::get_method(VM& vm, PropertyKey c // 4. If IsCallable(func) is false, throw a TypeError exception. if (!function.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, function.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, function.to_string_without_side_effects()); // 5. Return func. return function.as_function(); @@ -2070,7 +2070,7 @@ ThrowCompletionOr instance_of(VM& vm, Value value, Value target) { // 1. If target is not an Object, throw a TypeError exception. if (!target.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, target.to_string_without_side_effects()); // 2. Let instOfHandler be ? GetMethod(target, @@hasInstance). auto instance_of_handler = TRY(target.get_method(vm, vm.well_known_symbol_has_instance())); @@ -2083,7 +2083,7 @@ ThrowCompletionOr instance_of(VM& vm, Value value, Value target) // 4. If IsCallable(target) is false, throw a TypeError exception. if (!target.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAFunction, target.to_string_without_side_effects()); // 5. Return ? OrdinaryHasInstance(target, V). return ordinary_has_instance(vm, target, value); @@ -2118,7 +2118,7 @@ ThrowCompletionOr ordinary_has_instance(VM& vm, Value lhs, Value rhs) // 5. If P is not an Object, throw a TypeError exception. if (!rhs_prototype.is_object()) - return vm.throw_completion(ErrorType::InstanceOfOperatorBadPrototype, TRY_OR_THROW_OOM(vm, rhs.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::InstanceOfOperatorBadPrototype, rhs.to_string_without_side_effects()); // 6. Repeat, while (true) { diff --git a/Userland/Libraries/LibJS/Runtime/Value.h b/Userland/Libraries/LibJS/Runtime/Value.h index 653359d2558..6196d1545b4 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.h +++ b/Userland/Libraries/LibJS/Runtime/Value.h @@ -394,7 +394,7 @@ public: ThrowCompletionOr get(VM&, PropertyKey const&) const; ThrowCompletionOr> get_method(VM&, PropertyKey const&) const; - ErrorOr to_string_without_side_effects() const; + [[nodiscard]] String to_string_without_side_effects() const; Value value_or(Value fallback) const { @@ -684,7 +684,7 @@ struct Formatter : Formatter { { if (value.is_empty()) return Formatter::format(builder, ""sv); - return Formatter::format(builder, TRY(value.to_string_without_side_effects())); + return Formatter::format(builder, value.to_string_without_side_effects()); } }; diff --git a/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp b/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp index 26be688e069..47d85613993 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp @@ -62,7 +62,7 @@ ThrowCompletionOr> WeakMapConstructor::construct(FunctionOb // 7. Return ? AddEntriesFromIterable(map, iterable, adder). (void)TRY(get_iterator_values(vm, iterable, [&](Value iterator_value) -> Optional { if (!iterator_value.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, DeprecatedString::formatted("Iterator value {}", TRY_OR_THROW_OOM(vm, iterator_value.to_string_without_side_effects()))); + return vm.throw_completion(ErrorType::NotAnObject, DeprecatedString::formatted("Iterator value {}", iterator_value.to_string_without_side_effects())); auto key = TRY(iterator_value.as_object().get(0)); auto value = TRY(iterator_value.as_object().get(1)); diff --git a/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp index cddc6fc2d93..2a3396be3e6 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp @@ -113,7 +113,7 @@ JS_DEFINE_NATIVE_FUNCTION(WeakMapPrototype::set) // 3. If CanBeHeldWeakly(key) is false, throw a TypeError exception. if (!can_be_held_weakly(key)) - return vm.throw_completion(ErrorType::CannotBeHeldWeakly, TRY_OR_THROW_OOM(vm, value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::CannotBeHeldWeakly, value.to_string_without_side_effects()); // 4. For each Record { [[Key]], [[Value]] } p of M.[[WeakMapData]], do // a. If p.[[Key]] is not empty and SameValue(p.[[Key]], key) is true, then diff --git a/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp b/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp index 81c87ae2552..c5d951da9f5 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp @@ -45,7 +45,7 @@ ThrowCompletionOr> WeakRefConstructor::construct(FunctionOb // 2. If CanBeHeldWeakly(target) is false, throw a TypeError exception. if (!can_be_held_weakly(target)) - return vm.throw_completion(ErrorType::CannotBeHeldWeakly, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::CannotBeHeldWeakly, target.to_string_without_side_effects()); // 3. Let weakRef be ? OrdinaryCreateFromConstructor(NewTarget, "%WeakRef.prototype%", « [[WeakRefTarget]] »). // 4. Perform AddToKeptObjects(target). diff --git a/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp index 505d979de1f..a361a955735 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp @@ -41,7 +41,7 @@ JS_DEFINE_NATIVE_FUNCTION(WeakSetPrototype::add) // 3. If CanBeHeldWeakly(value) is false, throw a TypeError exception. if (!can_be_held_weakly(value)) - return vm.throw_completion(ErrorType::CannotBeHeldWeakly, TRY_OR_THROW_OOM(vm, value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::CannotBeHeldWeakly, value.to_string_without_side_effects()); // 4. For each element e of S.[[WeakSetData]], do // a. If e is not empty and SameValue(e, value) is true, then diff --git a/Userland/Libraries/LibTest/JavaScriptTestRunner.h b/Userland/Libraries/LibTest/JavaScriptTestRunner.h index d4a2ec872c4..3585cd0de98 100644 --- a/Userland/Libraries/LibTest/JavaScriptTestRunner.h +++ b/Userland/Libraries/LibTest/JavaScriptTestRunner.h @@ -375,7 +375,7 @@ inline JSFileResult TestRunner::run_file_test(DeprecatedString const& test_path) auto& arr = user_output.as_array(); for (auto& entry : arr.indexed_properties()) { auto message = MUST(arr.get(entry.index())); - file_result.logged_messages.append(message.to_string_without_side_effects().release_value_but_fixme_should_propagate_errors().to_deprecated_string()); + file_result.logged_messages.append(message.to_string_without_side_effects().to_deprecated_string()); } test_json.value().as_object().for_each_member([&](DeprecatedString const& suite_name, JsonValue const& suite_value) { @@ -448,11 +448,11 @@ inline JSFileResult TestRunner::run_file_test(DeprecatedString const& test_path) auto message = error_object.get_without_side_effects(g_vm->names.message).value_or(JS::js_undefined()); if (name.is_accessor() || message.is_accessor()) { - detail_builder.append(error.to_string_without_side_effects().release_value_but_fixme_should_propagate_errors()); + detail_builder.append(error.to_string_without_side_effects()); } else { - detail_builder.append(name.to_string_without_side_effects().release_value_but_fixme_should_propagate_errors()); + detail_builder.append(name.to_string_without_side_effects()); detail_builder.append(": "sv); - detail_builder.append(message.to_string_without_side_effects().release_value_but_fixme_should_propagate_errors()); + detail_builder.append(message.to_string_without_side_effects()); } if (is(error_object)) { @@ -463,7 +463,7 @@ inline JSFileResult TestRunner::run_file_test(DeprecatedString const& test_path) test_case.details = detail_builder.to_deprecated_string(); } else { - test_case.details = error.to_string_without_side_effects().release_value_but_fixme_should_propagate_errors().to_deprecated_string(); + test_case.details = error.to_string_without_side_effects().to_deprecated_string(); } suite.tests.append(move(test_case)); diff --git a/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.h b/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.h index 7206301f52c..9b2d96e660d 100644 --- a/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.h +++ b/Userland/Libraries/LibWasm/AbstractMachine/BytecodeInterpreter.h @@ -26,7 +26,7 @@ struct BytecodeInterpreter : public Interpreter { return m_trap.visit( [](Empty) -> DeprecatedString { VERIFY_NOT_REACHED(); }, [](Trap const& trap) { return trap.reason; }, - [](JS::Completion const& completion) { return completion.value()->to_string_without_side_effects().release_value().to_deprecated_string(); }); + [](JS::Completion const& completion) { return completion.value()->to_string_without_side_effects().to_deprecated_string(); }); } virtual void clear_trap() override { m_trap = Empty {}; } diff --git a/Userland/Libraries/LibWeb/Geometry/DOMMatrixReadOnly.cpp b/Userland/Libraries/LibWeb/Geometry/DOMMatrixReadOnly.cpp index 67f05effd1b..a8bc8770092 100644 --- a/Userland/Libraries/LibWeb/Geometry/DOMMatrixReadOnly.cpp +++ b/Userland/Libraries/LibWeb/Geometry/DOMMatrixReadOnly.cpp @@ -263,37 +263,37 @@ WebIDL::ExceptionOr DOMMatrixReadOnly::to_string() const TRY_OR_THROW_OOM(vm, builder.try_append("matrix("sv)); // 2. Append ! ToString(m11 element) to string. - TRY_OR_THROW_OOM(vm, builder.try_append(TRY_OR_THROW_OOM(vm, JS::Value(m11()).to_string_without_side_effects()))); + TRY_OR_THROW_OOM(vm, builder.try_append(JS::Value(m11()).to_string_without_side_effects())); // 3. Append ", " to string. TRY_OR_THROW_OOM(vm, builder.try_append(", "sv)); // 4. Append ! ToString(m12 element) to string. - TRY_OR_THROW_OOM(vm, builder.try_append(TRY_OR_THROW_OOM(vm, JS::Value(m12()).to_string_without_side_effects()))); + TRY_OR_THROW_OOM(vm, builder.try_append(JS::Value(m12()).to_string_without_side_effects())); // 5. Append ", " to string. TRY_OR_THROW_OOM(vm, builder.try_append(", "sv)); // 6. Append ! ToString(m21 element) to string. - TRY_OR_THROW_OOM(vm, builder.try_append(TRY_OR_THROW_OOM(vm, JS::Value(m21()).to_string_without_side_effects()))); + TRY_OR_THROW_OOM(vm, builder.try_append(JS::Value(m21()).to_string_without_side_effects())); // 7. Append ", " to string. TRY_OR_THROW_OOM(vm, builder.try_append(", "sv)); // 8. Append ! ToString(m22 element) to string. - TRY_OR_THROW_OOM(vm, builder.try_append(TRY_OR_THROW_OOM(vm, JS::Value(m22()).to_string_without_side_effects()))); + TRY_OR_THROW_OOM(vm, builder.try_append(JS::Value(m22()).to_string_without_side_effects())); // 9. Append ", " to string. TRY_OR_THROW_OOM(vm, builder.try_append(", "sv)); // 10. Append ! ToString(m41 element) to string. - TRY_OR_THROW_OOM(vm, builder.try_append(TRY_OR_THROW_OOM(vm, JS::Value(m41()).to_string_without_side_effects()))); + TRY_OR_THROW_OOM(vm, builder.try_append(JS::Value(m41()).to_string_without_side_effects())); // 11. Append ", " to string. TRY_OR_THROW_OOM(vm, builder.try_append(", "sv)); // 12. Append ! ToString(m42 element) to string. - TRY_OR_THROW_OOM(vm, builder.try_append(TRY_OR_THROW_OOM(vm, JS::Value(m42()).to_string_without_side_effects()))); + TRY_OR_THROW_OOM(vm, builder.try_append(JS::Value(m42()).to_string_without_side_effects())); // 13. Append ")" to string. TRY_OR_THROW_OOM(vm, builder.try_append(")"sv)); diff --git a/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp b/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp index 66c27c616fb..7eb760988d4 100644 --- a/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp +++ b/Userland/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp @@ -38,7 +38,7 @@ static JS::ThrowCompletionOr> convert_val // FIXME: De-duplicate this from the IDL generator. // 1. If the result of calling IsCallable(V) is false and the conversion to an IDL value is not being performed due to V being assigned to an attribute whose type is a nullable callback function that is annotated with [LegacyTreatNonObjectAsNull], then throw a TypeError. if (!value.is_function()) - return vm.throw_completion(JS::ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, value.to_string_without_side_effects())); + return vm.throw_completion(JS::ErrorType::NotAFunction, value.to_string_without_side_effects()); // 2. Return the IDL callback function type value that represents a reference to the same object that V represents, with the incumbent settings object as the callback context. return vm.heap().allocate_without_realm(value.as_object(), HTML::incumbent_settings_object()); @@ -51,14 +51,14 @@ static JS::ThrowCompletionOr> convert_value_to_sequence_of_string // An ECMAScript value V is converted to an IDL sequence value as follows: // 1. If Type(V) is not Object, throw a TypeError. if (!value.is_object()) - return vm.throw_completion(JS::ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, value.to_string_without_side_effects())); + return vm.throw_completion(JS::ErrorType::NotAnObject, value.to_string_without_side_effects()); // 2. Let method be ? GetMethod(V, @@iterator). auto method = TRY(value.get_method(vm, vm.well_known_symbol_iterator())); // 3. If method is undefined, throw a TypeError. if (!method) - return vm.throw_completion(JS::ErrorType::NotIterable, TRY_OR_THROW_OOM(vm, value.to_string_without_side_effects())); + return vm.throw_completion(JS::ErrorType::NotIterable, value.to_string_without_side_effects()); // 4. Return the result of creating a sequence from V and method. @@ -108,7 +108,7 @@ JS::ThrowCompletionOr CustomElementRegistry::define(String const& name, We // 1. If IsConstructor(constructor) is false, then throw a TypeError. if (!JS::Value(constructor->callback).is_constructor()) - return vm.throw_completion(JS::ErrorType::NotAConstructor, TRY_OR_THROW_OOM(vm, JS::Value(constructor->callback).to_string_without_side_effects())); + return vm.throw_completion(JS::ErrorType::NotAConstructor, JS::Value(constructor->callback).to_string_without_side_effects()); // 2. If name is not a valid custom element name, then throw a "SyntaxError" DOMException. if (!is_valid_custom_element_name(name)) @@ -179,7 +179,7 @@ JS::ThrowCompletionOr CustomElementRegistry::define(String const& name, We // 2. If Type(prototype) is not Object, then throw a TypeError exception. if (!prototype_value.is_object()) - return vm.throw_completion(JS::ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, prototype_value.to_string_without_side_effects())); + return vm.throw_completion(JS::ErrorType::NotAnObject, prototype_value.to_string_without_side_effects()); auto& prototype = prototype_value.as_object(); diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/ExceptionReporter.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/ExceptionReporter.cpp index d4931d9aa72..8db8aa2886e 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/ExceptionReporter.cpp +++ b/Userland/Libraries/LibWeb/HTML/Scripting/ExceptionReporter.cpp @@ -44,7 +44,7 @@ void report_exception_to_console(JS::Value value, JS::Realm& realm, ErrorInPromi dbgln("\033[31;1mUnhandled JavaScript exception{}:\033[0m {}", error_in_promise == ErrorInPromise::Yes ? " (in promise)" : "", value); } - console.report_exception(*JS::Error::create(realm, value.to_string_without_side_effects().release_value_but_fixme_should_propagate_errors()), error_in_promise == ErrorInPromise::Yes); + console.report_exception(*JS::Error::create(realm, value.to_string_without_side_effects()), error_in_promise == ErrorInPromise::Yes); } // https://html.spec.whatwg.org/#report-the-exception diff --git a/Userland/Libraries/LibWeb/HTML/Worker.cpp b/Userland/Libraries/LibWeb/HTML/Worker.cpp index b522bdbbce7..6f9f2f87a01 100644 --- a/Userland/Libraries/LibWeb/HTML/Worker.cpp +++ b/Userland/Libraries/LibWeb/HTML/Worker.cpp @@ -326,7 +326,7 @@ WebIDL::ExceptionOr Worker::terminate() // https://html.spec.whatwg.org/multipage/workers.html#dom-worker-postmessage void Worker::post_message(JS::Value message, JS::Value) { - dbgln_if(WEB_WORKER_DEBUG, "WebWorker: Post Message: {}", MUST(message.to_string_without_side_effects())); + dbgln_if(WEB_WORKER_DEBUG, "WebWorker: Post Message: {}", message.to_string_without_side_effects()); // 1. Let targetPort be the port with which this is entangled, if any; otherwise let it be null. auto& target_port = m_outside_port; diff --git a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp index 0afc4cf1f5f..b919b45403e 100644 --- a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp +++ b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp @@ -3297,7 +3297,7 @@ JS::ThrowCompletionOr> property_to_callback(JS: return JS::Handle {}; if (!property.is_function()) - return vm.throw_completion(JS::ErrorType::NotAFunction, TRY_OR_THROW_OOM(vm, property.to_string_without_side_effects())); + return vm.throw_completion(JS::ErrorType::NotAFunction, property.to_string_without_side_effects()); return vm.heap().allocate_without_realm(property.as_object(), HTML::incumbent_settings_object(), operation_returns_promise); } diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssembly.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssembly.cpp index 8654e3bc51e..ede245a4a64 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssembly.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssembly.cpp @@ -201,7 +201,7 @@ JS::ThrowCompletionOr instantiate_module(JS::VM& vm, Wasm::Module const& auto method = TRY(result.get_method(vm, vm.names.iterator)); if (method == JS::js_undefined()) - return vm.throw_completion(JS::ErrorType::NotIterable, TRY_OR_THROW_OOM(vm, result.to_string_without_side_effects())); + return vm.throw_completion(JS::ErrorType::NotIterable, result.to_string_without_side_effects()); auto values = TRY(JS::iterator_to_list(vm, TRY(JS::get_iterator_from_method(vm, result, *method)))); diff --git a/Userland/Libraries/LibWeb/WebIDL/AbstractOperations.cpp b/Userland/Libraries/LibWeb/WebIDL/AbstractOperations.cpp index 177e33f335c..0c1a80204d8 100644 --- a/Userland/Libraries/LibWeb/WebIDL/AbstractOperations.cpp +++ b/Userland/Libraries/LibWeb/WebIDL/AbstractOperations.cpp @@ -154,7 +154,7 @@ JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, Deprec // 4. If ! IsCallable(X) is false, then set completion to a new Completion{[[Type]]: throw, [[Value]]: a newly created TypeError object, [[Target]]: empty}, and jump to the step labeled return. if (!get_result.value().is_function()) { - completion = realm.vm().template throw_completion(JS::ErrorType::NotAFunction, TRY_OR_THROW_OOM(realm.vm(), get_result.value().to_string_without_side_effects())); + completion = realm.vm().template throw_completion(JS::ErrorType::NotAFunction, get_result.value().to_string_without_side_effects()); return clean_up_on_return(stored_settings, relevant_settings, completion, callback.operation_returns_promise); } @@ -258,7 +258,7 @@ JS::Completion construct(WebIDL::CallbackType& callback, JS::MarkedVector(JS::ErrorType::NotAConstructor, TRY_OR_THROW_OOM(realm.vm(), JS::Value(function_object).to_string_without_side_effects())); + return realm.vm().template throw_completion(JS::ErrorType::NotAConstructor, JS::Value(function_object).to_string_without_side_effects()); // 5. Let relevant settings be realm’s settings object. auto& relevant_settings = Bindings::host_defined_environment_settings_object(realm);