From 27e1f4762c4c50a3439c24bc4c08efc0090c22e1 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Sun, 5 May 2024 20:32:20 +1200 Subject: [PATCH] LibURL: Add BlobURLEntry to URL --- Userland/Libraries/LibURL/Forward.h | 2 ++ Userland/Libraries/LibURL/URL.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/Userland/Libraries/LibURL/Forward.h b/Userland/Libraries/LibURL/Forward.h index 5cfe7221487..10c8c5a70c0 100644 --- a/Userland/Libraries/LibURL/Forward.h +++ b/Userland/Libraries/LibURL/Forward.h @@ -9,4 +9,6 @@ namespace URL { class URL; class Parser; + +struct BlobURLEntry; } diff --git a/Userland/Libraries/LibURL/URL.h b/Userland/Libraries/LibURL/URL.h index 8809a237157..820c1a64917 100644 --- a/Userland/Libraries/LibURL/URL.h +++ b/Userland/Libraries/LibURL/URL.h @@ -58,6 +58,13 @@ enum class ApplyPercentDecoding { No }; +// https://w3c.github.io/FileAPI/#blob-url-entry +// NOTE: This represents the raw bytes behind a 'Blob' (and does not yet support a MediaSourceQuery). +struct BlobURLEntry { + String type; + ByteBuffer byte_buffer; +}; + void append_percent_encoded_if_necessary(StringBuilder&, u32 code_point, PercentEncodeSet set = PercentEncodeSet::Userinfo); void append_percent_encoded(StringBuilder&, u32 code_point); bool code_point_is_in_percent_encode_set(u32 code_point, PercentEncodeSet); @@ -143,6 +150,9 @@ public: String const& raw_username() const { return m_username; } String const& raw_password() const { return m_password; } + Optional const& blob_url_entry() const { return m_blob_url_entry; } + void set_blob_url_entry(Optional entry) { m_blob_url_entry = move(entry); } + private: bool compute_validity() const; @@ -174,6 +184,10 @@ private: Optional m_fragment; bool m_cannot_be_a_base_url { false }; + + // https://url.spec.whatwg.org/#concept-url-blob-entry + // A URL also has an associated blob URL entry that is either null or a blob URL entry. It is initially null. + Optional m_blob_url_entry; }; URL create_with_url_or_path(ByteString const&);