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).
This commit is contained in:
Timothy Flynn 2025-04-08 13:50:50 -04:00 committed by Tim Flynn
parent 917537b449
commit f070264800
Notes: github-actions[bot] 2025-04-09 00:01:12 +00:00
28 changed files with 51 additions and 51 deletions

View file

@ -99,7 +99,7 @@ struct Formatter<Core::DateTime> : StandardFormatter {
ErrorOr<void> 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());
}

View file

@ -267,15 +267,15 @@ ErrorOr<Vector<String>> 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;

View file

@ -51,7 +51,7 @@ static ErrorOr<AlgorithmIdentifier> 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<int>, algorithm);
POP_SCOPE();
@ -192,7 +192,7 @@ ErrorOr<SubjectPublicKey> 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<PrivateKey> parse_private_key_info(ASN1::Decoder& decoder, Vector<String
// }
PrivateKey private_key;
ENTER_TYPED_SCOPE(Sequence, "PrivateKeyInfo"sv);
ENTER_TYPED_SCOPE(Sequence, "PrivateKeyInfo");
READ_OBJECT(Integer, Crypto::UnsignedBigInteger, version);
if (version != 0) {

View file

@ -81,7 +81,7 @@ ErrorOr<EC::KeyPairType> 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::KeyPairType> EC::parse_ec_key(ReadonlyBytes der, bool is_private, Ve
auto tag = TRY(decoder.peek());
if (static_cast<u8>(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::KeyPairType> EC::parse_ec_key(ReadonlyBytes der, bool is_private, Ve
auto tag = TRY(decoder.peek());
if (static_cast<u8>(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());

View file

@ -43,7 +43,7 @@ ErrorOr<RSA::KeyPairType> 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::KeyPairType> 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);

View file

@ -117,7 +117,7 @@ struct AK::Formatter<Diff::HunkLocation> : Formatter<FormatString> {
static ErrorOr<void> 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));

View file

@ -451,7 +451,7 @@ struct AK::Formatter<Gfx::TIFF::Value> : Formatter<FormatString> {{
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));

View file

@ -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

View file

@ -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<SyntaxError>(MUST(String::formatted("Invalid character '{}'"sv, ch)));
auto error = vm.throw_completion<SyntaxError>(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<SyntaxError>(MUST(String::formatted("Invalid character '{}'"sv, ch)));
auto error = vm.throw_completion<SyntaxError>(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) };

View file

@ -112,6 +112,6 @@ template<>
struct AK::Formatter<Test::Randomized::RandomRun> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Test::Randomized::RandomRun run)
{
return Formatter<StringView>::format(builder, TRY(String::formatted("[{}]"sv, TRY(String::join(',', run.data(), "{}"sv)))));
return Formatter<StringView>::format(builder, TRY(String::formatted("[{}]", TRY(String::join(',', run.data(), "{}"sv)))));
}
};

View file

@ -27,7 +27,7 @@ PatternErrorOr<String> 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())

View file

@ -216,7 +216,7 @@ PatternErrorOr<Init> 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 baseURLs scheme and type.

View file

@ -515,7 +515,7 @@ static WebIDL::ExceptionOr<Vector<BaseKeyframe>> 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:

View file

@ -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)

View file

@ -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)

View file

@ -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(' ');

View file

@ -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());

View file

@ -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<Extent>() || m_properties.size.get<Extent>() != 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) {

View file

@ -1942,7 +1942,7 @@ WebIDL::ExceptionOr<GC::Ptr<Node>> 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

View file

@ -103,7 +103,7 @@ WebIDL::ExceptionOr<Infrastructure::BodyWithType> 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<DOMURL::URLSearchParams> const& url_search_params) -> WebIDL::ExceptionOr<void> {

View file

@ -2598,12 +2598,12 @@ WebIDL::ExceptionOr<GC::Ref<PendingResponse>> 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<GC::Ref<PendingResponse>> 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<GC::Ref<PendingResponse>> 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;
}
}

View file

@ -124,7 +124,7 @@ JS::ThrowCompletionOr<void> 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<void> 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<void> 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<GC::Ref<WebIDL::Promise>> 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<CustomElementDefinition> const& definition) {

View file

@ -264,7 +264,7 @@ ErrorOr<SerializedFormData> serialize_to_multipart_form_data(Vector<XHR::FormDat
StringBuilder builder;
// 1. For each entry of entry list:
for (auto const& entry : entry_list) {
TRY(builder.try_append(TRY(String::formatted("--{}\r\n"sv, boundary))));
TRY(builder.try_append(TRY(String::formatted("--{}\r\n", boundary))));
// Replace every occurrence of U+000D (CR) not followed by U+000A (LF), and every occurrence of U+000A (LF) not preceded by U+000D (CR) by a string consisting of a U+000D (CR) and U+000A (LF).
auto normalized_name = TRY(normalize_line_breaks(entry.name));

View file

@ -128,7 +128,7 @@ WebIDL::ExceptionOr<void> 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);

View file

@ -63,9 +63,9 @@ ErrorOr<String> load_file_directory_page(URL::URL const& url)
contents.append("<tr>"sv);
contents.appendff("<td><span class=\"{}\"></span></td>", is_directory ? "folder" : "file");
contents.appendff("<td><a href=\"file://{}\">{}</a></td><td>&nbsp;</td>"sv, path, name);
contents.appendff("<td><a href=\"file://{}\">{}</a></td><td>&nbsp;</td>", path, name);
contents.appendff("<td>{:10}</td><td>&nbsp;</td>", is_directory ? "-"_string : human_readable_size(st.st_size));
contents.appendff("<td>{}</td>"sv, Core::DateTime::from_timestamp(st.st_mtime).to_byte_string());
contents.appendff("<td>{}</td>", Core::DateTime::from_timestamp(st.st_mtime).to_byte_string());
contents.append("</tr>\n"sv);
}
}

View file

@ -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<JS::TypeError>(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<JS::TypeError>(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();

View file

@ -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();
}

View file

@ -265,7 +265,7 @@ TESTJS_GLOBAL_FUNCTION(test_simd_vector, testSIMDVector)
return false;
continue;
}
return vm.throw_completion<JS::TypeError>(ByteString::formatted("Bad SIMD float expectation: {}"sv, string));
return vm.throw_completion<JS::TypeError>(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)