1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:47:44 +00:00

LibWeb: Make HeaderList ref-counted

This is needed to eventually share a header list between a Request or
Response object's internal infra request/response and the object's
exposed Header object.
This commit is contained in:
Linus Groh 2022-09-25 20:52:51 +01:00
parent 2d57d47132
commit afe2563e2b
8 changed files with 61 additions and 46 deletions

View file

@ -35,9 +35,9 @@ public:
virtual ~Headers() override;
[[nodiscard]] Infrastructure::HeaderList& header_list() { return m_header_list; }
[[nodiscard]] Infrastructure::HeaderList const& header_list() const { return m_header_list; }
void set_header_list(Infrastructure::HeaderList header_list) { m_header_list = move(header_list); }
[[nodiscard]] NonnullRefPtr<Infrastructure::HeaderList>& header_list() { return m_header_list; }
[[nodiscard]] NonnullRefPtr<Infrastructure::HeaderList> const& header_list() const { return m_header_list; }
void set_header_list(NonnullRefPtr<Infrastructure::HeaderList> header_list) { m_header_list = move(header_list); }
[[nodiscard]] Guard guard() const { return m_guard; }
void set_guard(Guard guard) { m_guard = guard; }
@ -63,7 +63,7 @@ private:
// https://fetch.spec.whatwg.org/#concept-headers-header-list
// A Headers object has an associated header list (a header list), which is initially empty.
Infrastructure::HeaderList m_header_list;
NonnullRefPtr<Infrastructure::HeaderList> m_header_list;
// https://fetch.spec.whatwg.org/#concept-headers-guard
// A Headers object also has an associated guard, which is a headers guard. A headers guard is "immutable", "request", "request-no-cors", "response" or "none".