mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Implement referrerPolicy for HTMLLinkElement and HTMLScriptElement
This commit is contained in:
parent
02af8952eb
commit
a999850b24
15 changed files with 50 additions and 668 deletions
|
@ -3773,6 +3773,27 @@ pub fn set_cross_origin_attribute(element: &Element, value: Option<DOMString>) {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn reflect_referrer_policy_attribute(element: &Element) -> DOMString {
|
||||
let attr =
|
||||
element.get_attribute_by_name(DOMString::from_string(String::from("referrerpolicy")));
|
||||
|
||||
if let Some(mut val) = attr.map(|v| v.Value()) {
|
||||
val.make_ascii_lowercase();
|
||||
if val == "no-referrer" ||
|
||||
val == "no-referrer-when-downgrade" ||
|
||||
val == "same-origin" ||
|
||||
val == "origin" ||
|
||||
val == "strict-origin" ||
|
||||
val == "origin-when-cross-origin" ||
|
||||
val == "strict-origin-when-cross-origin" ||
|
||||
val == "unsafe-url"
|
||||
{
|
||||
return val;
|
||||
}
|
||||
}
|
||||
return DOMString::new();
|
||||
}
|
||||
|
||||
pub(crate) fn referrer_policy_for_element(element: &Element) -> Option<ReferrerPolicy> {
|
||||
element
|
||||
.get_attribute_by_name(DOMString::from_string(String::from("referrerpolicy")))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue