servo: Merge #12493 - Implement referrer policy delivery via noreferrer link relation (from TheKK:referrer_policy_dliver_via_rel); r=jdm
According to https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-delivery, there's `<a>`, `<link>` and `<area>` could apply this delivery method. This PR contains changes for `<a>` and `<link>` **but** not `<area>`, since HTMLAreaElement is barely implemented. We should file another issue for it. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11862 - [X] There are tests for these changes Source-Repo: https://github.com/servo/servo Source-Revision: 8a78e75d4314aa5ac770ec070a6ea7eed341e3ec
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
use dom::bindings::js::JS;
|
||||
use dom::document::Document;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use msg::constellation_msg::{PipelineId, ReferrerPolicy};
|
||||
use net_traits::{PendingAsyncLoad, AsyncResponseTarget, LoadContext};
|
||||
use net_traits::{ResourceThreads, IpcSend};
|
||||
use std::thread;
|
||||
@@ -125,7 +125,8 @@ impl DocumentLoader {
|
||||
/// the future.
|
||||
pub fn prepare_async_load(&mut self,
|
||||
load: LoadType,
|
||||
referrer: &Document) -> PendingAsyncLoad {
|
||||
referrer: &Document,
|
||||
referrer_policy: Option<ReferrerPolicy>) -> PendingAsyncLoad {
|
||||
let context = load.to_load_context();
|
||||
let url = load.url().clone();
|
||||
self.add_blocking_load(load);
|
||||
@@ -133,7 +134,7 @@ impl DocumentLoader {
|
||||
self.resource_threads.sender(),
|
||||
url,
|
||||
self.pipeline,
|
||||
referrer.get_referrer_policy(),
|
||||
referrer_policy.or(referrer.get_referrer_policy()),
|
||||
Some(referrer.url().clone()))
|
||||
}
|
||||
|
||||
@@ -141,8 +142,9 @@ impl DocumentLoader {
|
||||
pub fn load_async(&mut self,
|
||||
load: LoadType,
|
||||
listener: AsyncResponseTarget,
|
||||
referrer: &Document) {
|
||||
let pending = self.prepare_async_load(load, referrer);
|
||||
referrer: &Document,
|
||||
referrer_policy: Option<ReferrerPolicy>) {
|
||||
let pending = self.prepare_async_load(load, referrer, referrer_policy);
|
||||
pending.load_async(listener)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user