Commit graph

6 commits

Author SHA1 Message Date
Usman Yahaya Baba
2ad5b24225
Send WillNavigate earlier during navigation startup (#37778)
The will-navigate message tells the devtools client to expect a
navigation for a browsing context. This makes the network monitor clear
any previous entries and show the requests for the new page that is
loaded. In order to support this correctly, we need to send the
navigation notification from the constellation instead of the script
thread, otherwise we silently ignore navigations triggered by the
browser URL bar.




Testing: Ran servo in devtools mode , now the requests appear for new
loaded page
Fixes: https://github.com/servo/servo/issues/37334

---------

Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
2025-07-05 11:35:37 +00:00
Usman Yahaya Baba
152eb63fb3
Remove duplication between request/response properties in NetworkEventActor (#37651)
- Remove request/response fields in `NetworkEventActor` which now stores
minimal request metadata needed : `URL`, `method`, `timestamps`, `raw
headers`, `body`.
- Refactor add_request and add_response: `add_request` takes the
incoming DevtoolsHttpRequest and populates
`request_url`, `request_method`, `request_started`,
`request_time_stamp`, `request_body`, `request_headers_raw`
`request_cookies`, `request_headers`,`total_time` and `event_timing`
(via a new helper that computes Timings)
While `add_response` takes the incoming DevtoolsHttpResponse and
populates `response_headers_raw`, `response_body` ,`response_cookies`,
`response_headers`, `response_start`, `response_content`
- Add a call to `resources_updated` to push initial request info in
`handle_network_event`
Testing: Run and logged servo in devtools mode and now, the request
header info isavailable as soon as the request gets initiated
Fixes: https://github.com/servo/servo/issues/37566

---------

Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
2025-06-25 20:18:44 +00:00
Usman Yahaya Baba
7d2c9ec19c
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>
2025-06-19 16:00:37 +00:00
Usman Yahaya Baba
8e1cf31db3
Replace NetworkEventUpdateMsg with ResourcesUpdatedArray (#37384)
*Replaces NetworkEventUpdateMsg with ResourcesUpdatedArray in
HttpResponse case of handle_network_event *
- Adds ResourcesUpdatedArray and UpdateEntry structs in
`devtools/network_handler.rs` to hold an array of updates
(requestHeaders, responseCookies). Updates handle_network_event to use
BrowsingContextActor::resource_available for sending
"resources-updated-array").
- Adds browsing_context_actor_name parameter to handle_network_event to
resolve borrow checker issues and enable BrowsingContextActor lookup.
- Ensures borrow safety by scoping mutable actor access.

Testing: *Does not require test*
Fixes: part of https://github.com/servo/servo/issues/33556

---------

Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
2025-06-11 22:07:57 +00:00
Usman Yahaya Baba
e1ec650cfe
Update handle_network_event to use BrowsingContextActor for HttpRequest (#37263)
- Add browsing_context_actor_name parameter to handle_network_event
- Replace NetworkEventMsg in HttpRequest case with
BrowsingContextActor::resource_available
- Update DevTools caller in lib.rs to pass browsing_context_actor_name

Testing: 
Fixes:
https://github.com/servo/servo/issues/33556#issuecomment-2756544430

---------

Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
2025-06-10 14:11:39 +00:00
Jerens Lensun
02375809b0
devtools: refactor network related (#36093)
* devtools: extract network related into new file

Signed-off-by: jerensl <54782057+jerensl@users.noreply.github.com>

* devtools: fix missing license and linting error

Signed-off-by: jerensl <54782057+jerensl@users.noreply.github.com>

* fixup! devtools: extract network related into new file

Signed-off-by: jerensl <54782057+jerensl@users.noreply.github.com>

---------

Signed-off-by: jerensl <54782057+jerensl@users.noreply.github.com>
2025-03-22 14:46:57 +00:00