diff options
author | shanehandley <1322294+shanehandley@users.noreply.github.com> | 2024-11-30 17:15:36 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-30 06:15:36 +0000 |
commit | 82bbff45b30a567d779296f5611fd3ef65f6f16a (patch) | |
tree | 3425e8d6114a0c86e34f29522b6b1dffa2a5ae06 /components | |
parent | 096439b35ec07003e2d360a0448db54daec712d8 (diff) | |
download | servo-82bbff45b30a567d779296f5611fd3ef65f6f16a.tar.gz servo-82bbff45b30a567d779296f5611fd3ef65f6f16a.zip |
Retain the referrer policy when loading an about:blank iframe. (#34432)
This allows the referrer policy to be inherited correctly by the iframe.
Signed-off-by: Shane Handley <shanehandley@fastmail.com>
Diffstat (limited to 'components')
-rw-r--r-- | components/script/script_thread.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 55bd003915f..3565f646c7c 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -2985,7 +2985,7 @@ impl ScriptThread { load_data.inherited_secure_context, ); if load_data.url.as_str() == "about:blank" { - self.start_page_load_about_blank(new_load, load_data.js_eval_result); + self.start_page_load_about_blank(new_load, load_data); } else if load_data.url.as_str() == "about:srcdoc" { self.page_load_about_srcdoc(new_load, load_data); } else { @@ -4207,11 +4207,7 @@ impl ScriptThread { /// Synchronously fetch `about:blank`. Stores the `InProgressLoad` /// argument until a notification is received that the fetch is complete. - fn start_page_load_about_blank( - &self, - incomplete: InProgressLoad, - js_eval_result: Option<JsEvalResult>, - ) { + fn start_page_load_about_blank(&self, incomplete: InProgressLoad, load_data: LoadData) { let id = incomplete.pipeline_id; self.incomplete_loads.borrow_mut().push(incomplete); @@ -4221,10 +4217,11 @@ impl ScriptThread { let mut meta = Metadata::default(url); meta.set_content_type(Some(&mime::TEXT_HTML)); + meta.set_referrer_policy(load_data.referrer_policy); // If this page load is the result of a javascript scheme url, map // the evaluation result into a response. - let chunk = match js_eval_result { + let chunk = match load_data.js_eval_result { Some(JsEvalResult::Ok(content)) => content, Some(JsEvalResult::NoContent) => { meta.status = http::StatusCode::NO_CONTENT.into(); |