diff options
Diffstat (limited to 'components/script/dom/htmlanchorelement.rs')
-rw-r--r-- | components/script/dom/htmlanchorelement.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index 982b08f3924..9f64a93c0ca 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -27,6 +27,7 @@ use crate::dom::urlhelper::UrlHelper; use crate::dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; use html5ever::{LocalName, Prefix}; +use net_traits::request::Referrer; use num_traits::ToPrimitive; use servo_url::ServoUrl; use std::default::Default; @@ -639,7 +640,7 @@ pub fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<String>) { // will have been done as part of Step 7 above // in choose_browsing_context/create_auxiliary_browsing_context. - // Step 10, 11, 12, 13. TODO: if parsing the URL failed, navigate to error page. + // Step 10, 11. TODO: if parsing the URL failed, navigate to error page. let attribute = subject.get_attribute(&ns!(), &local_name!("href")).unwrap(); let mut href = attribute.Value(); // Step 11: append a hyperlink suffix. @@ -657,8 +658,16 @@ pub fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<String>) { .get_attribute_by_name(DOMString::from_string(String::from("referrerpolicy"))) .and_then(|attribute: DomRoot<Attr>| (determine_policy_for_token(&attribute.Value()))); - // Step 13, 14. + // Step 13 + let referrer = match subject.get_attribute(&ns!(), &local_name!("rel")) { + Some(ref link_types) if link_types.Value().contains("noreferrer") => { + Referrer::NoReferrer + }, + _ => Referrer::Client, + }; + + // Step 14 debug!("following hyperlink to {}", url); - target_window.load_url(url, replace, false, referrer_policy); + target_window.load_url(url, replace, false, referrer, referrer_policy); }; } |