Fix network event update Message (#37543)

- Add `ResourceArrayType` with `Available` and `Updated` variants
- Rename `resources-available` and `resource-available` to
`resources-array` ,`resource-array`
- Add `ResourceArrayType` as an argument to decide the type of resources
- Add `Option<ResponseContentMsg>`,`Option<ResponseStartMsg>`,
`Option<ResponseCookiesMsg>`,
`Option<ResponseHeadersMsg>`,`Option<RequestCookiesMsg>`,
`Option<RequestHeadersMsg>`, `total_time`, `security_state` to
`NetworkEventActor` struct , and serialize the data in each to
`resource_updates` , flattening the nested arrays into a single JSON
- Refactor the following methods `request_headers`,`response_start` ,
`response_content`,`response_cookies`,`response_headers`,
`request_cookies`,`total_time` to associated functions passing
`HttpRequest` and `HttpResponse` as parameters .

Testing: Ran servo with devtools flag to see the logs corresponding to
the changes
Fixes: https://github.com/servo/servo/issues/37479

This PR Builds on https://github.com/servo/servo/pull/37517 and was
opened due to merge conflicts and branch issues

---------

Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
This commit is contained in:
Usman Yahaya Baba 2025-06-19 17:00:37 +01:00 committed by GitHub
parent 8edae71286
commit 7d2c9ec19c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 216 additions and 138 deletions

View file

@ -29,7 +29,7 @@ use devtools_traits::{
use embedder_traits::{AllowOrDeny, EmbedderMsg, EmbedderProxy};
use ipc_channel::ipc::{self, IpcSender};
use log::trace;
use resource::ResourceAvailable;
use resource::{ResourceArrayType, ResourceAvailable};
use serde::Serialize;
use servo_rand::RngCore;
@ -540,7 +540,12 @@ impl DevtoolsInstance {
let worker_actor = actors.find::<WorkerActor>(worker_actor_name);
for stream in self.connections.values_mut() {
worker_actor.resource_available(&source_form, "source".into(), stream);
worker_actor.resource_array(
&source_form,
"source".into(),
ResourceArrayType::Available,
stream,
);
}
} else {
let Some(browsing_context_id) = self.pipelines.get(&pipeline_id) else {
@ -563,7 +568,12 @@ impl DevtoolsInstance {
let browsing_context = actors.find::<BrowsingContextActor>(actor_name);
for stream in self.connections.values_mut() {
browsing_context.resource_available(&source_form, "source".into(), stream);
browsing_context.resource_array(
&source_form,
"source".into(),
ResourceArrayType::Available,
stream,
);
}
}
}