From 4c9bc539057f8147097b6541424638c0ab8db402 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Tue, 8 Apr 2025 13:50:50 -0400 Subject: [PATCH] Everywhere: Remove `sv` suffix from format string literals This prevents the compile-time checks that would catch errors in the format invocation (which would usually lead to a runtime crash). --- Libraries/LibCore/DateTime.h | 2 +- Libraries/LibCore/StandardPaths.cpp | 8 ++++---- Libraries/LibCrypto/Certificate/Certificate.cpp | 6 +++--- Libraries/LibCrypto/PK/EC.cpp | 6 +++--- Libraries/LibCrypto/PK/RSA.cpp | 4 ++-- Libraries/LibDiff/Hunks.h | 2 +- Libraries/LibGfx/TIFFGenerator.py | 2 +- Libraries/LibJS/Bytecode/Interpreter.cpp | 4 ++-- Libraries/LibJS/Runtime/Uint8Array.cpp | 4 ++-- Libraries/LibTest/Randomized/RandomRun.h | 2 +- Libraries/LibURL/Pattern/Canonicalization.cpp | 2 +- Libraries/LibURL/Pattern/Init.cpp | 2 +- Libraries/LibWeb/Animations/KeyframeEffect.cpp | 2 +- Libraries/LibWeb/CSS/Serialize.cpp | 6 +++--- .../LibWeb/CSS/StyleValues/ConicGradientStyleValue.cpp | 2 +- .../CSS/StyleValues/FilterValueListStyleValue.cpp | 4 ++-- .../CSS/StyleValues/LinearGradientStyleValue.cpp | 2 +- .../CSS/StyleValues/RadialGradientStyleValue.cpp | 4 ++-- Libraries/LibWeb/DOM/Element.cpp | 2 +- Libraries/LibWeb/Fetch/BodyInit.cpp | 2 +- Libraries/LibWeb/Fetch/Fetching/Fetching.cpp | 10 +++++----- .../HTML/CustomElements/CustomElementRegistry.cpp | 10 +++++----- Libraries/LibWeb/HTML/FormControlInfrastructure.cpp | 2 +- Libraries/LibWeb/HTML/Storage.cpp | 2 +- Libraries/LibWeb/Loader/GeneratedPagesLoader.cpp | 4 ++-- .../LibWeb/BindingsGenerator/IDLGenerators.cpp | 2 +- .../CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp | 2 +- Tests/LibWasm/test-wasm.cpp | 2 +- 28 files changed, 51 insertions(+), 51 deletions(-) diff --git a/Libraries/LibCore/DateTime.h b/Libraries/LibCore/DateTime.h index e3268ec2837..cb7ea441013 100644 --- a/Libraries/LibCore/DateTime.h +++ b/Libraries/LibCore/DateTime.h @@ -99,7 +99,7 @@ struct Formatter : StandardFormatter { ErrorOr format(FormatBuilder& builder, Core::DateTime const& value) { // Can't use DateTime::to_string() here: It doesn't propagate allocation failure. - return builder.builder().try_appendff("{:04d}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}"sv, + return builder.builder().try_appendff("{:04d}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}", value.year(), value.month(), value.day(), value.hour(), value.minute(), value.second()); } diff --git a/Libraries/LibCore/StandardPaths.cpp b/Libraries/LibCore/StandardPaths.cpp index 1e6fe5818b9..2b454a6486c 100644 --- a/Libraries/LibCore/StandardPaths.cpp +++ b/Libraries/LibCore/StandardPaths.cpp @@ -267,15 +267,15 @@ ErrorOr> StandardPaths::font_directories() TRY(String::formatted(R"({}\Fonts)"sv, getenv("WINDIR"))), TRY(String::formatted(R"({}\Microsoft\Windows\Fonts)"sv, getenv("LOCALAPPDATA"))), # else - TRY(String::formatted("{}/fonts"sv, user_data_directory())), - TRY(String::formatted("{}/X11/fonts"sv, user_data_directory())), + TRY(String::formatted("{}/fonts", user_data_directory())), + TRY(String::formatted("{}/X11/fonts", user_data_directory())), # endif } }; # if !(defined(AK_OS_SERENITY) || defined(AK_OS_MACOS) || defined(AK_OS_WINDOWS)) auto data_directories = system_data_directories(); for (auto& data_directory : data_directories) { - paths.append(TRY(String::formatted("{}/fonts"sv, data_directory))); - paths.append(TRY(String::formatted("{}/X11/fonts"sv, data_directory))); + paths.append(TRY(String::formatted("{}/fonts", data_directory))); + paths.append(TRY(String::formatted("{}/X11/fonts", data_directory))); } # endif return paths; diff --git a/Libraries/LibCrypto/Certificate/Certificate.cpp b/Libraries/LibCrypto/Certificate/Certificate.cpp index 21a5ef11065..30cafeacd43 100644 --- a/Libraries/LibCrypto/Certificate/Certificate.cpp +++ b/Libraries/LibCrypto/Certificate/Certificate.cpp @@ -51,7 +51,7 @@ static ErrorOr parse_algorithm_identifier(ASN1::Decoder& de // algorithm ALGORITHM.&id({SupportedAlgorithms}), // parameters ALGORITHM.&Type({SupportedAlgorithms}{@algorithm}) OPTIONAL, // ... } - ENTER_TYPED_SCOPE(Sequence, "AlgorithmIdentifier"sv); + ENTER_TYPED_SCOPE(Sequence, "AlgorithmIdentifier"); PUSH_SCOPE("algorithm"sv); READ_OBJECT(ObjectIdentifier, Vector, algorithm); POP_SCOPE(); @@ -192,7 +192,7 @@ ErrorOr parse_subject_public_key_info(ASN1::Decoder& decoder, // } SubjectPublicKey public_key; - ENTER_TYPED_SCOPE(Sequence, "SubjectPublicKeyInfo"sv); + ENTER_TYPED_SCOPE(Sequence, "SubjectPublicKeyInfo"); public_key.algorithm = TRY(parse_algorithm_identifier(decoder, current_scope)); @@ -258,7 +258,7 @@ ErrorOr parse_private_key_info(ASN1::Decoder& decoder, Vector EC::parse_ec_key(ReadonlyBytes der, bool is_private, Ve // publicKey [1] BIT STRING OPTIONAL // } - ENTER_TYPED_SCOPE(Sequence, "ECPrivateKey"sv); + ENTER_TYPED_SCOPE(Sequence, "ECPrivateKey"); PUSH_SCOPE("version"); READ_OBJECT(Integer, Crypto::UnsignedBigInteger, version); @@ -98,7 +98,7 @@ ErrorOr EC::parse_ec_key(ReadonlyBytes der, bool is_private, Ve auto tag = TRY(decoder.peek()); if (static_cast(tag.kind) == 0) { REWRITE_TAG(Sequence); - ENTER_TYPED_SCOPE(Sequence, "parameters"sv); + ENTER_TYPED_SCOPE(Sequence, "parameters"); parameters = TRY(Crypto::Certificate::parse_ec_parameters(decoder, {})); EXIT_SCOPE(); } @@ -109,7 +109,7 @@ ErrorOr EC::parse_ec_key(ReadonlyBytes der, bool is_private, Ve auto tag = TRY(decoder.peek()); if (static_cast(tag.kind) == 1) { REWRITE_TAG(Sequence); - ENTER_TYPED_SCOPE(Sequence, "publicKey"sv); + ENTER_TYPED_SCOPE(Sequence, "publicKey"); READ_OBJECT(BitString, Crypto::ASN1::BitStringView, public_key_bits); auto public_key_bytes = TRY(public_key_bits.raw_bytes()); diff --git a/Libraries/LibCrypto/PK/RSA.cpp b/Libraries/LibCrypto/PK/RSA.cpp index bca6d183536..6f09834aa94 100644 --- a/Libraries/LibCrypto/PK/RSA.cpp +++ b/Libraries/LibCrypto/PK/RSA.cpp @@ -43,7 +43,7 @@ ErrorOr RSA::parse_rsa_key(ReadonlyBytes der, bool is_private, // otherPrimeInfos OtherPrimeInfos OPTIONAL // } - ENTER_TYPED_SCOPE(Sequence, "RSAPrivateKey"sv); + ENTER_TYPED_SCOPE(Sequence, "RSAPrivateKey"); PUSH_SCOPE("version"); READ_OBJECT(Integer, Crypto::UnsignedBigInteger, version); @@ -104,7 +104,7 @@ ErrorOr RSA::parse_rsa_key(ReadonlyBytes der, bool is_private, // publicExponent INTEGER // } - ENTER_TYPED_SCOPE(Sequence, "RSAPublicKey"sv); + ENTER_TYPED_SCOPE(Sequence, "RSAPublicKey"); PUSH_SCOPE("modulus"); READ_OBJECT(Integer, Crypto::UnsignedBigInteger, modulus); diff --git a/Libraries/LibDiff/Hunks.h b/Libraries/LibDiff/Hunks.h index fa919abeda7..2d36dd9a203 100644 --- a/Libraries/LibDiff/Hunks.h +++ b/Libraries/LibDiff/Hunks.h @@ -117,7 +117,7 @@ struct AK::Formatter : Formatter { static ErrorOr format(FormatBuilder& format_builder, Diff::HunkLocation const& location) { auto& builder = format_builder.builder(); - TRY(builder.try_appendff("@@ -{}"sv, location.old_range.start_line)); + TRY(builder.try_appendff("@@ -{}", location.old_range.start_line)); if (location.old_range.number_of_lines != 1) TRY(builder.try_appendff(",{}", location.old_range.number_of_lines)); diff --git a/Libraries/LibGfx/TIFFGenerator.py b/Libraries/LibGfx/TIFFGenerator.py index 7d2d3237f57..4f8f7d497e7 100755 --- a/Libraries/LibGfx/TIFFGenerator.py +++ b/Libraries/LibGfx/TIFFGenerator.py @@ -451,7 +451,7 @@ struct AK::Formatter : Formatter {{ String content; value.visit( [&](ByteBuffer const& buffer) {{ - content = MUST(String::formatted("Buffer of size: {{}}"sv, buffer.size())); + content = MUST(String::formatted("Buffer of size: {{}}", buffer.size())); }}, [&](auto const& other) {{ content = MUST(String::formatted("{{}}", other)); diff --git a/Libraries/LibJS/Bytecode/Interpreter.cpp b/Libraries/LibJS/Bytecode/Interpreter.cpp index 94d996a1aca..dea70a0957c 100644 --- a/Libraries/LibJS/Bytecode/Interpreter.cpp +++ b/Libraries/LibJS/Bytecode/Interpreter.cpp @@ -3052,14 +3052,14 @@ ByteString NewArray::to_byte_string_impl(Bytecode::Executable const& executable) ByteString NewPrimitiveArray::to_byte_string_impl(Bytecode::Executable const& executable) const { - return ByteString::formatted("NewPrimitiveArray {}, {}"sv, + return ByteString::formatted("NewPrimitiveArray {}, {}", format_operand("dst"sv, dst(), executable), format_value_list("elements"sv, elements())); } ByteString AddPrivateName::to_byte_string_impl(Bytecode::Executable const& executable) const { - return ByteString::formatted("AddPrivateName {}"sv, executable.identifier_table->get(m_name)); + return ByteString::formatted("AddPrivateName {}", executable.identifier_table->get(m_name)); } ByteString ArrayAppend::to_byte_string_impl(Bytecode::Executable const& executable) const diff --git a/Libraries/LibJS/Runtime/Uint8Array.cpp b/Libraries/LibJS/Runtime/Uint8Array.cpp index 6ab8ad84e69..299434451ee 100644 --- a/Libraries/LibJS/Runtime/Uint8Array.cpp +++ b/Libraries/LibJS/Runtime/Uint8Array.cpp @@ -718,7 +718,7 @@ DecodeResult from_base64(VM& vm, StringView string, Alphabet alphabet, LastChunk // i. If char is either "+" or "/", then if (ch == '+' || ch == '/') { // 1. Let error be a new SyntaxError exception. - auto error = vm.throw_completion(MUST(String::formatted("Invalid character '{}'"sv, ch))); + auto error = vm.throw_completion(MUST(String::formatted("Invalid character '{}'", ch))); // 2. Return the Record { [[Read]]: read, [[Bytes]]: bytes, [[Error]]: error }. return { .read = read, .bytes = move(bytes), .error = move(error) }; @@ -740,7 +740,7 @@ DecodeResult from_base64(VM& vm, StringView string, Alphabet alphabet, LastChunk if (!standard_base64_alphabet.contains(ch)) { // i. Let error be a new SyntaxError exception. - auto error = vm.throw_completion(MUST(String::formatted("Invalid character '{}'"sv, ch))); + auto error = vm.throw_completion(MUST(String::formatted("Invalid character '{}'", ch))); // ii. Return the Record { [[Read]]: read, [[Bytes]]: bytes, [[Error]]: error }. return { .read = read, .bytes = move(bytes), .error = move(error) }; diff --git a/Libraries/LibTest/Randomized/RandomRun.h b/Libraries/LibTest/Randomized/RandomRun.h index 72408e29687..c298ed71863 100644 --- a/Libraries/LibTest/Randomized/RandomRun.h +++ b/Libraries/LibTest/Randomized/RandomRun.h @@ -112,6 +112,6 @@ template<> struct AK::Formatter : Formatter { ErrorOr format(FormatBuilder& builder, Test::Randomized::RandomRun run) { - return Formatter::format(builder, TRY(String::formatted("[{}]"sv, TRY(String::join(',', run.data(), "{}"sv))))); + return Formatter::format(builder, TRY(String::formatted("[{}]", TRY(String::join(',', run.data(), "{}"sv))))); } }; diff --git a/Libraries/LibURL/Pattern/Canonicalization.cpp b/Libraries/LibURL/Pattern/Canonicalization.cpp index 1fd4c363cc0..e278df3166f 100644 --- a/Libraries/LibURL/Pattern/Canonicalization.cpp +++ b/Libraries/LibURL/Pattern/Canonicalization.cpp @@ -27,7 +27,7 @@ PatternErrorOr canonicalize_a_protocol(String const& value) // 2. Let parseResult be the result of running the basic URL parser given value followed by "://dummy.invalid/". // NOTE: Note, state override is not used here because it enforces restrictions that are only appropriate for the // protocol setter. Instead we use the protocol to parse a dummy URL using the normal parsing entry point. - auto parse_result = Parser::basic_parse(MUST(String::formatted("{}://dummy.invalid"sv, value))); + auto parse_result = Parser::basic_parse(MUST(String::formatted("{}://dummy.invalid", value))); // 4. If parseResult is failure, then throw a TypeError. if (!parse_result.has_value()) diff --git a/Libraries/LibURL/Pattern/Init.cpp b/Libraries/LibURL/Pattern/Init.cpp index 7820526cb1b..4426c86fc15 100644 --- a/Libraries/LibURL/Pattern/Init.cpp +++ b/Libraries/LibURL/Pattern/Init.cpp @@ -216,7 +216,7 @@ PatternErrorOr process_a_url_pattern_init(Init const& init, PatternProcess // 2. If baseURL is failure, then throw a TypeError. if (!base_url.has_value()) - return ErrorInfo { MUST(String::formatted("Invalid base URL '{}' provided for URLPattern"sv, init.base_url.value())) }; + return ErrorInfo { MUST(String::formatted("Invalid base URL '{}' provided for URLPattern", init.base_url.value())) }; // 3. If init["protocol"] does not exist, then set result["protocol"] to the result of processing a base URL // string given baseURL’s scheme and type. diff --git a/Libraries/LibWeb/Animations/KeyframeEffect.cpp b/Libraries/LibWeb/Animations/KeyframeEffect.cpp index 306cc0f4d6f..47496f2a506 100644 --- a/Libraries/LibWeb/Animations/KeyframeEffect.cpp +++ b/Libraries/LibWeb/Animations/KeyframeEffect.cpp @@ -515,7 +515,7 @@ static WebIDL::ExceptionOr> process_a_keyframes_argument(JS auto offset = keyframe.offset.value(); if (offset < 0.0 || offset > 1.0) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, MUST(String::formatted("Keyframe {} has invalid offset value {}"sv, i, offset)) }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, MUST(String::formatted("Keyframe {} has invalid offset value {}", i, offset)) }; } // 8. For each frame in processed keyframes, perform the following steps: diff --git a/Libraries/LibWeb/CSS/Serialize.cpp b/Libraries/LibWeb/CSS/Serialize.cpp index 6d2bfbe2a07..165730de2e1 100644 --- a/Libraries/LibWeb/CSS/Serialize.cpp +++ b/Libraries/LibWeb/CSS/Serialize.cpp @@ -178,11 +178,11 @@ void serialize_a_srgb_value(StringBuilder& builder, Color color) // (depending on whether the alpha is exactly 1, or not), with lowercase letters for the function name. // NOTE: Since we use Gfx::Color, having an "alpha of 1" means its value is 255. if (color.alpha() == 0) - builder.appendff("rgba({}, {}, {}, 0)"sv, color.red(), color.green(), color.blue()); + builder.appendff("rgba({}, {}, {}, 0)", color.red(), color.green(), color.blue()); else if (color.alpha() == 255) - builder.appendff("rgb({}, {}, {})"sv, color.red(), color.green(), color.blue()); + builder.appendff("rgb({}, {}, {})", color.red(), color.green(), color.blue()); else - builder.appendff("rgba({}, {}, {}, 0.{})"sv, color.red(), color.green(), color.blue(), format_to_8bit_compatible(color.alpha()).data()); + builder.appendff("rgba({}, {}, {}, 0.{})", color.red(), color.green(), color.blue(), format_to_8bit_compatible(color.alpha()).data()); } String serialize_an_identifier(StringView ident) diff --git a/Libraries/LibWeb/CSS/StyleValues/ConicGradientStyleValue.cpp b/Libraries/LibWeb/CSS/StyleValues/ConicGradientStyleValue.cpp index 0d91bab20f3..c160bc2724d 100644 --- a/Libraries/LibWeb/CSS/StyleValues/ConicGradientStyleValue.cpp +++ b/Libraries/LibWeb/CSS/StyleValues/ConicGradientStyleValue.cpp @@ -29,7 +29,7 @@ String ConicGradientStyleValue::to_string(SerializationMode mode) const if (has_at_position) { if (has_from_angle) builder.append(' '); - builder.appendff("at {}"sv, m_properties.position->to_string(mode)); + builder.appendff("at {}", m_properties.position->to_string(mode)); } if (has_color_space) { if (has_from_angle || has_at_position) diff --git a/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.cpp b/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.cpp index d363b4f7387..0698ab550fe 100644 --- a/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.cpp +++ b/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.cpp @@ -52,10 +52,10 @@ String FilterValueListStyleValue::to_string(SerializationMode) const builder.append(' '); filter_function.visit( [&](FilterOperation::Blur const& blur) { - builder.appendff("blur({}"sv, blur.radius.to_string()); + builder.appendff("blur({}", blur.radius.to_string()); }, [&](FilterOperation::DropShadow const& drop_shadow) { - builder.appendff("drop-shadow("sv); + builder.append("drop-shadow("sv); if (drop_shadow.color.has_value()) { serialize_a_srgb_value(builder, *drop_shadow.color); builder.append(' '); diff --git a/Libraries/LibWeb/CSS/StyleValues/LinearGradientStyleValue.cpp b/Libraries/LibWeb/CSS/StyleValues/LinearGradientStyleValue.cpp index 11ea664adf6..3491d00a553 100644 --- a/Libraries/LibWeb/CSS/StyleValues/LinearGradientStyleValue.cpp +++ b/Libraries/LibWeb/CSS/StyleValues/LinearGradientStyleValue.cpp @@ -51,7 +51,7 @@ String LinearGradientStyleValue::to_string(SerializationMode mode) const if (has_direction) { m_properties.direction.visit( [&](SideOrCorner side_or_corner) { - builder.appendff("{}{}"sv, m_properties.gradient_type == GradientType::Standard ? "to "sv : ""sv, side_or_corner_to_string(side_or_corner)); + builder.appendff("{}{}", m_properties.gradient_type == GradientType::Standard ? "to "sv : ""sv, side_or_corner_to_string(side_or_corner)); }, [&](Angle const& angle) { builder.append(angle.to_string()); diff --git a/Libraries/LibWeb/CSS/StyleValues/RadialGradientStyleValue.cpp b/Libraries/LibWeb/CSS/StyleValues/RadialGradientStyleValue.cpp index 3c4bbd600e4..1adef4e4c72 100644 --- a/Libraries/LibWeb/CSS/StyleValues/RadialGradientStyleValue.cpp +++ b/Libraries/LibWeb/CSS/StyleValues/RadialGradientStyleValue.cpp @@ -19,7 +19,7 @@ String RadialGradientStyleValue::to_string(SerializationMode mode) const StringBuilder builder; if (is_repeating()) builder.append("repeating-"sv); - builder.appendff("radial-gradient("sv); + builder.append("radial-gradient("sv); bool has_size = !m_properties.size.has() || m_properties.size.get() != Extent::FarthestCorner; bool has_position = !m_properties.position->is_center(); @@ -54,7 +54,7 @@ String RadialGradientStyleValue::to_string(SerializationMode mode) const if (has_size) builder.append(' '); - builder.appendff("at {}"sv, m_properties.position->to_string(mode)); + builder.appendff("at {}", m_properties.position->to_string(mode)); } if (has_color_space) { diff --git a/Libraries/LibWeb/DOM/Element.cpp b/Libraries/LibWeb/DOM/Element.cpp index 6d17000b2fd..08b9e6402ea 100644 --- a/Libraries/LibWeb/DOM/Element.cpp +++ b/Libraries/LibWeb/DOM/Element.cpp @@ -1942,7 +1942,7 @@ WebIDL::ExceptionOr> Element::insert_adjacent(StringView where, GC // -> Otherwise // Throw a "SyntaxError" DOMException. - return WebIDL::SyntaxError::create(realm(), MUST(String::formatted("Unknown position '{}'. Must be one of 'beforebegin', 'afterbegin', 'beforeend' or 'afterend'"sv, where))); + return WebIDL::SyntaxError::create(realm(), MUST(String::formatted("Unknown position '{}'. Must be one of 'beforebegin', 'afterbegin', 'beforeend' or 'afterend'", where))); } // https://dom.spec.whatwg.org/#dom-element-insertadjacentelement diff --git a/Libraries/LibWeb/Fetch/BodyInit.cpp b/Libraries/LibWeb/Fetch/BodyInit.cpp index 66e3a721253..5d84e7b1406 100644 --- a/Libraries/LibWeb/Fetch/BodyInit.cpp +++ b/Libraries/LibWeb/Fetch/BodyInit.cpp @@ -103,7 +103,7 @@ WebIDL::ExceptionOr extract_body(JS::Realm& realm, source = serialized_form_data.serialized_data; // FIXME: Set length to unclear, see html/6424 for improving this. // Set type to `multipart/form-data; boundary=`, followed by the multipart/form-data boundary string generated by the multipart/form-data encoding algorithm. - type = MUST(ByteBuffer::copy(MUST(String::formatted("multipart/form-data; boundary={}"sv, serialized_form_data.boundary)).bytes())); + type = MUST(ByteBuffer::copy(MUST(String::formatted("multipart/form-data; boundary={}", serialized_form_data.boundary)).bytes())); return {}; }, [&](GC::Root const& url_search_params) -> WebIDL::ExceptionOr { diff --git a/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp b/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp index 08c7d0f85d3..c346bc484be 100644 --- a/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp +++ b/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp @@ -2598,12 +2598,12 @@ WebIDL::ExceptionOr> cors_preflight_fetch(JS::Realm& re // is "include" or methods does not contain `*`, then return a network error. if (!methods.contains_slow(request.method()) && !Infrastructure::is_cors_safelisted_method(request.method())) { if (request.credentials_mode() == Infrastructure::Request::CredentialsMode::Include) { - returned_pending_response->resolve(Infrastructure::Response::network_error(vm, TRY_OR_IGNORE(String::formatted("Non-CORS-safelisted method '{}' not found in the CORS-preflight response's Access-Control-Allow-Methods header (the header may be missing). '*' is not allowed as the main request includes credentials."_string, StringView { request.method() })))); + returned_pending_response->resolve(Infrastructure::Response::network_error(vm, TRY_OR_IGNORE(String::formatted("Non-CORS-safelisted method '{}' not found in the CORS-preflight response's Access-Control-Allow-Methods header (the header may be missing). '*' is not allowed as the main request includes credentials.", StringView { request.method() })))); return; } if (!methods.contains_slow("*"sv.bytes())) { - returned_pending_response->resolve(Infrastructure::Response::network_error(vm, TRY_OR_IGNORE(String::formatted("Non-CORS-safelisted method '{}' not found in the CORS-preflight response's Access-Control-Allow-Methods header and there was no '*' entry. The header may be missing."sv, StringView { request.method() })))); + returned_pending_response->resolve(Infrastructure::Response::network_error(vm, TRY_OR_IGNORE(String::formatted("Non-CORS-safelisted method '{}' not found in the CORS-preflight response's Access-Control-Allow-Methods header and there was no '*' entry. The header may be missing.", StringView { request.method() })))); return; } } @@ -2622,7 +2622,7 @@ WebIDL::ExceptionOr> cors_preflight_fetch(JS::Realm& re } if (!is_in_header_names) { - returned_pending_response->resolve(Infrastructure::Response::network_error(vm, TRY_OR_IGNORE(String::formatted("Main request contains the header '{}' that is not specified in the CORS-preflight response's Access-Control-Allow-Headers header (the header may be missing). '*' does not capture this header."sv, StringView { header.name })))); + returned_pending_response->resolve(Infrastructure::Response::network_error(vm, TRY_OR_IGNORE(String::formatted("Main request contains the header '{}' that is not specified in the CORS-preflight response's Access-Control-Allow-Headers header (the header may be missing). '*' does not capture this header.", StringView { header.name })))); return; } } @@ -2644,12 +2644,12 @@ WebIDL::ExceptionOr> cors_preflight_fetch(JS::Realm& re if (!is_in_header_names) { if (request.credentials_mode() == Infrastructure::Request::CredentialsMode::Include) { - returned_pending_response->resolve(Infrastructure::Response::network_error(vm, TRY_OR_IGNORE(String::formatted("CORS-unsafe request-header '{}' not found in the CORS-preflight response's Access-Control-Allow-Headers header (the header may be missing). '*' is not allowed as the main request includes credentials."sv, StringView { unsafe_name })))); + returned_pending_response->resolve(Infrastructure::Response::network_error(vm, TRY_OR_IGNORE(String::formatted("CORS-unsafe request-header '{}' not found in the CORS-preflight response's Access-Control-Allow-Headers header (the header may be missing). '*' is not allowed as the main request includes credentials.", StringView { unsafe_name })))); return; } if (!header_names.contains_slow("*"sv.bytes())) { - returned_pending_response->resolve(Infrastructure::Response::network_error(vm, TRY_OR_IGNORE(String::formatted("CORS-unsafe request-header '{}' not found in the CORS-preflight response's Access-Control-Allow-Headers header and there was no '*' entry. The header may be missing."sv, StringView { unsafe_name })))); + returned_pending_response->resolve(Infrastructure::Response::network_error(vm, TRY_OR_IGNORE(String::formatted("CORS-unsafe request-header '{}' not found in the CORS-preflight response's Access-Control-Allow-Headers header and there was no '*' entry. The header may be missing.", StringView { unsafe_name })))); return; } } diff --git a/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp b/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp index 9ea80705430..290d2f91da9 100644 --- a/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp +++ b/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.cpp @@ -124,7 +124,7 @@ JS::ThrowCompletionOr CustomElementRegistry::define(String const& name, We // 2. If name is not a valid custom element name, then throw a "SyntaxError" DOMException. if (!is_valid_custom_element_name(name)) - return JS::throw_completion(WebIDL::SyntaxError::create(realm, MUST(String::formatted("'{}' is not a valid custom element name"sv, name)))); + return JS::throw_completion(WebIDL::SyntaxError::create(realm, MUST(String::formatted("'{}' is not a valid custom element name", name)))); // 3. If this's custom element definition set contains an item with name name, then throw a "NotSupportedError" DOMException. auto existing_definition_with_name_iterator = m_custom_element_definitions.find_if([&name](auto const& definition) { @@ -132,7 +132,7 @@ JS::ThrowCompletionOr CustomElementRegistry::define(String const& name, We }); if (existing_definition_with_name_iterator != m_custom_element_definitions.end()) - return JS::throw_completion(WebIDL::NotSupportedError::create(realm, MUST(String::formatted("A custom element with name '{}' is already defined"sv, name)))); + return JS::throw_completion(WebIDL::NotSupportedError::create(realm, MUST(String::formatted("A custom element with name '{}' is already defined", name)))); // 4. If this's custom element definition set contains an item with constructor constructor, then throw a "NotSupportedError" DOMException. auto existing_definition_with_constructor_iterator = m_custom_element_definitions.find_if([&constructor](auto const& definition) { @@ -152,13 +152,13 @@ JS::ThrowCompletionOr CustomElementRegistry::define(String const& name, We if (extends.has_value()) { // 1. If extends is a valid custom element name, then throw a "NotSupportedError" DOMException. if (is_valid_custom_element_name(extends.value())) - return JS::throw_completion(WebIDL::NotSupportedError::create(realm, MUST(String::formatted("'{}' is a custom element name, only non-custom elements can be extended"sv, extends.value())))); + return JS::throw_completion(WebIDL::NotSupportedError::create(realm, MUST(String::formatted("'{}' is a custom element name, only non-custom elements can be extended", extends.value())))); // 2. If the element interface for extends and the HTML namespace is HTMLUnknownElement // (e.g., if extends does not indicate an element definition in this specification), // then throw a "NotSupportedError" DOMException. if (DOM::is_unknown_html_element(extends.value())) - return JS::throw_completion(WebIDL::NotSupportedError::create(realm, MUST(String::formatted("'{}' is an unknown HTML element"sv, extends.value())))); + return JS::throw_completion(WebIDL::NotSupportedError::create(realm, MUST(String::formatted("'{}' is an unknown HTML element", extends.value())))); // 3. Set localName to extends. local_name = extends.value(); @@ -362,7 +362,7 @@ WebIDL::ExceptionOr> CustomElementRegistry::when_define // 1. If name is not a valid custom element name, then return a promise rejected with a "SyntaxError" DOMException. if (!is_valid_custom_element_name(name)) - return WebIDL::create_rejected_promise(realm, WebIDL::SyntaxError::create(realm, MUST(String::formatted("'{}' is not a valid custom element name"sv, name)))); + return WebIDL::create_rejected_promise(realm, WebIDL::SyntaxError::create(realm, MUST(String::formatted("'{}' is not a valid custom element name", name)))); // 2. If this's custom element definition set contains an item with name name, then return a promise resolved with that item's constructor. auto existing_definition_iterator = m_custom_element_definitions.find_if([&name](GC::Root const& definition) { diff --git a/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp b/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp index 5cd59a9f815..580baebdab6 100644 --- a/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp +++ b/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp @@ -264,7 +264,7 @@ ErrorOr serialize_to_multipart_form_data(Vector Storage::set_item(String const& key, String const& val // 4. If value cannot be stored, then throw a "QuotaExceededError" DOMException exception. new_size += value.bytes().size() - old_value.value_or(String {}).bytes().size(); if (m_storage_bottle->quota.has_value() && new_size > *m_storage_bottle->quota) - return WebIDL::QuotaExceededError::create(realm, MUST(String::formatted("Unable to store more than {} bytes in storage"sv, *m_storage_bottle->quota))); + return WebIDL::QuotaExceededError::create(realm, MUST(String::formatted("Unable to store more than {} bytes in storage", *m_storage_bottle->quota))); // 5. Set this's map[key] to value. map().set(key, value); diff --git a/Libraries/LibWeb/Loader/GeneratedPagesLoader.cpp b/Libraries/LibWeb/Loader/GeneratedPagesLoader.cpp index fc95b6e043a..5f2fce950c3 100644 --- a/Libraries/LibWeb/Loader/GeneratedPagesLoader.cpp +++ b/Libraries/LibWeb/Loader/GeneratedPagesLoader.cpp @@ -63,9 +63,9 @@ ErrorOr load_file_directory_page(URL::URL const& url) contents.append(""sv); contents.appendff("", is_directory ? "folder" : "file"); - contents.appendff("{} "sv, path, name); + contents.appendff("{} ", path, name); contents.appendff("{:10} ", is_directory ? "-"_string : human_readable_size(st.st_size)); - contents.appendff("{}"sv, Core::DateTime::from_timestamp(st.st_mtime).to_byte_string()); + contents.appendff("{}", Core::DateTime::from_timestamp(st.st_mtime).to_byte_string()); contents.append("\n"sv); } } diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index f12a2977671..d6fff6759a3 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -2654,7 +2654,7 @@ static void generate_html_constructor(SourceGenerator& generator, IDL::Construct // 2. If valid local names does not contain definition's local name, then throw a TypeError. if (!valid_local_names.contains_slow(definition->local_name())) - return vm.throw_completion(MUST(String::formatted("Local name '{}' of customized built-in element is not a valid local name for @name@"sv, definition->local_name()))); + return vm.throw_completion(MUST(String::formatted("Local name '{}' of customized built-in element is not a valid local name for @name@", definition->local_name()))); // 3. Set isValue to definition's name. is_value = definition->name(); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp index 858b258835f..1f81b8bec85 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp @@ -1114,7 +1114,7 @@ bool is_animatable_property(JsonObject& properties, StringView property_name) } if (!property.value().has("longhands"sv)) { - dbgln("Property '{}' must specify either 'animation-type' or 'longhands'"sv, property_name); + dbgln("Property '{}' must specify either 'animation-type' or 'longhands'", property_name); VERIFY_NOT_REACHED(); } diff --git a/Tests/LibWasm/test-wasm.cpp b/Tests/LibWasm/test-wasm.cpp index abefeab5db5..037b56c3b63 100644 --- a/Tests/LibWasm/test-wasm.cpp +++ b/Tests/LibWasm/test-wasm.cpp @@ -265,7 +265,7 @@ TESTJS_GLOBAL_FUNCTION(test_simd_vector, testSIMDVector) return false; continue; } - return vm.throw_completion(ByteString::formatted("Bad SIMD float expectation: {}"sv, string)); + return vm.throw_completion(ByteString::formatted("Bad SIMD float expectation: {}", string)); } u64 expect_value = expect.is_bigint() ? TRY(expect.to_bigint_uint64(vm)) : (u64)TRY(expect.to_index(vm)); if (got != expect_value)