mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:17:35 +00:00
LibWeb: Add referrer policy to Fetch::Infrastructure::Request
The enum is in its own directory and namespace as there's a standalone spec for it, that will later also house AOs. - https://w3c.github.io/webappsec-referrer-policy/ - https://www.w3.org/TR/referrer-policy/
This commit is contained in:
parent
a602a4c780
commit
dc6fb43d26
3 changed files with 32 additions and 1 deletions
|
@ -257,6 +257,9 @@ public:
|
||||||
[[nodiscard]] ReferrerType const& referrer() const { return m_referrer; }
|
[[nodiscard]] ReferrerType const& referrer() const { return m_referrer; }
|
||||||
void set_referrer(ReferrerType referrer) { m_referrer = move(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]] ResponseTainting response_tainting() const { return m_response_tainting; }
|
[[nodiscard]] ResponseTainting response_tainting() const { return m_response_tainting; }
|
||||||
void set_response_tainting(ResponseTainting response_tainting) { m_response_tainting = response_tainting; }
|
void set_response_tainting(ResponseTainting response_tainting) { m_response_tainting = response_tainting; }
|
||||||
|
|
||||||
|
@ -364,7 +367,8 @@ private:
|
||||||
ReferrerType m_referrer { Referrer::Client };
|
ReferrerType m_referrer { Referrer::Client };
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#concept-request-referrer-policy
|
// https://fetch.spec.whatwg.org/#concept-request-referrer-policy
|
||||||
// FIXME: A request has an associated referrer policy, which is a referrer policy. Unless stated otherwise it is the empty string.
|
// 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;
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#concept-request-mode
|
// 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 stated otherwise, it is "no-cors".
|
// A request has an associated mode, which is "same-origin", "cors", "no-cors", "navigate", or "websocket". Unless stated otherwise, it is "no-cors".
|
||||||
|
|
|
@ -357,6 +357,10 @@ namespace Web::Platform {
|
||||||
class Timer;
|
class Timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Web::ReferrerPolicy {
|
||||||
|
enum class ReferrerPolicy;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Web::RequestIdleCallback {
|
namespace Web::RequestIdleCallback {
|
||||||
class IdleDeadline;
|
class IdleDeadline;
|
||||||
}
|
}
|
||||||
|
|
23
Userland/Libraries/LibWeb/ReferrerPolicy/ReferrerPolicy.h
Normal file
23
Userland/Libraries/LibWeb/ReferrerPolicy/ReferrerPolicy.h
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace Web::ReferrerPolicy {
|
||||||
|
|
||||||
|
// https://w3c.github.io/webappsec-referrer-policy/#enumdef-referrerpolicy
|
||||||
|
enum class ReferrerPolicy {
|
||||||
|
NoReferrer,
|
||||||
|
NoReferrerWhenDowngrade,
|
||||||
|
SameOrigin,
|
||||||
|
Origin,
|
||||||
|
StrictOrigin,
|
||||||
|
OriginWhenCrossOrigin,
|
||||||
|
StrictOriginWhenCrossOrigin,
|
||||||
|
UnsafeURL,
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue