1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

LibJS+LibWeb: Remove more uses of DeprecatedFlyString

This commit is contained in:
Andreas Kling 2025-03-24 11:27:27 +00:00 committed by Andreas Kling
parent 46a5710238
commit f1914893e9
Notes: github-actions[bot] 2025-03-24 22:28:20 +00:00
12 changed files with 10 additions and 22 deletions

View file

@ -1336,8 +1336,6 @@ public:
Operand base() const { return m_base; } Operand base() const { return m_base; }
Operand property() const { return m_property; } Operand property() const { return m_property; }
Optional<DeprecatedFlyString const&> base_identifier(Bytecode::Interpreter const&) const;
private: private:
Operand m_dst; Operand m_dst;
Operand m_base; Operand m_base;

View file

@ -338,7 +338,6 @@ private:
NonnullRefPtr<SourceCode const> m_source_code; NonnullRefPtr<SourceCode const> m_source_code;
Vector<Position> m_rule_starts; Vector<Position> m_rule_starts;
ParserState m_state; ParserState m_state;
DeprecatedFlyString m_filename;
Vector<ParserState> m_saved_state; Vector<ParserState> m_saved_state;
HashMap<size_t, TokenMemoization> m_token_memoizations; HashMap<size_t, TokenMemoization> m_token_memoizations;
Program::Type m_program_type; Program::Type m_program_type;

View file

@ -6,7 +6,6 @@
#pragma once #pragma once
#include <AK/DeprecatedFlyString.h>
#include <LibJS/Forward.h> #include <LibJS/Forward.h>
#include <LibJS/Runtime/PropertyKey.h> #include <LibJS/Runtime/PropertyKey.h>

View file

@ -7,7 +7,6 @@
#pragma once #pragma once
#include <AK/DeprecatedFlyString.h>
#include <AK/Optional.h> #include <AK/Optional.h>
#include <AK/Try.h> #include <AK/Try.h>
#include <AK/TypeCasts.h> #include <AK/TypeCasts.h>

View file

@ -8,7 +8,6 @@
#pragma once #pragma once
#include <AK/DeprecatedFlyString.h>
#include <AK/WeakPtr.h> #include <AK/WeakPtr.h>
#include <LibJS/Bytecode/BasicBlock.h> #include <LibJS/Bytecode/BasicBlock.h>
#include <LibJS/Forward.h> #include <LibJS/Forward.h>

View file

