Implement PolicyContainer and update the default ReferrerPolicy (#33977)

* Implement PolicyContainer

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* implement small parts of fetch that interact with policy container

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* fix: allow policy container's csp list to be unset

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

* fix: use the correct default policy when parsing from a token

Signed-off-by: Shane Handley <shanehandley@fastmail.com>

---------

Signed-off-by: Shane Handley <shanehandley@fastmail.com>
This commit is contained in:
shanehandley 2024-11-08 18:19:23 +11:00 committed by GitHub
parent 4f6283d7fe
commit 6451767428
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
201 changed files with 210 additions and 5178 deletions

View file

@ -7,6 +7,7 @@ use std::cell::Cell;
use base::id::ServiceWorkerRegistrationId;
use devtools_traits::WorkerId;
use dom_struct::dom_struct;
use net_traits::request::Referrer;
use script_traits::{ScopeThings, WorkerScriptLoadOrigin};
use servo_url::ServoUrl;
use uuid::Uuid;
@ -112,8 +113,12 @@ impl ServiceWorkerRegistration {
pub fn create_scope_things(global: &GlobalScope, script_url: ServoUrl) -> ScopeThings {
let worker_load_origin = WorkerScriptLoadOrigin {
referrer_url: None,
referrer_policy: None,
referrer_url: match global.get_referrer() {
Referrer::Client(url) => Some(url),
Referrer::ReferrerUrl(url) => Some(url),
_ => None,
},
referrer_policy: Some(global.policy_container().referrer_policy),
pipeline_id: global.pipeline_id(),
};