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

@ -32,7 +32,7 @@ use crate::actors::watcher::thread_configuration::{
ThreadConfigurationActor, ThreadConfigurationActorMsg,
};
use crate::protocol::JsonPacketStream;
use crate::resource::ResourceAvailable;
use crate::resource::{ResourceArrayType, ResourceAvailable};
use crate::{EmptyReplyMsg, StreamId, WorkerActor};
pub mod network_parent;
@ -292,14 +292,20 @@ impl Actor for WatcherActor {
title: Some(target.title.borrow().clone()),
url: Some(target.url.borrow().clone()),
};
target.resource_available(event, "document-event".into(), stream);
target.resource_array(
event,
"document-event".into(),
ResourceArrayType::Available,
stream,
);
}
},
"source" => {
let thread_actor = registry.find::<ThreadActor>(&target.thread);
target.resources_available(
target.resources_array(
thread_actor.source_manager.source_forms(registry),
"source".into(),
ResourceArrayType::Available,
stream,
);
@ -307,9 +313,10 @@ impl Actor for WatcherActor {
let worker = registry.find::<WorkerActor>(worker_name);
let thread = registry.find::<ThreadActor>(&worker.thread);
worker.resources_available(
worker.resources_array(
thread.source_manager.source_forms(registry),
"source".into(),
ResourceArrayType::Available,
stream,
);
}