Userland: Avoid some conversions from rvalue strings to StringView

These are all actually fine, there is no UAF here. But once e.g.
`ByteString::view() &&` is deleted, these instances won't compile.
This commit is contained in:
Timothy Flynn 2024-04-03 21:51:34 -04:00 committed by Andreas Kling
commit 683c08744a
Notes: sideshowbarker 2024-07-17 03:59:29 +09:00
17 changed files with 48 additions and 26 deletions

View file

@ -189,7 +189,9 @@ FileFilter HTMLInputElement::parse_accept_attribute() const
// If specified, the attribute must consist of a set of comma-separated tokens, each of which must be an ASCII
// case-insensitive match for one of the following:
get_attribute_value(HTML::AttributeNames::accept).bytes_as_string_view().for_each_split_view(',', SplitBehavior::Nothing, [&](StringView value) {
auto accept = get_attribute_value(HTML::AttributeNames::accept);
accept.bytes_as_string_view().for_each_split_view(',', SplitBehavior::Nothing, [&](StringView value) {
// The string "audio/*"
// Indicates that sound files are accepted.
if (value.equals_ignoring_ascii_case("audio/*"sv))

View file

@ -117,7 +117,9 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> WindowProxy::internal_ge
// 6. If property is undefined and P is in W's document-tree child navigable target name property set, then:
auto navigable_property_set = m_window->document_tree_child_navigable_target_name_property_set();
if (auto navigable = navigable_property_set.get(property_key.to_string().view()); navigable.has_value()) {
auto property_key_string = property_key.to_string();
if (auto navigable = navigable_property_set.get(property_key_string.view()); navigable.has_value()) {
// 1. Let value be the active WindowProxy of the named object of W with the name P.
auto value = navigable.value()->active_window_proxy();