Remove referrer policy from document (#34263)

* Remove the referrer policy from document and rely on its policy container

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* Make ReferrerPolicy non-optional, instead using a new enum value to represent the empty string case

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* Fix clippy issue

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* Fix usage of Option<ReferrerPolicy> in unit test

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

---------

Signed-off-by: Shane Handley <shanehandley@fastmail.com>
This commit is contained in:
shanehandley 2024-11-19 23:45:10 +11:00 committed by GitHub
parent 83f8e88818
commit 975e2ae859
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
108 changed files with 171 additions and 1509 deletions

View file

@ -265,7 +265,7 @@ pub struct RequestBuilder {
pub policy_container: RequestPolicyContainer,
// XXXManishearth these should be part of the client object
pub referrer: Referrer,
pub referrer_policy: Option<ReferrerPolicy>,
pub referrer_policy: ReferrerPolicy,
pub pipeline_id: Option<PipelineId>,
pub redirect_mode: RedirectMode,
pub integrity_metadata: String,
@ -299,7 +299,7 @@ impl RequestBuilder {
origin: ImmutableOrigin::new_opaque(),
policy_container: RequestPolicyContainer::default(),
referrer,
referrer_policy: None,
referrer_policy: ReferrerPolicy::EmptyString,
pipeline_id: None,
redirect_mode: RedirectMode::Follow,
integrity_metadata: "".to_owned(),
@ -372,7 +372,7 @@ impl RequestBuilder {
self
}
pub fn referrer_policy(mut self, referrer_policy: Option<ReferrerPolicy>) -> RequestBuilder {
pub fn referrer_policy(mut self, referrer_policy: ReferrerPolicy) -> RequestBuilder {
self.referrer_policy = referrer_policy;
self
}
@ -494,7 +494,7 @@ pub struct Request {
/// <https://fetch.spec.whatwg.org/#concept-request-referrer>
pub referrer: Referrer,
/// <https://fetch.spec.whatwg.org/#concept-request-referrer-policy>
pub referrer_policy: Option<ReferrerPolicy>,
pub referrer_policy: ReferrerPolicy,
pub pipeline_id: Option<PipelineId>,
/// <https://fetch.spec.whatwg.org/#synchronous-flag>
pub synchronous: bool,
@ -553,7 +553,7 @@ impl Request {
destination: Destination::None,
origin: origin.unwrap_or(Origin::Client),
referrer,
referrer_policy: None,
referrer_policy: ReferrerPolicy::EmptyString,
pipeline_id,
synchronous: false,
mode: RequestMode::NoCors,