mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Implement referrer policy for dom worker construction (#34192)
Signed-off-by: Shane Handley <shanehandley@fastmail.com>
This commit is contained in:
parent
6c1cd56e52
commit
da462d0fcd
60 changed files with 25 additions and 381 deletions
|
@ -50,7 +50,7 @@ use net_traits::request::{Referrer, RequestBuilder};
|
|||
use net_traits::response::HttpsState;
|
||||
use net_traits::{
|
||||
fetch_async, CoreResourceMsg, CoreResourceThread, FetchResponseListener, IpcSend,
|
||||
ResourceThreads,
|
||||
ReferrerPolicy, ResourceThreads,
|
||||
};
|
||||
use profile_traits::{ipc as profile_ipc, mem as profile_mem, time as profile_time};
|
||||
use script_traits::serializable::{BlobData, BlobImpl, FileBlob};
|
||||
|
@ -2418,6 +2418,21 @@ impl GlobalScope {
|
|||
unreachable!();
|
||||
}
|
||||
|
||||
/// Get the Referrer Policy for this global scope.
|
||||
pub fn get_referrer_policy(&self) -> Option<ReferrerPolicy> {
|
||||
if let Some(window) = self.downcast::<Window>() {
|
||||
let document = window.Document();
|
||||
|
||||
return document.get_referrer_policy();
|
||||
}
|
||||
if let Some(worker) = self.downcast::<WorkerGlobalScope>() {
|
||||
let policy_container = worker.policy_container().to_owned();
|
||||
|
||||
return Some(policy_container.referrer_policy);
|
||||
}
|
||||
unreachable!();
|
||||
}
|
||||
|
||||
/// Determine the Referrer for a request whose Referrer is "client"
|
||||
pub fn get_referrer(&self) -> Referrer {
|
||||
// Step 3 of https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue