mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-08 05:27:14 +09:00
Everywhere: Remove DeprecatedFlyString + any remaining references to it
This reverts commit 7c32d1e8a5
.
This commit is contained in:
parent
4136d8d13e
commit
82a2ae99c8
Notes:
github-actions[bot]
2025-04-02 09:44:09 +00:00
Author: https://github.com/alimpfard
Commit: 82a2ae99c8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4181
22 changed files with 13 additions and 297 deletions
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
#include <AK/ByteString.h>
|
#include <AK/ByteString.h>
|
||||||
#include <AK/DeprecatedFlyString.h>
|
#include <AK/FlyString.h>
|
||||||
#include <AK/Format.h>
|
#include <AK/Format.h>
|
||||||
#include <AK/Function.h>
|
#include <AK/Function.h>
|
||||||
#include <AK/StdLibExtras.h>
|
#include <AK/StdLibExtras.h>
|
||||||
|
@ -16,11 +16,6 @@
|
||||||
|
|
||||||
namespace AK {
|
namespace AK {
|
||||||
|
|
||||||
bool ByteString::operator==(DeprecatedFlyString const& fly_string) const
|
|
||||||
{
|
|
||||||
return m_impl == fly_string.impl() || view() == fly_string.view();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ByteString::operator==(ByteString const& other) const
|
bool ByteString::operator==(ByteString const& other) const
|
||||||
{
|
{
|
||||||
return m_impl == other.impl() || view() == other.view();
|
return m_impl == other.impl() || view() == other.view();
|
||||||
|
@ -337,8 +332,8 @@ ByteString escape_html_entities(StringView html)
|
||||||
return builder.to_byte_string();
|
return builder.to_byte_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteString::ByteString(DeprecatedFlyString const& string)
|
ByteString::ByteString(FlyString const& string)
|
||||||
: m_impl(string.impl())
|
: m_impl(*StringImpl::create(string.bytes()))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteString(DeprecatedFlyString const&);
|
ByteString(FlyString const&);
|
||||||
|
|
||||||
static ErrorOr<ByteString> from_utf8(ReadonlyBytes);
|
static ErrorOr<ByteString> from_utf8(ReadonlyBytes);
|
||||||
static ErrorOr<ByteString> from_utf8(StringView string) { return from_utf8(string.bytes()); }
|
static ErrorOr<ByteString> from_utf8(StringView string) { return from_utf8(string.bytes()); }
|
||||||
|
@ -228,8 +228,6 @@ public:
|
||||||
|
|
||||||
bool operator==(StringView) const;
|
bool operator==(StringView) const;
|
||||||
|
|
||||||
bool operator==(DeprecatedFlyString const&) const;
|
|
||||||
|
|
||||||
bool operator<(ByteString const&) const;
|
bool operator<(ByteString const&) const;
|
||||||
bool operator>=(ByteString const& other) const { return !(*this < other); }
|
bool operator>=(ByteString const& other) const { return !(*this < other); }
|
||||||
bool operator>=(char const* other) const { return !(*this < other); }
|
bool operator>=(char const* other) const { return !(*this < other); }
|
||||||
|
|
|
@ -5,7 +5,6 @@ set(SOURCES
|
||||||
ConstrainedStream.cpp
|
ConstrainedStream.cpp
|
||||||
CountingStream.cpp
|
CountingStream.cpp
|
||||||
DOSPackedTime.cpp
|
DOSPackedTime.cpp
|
||||||
DeprecatedFlyString.cpp
|
|
||||||
ByteString.cpp
|
ByteString.cpp
|
||||||
Error.cpp
|
Error.cpp
|
||||||
FloatingPointStringConversions.cpp
|
FloatingPointStringConversions.cpp
|
||||||
|
|
|
@ -1,108 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2020, Andreas Kling <andreas@ladybird.org>
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <AK/ByteString.h>
|
|
||||||
#include <AK/DeprecatedFlyString.h>
|
|
||||||
#include <AK/HashTable.h>
|
|
||||||
#include <AK/Optional.h>
|
|
||||||
#include <AK/Singleton.h>
|
|
||||||
#include <AK/StringUtils.h>
|
|
||||||
#include <AK/StringView.h>
|
|
||||||
|
|
||||||
namespace AK {
|
|
||||||
|
|
||||||
struct DeprecatedFlyStringImplTraits : public Traits<StringImpl const*> {
|
|
||||||
static unsigned hash(StringImpl const* s) { return s->hash(); }
|
|
||||||
static bool equals(StringImpl const* a, StringImpl const* b)
|
|
||||||
{
|
|
||||||
return *a == *b;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static Singleton<HashTable<StringImpl const*, DeprecatedFlyStringImplTraits>> s_table;
|
|
||||||
|
|
||||||
static HashTable<StringImpl const*, DeprecatedFlyStringImplTraits>& fly_impls()
|
|
||||||
{
|
|
||||||
return *s_table;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DeprecatedFlyString::did_destroy_impl(Badge<StringImpl>, StringImpl& impl)
|
|
||||||
{
|
|
||||||
fly_impls().remove(&impl);
|
|
||||||
}
|
|
||||||
|
|
||||||
DeprecatedFlyString::DeprecatedFlyString(ByteString const& string)
|
|
||||||
: m_impl(string.impl())
|
|
||||||
{
|
|
||||||
if (string.impl()->is_fly())
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto it = fly_impls().find(string.impl());
|
|
||||||
if (it == fly_impls().end()) {
|
|
||||||
fly_impls().set(string.impl());
|
|
||||||
string.impl()->set_fly({}, true);
|
|
||||||
m_impl = string.impl();
|
|
||||||
} else {
|
|
||||||
VERIFY((*it)->is_fly());
|
|
||||||
m_impl = **it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DeprecatedFlyString::DeprecatedFlyString(StringView string)
|
|
||||||
: m_impl(StringImpl::the_empty_stringimpl())
|
|
||||||
{
|
|
||||||
if (string.is_null())
|
|
||||||
return;
|
|
||||||
auto it = fly_impls().find(string.hash(), [&](auto& candidate) {
|
|
||||||
return string == *candidate;
|
|
||||||
});
|
|
||||||
if (it == fly_impls().end()) {
|
|
||||||
auto new_string = string.to_byte_string();
|
|
||||||
fly_impls().set(new_string.impl());
|
|
||||||
new_string.impl()->set_fly({}, true);
|
|
||||||
m_impl = new_string.impl();
|
|
||||||
} else {
|
|
||||||
VERIFY((*it)->is_fly());
|
|
||||||
m_impl = **it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DeprecatedFlyString::equals_ignoring_ascii_case(StringView other) const
|
|
||||||
{
|
|
||||||
return StringUtils::equals_ignoring_ascii_case(view(), other);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DeprecatedFlyString::starts_with(StringView str, CaseSensitivity case_sensitivity) const
|
|
||||||
{
|
|
||||||
return StringUtils::starts_with(view(), str, case_sensitivity);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DeprecatedFlyString::ends_with(StringView str, CaseSensitivity case_sensitivity) const
|
|
||||||
{
|
|
||||||
return StringUtils::ends_with(view(), str, case_sensitivity);
|
|
||||||
}
|
|
||||||
|
|
||||||
DeprecatedFlyString DeprecatedFlyString::to_lowercase() const
|
|
||||||
{
|
|
||||||
return ByteString(*m_impl).to_lowercase();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DeprecatedFlyString::operator==(ByteString const& other) const
|
|
||||||
{
|
|
||||||
return m_impl == other.impl() || view() == other.view();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DeprecatedFlyString::operator==(StringView string) const
|
|
||||||
{
|
|
||||||
return view() == string;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DeprecatedFlyString::operator==(char const* string) const
|
|
||||||
{
|
|
||||||
return view() == string;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,105 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2020, Andreas Kling <andreas@ladybird.org>
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <AK/ByteString.h>
|
|
||||||
#include <AK/StringUtils.h>
|
|
||||||
|
|
||||||
namespace AK {
|
|
||||||
|
|
||||||
class DeprecatedFlyString {
|
|
||||||
public:
|
|
||||||
DeprecatedFlyString()
|
|
||||||
: m_impl(StringImpl::the_empty_stringimpl())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
DeprecatedFlyString(DeprecatedFlyString const& other)
|
|
||||||
: m_impl(other.impl())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
DeprecatedFlyString(DeprecatedFlyString&& other)
|
|
||||||
: m_impl(move(other.m_impl))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
DeprecatedFlyString(ByteString const&);
|
|
||||||
DeprecatedFlyString(StringView);
|
|
||||||
DeprecatedFlyString(char const* string)
|
|
||||||
: DeprecatedFlyString(static_cast<ByteString>(string))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static DeprecatedFlyString from_fly_impl(NonnullRefPtr<StringImpl const> impl)
|
|
||||||
{
|
|
||||||
VERIFY(impl->is_fly());
|
|
||||||
DeprecatedFlyString string;
|
|
||||||
string.m_impl = move(impl);
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
|
|
||||||
DeprecatedFlyString& operator=(DeprecatedFlyString const& other)
|
|
||||||
{
|
|
||||||
m_impl = other.m_impl;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
DeprecatedFlyString& operator=(DeprecatedFlyString&& other)
|
|
||||||
{
|
|
||||||
m_impl = move(other.m_impl);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_empty() const { return !m_impl->length(); }
|
|
||||||
|
|
||||||
bool operator==(DeprecatedFlyString const& other) const { return m_impl == other.m_impl; }
|
|
||||||
|
|
||||||
bool operator==(ByteString const&) const;
|
|
||||||
|
|
||||||
bool operator==(StringView) const;
|
|
||||||
|
|
||||||
bool operator==(char const*) const;
|
|
||||||
|
|
||||||
NonnullRefPtr<StringImpl const> impl() const { return m_impl; }
|
|
||||||
char const* characters() const { return m_impl->characters(); }
|
|
||||||
size_t length() const { return m_impl->length(); }
|
|
||||||
|
|
||||||
ALWAYS_INLINE u32 hash() const { return m_impl->existing_hash(); }
|
|
||||||
ALWAYS_INLINE StringView view() const { return m_impl->view(); }
|
|
||||||
|
|
||||||
DeprecatedFlyString to_lowercase() const;
|
|
||||||
|
|
||||||
template<Arithmetic T>
|
|
||||||
Optional<T> to_number(TrimWhitespace trim_whitespace = TrimWhitespace::Yes) const
|
|
||||||
{
|
|
||||||
return view().to_number<T>(trim_whitespace);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool equals_ignoring_ascii_case(StringView) const;
|
|
||||||
bool starts_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
|
|
||||||
bool ends_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
|
|
||||||
|
|
||||||
static void did_destroy_impl(Badge<StringImpl>, StringImpl&);
|
|
||||||
|
|
||||||
template<typename... Ts>
|
|
||||||
[[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of(Ts&&... strings) const
|
|
||||||
{
|
|
||||||
return (... || this->operator==(forward<Ts>(strings)));
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
NonnullRefPtr<StringImpl const> m_impl;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<>
|
|
||||||
struct Traits<DeprecatedFlyString> : public DefaultTraits<DeprecatedFlyString> {
|
|
||||||
static unsigned hash(DeprecatedFlyString const& s) { return s.hash(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#if USING_AK_GLOBALLY
|
|
||||||
using AK::DeprecatedFlyString;
|
|
||||||
#endif
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
}
|
}
|
||||||
static Error from_string_view(StringView string_literal) { return Error(string_literal); }
|
static Error from_string_view(StringView string_literal) { return Error(string_literal); }
|
||||||
|
|
||||||
template<OneOf<ByteString, DeprecatedFlyString, String, FlyString> T>
|
template<OneOf<ByteString, String, FlyString> T>
|
||||||
static Error from_string_view(T)
|
static Error from_string_view(T)
|
||||||
{
|
{
|
||||||
// `Error::from_string_view(ByteString::formatted(...))` is a somewhat common mistake, which leads to a UAF situation.
|
// `Error::from_string_view(ByteString::formatted(...))` is a somewhat common mistake, which leads to a UAF situation.
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/DeprecatedFlyString.h>
|
|
||||||
#include <AK/FlyString.h>
|
#include <AK/FlyString.h>
|
||||||
#include <AK/HashTable.h>
|
#include <AK/HashTable.h>
|
||||||
#include <AK/Singleton.h>
|
#include <AK/Singleton.h>
|
||||||
|
@ -120,16 +119,6 @@ size_t FlyString::number_of_fly_strings()
|
||||||
return all_fly_strings().size();
|
return all_fly_strings().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedFlyString FlyString::to_deprecated_fly_string() const
|
|
||||||
{
|
|
||||||
return DeprecatedFlyString(bytes_as_string_view());
|
|
||||||
}
|
|
||||||
|
|
||||||
ErrorOr<FlyString> FlyString::from_deprecated_fly_string(DeprecatedFlyString const& deprecated_fly_string)
|
|
||||||
{
|
|
||||||
return FlyString::from_utf8(deprecated_fly_string.view());
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned Traits<FlyString>::hash(FlyString const& fly_string)
|
unsigned Traits<FlyString>::hash(FlyString const& fly_string)
|
||||||
{
|
{
|
||||||
return fly_string.hash();
|
return fly_string.hash();
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
static ErrorOr<FlyString> from_utf8(StringView);
|
static ErrorOr<FlyString> from_utf8(StringView);
|
||||||
static FlyString from_utf8_without_validation(ReadonlyBytes);
|
static FlyString from_utf8_without_validation(ReadonlyBytes);
|
||||||
template<typename T>
|
template<typename T>
|
||||||
requires(IsOneOf<RemoveCVReference<T>, ByteString, DeprecatedFlyString, FlyString, String>)
|
requires(IsOneOf<RemoveCVReference<T>, ByteString, FlyString, String>)
|
||||||
static ErrorOr<String> from_utf8(T&&) = delete;
|
static ErrorOr<String> from_utf8(T&&) = delete;
|
||||||
|
|
||||||
FlyString(String const&);
|
FlyString(String const&);
|
||||||
|
@ -55,9 +55,6 @@ public:
|
||||||
// This is primarily interesting to unit tests.
|
// This is primarily interesting to unit tests.
|
||||||
[[nodiscard]] static size_t number_of_fly_strings();
|
[[nodiscard]] static size_t number_of_fly_strings();
|
||||||
|
|
||||||
// FIXME: Remove these once all code has been ported to FlyString
|
|
||||||
[[nodiscard]] DeprecatedFlyString to_deprecated_fly_string() const;
|
|
||||||
static ErrorOr<FlyString> from_deprecated_fly_string(DeprecatedFlyString const&);
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
requires(IsSame<RemoveCVReference<T>, StringView>)
|
requires(IsSame<RemoveCVReference<T>, StringView>)
|
||||||
static ErrorOr<String> from_deprecated_fly_string(T&&) = delete;
|
static ErrorOr<String> from_deprecated_fly_string(T&&) = delete;
|
||||||
|
|
|
@ -496,9 +496,6 @@ struct Formatter<unsigned char[Size]> : Formatter<StringView> {
|
||||||
template<>
|
template<>
|
||||||
struct Formatter<ByteString> : Formatter<StringView> {
|
struct Formatter<ByteString> : Formatter<StringView> {
|
||||||
};
|
};
|
||||||
template<>
|
|
||||||
struct Formatter<DeprecatedFlyString> : Formatter<StringView> {
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct Formatter<T*> : StandardFormatter {
|
struct Formatter<T*> : StandardFormatter {
|
||||||
|
|
|
@ -29,7 +29,6 @@ using ByteBuffer = Detail::ByteBuffer<32>;
|
||||||
class CircularBuffer;
|
class CircularBuffer;
|
||||||
class ConstrainedStream;
|
class ConstrainedStream;
|
||||||
class CountingStream;
|
class CountingStream;
|
||||||
class DeprecatedFlyString;
|
|
||||||
class ByteString;
|
class ByteString;
|
||||||
class Duration;
|
class Duration;
|
||||||
class Error;
|
class Error;
|
||||||
|
@ -161,7 +160,6 @@ using AK::CircularBuffer;
|
||||||
using AK::CircularQueue;
|
using AK::CircularQueue;
|
||||||
using AK::ConstrainedStream;
|
using AK::ConstrainedStream;
|
||||||
using AK::CountingStream;
|
using AK::CountingStream;
|
||||||
using AK::DeprecatedFlyString;
|
|
||||||
using AK::DoublyLinkedList;
|
using AK::DoublyLinkedList;
|
||||||
using AK::Error;
|
using AK::Error;
|
||||||
using AK::ErrorOr;
|
using AK::ErrorOr;
|
||||||
|
|
|
@ -60,7 +60,7 @@ public:
|
||||||
[[nodiscard]] static String from_utf8_with_replacement_character(StringView, WithBOMHandling = WithBOMHandling::Yes);
|
[[nodiscard]] static String from_utf8_with_replacement_character(StringView, WithBOMHandling = WithBOMHandling::Yes);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
requires(IsOneOf<RemoveCVReference<T>, ByteString, DeprecatedFlyString, FlyString, String>)
|
requires(IsOneOf<RemoveCVReference<T>, ByteString, FlyString, String>)
|
||||||
static ErrorOr<String> from_utf8(T&&) = delete;
|
static ErrorOr<String> from_utf8(T&&) = delete;
|
||||||
|
|
||||||
[[nodiscard]] static String from_utf8_without_validation(ReadonlyBytes);
|
[[nodiscard]] static String from_utf8_without_validation(ReadonlyBytes);
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/CharacterTypes.h>
|
#include <AK/CharacterTypes.h>
|
||||||
#include <AK/DeprecatedFlyString.h>
|
|
||||||
#include <AK/StringHash.h>
|
#include <AK/StringHash.h>
|
||||||
#include <AK/StringImpl.h>
|
#include <AK/StringImpl.h>
|
||||||
#include <AK/kmalloc.h>
|
#include <AK/kmalloc.h>
|
||||||
|
@ -28,11 +27,7 @@ StringImpl::StringImpl(ConstructWithInlineBufferTag, size_t length)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
StringImpl::~StringImpl()
|
StringImpl::~StringImpl() = default;
|
||||||
{
|
|
||||||
if (m_fly)
|
|
||||||
DeprecatedFlyString::did_destroy_impl({}, *this);
|
|
||||||
}
|
|
||||||
|
|
||||||
NonnullRefPtr<StringImpl const> StringImpl::create_uninitialized(size_t length, char*& buffer)
|
NonnullRefPtr<StringImpl const> StringImpl::create_uninitialized(size_t length, char*& buffer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,9 +77,6 @@ public:
|
||||||
|
|
||||||
unsigned case_insensitive_hash() const;
|
unsigned case_insensitive_hash() const;
|
||||||
|
|
||||||
bool is_fly() const { return m_fly; }
|
|
||||||
void set_fly(Badge<DeprecatedFlyString>, bool fly) const { m_fly = fly; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum ConstructTheEmptyStringImplTag {
|
enum ConstructTheEmptyStringImplTag {
|
||||||
ConstructTheEmptyStringImpl
|
ConstructTheEmptyStringImpl
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <AK/AnyOf.h>
|
#include <AK/AnyOf.h>
|
||||||
#include <AK/ByteBuffer.h>
|
#include <AK/ByteBuffer.h>
|
||||||
#include <AK/ByteString.h>
|
#include <AK/ByteString.h>
|
||||||
#include <AK/DeprecatedFlyString.h>
|
|
||||||
#include <AK/Find.h>
|
#include <AK/Find.h>
|
||||||
#include <AK/FlyString.h>
|
#include <AK/FlyString.h>
|
||||||
#include <AK/Function.h>
|
#include <AK/Function.h>
|
||||||
|
@ -36,12 +35,6 @@ StringView::StringView(ByteString const& string)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
StringView::StringView(DeprecatedFlyString const& string)
|
|
||||||
: m_characters(string.characters())
|
|
||||||
, m_length(string.length())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
StringView::StringView(ByteBuffer const& buffer)
|
StringView::StringView(ByteBuffer const& buffer)
|
||||||
: m_characters((char const*)buffer.data())
|
: m_characters((char const*)buffer.data())
|
||||||
, m_length(buffer.size())
|
, m_length(buffer.size())
|
||||||
|
|
|
@ -51,15 +51,13 @@ public:
|
||||||
StringView(String const&);
|
StringView(String const&);
|
||||||
StringView(FlyString const&);
|
StringView(FlyString const&);
|
||||||
StringView(ByteString const&);
|
StringView(ByteString const&);
|
||||||
StringView(DeprecatedFlyString const&);
|
|
||||||
|
|
||||||
explicit StringView(ByteBuffer&&) = delete;
|
explicit StringView(ByteBuffer&&) = delete;
|
||||||
explicit StringView(String&&) = delete;
|
explicit StringView(String&&) = delete;
|
||||||
explicit StringView(FlyString&&) = delete;
|
explicit StringView(FlyString&&) = delete;
|
||||||
explicit StringView(ByteString&&) = delete;
|
explicit StringView(ByteString&&) = delete;
|
||||||
explicit StringView(DeprecatedFlyString&&) = delete;
|
|
||||||
|
|
||||||
template<OneOf<String, FlyString, ByteString, DeprecatedFlyString, ByteBuffer> StringType>
|
template<OneOf<String, FlyString, ByteString, ByteBuffer> StringType>
|
||||||
StringView& operator=(StringType&&) = delete;
|
StringView& operator=(StringType&&) = delete;
|
||||||
|
|
||||||
[[nodiscard]] constexpr bool is_null() const
|
[[nodiscard]] constexpr bool is_null() const
|
||||||
|
|
|
@ -659,7 +659,7 @@ void VM::load_imported_module(ImportedModuleReferrer referrer, ModuleRequest con
|
||||||
});
|
});
|
||||||
|
|
||||||
LexicalPath base_path { base_filename };
|
LexicalPath base_path { base_filename };
|
||||||
auto filename = LexicalPath::absolute_path(base_path.dirname(), module_request.module_specifier.to_deprecated_fly_string());
|
auto filename = LexicalPath::absolute_path(base_path.dirname(), module_request.module_specifier);
|
||||||
|
|
||||||
dbgln_if(JS_MODULE_DEBUG, "[JS MODULE] base path: '{}'", base_path);
|
dbgln_if(JS_MODULE_DEBUG, "[JS MODULE] base path: '{}'", base_path);
|
||||||
dbgln_if(JS_MODULE_DEBUG, "[JS MODULE] initial filename: '{}'", filename);
|
dbgln_if(JS_MODULE_DEBUG, "[JS MODULE] initial filename: '{}'", filename);
|
||||||
|
|
|
@ -2100,7 +2100,7 @@ WebIDL::ExceptionOr<GC::Ref<Element>> Document::create_element(String const& a_l
|
||||||
namespace_ = Namespace::HTML;
|
namespace_ = Namespace::HTML;
|
||||||
|
|
||||||
// 6. Return the result of creating an element given this, localName, namespace, null, is, and with the synchronous custom elements flag set.
|
// 6. Return the result of creating an element given this, localName, namespace, null, is, and with the synchronous custom elements flag set.
|
||||||
return TRY(DOM::create_element(*this, MUST(FlyString::from_deprecated_fly_string(local_name)), move(namespace_), {}, move(is_value), true));
|
return TRY(DOM::create_element(*this, FlyString::from_utf8_without_validation(local_name.bytes()), move(namespace_), {}, move(is_value), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-document-createelementns
|
// https://dom.spec.whatwg.org/#dom-document-createelementns
|
||||||
|
|
|
@ -2206,7 +2206,7 @@ GC::Ref<Node> Node::get_root_node(GetRootNodeOptions const& options)
|
||||||
String Node::debug_description() const
|
String Node::debug_description() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
builder.append(node_name().to_deprecated_fly_string().to_lowercase());
|
builder.append(node_name().to_ascii_lowercase());
|
||||||
if (is_element()) {
|
if (is_element()) {
|
||||||
auto const& element = static_cast<DOM::Element const&>(*this);
|
auto const& element = static_cast<DOM::Element const&>(*this);
|
||||||
if (element.id().has_value())
|
if (element.id().has_value())
|
||||||
|
|
|
@ -61,8 +61,6 @@ shared_library("AK") {
|
||||||
"DateConstants.h",
|
"DateConstants.h",
|
||||||
"DefaultDelete.h",
|
"DefaultDelete.h",
|
||||||
"Demangle.h",
|
"Demangle.h",
|
||||||
"DeprecatedFlyString.cpp",
|
|
||||||
"DeprecatedFlyString.h",
|
|
||||||
"Diagnostics.h",
|
"Diagnostics.h",
|
||||||
"DisjointChunks.h",
|
"DisjointChunks.h",
|
||||||
"DistinctNumeric.h",
|
"DistinctNumeric.h",
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#include <LibTest/TestCase.h>
|
#include <LibTest/TestCase.h>
|
||||||
|
|
||||||
#include <AK/ByteString.h>
|
#include <AK/ByteString.h>
|
||||||
#include <AK/DeprecatedFlyString.h>
|
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
@ -139,26 +138,6 @@ TEST_CASE(to_uppercase)
|
||||||
EXPECT(ByteString("AbC").to_uppercase() == "ABC");
|
EXPECT(ByteString("AbC").to_uppercase() == "ABC");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE(flystring)
|
|
||||||
{
|
|
||||||
{
|
|
||||||
DeprecatedFlyString a("foo");
|
|
||||||
DeprecatedFlyString b("foo");
|
|
||||||
EXPECT_EQ(a.impl(), b.impl());
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
ByteString a = "foo";
|
|
||||||
DeprecatedFlyString b = a;
|
|
||||||
StringBuilder builder;
|
|
||||||
builder.append('f');
|
|
||||||
builder.append("oo"sv);
|
|
||||||
DeprecatedFlyString c = builder.to_byte_string();
|
|
||||||
EXPECT_EQ(a.impl(), b.impl());
|
|
||||||
EXPECT_EQ(a.impl(), c.impl());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE(replace)
|
TEST_CASE(replace)
|
||||||
{
|
{
|
||||||
ByteString test_string = "Well, hello Friends!";
|
ByteString test_string = "Well, hello Friends!";
|
||||||
|
|
|
@ -23,11 +23,7 @@ TEST_CASE(hash_compatible)
|
||||||
static_assert(AK::Concepts::HashCompatible<FlyString, StringView>);
|
static_assert(AK::Concepts::HashCompatible<FlyString, StringView>);
|
||||||
|
|
||||||
static_assert(AK::Concepts::HashCompatible<ByteString, StringView>);
|
static_assert(AK::Concepts::HashCompatible<ByteString, StringView>);
|
||||||
static_assert(AK::Concepts::HashCompatible<ByteString, DeprecatedFlyString>);
|
|
||||||
static_assert(AK::Concepts::HashCompatible<StringView, ByteString>);
|
static_assert(AK::Concepts::HashCompatible<StringView, ByteString>);
|
||||||
static_assert(AK::Concepts::HashCompatible<StringView, DeprecatedFlyString>);
|
|
||||||
static_assert(AK::Concepts::HashCompatible<DeprecatedFlyString, ByteString>);
|
|
||||||
static_assert(AK::Concepts::HashCompatible<DeprecatedFlyString, StringView>);
|
|
||||||
|
|
||||||
static_assert(AK::Concepts::HashCompatible<StringView, ByteBuffer>);
|
static_assert(AK::Concepts::HashCompatible<StringView, ByteBuffer>);
|
||||||
static_assert(AK::Concepts::HashCompatible<ByteBuffer, StringView>);
|
static_assert(AK::Concepts::HashCompatible<ByteBuffer, StringView>);
|
||||||
|
|
|
@ -795,7 +795,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
|
||||||
for (auto const& name : global_environment.declarative_record().bindings()) {
|
for (auto const& name : global_environment.declarative_record().bindings()) {
|
||||||
if (name.bytes_as_string_view().starts_with(variable_name)) {
|
if (name.bytes_as_string_view().starts_with(variable_name)) {
|
||||||
results.empend(name.to_deprecated_fly_string());
|
results.empend(name);
|
||||||
results.last().invariant_offset = variable_name.bytes().size();
|
results.last().invariant_offset = variable_name.bytes().size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue