mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-09 04:37:52 +03: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
Notes:
sideshowbarker
2024-07-17 09:39:38 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/dc6fb43d26 Pull-request: https://github.com/SerenityOS/serenity/pull/15359 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/davidot ✅ Reviewed-by: https://github.com/kennethmyhra
@ -257,6 +257,9 @@ 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]] ResponseTainting response_tainting() const { return m_response_tainting; }
|
||||
void set_response_tainting(ResponseTainting response_tainting) { m_response_tainting = response_tainting; }
|
||||
|
||||
@ -364,7 +367,8 @@ private:
|
||||
ReferrerType m_referrer { Referrer::Client };
|
||||
|
||||
// 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
|
||||
// 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;
|
||||
}
|
||||
|
||||
namespace Web::ReferrerPolicy {
|
||||
enum class ReferrerPolicy;
|
||||
}
|
||||
|
||||
namespace Web::RequestIdleCallback {
|
||||
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…
Reference in New Issue
Block a user