Add support for Reporting-Endpoints (#37965)

Does not yet handle failures of endpoints, which requires us to update
metadata. I don't see that metadata being used anywhere, so I am not
sure if there is WPT coverage for it.

Part of #37238

Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
Tim van der Lippe 2025-07-09 21:07:29 +02:00 committed by GitHub
parent 16aca5516d
commit 70c57c6136
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 439 additions and 22 deletions

View file

@ -49,6 +49,7 @@ use crate::dom::event::{Event, EventBubbles, EventCancelable, EventStatus};
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
use crate::dom::messageevent::MessageEvent;
use crate::dom::reportingendpoint::ReportingEndpoint;
#[cfg(feature = "webgpu")]
use crate::dom::webgpu::identityhub::IdentityHub;
use crate::dom::worker::{TrustedWorkerAddress, Worker};
@ -481,6 +482,10 @@ impl DedicatedWorkerGlobalScope {
};
scope.set_url(metadata.final_url.clone());
scope.set_csp_list(parse_csp_list_from_metadata(&metadata.headers));
scope.set_endpoints_list(ReportingEndpoint::parse_reporting_endpoints_header(
&metadata.final_url.clone(),
&metadata.headers,
));
global_scope.set_https_state(metadata.https_state);
let source = String::from_utf8_lossy(&bytes);
if let Some(chan) = global_scope.devtools_chan() {