Auto merge of #27104 - utsavoza:ugo/issue-27030/28-06-2020, r=gterzian

Update referrer computation

The PR updates the request's referrer computation in consideration with the recent changes in [w3c/webappsec-referrer-policy#135](https://github.com/w3c/webappsec-referrer-policy/pull/135).

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #27030 and fix #14505
- [x] There are tests for these changes
This commit is contained in:
bors-servo 2020-07-03 11:39:07 -04:00 committed by GitHub
commit 8800452e34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
68 changed files with 153 additions and 2066 deletions

View file

@ -2370,10 +2370,10 @@ impl GlobalScope {
}
// Substep 3.1.4
return Referrer::Client(url);
Referrer::Client(url)
} else {
// Substep 3.2
return Referrer::Client(self.get_url());
Referrer::Client(self.get_url())
}
}

View file

@ -2502,7 +2502,7 @@ impl ScriptThread {
if load_data.url.as_str() == "about:blank" {
self.start_page_load_about_blank(new_load, load_data.js_eval_result);
} else if load_data.url.as_str() == "about:srcdoc" {
self.page_load_about_srcdoc(new_load, load_data.srcdoc);
self.page_load_about_srcdoc(new_load, load_data);
} else {
self.pre_page_load(new_load, load_data);
}
@ -3865,7 +3865,7 @@ impl ScriptThread {
}
/// Synchronously parse a srcdoc document from a giving HTML string.
fn page_load_about_srcdoc(&self, incomplete: InProgressLoad, src_doc: String) {
fn page_load_about_srcdoc(&self, incomplete: InProgressLoad, load_data: LoadData) {
let id = incomplete.pipeline_id;
self.incomplete_loads.borrow_mut().push(incomplete);
@ -3875,8 +3875,9 @@ impl ScriptThread {
let mut meta = Metadata::default(url);
meta.set_content_type(Some(&mime::TEXT_HTML));
meta.set_referrer_policy(load_data.referrer_policy);
let chunk = src_doc.into_bytes();
let chunk = load_data.srcdoc.into_bytes();
context.process_response(Ok(FetchMetadata::Unfiltered(meta)));
context.process_response_chunk(chunk);