1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-03 01:02:06 +00:00

LibWeb: Consistently use the EmptyString state of ReferrerPolicy

We previously used an empty optional to denote that a ReferrerPolicy is
in the default empty string state. However, later additions added an
explicit EmptyString state. This patch moves all users to the explicit
state, and stops using `Optional<ReferrerPolicy>` everywhere except for
when an option not being passed from JavaScript has meaning.
This commit is contained in:
Andrew Kaster 2024-03-05 09:35:25 -07:00 committed by Andreas Kling
parent 637f2f2ed6
commit c79bac70f4
12 changed files with 23 additions and 24 deletions

View file

@ -273,8 +273,8 @@ public:
[[nodiscard]] ReferrerType const& referrer() const { return m_referrer; }
void set_referrer(ReferrerType referrer) { m_referrer = move(referrer); }
[[nodiscard]] Optional<ReferrerPolicy::ReferrerPolicy> const& referrer_policy() const { return m_referrer_policy; }
void set_referrer_policy(Optional<ReferrerPolicy::ReferrerPolicy> referrer_policy) { m_referrer_policy = move(referrer_policy); }
[[nodiscard]] ReferrerPolicy::ReferrerPolicy const& referrer_policy() const { return m_referrer_policy; }
void set_referrer_policy(ReferrerPolicy::ReferrerPolicy referrer_policy) { m_referrer_policy = move(referrer_policy); }
[[nodiscard]] ResponseTainting response_tainting() const { return m_response_tainting; }
void set_response_tainting(ResponseTainting response_tainting) { m_response_tainting = response_tainting; }
@ -420,7 +420,7 @@ private:
// https://fetch.spec.whatwg.org/#concept-request-referrer-policy
// A request has an associated referrer policy, which is a referrer policy. Unless stated otherwise it is the empty
// string.
Optional<ReferrerPolicy::ReferrerPolicy> m_referrer_policy;
ReferrerPolicy::ReferrerPolicy m_referrer_policy { ReferrerPolicy::ReferrerPolicy::EmptyString };
// https://fetch.spec.whatwg.org/#concept-request-mode
// A request has an associated mode, which is "same-origin", "cors", "no-cors", "navigate", or "websocket". Unless