From 278061e8b90d95ec2dc69df11b81282db5a5f127 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Wed, 6 Sep 2023 16:06:53 +1200 Subject: [PATCH] LibWeb: Port TextDecoder interface from DeprecatedString to String --- Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp | 8 ++++---- Userland/Libraries/LibWeb/Encoding/TextDecoder.h | 10 +++++----- Userland/Libraries/LibWeb/Encoding/TextDecoder.idl | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp b/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp index 7e0ad625a1..64ef50e016 100644 --- a/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp +++ b/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include #include @@ -12,7 +12,7 @@ namespace Web::Encoding { -WebIDL::ExceptionOr> TextDecoder::construct_impl(JS::Realm& realm, DeprecatedFlyString encoding) +WebIDL::ExceptionOr> TextDecoder::construct_impl(JS::Realm& realm, FlyString encoding) { auto& vm = realm.vm(); @@ -24,7 +24,7 @@ WebIDL::ExceptionOr> TextDecoder::construct_impl(J } // https://encoding.spec.whatwg.org/#dom-textdecoder -TextDecoder::TextDecoder(JS::Realm& realm, TextCodec::Decoder& decoder, DeprecatedFlyString encoding, bool fatal, bool ignore_bom) +TextDecoder::TextDecoder(JS::Realm& realm, TextCodec::Decoder& decoder, FlyString encoding, bool fatal, bool ignore_bom) : PlatformObject(realm) , m_decoder(decoder) , m_encoding(move(encoding)) @@ -42,7 +42,7 @@ void TextDecoder::initialize(JS::Realm& realm) } // https://encoding.spec.whatwg.org/#dom-textdecoder-decode -WebIDL::ExceptionOr TextDecoder::decode(Optional> const& input) const +WebIDL::ExceptionOr TextDecoder::decode(Optional> const& input) const { if (!input.has_value()) return TRY_OR_THROW_OOM(vm(), m_decoder.to_utf8({})); diff --git a/Userland/Libraries/LibWeb/Encoding/TextDecoder.h b/Userland/Libraries/LibWeb/Encoding/TextDecoder.h index c4b8f508da..5d12a3c1c0 100644 --- a/Userland/Libraries/LibWeb/Encoding/TextDecoder.h +++ b/Userland/Libraries/LibWeb/Encoding/TextDecoder.h @@ -21,24 +21,24 @@ class TextDecoder : public Bindings::PlatformObject { WEB_PLATFORM_OBJECT(TextDecoder, Bindings::PlatformObject); public: - static WebIDL::ExceptionOr> construct_impl(JS::Realm&, DeprecatedFlyString encoding); + static WebIDL::ExceptionOr> construct_impl(JS::Realm&, FlyString encoding); virtual ~TextDecoder() override; - WebIDL::ExceptionOr decode(Optional> const&) const; + WebIDL::ExceptionOr decode(Optional> const&) const; - DeprecatedFlyString const& encoding() const { return m_encoding; } + FlyString const& encoding() const { return m_encoding; } bool fatal() const { return m_fatal; } bool ignore_bom() const { return m_ignore_bom; } private: // https://encoding.spec.whatwg.org/#dom-textdecoder - TextDecoder(JS::Realm&, TextCodec::Decoder&, DeprecatedFlyString encoding, bool fatal, bool ignore_bom); + TextDecoder(JS::Realm&, TextCodec::Decoder&, FlyString encoding, bool fatal, bool ignore_bom); virtual void initialize(JS::Realm&) override; TextCodec::Decoder& m_decoder; - DeprecatedFlyString m_encoding; + FlyString m_encoding; bool m_fatal { false }; bool m_ignore_bom { false }; }; diff --git a/Userland/Libraries/LibWeb/Encoding/TextDecoder.idl b/Userland/Libraries/LibWeb/Encoding/TextDecoder.idl index 5b669c88d7..acded928c7 100644 --- a/Userland/Libraries/LibWeb/Encoding/TextDecoder.idl +++ b/Userland/Libraries/LibWeb/Encoding/TextDecoder.idl @@ -1,4 +1,4 @@ -[Exposed=(Window,Worker), UseDeprecatedAKString] +[Exposed=(Window,Worker)] interface TextDecoder { // FIXME: 'optional TextDecoderOptions options = {}' constructor(optional DOMString label = "utf-8");