Commit Graph

12 Commits

Author SHA1 Message Date
SeiRan
375c4f722b devtools: Restrict visibility of actors in devtools (#41935)
This change is to make visibility uniformly crate wide across all of the
structs and their props within devtools.

Testing: Tested using `.\mach build -d` `.\mach fmt` `.\mach test-tidy`
all passed
Part of: #41893

---------

Signed-off-by: Seiran <bo646ru@gmail.com>
2026-01-15 21:39:17 +00:00
eri
41db8d9111 devtools: Consolidate register/register_later (#41796)
Replace `RefCell` with `AtomicRefCell` for structs implementing Actor,
making them `Sync`.

Consolidate `register` and `register_later` into a single function,
removing the need to wait for a loop before accessing newly created
actors.

Now `ActorRegsitry` has improved locking. Instead of locking the entire
struct, each member can be locked separately. Additionally, since `find`
now returns `Arc`, we can `find` and `register` multiple actors
depending on each other, since the lock is only needed for the operation
and we can keep the reference after that.

Depends on: #41741, #41744
Testing: Manual testing

---------

Signed-off-by: eri <eri@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2026-01-13 19:24:30 +00:00
eri
f9a328a972 devtools: Improve serialization and remove mutability from NetworkEventActor (#41741)
Now `NetworkEventActor`'s methods take a non mutable reference to self
(`add_request`, `add_response` and `add_security_info`). This actor now
has three different `RefCells` inside (`request`, `response` and
`security`), which group pieces of data that are updated separately via
the public methods.

For the actor functionality itself, it now follows Firefox more closely.
In the `resource-available` message it only sends the `*_available`
fields (i.e. `response_headers_available`), deferring the actual data to
the `get*` messages (i.e `getResponseHeaders`). There were also a few
slight changes I noticed along the way that I tried to fix.

Simplify some repeated logic calculating header sizes and listing
cookies.

`resource_updates` is updated to use `Serialize` structs instead of
manually adding values to a map. This is more in line with the rest of
the DevTools code and probably less prone to future errors.

Fix "Resource of network-event is missing a browsingContextID or
innerWindowId attribute" error that shows multiple times each time the
Network tab is open. Updated all messages to use the correct
browsingContextID.

Testing: Manually compared all of the Network tab features to avoid
regressions.

---------

Signed-off-by: eri <eri@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2026-01-12 07:55:34 +00:00
eri
6fd9dd8998 devtools: Implement ActorEncode for NetworkEventActor (#41731)
Implement `ActorEncode` for `NetworkEventActor` to be more in line with
the rest of actors

Testing: This change does not modify behaviour

Signed-off-by: eri <eri@igalia.com>
2026-01-07 14:14:17 +00:00
jiang1997
f60735086d net/devtools: Expose TLS security info to DevTools network panel (#40567)
First PR for #40232.

Implement the getSecurityInfo protocol message to allow DevTools clients
to inspect TLS connection details for HTTPS requests, including:
- Protocol version (TLS 1.2/1.3)
- Cipher suite
- Key exchange group
- ALPN protocol
- HSTS and ECH status
- Security state

Security state is simplified (secure/insecure only) and certificate
details are stubbed out; both will be completed in follow-up work.

Signed-off-by: jiang1997 <jieke@live.cn>
2025-12-11 10:27:17 +00:00
Usman Yahaya Baba
ff02fdad6d Send early DevToolsHttpRequest and relocate response reporting to main_fetch (#37906)
This change refactors how we notify DevTools about network activity so
that all fetches (even those served from cache) appear correctly in the
Network panel, and so that DevTools sees request metadata as soon as
possible rather than waiting until the end of a full HTTP cycle.
- Before, we only send DevTools events inside http_network_fetch, so
cached responses (which skip that path) never show up. By emitting a
minimal HttpRequest event at the very start of main_fetch (with URL,
method, pipeline and browsing IDs), we guarantee every fetch shows up
immediately.
- Then, by moving HttpResponse notifications out of http_network_fetch
into main_fetch (right after process_response and process_response_eof),
we ensure DevTools gets status, header, and completion events for both
network and cache hits. Leveraging nullable fields in NetworkEventActor
lets us incrementally fill in timing, header, and body data later,
improving DevTools’ visibility.
Testing: Ran servo with `--devtools=6080` flag, cached responses now
appear in the network panel
Fixes: https://github.com/servo/servo/issues/37869

---------

Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
2025-07-15 05:41:11 +00:00
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