Add an event listener for `clearBreakpoint` to `debugger.js` and the
necessary glue to access it from the `devtools` crate.
Testing: `./mach test-devtools` and manual testing.
Fixes: Part of: https://github.com/servo/servo/issues/36027
---------
Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: eri <eri@igalia.com>
Listen for `setBreakpoint` on `debugger.js` and add the relevant WebIDLs
and Servo counterparts to trigger this event and notify SpiderMonkey.
Implement `find_source` for `SourceManager` and `find_offset` for
`SourceActor`.
Testing: Manual testing and `./mach test-devtools` (note, the latter
seems to have some failing tests, we are investigating this, but this
patch doesn't add any new failure).
Fixes: Part of #36027
---------
Signed-off-by: eri <eri@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
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>
Unify various `encodable` and `encode` methods from actors in an
`ActorEncode` trait, making it more consistent.
Add an `ActorRegistry::encode` method that finds an actor by name and
then returns its serialized version.
Add an `ActorMsg` struct to avoid creating repeated structs for simple
serializations.
There are two exceptions: `EncodableConsoleMessage` and `NodeInfo`.
These also have an `encode` method, but they are not actors, so
including them in this trait doesn't make much sense. Besides, they have
special requirements so it is better to keep them separate.
Testing: Manual testing in `about:debugging`.
Signed-off-by: eri <eri@igalia.com>
The breakpoint-list actor did not implement a handler for the
`removeBreakpoint` request, causing the client to receive
`unrecognizedPacketType` error. This patch adds `removeBreakpoint`
handler
Fixes: Part of #36027
Signed-off-by: atbrakhi <atbrakhi@igalia.com>
the Firefox devtools client often sends multiple
`getBreakpointListActor` requests to the watcher actor when connecting,
and the Firefox devtools server returns the same breakpoint list actor
every time, but Servo returns a new breakpoint list actor each time.
this patch aligns Servo’s behaviour with Firefox.
Testing: this patch adds a devtools test
Signed-off-by: Delan Azabani <dazabani@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
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>
This patch fixes the source panel in the DevTools that was broken due to
missing breakpoint actor implementation. The client was sending messages
to the breakpoint actor that didn't exist in Servo, resulting in
"unknown actor"
warnings in the logs(See logs in issue description)
To fix this this patch implements the `BreakpointListActor` that handles
`setBreakpoint` and `setActiveEventBreakpoints` messages with empty
replies. This PR does not implement `breakpoint` functionality
<img width="1512" alt="image"
src="https://github.com/user-attachments/assets/ac4985a6-9fd3-4854-a491-b39241e19d13"
/>
Fixes: https://github.com/servo/servo/issues/37196
Signed-off-by: atbrakhi <atbrakhi@igalia.com>