Skip to content

Commit 27e1f47

Browse files
shannonboothADKaster
authored andcommitted
LibURL: Add BlobURLEntry to URL
1 parent ec381c1 commit 27e1f47

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Userland/Libraries/LibURL/Forward.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@
99
namespace URL {
1010
class URL;
1111
class Parser;
12+
13+
struct BlobURLEntry;
1214
}

Userland/Libraries/LibURL/URL.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ enum class ApplyPercentDecoding {
5858
No
5959
};
6060

61+
// https://w3c.github.io/FileAPI/#blob-url-entry
62+
// NOTE: This represents the raw bytes behind a 'Blob' (and does not yet support a MediaSourceQuery).
63+
struct BlobURLEntry {
64+
String type;
65+
ByteBuffer byte_buffer;
66+
};
67+
6168
void append_percent_encoded_if_necessary(StringBuilder&, u32 code_point, PercentEncodeSet set = PercentEncodeSet::Userinfo);
6269
void append_percent_encoded(StringBuilder&, u32 code_point);
6370
bool code_point_is_in_percent_encode_set(u32 code_point, PercentEncodeSet);
@@ -143,6 +150,9 @@ class URL {
143150
String const& raw_username() const { return m_username; }
144151
String const& raw_password() const { return m_password; }
145152

153+
Optional<BlobURLEntry> const& blob_url_entry() const { return m_blob_url_entry; }
154+
void set_blob_url_entry(Optional<BlobURLEntry> entry) { m_blob_url_entry = move(entry); }
155+
146156
private:
147157
bool compute_validity() const;
148158

@@ -174,6 +184,10 @@ class URL {
174184
Optional<String> m_fragment;
175185

176186
bool m_cannot_be_a_base_url { false };
187+
188+
// https://url.spec.whatwg.org/#concept-url-blob-entry
189+
// A URL also has an associated blob URL entry that is either null or a blob URL entry. It is initially null.
190+
Optional<BlobURLEntry> m_blob_url_entry;
177191
};
178192

179193
URL create_with_url_or_path(ByteString const&);

0 commit comments

Comments
 (0)