diff --git a/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp b/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp index 64c6778e16..6d05a282be 100644 --- a/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp +++ b/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp @@ -53,22 +53,22 @@ WebIDL::ExceptionOr MutationObserver::observe(Node& target, MutationObserv // 3. If none of options["childList"], options["attributes"], and options["characterData"] is true, then throw a TypeError. if (!options.child_list && (!options.attributes.has_value() || !options.attributes.value()) && (!options.character_data.has_value() || !options.character_data.value())) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Options must have one of childList, attributes or characterData set to true." }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Options must have one of childList, attributes or characterData set to true."sv }; // 4. If options["attributeOldValue"] is true and options["attributes"] is false, then throw a TypeError. // NOTE: If attributeOldValue is present, attributes will be present because of step 1. if (options.attribute_old_value.has_value() && options.attribute_old_value.value() && !options.attributes.value()) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "attributes must be true if attributeOldValue is true." }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "attributes must be true if attributeOldValue is true."sv }; // 5. If options["attributeFilter"] is present and options["attributes"] is false, then throw a TypeError. // NOTE: If attributeFilter is present, attributes will be present because of step 1. if (options.attribute_filter.has_value() && !options.attributes.value()) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "attributes must be true if attributeFilter is present." }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "attributes must be true if attributeFilter is present."sv }; // 6. If options["characterDataOldValue"] is true and options["characterData"] is false, then throw a TypeError. // NOTE: If characterDataOldValue is present, characterData will be present because of step 2. if (options.character_data_old_value.has_value() && options.character_data_old_value.value() && !options.character_data.value()) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "characterData must be true if characterDataOldValue is true." }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "characterData must be true if characterDataOldValue is true."sv }; // 7. For each registered of target’s registered observer list, if registered’s observer is this: bool updated_existing_observer = false; diff --git a/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp b/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp index 80f431aaeb..e00c4eb0dc 100644 --- a/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp +++ b/Userland/Libraries/LibWeb/DOMParsing/XMLSerializer.cpp @@ -212,7 +212,7 @@ WebIDL::ExceptionOr serialize_node_to_xml_string_impl(JS::NonnullGCPtr Anything else // Throw a TypeError. Only Nodes and Attr objects can be serialized by this algorithm. - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Can only serialize Nodes or Attributes." }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Can only serialize Nodes or Attributes."sv }; } // https://w3c.github.io/DOM-Parsing/#dfn-recording-the-namespace-information diff --git a/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp b/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp index 5f5964d972..fdb1e6fb32 100644 --- a/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp +++ b/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp @@ -74,11 +74,11 @@ WebIDL::ExceptionOr extract_body(JS::Realm& realm, [&](JS::Handle const& stream) -> WebIDL::ExceptionOr { // If keepalive is true, then throw a TypeError. if (keepalive) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Cannot extract body from stream when keepalive is set" }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Cannot extract body from stream when keepalive is set"sv }; // If object is disturbed or locked, then throw a TypeError. if (stream->is_disturbed() || stream->is_locked()) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Cannot extract body from disturbed or locked stream" }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Cannot extract body from disturbed or locked stream"sv }; return {}; })); diff --git a/Userland/Libraries/LibWeb/Fetch/Headers.cpp b/Userland/Libraries/LibWeb/Fetch/Headers.cpp index 257f070161..2b0c2fea92 100644 --- a/Userland/Libraries/LibWeb/Fetch/Headers.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Headers.cpp @@ -55,11 +55,11 @@ WebIDL::ExceptionOr Headers::delete_(String const& name_string) // 1. If name is not a header name, then throw a TypeError. if (!Infrastructure::is_header_name(name)) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid header name" }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid header name"sv }; // 2. If this’s guard is "immutable", then throw a TypeError. if (m_guard == Guard::Immutable) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Headers object is immutable" }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Headers object is immutable"sv }; // 3. Otherwise, if this’s guard is "request" and name is a forbidden header name, return. if (m_guard == Guard::Request && Infrastructure::is_forbidden_header_name(name)) @@ -95,7 +95,7 @@ WebIDL::ExceptionOr Headers::get(String const& name_string) // 1. If name is not a header name, then throw a TypeError. if (!Infrastructure::is_header_name(name)) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid header name" }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid header name"sv }; // 2. Return the result of getting name from this’s header list. auto byte_buffer = TRY_OR_RETURN_OOM(realm(), m_header_list->get(name)); @@ -111,7 +111,7 @@ WebIDL::ExceptionOr Headers::has(String const& name_string) // 1. If name is not a header name, then throw a TypeError. if (!Infrastructure::is_header_name(name)) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid header name" }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid header name"sv }; // 2. Return true if this’s header list contains name; otherwise false. return m_header_list->contains(name); @@ -134,13 +134,13 @@ WebIDL::ExceptionOr Headers::set(String const& name_string, String const& // 2. If name is not a header name or value is not a header value, then throw a TypeError. if (!Infrastructure::is_header_name(name)) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid header name" }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid header name"sv }; if (!Infrastructure::is_header_value(value)) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid header value" }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid header value"sv }; // 3. If this’s guard is "immutable", then throw a TypeError. if (m_guard == Guard::Immutable) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Headers object is immutable" }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Headers object is immutable"sv }; // 4. Otherwise, if this’s guard is "request" and name is a forbidden header name, return. if (m_guard == Guard::Request && Infrastructure::is_forbidden_header_name(name)) @@ -212,13 +212,13 @@ WebIDL::ExceptionOr Headers::append(Infrastructure::Header header) // 2. If name is not a header name or value is not a header value, then throw a TypeError. if (!Infrastructure::is_header_name(name)) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid header name" }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid header name"sv }; if (!Infrastructure::is_header_value(value)) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid header value" }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid header value"sv }; // 3. If headers’s guard is "immutable", then throw a TypeError. if (m_guard == Guard::Immutable) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Headers object is immutable" }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Headers object is immutable"sv }; // 4. Otherwise, if headers’s guard is "request" and name is a forbidden header name, return. if (m_guard == Guard::Request && Infrastructure::is_forbidden_header_name(name)) @@ -274,7 +274,7 @@ WebIDL::ExceptionOr Headers::fill(HeadersInit const& object) for (auto const& entry : object) { // 1. If header does not contain exactly two items, then throw a TypeError. if (entry.size() != 2) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Array must contain header key/value pair" }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Array must contain header key/value pair"sv }; // 2. Append (header’s first item, header’s second item) to headers. auto header = TRY_OR_RETURN_OOM(realm(), Infrastructure::Header::from_string_pair(entry[0], entry[1].bytes())); diff --git a/Userland/Libraries/LibWeb/URL/URL.cpp b/Userland/Libraries/LibWeb/URL/URL.cpp index 62f9210f26..09bb522f9e 100644 --- a/Userland/Libraries/LibWeb/URL/URL.cpp +++ b/Userland/Libraries/LibWeb/URL/URL.cpp @@ -26,7 +26,7 @@ WebIDL::ExceptionOr> URL::construct_impl(JS::Realm& realm, parsed_base = base; // 2. If parsedBase is failure, then throw a TypeError. if (!parsed_base->is_valid()) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid base URL" }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid base URL"sv }; } // 3. Let parsedURL be the result of running the basic URL parser on url with parsedBase. AK::URL parsed_url; @@ -36,7 +36,7 @@ WebIDL::ExceptionOr> URL::construct_impl(JS::Realm& realm, parsed_url = url; // 4. If parsedURL is failure, then throw a TypeError. if (!parsed_url.is_valid()) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid URL" }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid URL"sv }; // 5. Let query be parsedURL’s query, if that is non-null, and the empty string otherwise. auto& query = parsed_url.query().is_null() ? String::empty() : parsed_url.query(); // 6. Set this’s URL to parsedURL. @@ -84,7 +84,7 @@ WebIDL::ExceptionOr URL::set_href(String const& href) AK::URL parsed_url = href; // 2. If parsedURL is failure, then throw a TypeError. if (!parsed_url.is_valid()) - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid URL" }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid URL"sv }; // 3. Set this’s URL to parsedURL. m_url = move(parsed_url); // 4. Empty this’s query object’s list. diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index 8ea8645172..001512452b 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -163,7 +163,7 @@ WebIDL::ExceptionOr XMLHttpRequest::response() // 7. Otherwise, if this’s response type is "document", set a document response for this. else if (m_response_type == Bindings::XMLHttpRequestResponseType::Document) { // FIXME: Implement this. - return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "XHR Document type not implemented" }; + return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "XHR Document type not implemented"sv }; } // 8. Otherwise: else {