From b245300ba132ea3bce21c82ea585ce8ea85cca40 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sun, 12 Feb 2023 20:38:28 -0500 Subject: [PATCH] LibJS+Everywhere: Deprecate Value::to_string_without_side_effects --- .../BindingsGenerator/IDLGenerators.cpp | 14 ++++---- Tests/LibJS/test-js.cpp | 2 +- Tests/LibJS/test262-runner.cpp | 8 ++--- Userland/Applications/Assistant/Providers.cpp | 2 +- Userland/Applications/Spreadsheet/Cell.cpp | 2 +- .../Applications/Spreadsheet/Spreadsheet.cpp | 6 ++-- .../Spreadsheet/SpreadsheetModel.cpp | 4 +-- Userland/Libraries/LibJS/AST.cpp | 8 ++--- .../Libraries/LibJS/Bytecode/Interpreter.cpp | 2 +- Userland/Libraries/LibJS/Bytecode/Op.cpp | 12 +++---- Userland/Libraries/LibJS/MarkupGenerator.cpp | 6 ++-- Userland/Libraries/LibJS/Print.cpp | 6 ++-- .../LibJS/Runtime/AbstractOperations.cpp | 18 +++++------ .../LibJS/Runtime/ArrayConstructor.cpp | 2 +- .../LibJS/Runtime/ArrayPrototype.cpp | 32 +++++++++---------- .../LibJS/Runtime/DataViewConstructor.cpp | 2 +- .../Libraries/LibJS/Runtime/DatePrototype.cpp | 4 +-- .../Runtime/DisposableStackPrototype.cpp | 8 ++--- .../LibJS/Runtime/ErrorPrototype.cpp | 2 +- .../FinalizationRegistryConstructor.cpp | 2 +- .../Runtime/FinalizationRegistryPrototype.cpp | 8 ++--- .../LibJS/Runtime/FunctionPrototype.cpp | 6 ++-- .../LibJS/Runtime/IteratorOperations.cpp | 4 +-- .../LibJS/Runtime/MapConstructor.cpp | 2 +- .../Libraries/LibJS/Runtime/MapPrototype.cpp | 2 +- .../LibJS/Runtime/ObjectConstructor.cpp | 4 +-- .../LibJS/Runtime/ObjectPrototype.cpp | 4 +-- .../LibJS/Runtime/PromiseCapability.cpp | 2 +- .../LibJS/Runtime/PromiseConstructor.cpp | 4 +-- .../LibJS/Runtime/PromisePrototype.cpp | 2 +- .../LibJS/Runtime/PropertyDescriptor.cpp | 2 +- .../LibJS/Runtime/PropertyDescriptor.h | 2 +- .../LibJS/Runtime/ProxyConstructor.cpp | 4 +-- .../Libraries/LibJS/Runtime/ProxyObject.cpp | 6 ++-- .../Libraries/LibJS/Runtime/Reference.cpp | 8 ++--- .../Libraries/LibJS/Runtime/ReflectObject.cpp | 28 ++++++++-------- .../LibJS/Runtime/RegExpPrototype.cpp | 4 +-- .../Libraries/LibJS/Runtime/SetPrototype.cpp | 12 +++---- .../LibJS/Runtime/ShadowRealmPrototype.cpp | 2 +- .../LibJS/Runtime/StringConstructor.cpp | 4 +-- .../LibJS/Runtime/SymbolConstructor.cpp | 2 +- .../Runtime/Temporal/AbstractOperations.cpp | 2 +- .../LibJS/Runtime/Temporal/Calendar.cpp | 2 +- .../Runtime/Temporal/CalendarPrototype.cpp | 8 ++--- .../LibJS/Runtime/Temporal/Duration.cpp | 2 +- .../Runtime/Temporal/PlainDatePrototype.cpp | 2 +- .../Temporal/PlainDateTimePrototype.cpp | 2 +- .../Temporal/PlainMonthDayPrototype.cpp | 2 +- .../Runtime/Temporal/PlainTimePrototype.cpp | 2 +- .../Temporal/PlainYearMonthPrototype.cpp | 2 +- .../Temporal/ZonedDateTimePrototype.cpp | 2 +- .../LibJS/Runtime/TypedArrayConstructor.cpp | 6 ++-- .../LibJS/Runtime/TypedArrayPrototype.cpp | 4 +-- Userland/Libraries/LibJS/Runtime/Value.cpp | 12 +++---- Userland/Libraries/LibJS/Runtime/Value.h | 4 +-- .../LibJS/Runtime/WeakMapConstructor.cpp | 2 +- .../LibJS/Runtime/WeakMapPrototype.cpp | 2 +- .../LibJS/Runtime/WeakRefConstructor.cpp | 2 +- .../LibJS/Runtime/WeakSetPrototype.cpp | 2 +- .../Libraries/LibTest/JavaScriptTestRunner.h | 10 +++--- .../Libraries/LibWeb/Bindings/FetchMethod.cpp | 4 +-- .../HTML/Scripting/ExceptionReporter.cpp | 2 +- Userland/Libraries/LibWeb/HTML/Worker.cpp | 2 +- .../WebAssemblyTableConstructor.cpp | 2 +- .../LibWeb/WebIDL/AbstractOperations.h | 2 +- 65 files changed, 168 insertions(+), 168 deletions(-) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index 4fd30cc2f11..3810f56fd11 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -325,7 +325,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, @js_name@@js_suffix@.to_string_without_side_effects()); + return vm.throw_completion(JS::ErrorType::NotAnObject, @js_name@@js_suffix@.to_deprecated_string_without_side_effects()); auto callback_type = vm.heap().allocate_without_realm(@js_name@@js_suffix@.as_object(), HTML::incumbent_settings_object()); @cpp_name@ = @cpp_type@::create(realm, *callback_type).ptr(); @@ -334,7 +334,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, @js_name@@js_suffix@.to_string_without_side_effects()); + return vm.throw_completion(JS::ErrorType::NotAnObject, @js_name@@js_suffix@.to_deprecated_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)); @@ -692,7 +692,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, @js_name@@js_suffix@.to_string_without_side_effects()); + return vm.throw_completion(JS::ErrorType::NotAFunction, @js_name@@js_suffix@.to_deprecated_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. @@ -757,11 +757,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, @js_name@@js_suffix@.to_string_without_side_effects()); + return vm.throw_completion(JS::ErrorType::NotAnObject, @js_name@@js_suffix@.to_deprecated_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, @js_name@@js_suffix@.to_string_without_side_effects()); + return vm.throw_completion(JS::ErrorType::NotIterable, @js_name@@js_suffix@.to_deprecated_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); @@ -806,7 +806,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, @js_name@@js_suffix@.to_string_without_side_effects()); + return vm.throw_completion(JS::ErrorType::NotAnObject, @js_name@@js_suffix@.to_deprecated_string_without_side_effects()); auto& @js_name@@js_suffix@_object = @js_name@@js_suffix@.as_object(); )~~~"); @@ -2764,7 +2764,7 @@ JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::for_each) auto callback = vm.argument(0); if (!callback.is_function()) - return vm.throw_completion(JS::ErrorType::NotAFunction, callback.to_string_without_side_effects()); + return vm.throw_completion(JS::ErrorType::NotAFunction, callback.to_deprecated_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 4ece7c4dfa3..62478a46d1e 100644 --- a/Tests/LibJS/test-js.cpp +++ b/Tests/LibJS/test-js.cpp @@ -53,7 +53,7 @@ TESTJS_GLOBAL_FUNCTION(mark_as_garbage, markAsGarbage) { auto argument = vm.argument(0); if (!argument.is_string()) - return vm.throw_completion(JS::ErrorType::NotAString, argument.to_string_without_side_effects()); + return vm.throw_completion(JS::ErrorType::NotAString, argument.to_deprecated_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 76ac7167fe1..3765d79acfc 100644 --- a/Tests/LibJS/test262-runner.cpp +++ b/Tests/LibJS/test262-runner.cpp @@ -112,22 +112,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(); + error.type = name.to_deprecated_string_without_side_effects(); } 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(); + error.type = name.to_deprecated_string_without_side_effects(); } } auto message = object.get_without_side_effects("message"); if (!message.is_empty() && !message.is_accessor()) - error.details = message.to_string_without_side_effects(); + error.details = message.to_deprecated_string_without_side_effects(); } if (error.type.is_empty()) - error.type = error_value.to_string_without_side_effects(); + error.type = error_value.to_deprecated_string_without_side_effects(); return error; } return {}; diff --git a/Userland/Applications/Assistant/Providers.cpp b/Userland/Applications/Assistant/Providers.cpp index 97ca9b3c174..ee4bb0988c2 100644 --- a/Userland/Applications/Assistant/Providers.cpp +++ b/Userland/Applications/Assistant/Providers.cpp @@ -105,7 +105,7 @@ void CalculatorProvider::query(DeprecatedString const& query, Function results; diff --git a/Userland/Applications/Spreadsheet/Cell.cpp b/Userland/Applications/Spreadsheet/Cell.cpp index d56b48e4548..e308f74afb8 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()); + builder.append(new_data.to_deprecated_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 94b12d07f00..cc6d8034c1a 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp +++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp @@ -64,7 +64,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: {}", thrown_value.to_string_without_side_effects()); + warn("Threw: {}", thrown_value.to_deprecated_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(interpreter().vm().names.message)); @@ -562,7 +562,7 @@ JsonObject Sheet::to_json() const auto json = interpreter().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()); + data.set("value", stringified_or_error.release_value().to_deprecated_string_without_side_effects()); } else { data.set("value", it.value->data()); } @@ -693,7 +693,7 @@ JsonObject Sheet::gather_documentation() const if (!doc.is_string()) return; - JsonParser parser(doc.to_string_without_side_effects()); + JsonParser parser(doc.to_deprecated_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 df3607687ff..3f90b4e2c3d 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()); + builder.append(message.to_deprecated_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()); + builder.appendff("{}\n", error.get_without_side_effects(object.vm().names.message).to_deprecated_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 23255544969..2be9399c733 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/Userland/Libraries/LibJS/AST.cpp @@ -436,9 +436,9 @@ Completion CallExpression::throw_type_error_for_callee(Interpreter& interpreter, auto& vm = interpreter.vm(); if (auto expression_string = this->expression_string(); expression_string.has_value()) - return vm.throw_completion(ErrorType::IsNotAEvaluatedFrom, callee_value.to_string_without_side_effects(), call_type, expression_string.release_value()); + return vm.throw_completion(ErrorType::IsNotAEvaluatedFrom, callee_value.to_deprecated_string_without_side_effects(), call_type, expression_string.release_value()); - return vm.throw_completion(ErrorType::IsNotA, callee_value.to_string_without_side_effects(), call_type); + return vm.throw_completion(ErrorType::IsNotA, callee_value.to_deprecated_string_without_side_effects(), call_type); } // 13.3.6.1 Runtime Semantics: Evaluation, https://tc39.es/ecma262/#sec-function-calls-runtime-semantics-evaluation @@ -1970,11 +1970,11 @@ ThrowCompletionOr ClassExpression::class_definition_e if (super_class.is_null()) { proto_parent = nullptr; } else if (!super_class.is_constructor()) { - return vm.throw_completion(ErrorType::ClassExtendsValueNotAConstructorOrNull, super_class.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::ClassExtendsValueNotAConstructorOrNull, super_class.to_deprecated_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, super_class_prototype.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::ClassExtendsValueInvalidPrototype, super_class_prototype.to_deprecated_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 abda1f3be21..b96251e9a69 100644 --- a/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -149,7 +149,7 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e if (registers()[i].is_empty()) value_string = "(empty)"; else - value_string = registers()[i].to_string_without_side_effects(); + value_string = registers()[i].to_deprecated_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 be45a172569..7f3964658df 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -74,7 +74,7 @@ static ThrowCompletionOr put_by_property_key(Object* object, Value value, case PropertyKind::KeyValue: { bool succeeded = TRY(object->internal_set(name, interpreter.accumulator(), object)); if (!succeeded && vm.in_strict_mode()) - return vm.throw_completion(ErrorType::ReferenceNullishSetProperty, name, interpreter.accumulator().to_string_without_side_effects()); + return vm.throw_completion(ErrorType::ReferenceNullishSetProperty, name, interpreter.accumulator().to_deprecated_string_without_side_effects()); break; } case PropertyKind::Spread: @@ -593,7 +593,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(), arguments.to_string_without_side_effects()); + dbgln("[{}] Call arguments are not an array, but: {}", interpreter.debug_position(), arguments.to_deprecated_string_without_side_effects()); interpreter.current_executable().dump(); VERIFY_NOT_REACHED(); } @@ -616,9 +616,9 @@ Completion Call::throw_type_error_for_callee(Bytecode::Interpreter& interpreter, { auto callee = interpreter.reg(m_callee); if (m_expression_string.has_value()) - return interpreter.vm().throw_completion(ErrorType::IsNotAEvaluatedFrom, callee.to_string_without_side_effects(), callee_type, interpreter.current_executable().get_string(m_expression_string->value())); + return interpreter.vm().throw_completion(ErrorType::IsNotAEvaluatedFrom, callee.to_deprecated_string_without_side_effects(), callee_type, interpreter.current_executable().get_string(m_expression_string->value())); - return interpreter.vm().throw_completion(ErrorType::IsNotA, callee.to_string_without_side_effects(), callee_type); + return interpreter.vm().throw_completion(ErrorType::IsNotA, callee.to_deprecated_string_without_side_effects(), callee_type); } ThrowCompletionOr Call::execute_impl(Bytecode::Interpreter& interpreter) const @@ -747,7 +747,7 @@ ThrowCompletionOr ThrowIfNotObject::execute_impl(Bytecode::Interpreter& in { auto& vm = interpreter.vm(); if (!interpreter.accumulator().is_object()) - return vm.throw_completion(ErrorType::NotAnObject, interpreter.accumulator().to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, interpreter.accumulator().to_deprecated_string_without_side_effects()); return {}; } @@ -1343,7 +1343,7 @@ DeprecatedString GetObjectPropertyIterator::to_deprecated_string_impl(Bytecode:: DeprecatedString IteratorClose::to_deprecated_string_impl(Bytecode::Executable const&) const { - return DeprecatedString::formatted("IteratorClose completion_type={} completion_value={}", to_underlying(m_completion_type), m_completion_value.has_value() ? m_completion_value.value().to_string_without_side_effects() : ""); + return DeprecatedString::formatted("IteratorClose completion_type={} completion_value={}", to_underlying(m_completion_type), m_completion_value.has_value() ? m_completion_value.value().to_deprecated_string_without_side_effects() : ""); } DeprecatedString IteratorNext::to_deprecated_string_impl(Executable const&) const diff --git a/Userland/Libraries/LibJS/MarkupGenerator.cpp b/Userland/Libraries/LibJS/MarkupGenerator.cpp index 424589e2623..27d63f3a3a5 100644 --- a/Userland/Libraries/LibJS/MarkupGenerator.cpp +++ b/Userland/Libraries/LibJS/MarkupGenerator.cpp @@ -81,7 +81,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(value.to_string_without_side_effects()))); + TRY(output_html.try_append(escape_html_entities(value.to_deprecated_string_without_side_effects()))); if (value.is_string()) TRY(output_html.try_append('"')); @@ -167,8 +167,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 = name.to_string_without_side_effects(); - auto message_string = message.to_string_without_side_effects(); + auto name_string = name.to_deprecated_string_without_side_effects(); + auto message_string = message.to_deprecated_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 76b551b58e4..9145e860c3d 100644 --- a/Userland/Libraries/LibJS/Print.cpp +++ b/Userland/Libraries/LibJS/Print.cpp @@ -230,8 +230,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 = name.to_string_without_side_effects(); - auto message_string = message.to_string_without_side_effects(); + auto name_string = name.to_deprecated_string_without_side_effects(); + auto message_string = message.to_deprecated_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)); @@ -1018,7 +1018,7 @@ ErrorOr print_value(JS::PrintContext& print_context, JS::Value value, Hash TRY(js_out(print_context, "\"")); else if (value.is_negative_zero()) TRY(js_out(print_context, "-")); - TRY(js_out(print_context, "{}", value.to_string_without_side_effects())); + TRY(js_out(print_context, "{}", value.to_deprecated_string_without_side_effects())); if (value.is_string()) TRY(js_out(print_context, "\"")); TRY(js_out(print_context, "\033[0m")); diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp index 50050439894..fa0f5129d59 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp @@ -39,7 +39,7 @@ namespace JS { ThrowCompletionOr require_object_coercible(VM& vm, Value value) { if (value.is_nullish()) - return vm.throw_completion(ErrorType::NotObjectCoercible, value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotObjectCoercible, value.to_deprecated_string_without_side_effects()); return value; } @@ -52,7 +52,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, function.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, function.to_deprecated_string_without_side_effects()); // 3. Return ? F.[[Call]](V, argumentsList). return function.as_function().internal_call(this_value, move(*arguments_list)); @@ -100,7 +100,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, value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, value.to_deprecated_string_without_side_effects()); auto& array_like = value.as_object(); @@ -144,7 +144,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, constructor.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAConstructor, constructor.to_deprecated_string_without_side_effects()); // 4. Let S be ? Get(C, @@species). auto species = TRY(constructor.as_object().get(*vm.well_known_symbol_species())); @@ -158,7 +158,7 @@ ThrowCompletionOr species_constructor(VM& vm, Object const& obj return &species.as_function(); // 7. Throw a TypeError exception. - return vm.throw_completion(ErrorType::NotAConstructor, species.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAConstructor, species.to_deprecated_string_without_side_effects()); } // 7.3.25 GetFunctionRealm ( obj ), https://tc39.es/ecma262/#sec-getfunctionrealm @@ -1223,7 +1223,7 @@ CanonicalIndex canonical_numeric_index_string(PropertyKey const& property_key, C // FIXME: We return 0 instead of n but it might not observable? // 3. If SameValue(! ToString(n), argument) is true, return n. - if (double_value.to_string_without_side_effects() == argument) + if (double_value.to_deprecated_string_without_side_effects() == argument) return CanonicalIndex(CanonicalIndex::Type::Numeric, 0); // 4. Return undefined. @@ -1333,7 +1333,7 @@ ThrowCompletionOr add_disposable_resource(VM& vm, Vector(ErrorType::NotAnObject, value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, value.to_deprecated_string_without_side_effects()); // c. Let resource be ? CreateDisposableResource(V, hint). resource = TRY(create_disposable_resource(vm, value, hint)); @@ -1349,7 +1349,7 @@ ThrowCompletionOr add_disposable_resource(VM& vm, Vector(ErrorType::NotAnObject, value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, value.to_deprecated_string_without_side_effects()); // ii. Let resource be ? CreateDisposableResource(V, hint, method). resource = TRY(create_disposable_resource(vm, value, hint, method)); @@ -1378,7 +1378,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, value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NoDisposeMethod, value.to_deprecated_string_without_side_effects()); } // 2. Else, // a. If IsCallable(method) is false, throw a TypeError exception. diff --git a/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp index faaf5960bea..7e14a9965c4 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayConstructor.cpp @@ -148,7 +148,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, mapfn_value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, mapfn_value.to_deprecated_string_without_side_effects()); // b. Let mapping be true. mapfn = &mapfn_value.as_function(); diff --git a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp index f3ae1540813..e2f2139a627 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp @@ -145,7 +145,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, constructor.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAConstructor, constructor.to_deprecated_string_without_side_effects()); return TRY(construct(vm, constructor.as_function(), Value(length))).ptr(); } @@ -318,7 +318,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, callback_function.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_deprecated_string_without_side_effects()); // 4. Let k be 0. // 5. Repeat, while k < len, @@ -404,7 +404,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, callback_function.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_deprecated_string_without_side_effects()); // 4. Let A be ? ArraySpeciesCreate(O, 0). auto* array = TRY(array_species_create(vm, *object, 0)); @@ -462,7 +462,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, predicate.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, predicate.to_deprecated_string_without_side_effects()); // 4. Let k be 0. // 5. Repeat, while k < len, @@ -501,7 +501,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, predicate.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, predicate.to_deprecated_string_without_side_effects()); // 4. Let k be 0. // 5. Repeat, while k < len, @@ -540,7 +540,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, predicate.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, predicate.to_deprecated_string_without_side_effects()); // 4. Let k be len - 1. // 5. Repeat, while k ≥ 0, @@ -579,7 +579,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, predicate.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, predicate.to_deprecated_string_without_side_effects()); // 4. Let k be len - 1. // 5. Repeat, while k ≥ 0, @@ -671,7 +671,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, mapper_function.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, mapper_function.to_deprecated_string_without_side_effects()); // 4. Let A be ? ArraySpeciesCreate(O, 0). auto* array = TRY(array_species_create(vm, *object, 0)); @@ -697,7 +697,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, callback_function.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_deprecated_string_without_side_effects()); // 4. Let k be 0. // 5. Repeat, while k < len, @@ -768,7 +768,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::group) // 3. If IsCallable(callbackfn) is false, throw a TypeError exception. if (!callback_function.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_deprecated_string_without_side_effects()); // 5. Let groups be a new empty List. OrderedHashMap> groups; @@ -824,7 +824,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::group_to_map) // 3. If IsCallable(callbackfn) is false, throw a TypeError exception. if (!callback_function.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_deprecated_string_without_side_effects()); struct KeyedGroupTraits : public Traits> { static unsigned hash(Handle const& value_handle) @@ -1109,7 +1109,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, callback_function.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_deprecated_string_without_side_effects()); // 4. Let A be ? ArraySpeciesCreate(O, len). auto* array = TRY(array_species_create(vm, *object, length)); @@ -1188,7 +1188,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, callback_function.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_deprecated_string_without_side_effects()); // 4. If len = 0 and initialValue is not present, throw a TypeError exception. if (length == 0 && vm.argument_count() <= 1) @@ -1270,7 +1270,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, callback_function.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_deprecated_string_without_side_effects()); // 4. If len = 0 and initialValue is not present, throw a TypeError exception. if (length == 0 && vm.argument_count() <= 1) @@ -1470,7 +1470,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, callback_function.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, callback_function.to_deprecated_string_without_side_effects()); // 4. Let k be 0. // 5. Repeat, while k < len, @@ -1564,7 +1564,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, comparefn.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, comparefn.to_deprecated_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 4718474307b..2daabce612d 100644 --- a/Userland/Libraries/LibJS/Runtime/DataViewConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/DataViewConstructor.cpp @@ -52,7 +52,7 @@ ThrowCompletionOr> DataViewConstructor::construct(FunctionO // 2. Perform ? RequireInternalSlot(buffer, [[ArrayBufferData]]). if (!buffer.is_object() || !is(buffer.as_object())) - return vm.throw_completion(ErrorType::IsNotAn, buffer.to_string_without_side_effects(), vm.names.ArrayBuffer); + return vm.throw_completion(ErrorType::IsNotAn, buffer.to_deprecated_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 56258ebb7ce..064f59f34d6 100644 --- a/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DatePrototype.cpp @@ -1255,10 +1255,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, this_value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, this_value.to_deprecated_string_without_side_effects()); auto hint_value = vm.argument(0); if (!hint_value.is_string()) - return vm.throw_completion(ErrorType::InvalidHint, hint_value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::InvalidHint, hint_value.to_deprecated_string_without_side_effects()); auto hint = TRY(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 01a28a335c7..fc4ef9fd2cd 100644 --- a/Userland/Libraries/LibJS/Runtime/DisposableStackPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/DisposableStackPrototype.cpp @@ -89,7 +89,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, value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, value.to_deprecated_string_without_side_effects()); // FIXME: This should be TRY in the spec // b. Let method be GetDisposeMethod(value, sync-dispose). @@ -98,7 +98,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, value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NoDisposeMethod, value.to_deprecated_string_without_side_effects()); } // d. Else, // i. Perform ? AddDisposableResource(disposableStack, value, sync-dispose, method). @@ -128,7 +128,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, on_dispose.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, on_dispose.to_deprecated_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. @@ -169,7 +169,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, on_dispose.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, on_dispose.to_deprecated_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 2656f08cb78..4175e6e9c39 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp @@ -111,7 +111,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, this_value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, this_value.to_deprecated_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 5ea6ea90267..cf141fc0618 100644 --- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.cpp @@ -48,7 +48,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, cleanup_callback.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, cleanup_callback.to_deprecated_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 a1fee3ca3a9..e838e02ab1a 100644 --- a/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.cpp @@ -42,7 +42,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, callback.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, callback.to_deprecated_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. @@ -66,7 +66,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, target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::CannotBeHeldWeakly, target.to_deprecated_string_without_side_effects()); // 4. If SameValue(target, heldValue) is true, throw a TypeError exception. if (same_value(target, held_value)) @@ -76,7 +76,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, unregister_token.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::CannotBeHeldWeakly, unregister_token.to_deprecated_string_without_side_effects()); // 6. Let cell be the Record { [[WeakRefTarget]]: target, [[HeldValue]]: heldValue, [[UnregisterToken]]: unregisterToken }. // 7. Append cell to finalizationRegistry.[[Cells]]. @@ -97,7 +97,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, unregister_token.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::CannotBeHeldWeakly, unregister_token.to_deprecated_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 af02eaf5818..9ccdc8b3cb0 100644 --- a/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/FunctionPrototype.cpp @@ -56,7 +56,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, function_value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, function_value.to_deprecated_string_without_side_effects()); auto& function = static_cast(function_value.as_object()); @@ -93,7 +93,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, target_value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, target_value.to_deprecated_string_without_side_effects()); auto& target = static_cast(target_value.as_object()); @@ -124,7 +124,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, function_value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, function_value.to_deprecated_string_without_side_effects()); auto& function = static_cast(function_value.as_object()); diff --git a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp index 190465a69ee..0df1847252d 100644 --- a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp @@ -48,14 +48,14 @@ ThrowCompletionOr get_iterator(VM& vm, Value value, IteratorHint hint, // NOTE: Additional type check to produce a better error message than Call(). if (!method->is_function()) - return vm.throw_completion(ErrorType::NotIterable, value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotIterable, value.to_deprecated_string_without_side_effects()); // 3. Let iterator be ? Call(method, obj). auto iterator = TRY(call(vm, *method, value)); // 4. If Type(iterator) is not Object, throw a TypeError exception. if (!iterator.is_object()) - return vm.throw_completion(ErrorType::NotIterable, value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotIterable, value.to_deprecated_string_without_side_effects()); // 5. Let nextMethod be ? GetV(iterator, "next"). auto next_method = TRY(iterator.get(vm, vm.names.next)); diff --git a/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp b/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp index 9a3d570c6c0..0801195d34e 100644 --- a/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp @@ -56,7 +56,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 {}", iterator_value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, DeprecatedString::formatted("Iterator value {}", iterator_value.to_deprecated_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 2082b663f99..5ed1fd23f23 100644 --- a/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapPrototype.cpp @@ -71,7 +71,7 @@ JS_DEFINE_NATIVE_FUNCTION(MapPrototype::for_each) { auto* map = TRY(typed_this_object(vm)); if (!vm.argument(0).is_function()) - return vm.throw_completion(ErrorType::NotAFunction, vm.argument(0).to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, vm.argument(0).to_deprecated_string_without_side_effects()); auto this_value = vm.this_value(); for (auto& entry : *map) TRY(call(vm, vm.argument(0).as_function(), vm.argument(1), entry.value, entry.key, this_value)); diff --git a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp index 0d2b6f4acc6..1d57ba38322 100644 --- a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp @@ -229,7 +229,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::from_entries) (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 {}", iterator_value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, DeprecatedString::formatted("Iterator value {}", iterator_value.to_deprecated_string_without_side_effects())); auto key = TRY(iterator_value.as_object().get(0)); auto value = TRY(iterator_value.as_object().get(1)); @@ -301,7 +301,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::get_own_property_descriptors) JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::define_property) { if (!vm.argument(0).is_object()) - return vm.throw_completion(ErrorType::NotAnObject, vm.argument(0).to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, vm.argument(0).to_deprecated_string_without_side_effects()); auto key = TRY(vm.argument(1).to_property_key(vm)); auto descriptor = TRY(to_property_descriptor(vm, vm.argument(2))); TRY(vm.argument(0).as_object().define_property_or_throw(key, descriptor)); diff --git a/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp index 97681f5d4f1..388e98da3f2 100644 --- a/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ObjectPrototype.cpp @@ -187,7 +187,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::define_getter) auto getter = vm.argument(1); if (!getter.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, getter.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, getter.to_deprecated_string_without_side_effects()); auto descriptor = PropertyDescriptor { .get = &getter.as_function(), .enumerable = true, .configurable = true }; @@ -205,7 +205,7 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectPrototype::define_setter) auto setter = vm.argument(1); if (!setter.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, setter.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, setter.to_deprecated_string_without_side_effects()); 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 e3715ce70d1..8ea4a0bc9f5 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseCapability.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseCapability.cpp @@ -37,7 +37,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, constructor.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAConstructor, constructor.to_deprecated_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 ed78bbdf77f..2af1f8054f0 100644 --- a/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromiseConstructor.cpp @@ -30,7 +30,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, promise_resolve.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, promise_resolve.to_deprecated_string_without_side_effects()); // 3. Return promiseResolve. return promise_resolve; @@ -474,7 +474,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, constructor.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, constructor.to_deprecated_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 5812ef56c70..58b38b494f9 100644 --- a/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/PromisePrototype.cpp @@ -83,7 +83,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, promise.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, promise.to_deprecated_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 198a5efb90e..98c2caa0d63 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, argument.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, argument.to_deprecated_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 755400c362f..439e10f9849 100644 --- a/Userland/Libraries/LibJS/Runtime/PropertyDescriptor.h +++ b/Userland/Libraries/LibJS/Runtime/PropertyDescriptor.h @@ -51,7 +51,7 @@ struct Formatter : Formatter { { Vector parts; if (property_descriptor.value.has_value()) - parts.append(DeprecatedString::formatted("[[Value]]: {}", property_descriptor.value->to_string_without_side_effects())); + parts.append(DeprecatedString::formatted("[[Value]]: {}", property_descriptor.value->to_deprecated_string_without_side_effects())); if (property_descriptor.get.has_value()) parts.append(DeprecatedString::formatted("[[Get]]: JS::Function* @ {:p}", *property_descriptor.get)); if (property_descriptor.set.has_value()) diff --git a/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp index 4d34e822c4a..675a44cb21b 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ProxyConstructor.cpp @@ -18,9 +18,9 @@ static ThrowCompletionOr proxy_create(VM& vm, Value target, Value { auto& realm = *vm.current_realm(); if (!target.is_object()) - return vm.throw_completion(ErrorType::ProxyConstructorBadType, "target", target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::ProxyConstructorBadType, "target", target.to_deprecated_string_without_side_effects()); if (!handler.is_object()) - return vm.throw_completion(ErrorType::ProxyConstructorBadType, "handler", handler.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::ProxyConstructorBadType, "handler", handler.to_deprecated_string_without_side_effects()); return ProxyObject::create(realm, target.as_object(), handler.as_object()).ptr(); } diff --git a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp index 186daca8cdc..ea4653129cd 100644 --- a/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ProxyObject.cpp @@ -707,7 +707,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, key.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::ProxyOwnPropertyKeysSkippedNonconfigurableProperty, key.to_deprecated_string_without_side_effects()); // b. Remove key from uncheckedResultKeys. unchecked_result_keys.remove_first_matching([&](auto& value) { @@ -723,7 +723,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, key.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::ProxyOwnPropertyKeysNonExtensibleSkippedProperty, key.to_deprecated_string_without_side_effects()); // b. Remove key from uncheckedResultKeys. unchecked_result_keys.remove_first_matching([&](auto& value) { @@ -733,7 +733,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, unchecked_result_keys[0].to_string_without_side_effects()); + return vm.throw_completion(ErrorType::ProxyOwnPropertyKeysNonExtensibleNewProperty, unchecked_result_keys[0].to_deprecated_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 0c0f68fd106..6120d116b7e 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, m_base_value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::ReferenceNullishSetProperty, m_name, m_base_value.to_deprecated_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, m_base_value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::ReferenceNullishDeleteProperty, m_name, m_base_value.to_deprecated_string_without_side_effects()); // f. Return deleteStatus. return delete_status; @@ -209,7 +209,7 @@ DeprecatedString Reference::to_deprecated_string() const if (m_base_value.is_empty()) builder.append(""sv); else - builder.appendff("{}", m_base_value.to_string_without_side_effects()); + builder.appendff("{}", m_base_value.to_deprecated_string_without_side_effects()); break; } builder.append(", ReferencedName="sv); @@ -224,7 +224,7 @@ DeprecatedString Reference::to_deprecated_string() const if (m_this_value.is_empty()) builder.append(""sv); else - builder.appendff("{}", m_this_value.to_string_without_side_effects()); + builder.appendff("{}", m_this_value.to_deprecated_string_without_side_effects()); builder.append(" }"sv); return builder.to_deprecated_string(); diff --git a/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp b/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp index 9f4a1044c97..d6e68a3161e 100644 --- a/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/ReflectObject.cpp @@ -54,7 +54,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, target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, target.to_deprecated_string_without_side_effects()); // 2. Let args be ? CreateListFromArrayLike(argumentsList). auto args = TRY(create_list_from_array_like(vm, arguments_list)); @@ -73,14 +73,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, target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAConstructor, target.to_deprecated_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, new_target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAConstructor, new_target.to_deprecated_string_without_side_effects()); // 4. Let args be ? CreateListFromArrayLike(argumentsList). auto args = TRY(create_list_from_array_like(vm, arguments_list)); @@ -98,7 +98,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, target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, target.to_deprecated_string_without_side_effects()); // 2. Let key be ? ToPropertyKey(propertyKey). auto key = TRY(property_key.to_property_key(vm)); @@ -118,7 +118,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, target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, target.to_deprecated_string_without_side_effects()); // 2. Let key be ? ToPropertyKey(propertyKey). auto key = TRY(property_key.to_property_key(vm)); @@ -136,7 +136,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, target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, target.to_deprecated_string_without_side_effects()); // 2. Let key be ? ToPropertyKey(propertyKey). auto key = TRY(property_key.to_property_key(vm)); @@ -159,7 +159,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, target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, target.to_deprecated_string_without_side_effects()); // 2. Let key be ? ToPropertyKey(propertyKey). auto key = TRY(property_key.to_property_key(vm)); @@ -178,7 +178,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, target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, target.to_deprecated_string_without_side_effects()); // 2. Return ? target.[[GetPrototypeOf]](). return TRY(target.as_object().internal_get_prototype_of()); @@ -192,7 +192,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, target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, target.to_deprecated_string_without_side_effects()); // 2. Let key be ? ToPropertyKey(propertyKey). auto key = TRY(property_key.to_property_key(vm)); @@ -208,7 +208,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, target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, target.to_deprecated_string_without_side_effects()); // 2. Return ? target.[[IsExtensible]](). return Value(TRY(target.as_object().internal_is_extensible())); @@ -223,7 +223,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, target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, target.to_deprecated_string_without_side_effects()); // 2. Let keys be ? target.[[OwnPropertyKeys]](). auto keys = TRY(target.as_object().internal_own_property_keys()); @@ -239,7 +239,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, target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, target.to_deprecated_string_without_side_effects()); // 2. Return ? target.[[PreventExtensions]](). return Value(TRY(target.as_object().internal_prevent_extensions())); @@ -255,7 +255,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, target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, target.to_deprecated_string_without_side_effects()); // 2. Let key be ? ToPropertyKey(propertyKey). auto key = TRY(property_key.to_property_key(vm)); @@ -278,7 +278,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, target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, target.to_deprecated_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 047e133a9c2..2f3f5beef51 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp @@ -397,7 +397,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, result.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObjectOrNull, result.to_deprecated_string_without_side_effects()); // c. Return result. return result; @@ -1119,7 +1119,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, flags.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotUndefined, flags.to_deprecated_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 9d2651afa21..dee28ddec9f 100644 --- a/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/SetPrototype.cpp @@ -93,7 +93,7 @@ JS_DEFINE_NATIVE_FUNCTION(SetPrototype::for_each) { auto* set = TRY(typed_this_object(vm)); if (!vm.argument(0).is_function()) - return vm.throw_completion(ErrorType::NotAFunction, vm.argument(0).to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, vm.argument(0).to_deprecated_string_without_side_effects()); auto this_value = vm.this_value(); for (auto& entry : *set) TRY(call(vm, vm.argument(0).as_function(), vm.argument(1), entry.key, entry.key, this_value)); @@ -137,7 +137,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, value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, value.to_deprecated_string_without_side_effects()); auto const& object = value.as_object(); // 2. Let rawSize be ? Get(obj, "size"). @@ -159,14 +159,14 @@ static ThrowCompletionOr get_set_record(VM& vm, Value value) // 8. If IsCallable(has) is false, throw a TypeError exception. if (!has.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, has.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, has.to_deprecated_string_without_side_effects()); // 9. Let keys be ? Get(obj, "keys"). auto keys = TRY(object.get(vm.names.keys)); // 10. If IsCallable(keys) is false, throw a TypeError exception. if (!keys.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, keys.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, keys.to_deprecated_string_without_side_effects()); // 11. 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() }; @@ -180,14 +180,14 @@ static ThrowCompletionOr get_keys_iterator(VM& vm, SetRecord const& se // 2. If keysIter is not an Object, throw a TypeError exception. if (!keys_iterator.is_object()) - return vm.throw_completion(ErrorType::NotAnObject, keys_iterator.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, keys_iterator.to_deprecated_string_without_side_effects()); // 3. Let nextMethod be ? Get(keysIter, "next"). auto next_method = TRY(keys_iterator.as_object().get(vm.names.next)); // 4. If IsCallable(nextMethod) is false, throw a TypeError exception. if (!next_method.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, next_method.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, next_method.to_deprecated_string_without_side_effects()); // 5. Return a new Iterator Record { [[Iterator]]: keysIter, [[NextMethod]]: nextMethod, [[Done]]: false }. return Iterator { .iterator = &keys_iterator.as_object(), .next_method = next_method, .done = false }; diff --git a/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp index ae4d20b4345..8d24c38e786 100644 --- a/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ShadowRealmPrototype.cpp @@ -69,7 +69,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, export_name.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAString, export_name.to_deprecated_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 659122d41f9..f2384cd309e 100644 --- a/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp @@ -120,10 +120,10 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::from_code_point) for (size_t i = 0; i < vm.argument_count(); ++i) { auto next_code_point = TRY(vm.argument(i).to_number(vm)); if (!next_code_point.is_integral_number()) - return vm.throw_completion(ErrorType::InvalidCodePoint, next_code_point.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::InvalidCodePoint, next_code_point.to_deprecated_string_without_side_effects()); auto code_point = TRY(next_code_point.to_i32(vm)); if (code_point < 0 || code_point > 0x10FFFF) - return vm.throw_completion(ErrorType::InvalidCodePoint, next_code_point.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::InvalidCodePoint, next_code_point.to_deprecated_string_without_side_effects()); 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 5c736b577c0..6e263893f31 100644 --- a/Userland/Libraries/LibJS/Runtime/SymbolConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/SymbolConstructor.cpp @@ -84,7 +84,7 @@ JS_DEFINE_NATIVE_FUNCTION(SymbolConstructor::key_for) { auto argument = vm.argument(0); if (!argument.is_symbol()) - return vm.throw_completion(ErrorType::NotASymbol, argument.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotASymbol, argument.to_deprecated_string_without_side_effects()); auto& symbol = argument.as_symbol(); if (symbol.is_global()) { diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index 987de7c004f..69189f850fa 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, next_value.to_string_without_side_effects()); + auto completion = vm.throw_completion(ErrorType::IterableToListOfTypeInvalidValue, next_value.to_deprecated_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 9a50d801e9c..1d9da317152 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, result.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, result.to_deprecated_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 e94e9a06ebd..6461cdcc0d8 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/CalendarPrototype.cpp @@ -94,7 +94,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, fields.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, fields.to_deprecated_string_without_side_effects()); // 5. Set options to ? GetOptionsObject(options). auto const* options = TRY(get_options_object(vm, vm.argument(1))); @@ -120,7 +120,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, fields.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, fields.to_deprecated_string_without_side_effects()); // 5. Set options to ? GetOptionsObject(options). auto const* options = TRY(get_options_object(vm, vm.argument(1))); @@ -146,7 +146,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, fields.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, fields.to_deprecated_string_without_side_effects()); // 5. Set options to ? GetOptionsObject(options). auto const* options = TRY(get_options_object(vm, vm.argument(1))); @@ -555,7 +555,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, next_value.to_string_without_side_effects()); + auto completion = vm.throw_completion(ErrorType::TemporalInvalidCalendarFieldValue, next_value.to_deprecated_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 4b62d791579..fac030ffc3b 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, temporal_duration_like.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, temporal_duration_like.to_deprecated_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 5ceaa46d4a0..80646116765 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDatePrototype.cpp @@ -410,7 +410,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, temporal_date_like.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, temporal_date_like.to_deprecated_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 0eb5a23c7a3..bb7dbfd9aa6 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainDateTimePrototype.cpp @@ -382,7 +382,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, temporal_date_time_like.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, temporal_date_time_like.to_deprecated_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 49f4688fbf5..1838ba5cc33 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainMonthDayPrototype.cpp @@ -97,7 +97,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, temporal_month_day_like.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, temporal_month_day_like.to_deprecated_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 492c1e2102f..78d7b8ba485 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainTimePrototype.cpp @@ -176,7 +176,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, temporal_time_like_argument.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, temporal_time_like_argument.to_deprecated_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 95be5017f17..4d1aeb51fe5 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/PlainYearMonthPrototype.cpp @@ -208,7 +208,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, temporal_year_month_like.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, temporal_year_month_like.to_deprecated_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 41e3824089f..1f098d5082d 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/ZonedDateTimePrototype.cpp @@ -756,7 +756,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, temporal_zoned_date_time_like.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, temporal_zoned_date_time_like.to_deprecated_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 aa5df341fee..48c5db821a3 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayConstructor.cpp @@ -57,13 +57,13 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::from) { auto constructor = vm.this_value(); if (!constructor.is_constructor()) - return vm.throw_completion(ErrorType::NotAConstructor, constructor.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAConstructor, constructor.to_deprecated_string_without_side_effects()); FunctionObject* map_fn = nullptr; if (!vm.argument(1).is_undefined()) { auto callback = vm.argument(1); if (!callback.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, callback.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, callback.to_deprecated_string_without_side_effects()); map_fn = &callback.as_function(); } @@ -117,7 +117,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayConstructor::of) auto length = vm.argument_count(); auto constructor = vm.this_value(); if (!constructor.is_constructor()) - return vm.throw_completion(ErrorType::NotAConstructor, constructor.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAConstructor, constructor.to_deprecated_string_without_side_effects()); MarkedVector arguments(vm.heap()); arguments.append(Value(length)); auto new_object = TRY(typed_array_create(vm, constructor.as_function(), move(arguments))); diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp index 685fcd85a93..5202c4ba9d5 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp @@ -95,7 +95,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, callback.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, callback.to_deprecated_string_without_side_effects()); return &callback.as_function(); } @@ -1410,7 +1410,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, compare_fn.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, compare_fn.to_deprecated_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 680d3b3a17d..aa7bf20383f 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -355,7 +355,7 @@ StringView Value::typeof() const } } -DeprecatedString Value::to_string_without_side_effects() const +DeprecatedString Value::to_deprecated_string_without_side_effects() const { if (is_double()) return number_to_deprecated_string(m_value.as_double); @@ -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, to_string_without_side_effects(), hint); + return vm.throw_completion(ErrorType::ToPrimitiveReturnedObject, to_deprecated_string_without_side_effects(), hint); } // c. If preferredType is not present, let preferredType be number. @@ -1225,7 +1225,7 @@ ThrowCompletionOr Value::get_method(VM& vm, PropertyKey const& // 4. If IsCallable(func) is false, throw a TypeError exception. if (!function.is_function()) - return vm.throw_completion(ErrorType::NotAFunction, function.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, function.to_deprecated_string_without_side_effects()); // 5. Return func. return &function.as_function(); @@ -2042,7 +2042,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, target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAnObject, target.to_deprecated_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())); @@ -2055,7 +2055,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, target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::NotAFunction, target.to_deprecated_string_without_side_effects()); // 5. Return ? OrdinaryHasInstance(target, V). return ordinary_has_instance(vm, target, value); @@ -2090,7 +2090,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, rhs.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::InstanceOfOperatorBadPrototype, rhs.to_deprecated_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 d4679254c28..7516a40cbf9 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; - DeprecatedString to_string_without_side_effects() const; + DeprecatedString to_deprecated_string_without_side_effects() const; Value value_or(Value fallback) const { @@ -682,7 +682,7 @@ template<> struct Formatter : Formatter { ErrorOr format(FormatBuilder& builder, JS::Value value) { - return Formatter::format(builder, value.is_empty() ? "" : value.to_string_without_side_effects()); + return Formatter::format(builder, value.is_empty() ? "" : value.to_deprecated_string_without_side_effects()); } }; diff --git a/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp b/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp index 7ae0efeaa3d..02378affb9a 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp @@ -54,7 +54,7 @@ ThrowCompletionOr> WeakMapConstructor::construct(FunctionOb (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 {}", iterator_value.to_string_without_side_effects())); + return vm.throw_completion(ErrorType::NotAnObject, DeprecatedString::formatted("Iterator value {}", iterator_value.to_deprecated_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 6e33921c826..1c4ef15e2e9 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakMapPrototype.cpp @@ -74,7 +74,7 @@ JS_DEFINE_NATIVE_FUNCTION(WeakMapPrototype::set) auto* weak_map = TRY(typed_this_object(vm)); auto value = vm.argument(0); if (!can_be_held_weakly(value)) - return vm.throw_completion(ErrorType::CannotBeHeldWeakly, value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::CannotBeHeldWeakly, value.to_deprecated_string_without_side_effects()); weak_map->values().set(&value.as_cell(), vm.argument(1)); return weak_map; } diff --git a/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp b/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp index 5be04068ea0..afac4c022e5 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp @@ -44,7 +44,7 @@ ThrowCompletionOr> WeakRefConstructor::construct(FunctionOb auto target = vm.argument(0); if (!can_be_held_weakly(target)) - return vm.throw_completion(ErrorType::CannotBeHeldWeakly, target.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::CannotBeHeldWeakly, target.to_deprecated_string_without_side_effects()); if (target.is_object()) return TRY(ordinary_create_from_constructor(vm, new_target, &Intrinsics::weak_ref_prototype, target.as_object())); diff --git a/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp b/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp index d5373e124e6..a0913cd42de 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakSetPrototype.cpp @@ -38,7 +38,7 @@ JS_DEFINE_NATIVE_FUNCTION(WeakSetPrototype::add) auto* weak_set = TRY(typed_this_object(vm)); auto value = vm.argument(0); if (!can_be_held_weakly(value)) - return vm.throw_completion(ErrorType::CannotBeHeldWeakly, value.to_string_without_side_effects()); + return vm.throw_completion(ErrorType::CannotBeHeldWeakly, value.to_deprecated_string_without_side_effects()); weak_set->values().set(&value.as_cell(), AK::HashSetExistingEntryBehavior::Keep); return weak_set; } diff --git a/Userland/Libraries/LibTest/JavaScriptTestRunner.h b/Userland/Libraries/LibTest/JavaScriptTestRunner.h index 629513f90a1..2507d5bf6f6 100644 --- a/Userland/Libraries/LibTest/JavaScriptTestRunner.h +++ b/Userland/Libraries/LibTest/JavaScriptTestRunner.h @@ -409,7 +409,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()); + file_result.logged_messages.append(message.to_deprecated_string_without_side_effects()); } test_json.value().as_object().for_each_member([&](DeprecatedString const& suite_name, JsonValue const& suite_value) { @@ -475,11 +475,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()); + detail_builder.append(error.to_deprecated_string_without_side_effects()); } else { - detail_builder.append(name.to_string_without_side_effects()); + detail_builder.append(name.to_deprecated_string_without_side_effects()); detail_builder.append(": "sv); - detail_builder.append(message.to_string_without_side_effects()); + detail_builder.append(message.to_deprecated_string_without_side_effects()); } if (is(error_object)) { @@ -490,7 +490,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(); + test_case.details = error.to_deprecated_string_without_side_effects(); } suite.tests.append(move(test_case)); diff --git a/Userland/Libraries/LibWeb/Bindings/FetchMethod.cpp b/Userland/Libraries/LibWeb/Bindings/FetchMethod.cpp index 335f8d5f03d..ee8f26d3ba5 100644 --- a/Userland/Libraries/LibWeb/Bindings/FetchMethod.cpp +++ b/Userland/Libraries/LibWeb/Bindings/FetchMethod.cpp @@ -172,10 +172,10 @@ JS::ThrowCompletionOr fetch(JS::VM& vm) break; auto next_item1 = TRY(JS::iterator_value(vm, *next1)); if (!next_item1.is_object()) - return vm.throw_completion(JS::ErrorType::NotAnObject, next_item1.to_string_without_side_effects()); + return vm.throw_completion(JS::ErrorType::NotAnObject, next_item1.to_deprecated_string_without_side_effects()); auto* iterator_method1 = TRY(next_item1.get_method(vm, *vm.well_known_symbol_iterator())); if (!iterator_method1) - return vm.throw_completion(JS::ErrorType::NotIterable, next_item1.to_string_without_side_effects()); + return vm.throw_completion(JS::ErrorType::NotIterable, next_item1.to_deprecated_string_without_side_effects()); auto iterator2 = TRY(JS::get_iterator(vm, next_item1, JS::IteratorHint::Sync, iterator_method1)); Vector sequence_item1; for (;;) { diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/ExceptionReporter.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/ExceptionReporter.cpp index e50078e773f..23e00d03932 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()), error_in_promise == ErrorInPromise::Yes); + console.report_exception(*JS::Error::create(realm, value.to_deprecated_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 caee45dc91e..b04a40349ad 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: {}", message.to_string_without_side_effects()); + dbgln_if(WEB_WORKER_DEBUG, "WebWorker: Post Message: {}", message.to_deprecated_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/WebAssembly/WebAssemblyTableConstructor.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp index 9d1dac12214..3ac0cf62f45 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableConstructor.cpp @@ -34,7 +34,7 @@ JS::ThrowCompletionOr> WebAssemblyTableConstructor: auto descriptor = TRY(vm.argument(0).to_object(vm)); auto element_value = TRY(descriptor->get("element")); if (!element_value.is_string()) - return vm.throw_completion(JS::ErrorType::InvalidHint, element_value.to_string_without_side_effects()); + return vm.throw_completion(JS::ErrorType::InvalidHint, element_value.to_deprecated_string_without_side_effects()); auto element = TRY(element_value.as_string().deprecated_string()); Optional reference_type; diff --git a/Userland/Libraries/LibWeb/WebIDL/AbstractOperations.h b/Userland/Libraries/LibWeb/WebIDL/AbstractOperations.h index f348451657d..d9e792972a3 100644 --- a/Userland/Libraries/LibWeb/WebIDL/AbstractOperations.h +++ b/Userland/Libraries/LibWeb/WebIDL/AbstractOperations.h @@ -88,7 +88,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, get_result.value().to_string_without_side_effects()); + completion = realm.vm().template throw_completion(JS::ErrorType::NotAFunction, get_result.value().to_deprecated_string_without_side_effects()); return clean_up_on_return(stored_settings, relevant_settings, completion); }