mirror of
https://github.com/servo/servo.git
synced 2025-06-06 00:25:37 +00:00
Merge b144cf8b10
into 8d086b9fe5
This commit is contained in:
commit
56e839f4c0
2 changed files with 11 additions and 2 deletions
|
@ -6731,7 +6731,7 @@ pub(crate) fn determine_policy_for_token(token: &str) -> ReferrerPolicy {
|
|||
"same-origin" => ReferrerPolicy::SameOrigin,
|
||||
"strict-origin" => ReferrerPolicy::StrictOrigin,
|
||||
"default" | "strict-origin-when-cross-origin" => ReferrerPolicy::StrictOriginWhenCrossOrigin,
|
||||
"origin-when-cross-origin" => ReferrerPolicy::OriginWhenCrossOrigin,
|
||||
"origin-when-cross-origin" | "origin-when-crossorigin" => ReferrerPolicy::OriginWhenCrossOrigin,
|
||||
"always" | "unsafe-url" => ReferrerPolicy::UnsafeUrl,
|
||||
_ => ReferrerPolicy::EmptyString,
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
use dom_struct::dom_struct;
|
||||
use html5ever::{LocalName, Prefix, local_name, ns};
|
||||
use js::rust::HandleObject;
|
||||
use style::attr::AttrValue;
|
||||
use style::str::HTML_SPACE_CHARACTERS;
|
||||
|
||||
use crate::dom::attr::Attr;
|
||||
|
@ -108,7 +109,15 @@ impl HTMLMetaElement {
|
|||
.get_attribute(&ns!(), &local_name!("content"));
|
||||
if let Some(attr) = content {
|
||||
let attr = attr.value();
|
||||
let attr_val = attr.trim();
|
||||
let attr_val = match &*attr {
|
||||
AttrValue::TokenList(_, list) => {
|
||||
let Some(last_atom) = list.last() else {
|
||||
return;
|
||||
};
|
||||
last_atom.trim()
|
||||
},
|
||||
val => val.trim(),
|
||||
};
|
||||
if !attr_val.is_empty() {
|
||||
doc.set_referrer_policy(determine_policy_for_token(attr_val));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue