servo/components
atbrakhi 71d97bd935
Devtools: send error replies instead of ignoring messages (#37686)
Client messages, which are always requests, are dispatched to Actor
instances one at a time via Actor::handle_message. Each request must be
paired with exactly one reply from the same actor the request was sent
to, where a reply is a message with no type (if a message from the
server has a type, it’s a notification, not a reply).

Failing to reply to a request will almost always permanently break that
actor, because either the client gets stuck waiting for a reply, or the
client receives the reply for a subsequent request as if it was the
reply for the current request. If an actor fails to reply to a request,
we want the dispatcher (ActorRegistry::handle_message) to send an error
of type `unrecognizedPacketType`, to keep the conversation for that
actor in sync. Since replies come in all shapes and sizes, we want to
allow Actor types to send replies without having to return them to the
dispatcher.

This patch adds a wrapper type around a client stream that guarantees
request/reply invariants. It allows the dispatcher to check if a valid
reply was sent, and guarantees that if the actor tries to send a reply,
it’s actually a valid reply (see ClientRequest::is_valid_reply). It does
not currently guarantee anything about messages sent via the TcpStream
released via ClientRequest::try_clone_stream or the return value of
ClientRequest::reply. We also send `unrecognizedPacketType`,
`missingParameter`, `badParameterType`, and `noSuchActor` messages per
the
[protocol](https://firefox-source-docs.mozilla.org/devtools/backend/protocol.html#error-packets)
[docs](https://firefox-source-docs.mozilla.org/devtools/backend/protocol.html#packets).

Testing: automated tests all pass, and manual testing looks ok
Fixes: #37683 and at least six bugs, plus one with a different root
cause, plus three with zero impact

---------

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: delan azabani <dazabani@igalia.com>
Co-authored-by: Simon Wülker <simon.wuelker@arcor.de>
Co-authored-by: the6p4c <me@doggirl.gay>
2025-07-07 12:40:44 +00:00
..
allocator Organize component Cargo.toml dependencies (#36224) 2025-03-30 19:03:54 +00:00
background_hang_monitor bhm: Add backtrace demangling (#37819) 2025-07-02 13:39:36 +00:00
bluetooth Replace bluetooth Readme with corrected version from devices repository (#36429) 2025-04-10 18:02:45 +00:00
canvas canvas: Use snapshot in canvas backends (#37863) 2025-07-04 20:22:20 +00:00
compositing Move webdriver actions commands to servoshell (#37669) 2025-07-04 16:29:38 +00:00
config refactor(webdriver): move webdriver_port option to servoshell pref (#37867) 2025-07-04 07:04:49 +00:00
constellation Send WillNavigate earlier during navigation startup (#37778) 2025-07-05 11:35:37 +00:00
deny_public_fields Add rust-version to all Cargo.toml files (#33483) 2024-09-17 16:39:07 +00:00
devtools Devtools: send error replies instead of ignoring messages (#37686) 2025-07-07 12:40:44 +00:00
dom_struct script: Feature-gate all crown support. (#35055) 2025-01-18 21:36:15 +00:00
domobject_derive Update rustfmt to the 2024 style edition (#35764) 2025-03-03 11:26:53 +00:00
fonts Clean up unused dependencies / features and centralize more feature selection into root Cargo.toml (#37720) 2025-06-26 11:56:48 +00:00
geometry servoshell: Allow overriding screen resolution with a command-line argument (#34038) 2024-10-30 11:54:13 +00:00
hyper_serde Update rustfmt to the 2024 style edition (#35764) 2025-03-03 11:26:53 +00:00
jstraceable_derive Add rust-version to all Cargo.toml files (#33483) 2024-09-17 16:39:07 +00:00
layout layout: Add incremental box tree construction for inline floats and abspos (#37892) 2025-07-05 08:33:04 +00:00
malloc_size_of Clean up unused dependencies / features and centralize more feature selection into root Cargo.toml (#37720) 2025-06-26 11:56:48 +00:00
media compositing: Combine webrender_traits and compositing_traits (#36372) 2025-04-06 17:34:18 +00:00
metrics Removing unused dependencies in crates. (#37096) 2025-05-23 12:58:00 +00:00
net Send WillNavigate earlier during navigation startup (#37778) 2025-07-05 11:35:37 +00:00
pixels canvas: Use snapshot in canvas backends (#37863) 2025-07-04 20:22:20 +00:00
profile Profile: Resident Segments was not correctly parsing /proc/self/smaps as the regexp did not work anymore. (#37549) 2025-06-19 09:19:31 +00:00
rand Migrate to the 2024 edition (#35755) 2025-03-13 10:28:11 +00:00
range Add rust-version to all Cargo.toml files (#33483) 2024-09-17 16:39:07 +00:00
script Implement initial version of ReportingObserver (#37905) 2025-07-07 10:43:30 +00:00
script_bindings Implement initial version of ReportingObserver (#37905) 2025-07-07 10:43:30 +00:00
servo Fix unused import TouchEventType warning (#37900) 2025-07-05 21:48:39 +00:00
servo_tracing [tracing] Add convenience macro for function tracing (#36573) 2025-04-22 19:58:20 +00:00
shared Send WillNavigate earlier during navigation startup (#37778) 2025-07-05 11:35:37 +00:00
timers script: Allow reflows that do not produce display lists (#37186) 2025-06-12 19:25:04 +00:00
url script: complete resolve_module_specifier (#37552) 2025-06-21 06:17:27 +00:00
webdriver_server webdriver: Properly insert the user agent into the capabilities data structure (#37876) 2025-07-04 18:09:59 +00:00
webgl Add a basic caching mechanism for ImageKeys. (#37369) 2025-07-03 13:16:43 +00:00
webgpu Add a basic caching mechanism for ImageKeys. (#37369) 2025-07-03 13:16:43 +00:00
webxr Removing unused dependencies in crates. (#37096) 2025-05-23 12:58:00 +00:00