1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

LibWeb: Use StringView literals for all WebIDL::SimpleExceptions

This commit is contained in:
Linus Groh 2022-10-27 23:18:16 +01:00
parent 14d4f227f2
commit 6ce08d3f75
6 changed files with 22 additions and 22 deletions

View file

@ -26,7 +26,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<URL>> 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<JS::NonnullGCPtr<URL>> 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 parsedURLs 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 thiss URL to parsedURL.
@ -84,7 +84,7 @@ WebIDL::ExceptionOr<void> 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 thiss URL to parsedURL.
m_url = move(parsed_url);
// 4. Empty thiss query objects list.