devtools: Add support for one-way protocol messages#43230
Merged
Conversation
Signed-off-by: Brent Schroeter <contact@brentsch.com>
Contributor
Author
|
Example of a one-way message type in the Firefox spec, for reference: https://github.com/mozilla-firefox/firefox/blob/a86d8293217bbdc69abd541c9c7f8a4c6e227a8c/devtools/shared/specs/watcher.js#L28 |
Contributor
Author
|
@eerii Another small stepping stone on the way to fixing navigation for the devtools inspector panel. |
eerii
approved these changes
Mar 13, 2026
eerii
left a comment
Member
There was a problem hiding this comment.
Great! This gets rid of some of the warnings when closing DevTools.
|
|
||
| /// Like `reply`, but it doesn't check if it is a valid reply. | ||
| /// Sometimes the client breaks the rules and expects an out of form message. | ||
| pub fn reply_unchecked<T: Serialize>( |
Member
There was a problem hiding this comment.
I'll make a followup to remove reply_unchecked, as it no longer needs to be separate from reply. We can use write_json_packet followed by mark_handled. As far as I can tell this is only used in frame::getEnvironment.
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Mar 13, 2026
`reply_unchecked` was added in #42007 since `getEnvironment` from the frame actor has a `type` field but it already counts as a final reply, unlike every other message like it. Since it is only used there, we can revert the `reply_unchecked` change and use the new `mark_handled` instead. Depends on: #43230 Testing: DevTools tests Signed-off-by: eri <eri@igalia.com>
offline-ant
pushed a commit
to offline-ant/havi
that referenced
this pull request
Jun 4, 2026
Some Remote Debugging Protocol message types are specified as `oneway`, meaning that they expect no reply. Sending anything—including an error—in response to these messages throws the devtools client and actor out of sync. As noted in the `ClientRequest` docstring, most client messages expect exactly one reply, so `ClientRequest::handle()` includes a fail-safe that automatically sends an error message if none of the `reply()`, `reply_unchecked()`, or `reply_final()` methods have been called. This change introduces an additional method, `ClientRequest::mark_handled()`, which allows the actor handling the request to disarm the fail-safe without sending a reply over the wire, and it adds handling logic for 3 one-way message types that are frequently emitted by the Firefox Toolbox. Testing: This change introduces no new tests. Unless we take the unusual step of enumerating all supported one-way message types and validating each, automated tests provide little assurance of correctness. Meaningfully testing this feature would be cumbersome, and it would likely hamper future development more than it would help. Signed-off-by: Brent Schroeter <contact@brentsch.com> (cherry picked from commit 69a1f99)
offline-ant
pushed a commit
to offline-ant/havi
that referenced
this pull request
Jun 4, 2026
…#43236) `reply_unchecked` was added in servo#42007 since `getEnvironment` from the frame actor has a `type` field but it already counts as a final reply, unlike every other message like it. Since it is only used there, we can revert the `reply_unchecked` change and use the new `mark_handled` instead. Depends on: servo#43230 Testing: DevTools tests Signed-off-by: eri <eri@igalia.com> (cherry picked from commit 5c30339)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some Remote Debugging Protocol message types are specified as
oneway, meaning that they expect no reply. Sending anything—including an error—in response to these messages throws the devtools client and actor out of sync.As noted in the
ClientRequestdocstring, most client messages expect exactly one reply, soClientRequest::handle()includes a fail-safe that automatically sends an error message if none of thereply(),reply_unchecked(), orreply_final()methods have been called.This change introduces an additional method,
ClientRequest::mark_handled(), which allows the actor handling the request to disarm the fail-safe without sending a reply over the wire, and it adds handling logic for 3 one-way message types that are frequently emitted by the Firefox Toolbox.Testing: This change introduces no new tests. Unless we take the unusual step of enumerating all supported one-way message types and validating each, automated tests provide little assurance of correctness. Meaningfully testing this feature would be cumbersome, and it would likely hamper future development more than it would help.