@ -229,11 +229,6 @@ GC::Ref<PrimitiveString> PrimitiveString::create(VM& vm, ByteString string)
return *it->value; return *it->value;
} }
GC::Ref<PrimitiveString> PrimitiveString::create(VM& vm, DeprecatedFlyString const& string)
{
return create(vm, ByteString { string });
}
GC::Ref<PrimitiveString> PrimitiveString::create(VM& vm, PrimitiveString& lhs, PrimitiveString& rhs) GC::Ref<PrimitiveString> PrimitiveString::create(VM& vm, PrimitiveString& lhs, PrimitiveString& rhs)
{ {
// We're here to concatenate two strings into a new rope string. // We're here to concatenate two strings into a new rope string.

View file

@ -29,7 +29,6 @@ public:
[[nodiscard]] static GC::Ref<PrimitiveString> create(VM&, String); [[nodiscard]] static GC::Ref<PrimitiveString> create(VM&, String);
[[nodiscard]] static GC::Ref<PrimitiveString> create(VM&, FlyString const&); [[nodiscard]] static GC::Ref<PrimitiveString> create(VM&, FlyString const&);
[[nodiscard]] static GC::Ref<PrimitiveString> create(VM&, ByteString); [[nodiscard]] static GC::Ref<PrimitiveString> create(VM&, ByteString);
[[nodiscard]] static GC::Ref<PrimitiveString> create(VM&, DeprecatedFlyString const&);
[[nodiscard]] static GC::Ref<PrimitiveString> create(VM&, PrimitiveString&, PrimitiveString&); [[nodiscard]] static GC::Ref<PrimitiveString> create(VM&, PrimitiveString&, PrimitiveString&);
[[nodiscard]] static GC::Ref<PrimitiveString> create(VM&, StringView); [[nodiscard]] static GC::Ref<PrimitiveString> create(VM&, StringView);

View file

@ -2923,7 +2923,7 @@ void HTMLTokenizer::switch_to(Badge<HTMLParser>, State new_state)
void HTMLTokenizer::will_emit(HTMLToken& token) void HTMLTokenizer::will_emit(HTMLToken& token)
{ {
if (token.is_start_tag()) if (token.is_start_tag())
m_last_emitted_start_tag_name = token.tag_name().to_deprecated_fly_string(); m_last_emitted_start_tag_name = token.tag_name();
auto is_start_or_end_tag = token.type() == HTMLToken::Type::StartTag || token.type() == HTMLToken::Type::EndTag; auto is_start_or_end_tag = token.type() == HTMLToken::Type::StartTag || token.type() == HTMLToken::Type::EndTag;
token.set_end_position({}, nth_last_position(is_start_or_end_tag ? 1 : 0)); token.set_end_position({}, nth_last_position(is_start_or_end_tag ? 1 : 0));
@ -2937,7 +2937,7 @@ bool HTMLTokenizer::current_end_tag_token_is_appropriate() const
VERIFY(m_current_token.is_end_tag()); VERIFY(m_current_token.is_end_tag());
if (!m_last_emitted_start_tag_name.has_value()) if (!m_last_emitted_start_tag_name.has_value())
return false; return false;
return m_current_token.tag_name().to_deprecated_fly_string() == m_last_emitted_start_tag_name.value(); return m_current_token.tag_name() == m_last_emitted_start_tag_name.value();
} }
bool HTMLTokenizer::consumed_as_part_of_an_attribute() const bool HTMLTokenizer::consumed_as_part_of_an_attribute() const

View file

@ -214,7 +214,7 @@ private:
NamedCharacterReferenceMatcher m_named_character_reference_matcher; NamedCharacterReferenceMatcher m_named_character_reference_matcher;
Optional<ByteString> m_last_emitted_start_tag_name; Optional<FlyString> m_last_emitted_start_tag_name;
bool m_explicit_eof_inserted { false }; bool m_explicit_eof_inserted { false };
bool m_has_emitted_eof { false }; bool m_has_emitted_eof { false };

View file

@ -547,9 +547,9 @@ WebIDL::ExceptionOr<void> serialize_bytes(JS::VM& vm, Vector<u32>& vector, Reado
return {}; return {};
} }
WebIDL::ExceptionOr<void> serialize_string(JS::VM& vm, Vector<u32>& vector, DeprecatedFlyString const& string) WebIDL::ExceptionOr<void> serialize_string(JS::VM& vm, Vector<u32>& vector, StringView string)
{ {
return serialize_bytes(vm, vector, string.view().bytes()); return serialize_bytes(vm, vector, string.bytes());
} }
WebIDL::ExceptionOr<void> serialize_string(JS::VM& vm, Vector<u32>& vector, String const& string) WebIDL::ExceptionOr<void> serialize_string(JS::VM& vm, Vector<u32>& vector, String const& string)

View file

@ -88,7 +88,7 @@ void serialize_enum(SerializationRecord& serialized, T value)
} }
WebIDL::ExceptionOr<void> serialize_bytes(JS::VM& vm, Vector<u32>& vector, ReadonlyBytes bytes); WebIDL::ExceptionOr<void> serialize_bytes(JS::VM& vm, Vector<u32>& vector, ReadonlyBytes bytes);
WebIDL::ExceptionOr<void> serialize_string(JS::VM& vm, Vector<u32>& vector, DeprecatedFlyString const& string); WebIDL::ExceptionOr<void> serialize_string(JS::VM& vm, Vector<u32>& vector, StringView);
WebIDL::ExceptionOr<void> serialize_string(JS::VM& vm, Vector<u32>& vector, String const& string); WebIDL::ExceptionOr<void> serialize_string(JS::VM& vm, Vector<u32>& vector, String const& string);
WebIDL::ExceptionOr<void> serialize_string(JS::VM& vm, Vector<u32>& vector, JS::PrimitiveString const& primitive_string); WebIDL::ExceptionOr<void> serialize_string(JS::VM& vm, Vector<u32>& vector, JS::PrimitiveString const& primitive_string);
WebIDL::ExceptionOr<void> serialize_array_buffer(JS::VM& vm, Vector<u32>& vector, JS::ArrayBuffer const& array_buffer, bool for_storage); WebIDL::ExceptionOr<void> serialize_array_buffer(JS::VM& vm, Vector<u32>& vector, JS::ArrayBuffer const& array_buffer, bool for_storage);

