mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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:
parent
8edae71286
commit
7d2c9ec19c
6 changed files with 216 additions and 138 deletions
|
@ -30,7 +30,7 @@ use crate::actors::browsing_context::BrowsingContextActor;
|
|||
use crate::actors::object::ObjectActor;
|
||||
use crate::actors::worker::WorkerActor;
|
||||
use crate::protocol::JsonPacketStream;
|
||||
use crate::resource::ResourceAvailable;
|
||||
use crate::resource::{ResourceArrayType, ResourceAvailable};
|
||||
use crate::{StreamId, UniqueId};
|
||||
|
||||
trait EncodableConsoleMessage {
|
||||
|
@ -261,13 +261,12 @@ impl ConsoleActor {
|
|||
.push(CachedConsoleMessage::PageError(page_error.clone()));
|
||||
if id == self.current_unique_id(registry) {
|
||||
if let Root::BrowsingContext(bc) = &self.root {
|
||||
registry
|
||||
.find::<BrowsingContextActor>(bc)
|
||||
.resource_available(
|
||||
PageErrorWrapper { page_error },
|
||||
"error-message".into(),
|
||||
stream,
|
||||
)
|
||||
registry.find::<BrowsingContextActor>(bc).resource_array(
|
||||
PageErrorWrapper { page_error },
|
||||
"error-message".into(),
|
||||
ResourceArrayType::Available,
|
||||
stream,
|
||||
)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -287,9 +286,12 @@ impl ConsoleActor {
|
|||
.push(CachedConsoleMessage::ConsoleLog(log_message.clone()));
|
||||
if id == self.current_unique_id(registry) {
|
||||
if let Root::BrowsingContext(bc) = &self.root {
|
||||
registry
|
||||
.find::<BrowsingContextActor>(bc)
|
||||
.resource_available(log_message, "console-message".into(), stream)
|
||||
registry.find::<BrowsingContextActor>(bc).resource_array(
|
||||
log_message,
|
||||
"console-message".into(),
|
||||
ResourceArrayType::Available,
|
||||
stream,
|
||||
)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue