aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlimageelement.rs
diff options
context:
space:
mode:
authorshanehandley <1322294+shanehandley@users.noreply.github.com>2024-11-19 23:45:10 +1100
committerGitHub <noreply@github.com>2024-11-19 12:45:10 +0000
commit975e2ae85925d5660d09415de33ea77537bcf0d4 (patch)
tree197776b1eafc04477081a131d982435f1340ad43 /components/script/dom/htmlimageelement.rs
parent83f8e888189cc265e73d6a3849f7b8c71c080181 (diff)
downloadservo-975e2ae85925d5660d09415de33ea77537bcf0d4.tar.gz
servo-975e2ae85925d5660d09415de33ea77537bcf0d4.zip
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>
Diffstat (limited to 'components/script/dom/htmlimageelement.rs')
-rw-r--r--components/script/dom/htmlimageelement.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs
index b8cb5d15f62..61f4400a554 100644
--- a/components/script/dom/htmlimageelement.rs
+++ b/components/script/dom/htmlimageelement.rs
@@ -336,7 +336,7 @@ pub(crate) fn image_fetch_request(
referrer: Referrer,
pipeline_id: PipelineId,
cors_setting: Option<CorsSettings>,
- referrer_policy: Option<ReferrerPolicy>,
+ referrer_policy: ReferrerPolicy,
from_picture_or_srcset: FromPictureOrSrcSet,
) -> RequestBuilder {
let mut request =
@@ -1523,12 +1523,13 @@ fn get_correct_referrerpolicy_from_raw_token(token: &DOMString) -> DOMString {
// so it should remain unchanged.
DOMString::new()
} else {
- match determine_policy_for_token(token) {
- Some(policy) => DOMString::from_string(policy.to_string()),
- // If the policy is set to an incorrect value, then it should be
- // treated as an invalid value default (empty string).
- None => DOMString::new(),
+ let policy = determine_policy_for_token(token);
+
+ if policy == ReferrerPolicy::EmptyString {
+ return DOMString::new();
}
+
+ DOMString::from_string(policy.to_string())
}
}