View file

@ -106,7 +106,7 @@ void XMLDocumentBuilder::element_start(const XML::Name& name, HashMap<XML::Name,
if (namespaces.find_if([&](auto const& namespace_and_prefix) { return namespace_and_prefix.prefix == prefix; }) != namespaces.end()) if (namespaces.find_if([&](auto const& namespace_and_prefix) { return namespace_and_prefix.prefix == prefix; }) != namespaces.end())
continue; continue;
namespaces.append({ MUST(FlyString::from_deprecated_fly_string(namespace_)), prefix }); namespaces.append({ FlyString(MUST(String::from_byte_string(namespace_))), prefix });
} }
} }
@ -118,7 +118,7 @@ void XMLDocumentBuilder::element_start(const XML::Name& name, HashMap<XML::Name,
auto namespace_ = namespace_for_element(name); auto namespace_ = namespace_for_element(name);
auto qualified_name_or_error = DOM::validate_and_extract(m_document->realm(), namespace_, MUST(FlyString::from_deprecated_fly_string(name))); auto qualified_name_or_error = DOM::validate_and_extract(m_document->realm(), namespace_, FlyString(MUST(String::from_byte_string(name))));
if (qualified_name_or_error.is_error()) { if (qualified_name_or_error.is_error()) {
m_has_error = true; m_has_error = true;
@ -157,7 +157,7 @@ void XMLDocumentBuilder::element_start(const XML::Name& name, HashMap<XML::Name,
auto name = attribute.key; auto name = attribute.key;
if (!name.is_one_of("xmlns:"sv, "xmlns:xmlns"sv)) { if (!name.is_one_of("xmlns:"sv, "xmlns:xmlns"sv)) {
// The prefix xmlns is used only to declare namespace bindings and is by definition bound to the namespace name http://www.w3.org/2000/xmlns/. // The prefix xmlns is used only to declare namespace bindings and is by definition bound to the namespace name http://www.w3.org/2000/xmlns/.
MUST(node->set_attribute_ns(Namespace::XMLNS, MUST(FlyString::from_deprecated_fly_string(name)), MUST(String::from_byte_string(attribute.value)))); MUST(node->set_attribute_ns(Namespace::XMLNS, MUST(String::from_byte_string(name)), MUST(String::from_byte_string(attribute.value))));
} else { } else {
m_has_error = true; m_has_error = true;
} }
@ -166,7 +166,7 @@ void XMLDocumentBuilder::element_start(const XML::Name& name, HashMap<XML::Name,
m_has_error = true; m_has_error = true;
} }
} }
MUST(node->set_attribute(MUST(FlyString::from_deprecated_fly_string(attribute.key)), MUST(String::from_byte_string(attribute.value)))); MUST(node->set_attribute(MUST(String::from_byte_string(attribute.key)), MUST(String::from_byte_string(attribute.value))));
} }
m_current_node = node.ptr(); m_current_node = node.ptr();