diff options
author | Russell Cousineau <miller.time.baby@gmail.com> | 2019-03-24 23:04:17 -0700 |
---|---|---|
committer | Russell Cousineau <miller.time.baby@gmail.com> | 2019-04-19 16:50:38 -0700 |
commit | 2440e0f98ade12cf595fe7c791a1065b29b53d74 (patch) | |
tree | ea5b333151d9580ff8c690994570272f3785d305 /components/script/dom/windowproxy.rs | |
parent | f9c58ccd401253b16916d173df621b1abc27f103 (diff) | |
download | servo-2440e0f98ade12cf595fe7c791a1065b29b53d74.tar.gz servo-2440e0f98ade12cf595fe7c791a1065b29b53d74.zip |
set referrer in window.load_url
- this conforms to follow-hyperlinks spec step 13
- this conforms to window-open spec step 14.3
- replace uses of `referrer_url` with `referrer`
- in Request class, change "no-referrer" to ""
- set websocket fetch referrer to "no-referrer"
Diffstat (limited to 'components/script/dom/windowproxy.rs')
-rw-r--r-- | components/script/dom/windowproxy.rs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/components/script/dom/windowproxy.rs b/components/script/dom/windowproxy.rs index 8a78b661a76..12e726f1752 100644 --- a/components/script/dom/windowproxy.rs +++ b/components/script/dom/windowproxy.rs @@ -45,6 +45,7 @@ use js::JSCLASS_IS_GLOBAL; use msg::constellation_msg::BrowsingContextId; use msg::constellation_msg::PipelineId; use msg::constellation_msg::TopLevelBrowsingContextId; +use net_traits::request::Referrer; use script_traits::{AuxiliaryBrowsingContextLoadInfo, LoadData, NewLayoutInfo, ScriptMsg}; use servo_url::ServoUrl; use std::cell::Cell; @@ -281,8 +282,8 @@ impl WindowProxy { let load_data = LoadData::new( blank_url, None, + Some(Referrer::ReferrerUrl(document.url().clone())), document.get_referrer_policy(), - Some(document.url().clone()), ); let (pipeline_sender, pipeline_receiver) = ipc::channel().unwrap(); let new_layout_info = NewLayoutInfo { @@ -428,9 +429,20 @@ impl WindowProxy { Ok(url) => url, Err(_) => return None, // TODO: throw a "SyntaxError" DOMException. }; - // TODO Step 14.3, handle noreferrer flag + // Step 14.3 + let referrer = if noreferrer { + Referrer::NoReferrer + } else { + Referrer::Client + }; // Step 14.5 - target_window.load_url(url, new, false, target_document.get_referrer_policy()); + target_window.load_url( + url, + new, + false, + referrer, + target_document.get_referrer_policy(), + ); } if noopener { // Step 15 (Dis-owning has been done in create_auxiliary_browsing_context). |