Use the correct fallback referrer policy for the empty string case (#34201)

Signed-off-by: Shane Handley <shanehandley@fastmail.com>
This commit is contained in:
shanehandley 2024-11-10 14:26:19 +11:00 committed by GitHub
parent 4da378a987
commit 5e2c7908d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 5 additions and 189 deletions

View file

@ -1519,8 +1519,8 @@ pub fn parse_a_sizes_attribute(value: DOMString) -> SourceSizeList {
fn get_correct_referrerpolicy_from_raw_token(token: &DOMString) -> DOMString {
if token == "" {
// Empty token is treated as no-referrer inside determine_policy_for_token,
// while here it should be treated as the default value, so it should remain unchanged.
// Empty token is treated as the default referrer policy inside determine_policy_for_token,
// so it should remain unchanged.
DOMString::new()
} else {
match determine_policy_for_token(token) {
@ -1532,6 +1532,7 @@ fn get_correct_referrerpolicy_from_raw_token(token: &DOMString) -> DOMString {
}
}
#[allow(non_snake_case)]
impl HTMLImageElementMethods for HTMLImageElement {
// https://html.spec.whatwg.org/multipage/#dom-image
fn Image(