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

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